ABLATE Source Documentation  0.12.34
extractLineMonitor.hpp
1 #ifndef ABLATELIBRARY_EXTRACTLINEMONITOR_HPP
2 #define ABLATELIBRARY_EXTRACTLINEMONITOR_HPP
3 
4 #include <petsc.h>
5 #include <vector>
6 #include "finiteVolume/finiteVolumeSolver.hpp"
7 #include "monitor.hpp"
8 namespace ablate::monitors {
9 
10 class ExtractLineMonitor : public Monitor {
11  private:
12  // init variables
13  const PetscInt interval;
14  const std::vector<double> start;
15  const std::vector<double> end;
16  const std::vector<std::string> outputFields;
17  const std::vector<std::string> outputAuxFields;
18 
19  const std::string filePrefix;
20  inline static const std::string fileExtension = ".curve";
21 
22  // working variables
23  PetscInt outputIndex = 0; /*keep track of the local cell number we are outputting*/
24  std::vector<PetscInt> indexLocations;
25  std::vector<PetscReal> distanceAlongLine;
26  std::shared_ptr<ablate::finiteVolume::FiniteVolumeSolver> flow;
27 
28  static PetscErrorCode OutputCurve(TS ts, PetscInt steps, PetscReal time, Vec u, void *mctx);
29 
30  public:
31  ExtractLineMonitor(int interval, std::string prefix, std::vector<double> start, std::vector<double> end, std::vector<std::string> outputFields, const std::vector<std::string> outputAuxFields);
32 
33  void Register(std::shared_ptr<solver::Solver>) override;
34  PetscMonitorFunction GetPetscFunction() override { return OutputCurve; }
35 };
36 
37 } // namespace ablate::monitors
38 
39 #endif // ABLATELIBRARY_EXTRACTLINEMONITOR_HPP
Definition: extractLineMonitor.hpp:10
void Register(std::shared_ptr< solver::Solver >) override
Definition: extractLineMonitor.cpp:12
PetscMonitorFunction GetPetscFunction() override
Definition: extractLineMonitor.hpp:34
Definition: monitor.hpp:12
Definition: boundarySolverMonitor.hpp:16