ABLATE Source Documentation  0.12.34
solutionErrorMonitor.hpp
1 #ifndef ABLATELIBRARY_SOLUTIONERRORMONITOR_HPP
2 #define ABLATELIBRARY_SOLUTIONERRORMONITOR_HPP
3 #include <iostream>
4 #include <monitors/logs/log.hpp>
5 #include <vector>
6 #include "monitor.hpp"
7 #include "utilities/mathUtilities.hpp"
8 
9 namespace ablate::monitors {
10 
11 class SolutionErrorMonitor : public Monitor {
12  public:
13  enum class Scope { VECTOR, COMPONENT };
14 
15  private:
16  static PetscErrorCode MonitorError(TS ts, PetscInt step, PetscReal crtime, Vec u, void* ctx);
17  Scope errorScope;
19  const std::shared_ptr<logs::Log> log;
20 
21  public:
22  SolutionErrorMonitor(Scope errorScope, ablate::utilities::MathUtilities::Norm normType, const std::shared_ptr<logs::Log>& log = {});
23 
24  PetscMonitorFunction GetPetscFunction() override { return MonitorError; }
25 
26  std::vector<PetscReal> ComputeError(TS ts, PetscReal time, Vec u);
27 };
28 
35 std::ostream& operator<<(std::ostream& os, const SolutionErrorMonitor::Scope& v);
42 std::istream& operator>>(std::istream& is, SolutionErrorMonitor::Scope& v);
43 } // namespace ablate::monitors
44 
45 #endif // ABLATELIBRARY_ERRORMONITOR_HPP
Definition: monitor.hpp:12
Definition: solutionErrorMonitor.hpp:11
PetscMonitorFunction GetPetscFunction() override
Definition: solutionErrorMonitor.hpp:24
Norm
Definition: mathUtilities.hpp:272
Definition: boundarySolverMonitor.hpp:16
std::ostream & operator<<(std::ostream &os, const DmViewFromOptions::Scope &v)
Definition: dmViewFromOptions.cpp:76
std::istream & operator>>(std::istream &is, DmViewFromOptions::Scope &v)
Definition: dmViewFromOptions.cpp:87