AMDiS 2.10
The Adaptive Multi-Dimensional Simulation Toolbox
FileWriterBase.hpp
1#pragma once
2
3#include <limits>
4#include <string>
5
6namespace AMDiS
7{
8 // forward declaration
9 class AdaptInfo;
10
13 {
14 public:
16 virtual ~FileWriterInterface() = default;
17
19 virtual void write(AdaptInfo& adaptInfo, bool force) = 0;
20 };
21
23
38 : public FileWriterInterface
39 {
40 public:
42 FileWriterBase(std::string const& base);
43
45 bool doWrite(AdaptInfo& adaptInfo) const;
46
47 public:
48 std::string const& filename() const
49 {
50 return filename_;
51 }
52
53 std::string const& dir() const
54 {
55 return dir_;
56 }
57
58 std::string const& name() const
59 {
60 return name_;
61 }
62
63 protected:
65 std::string filename_ = "solution";
66
68 std::string dir_ = ".";
69
71 std::string name_ = "solution";
72
74 int tsModulo_ = 0;
75
77 double timeModulo_ = 0.0;
78
79 private:
80 // time counter for the interval output
81 mutable double lastWriteTime_ = std::numeric_limits<double>::lowest();
82 };
83
84} // end namespace AMDiS
Holds adapt parameters and infos about the problem.
Definition: AdaptInfo.hpp:26
Base class for filewriters.
Definition: FileWriterBase.hpp:39
double timeModulo_
Write after every time interval.
Definition: FileWriterBase.hpp:77
std::string filename_
Base part of output filename.
Definition: FileWriterBase.hpp:65
std::string name_
Name of the data.
Definition: FileWriterBase.hpp:71
int tsModulo_
Write every i'th timestep.
Definition: FileWriterBase.hpp:74
FileWriterBase(std::string const &base)
Constructor. Reads common parameters.
Definition: FileWriterBase.cpp:12
std::string dir_
Output directory.
Definition: FileWriterBase.hpp:68
bool doWrite(AdaptInfo &adaptInfo) const
Return whether to write the current timestep or not.
Definition: FileWriterBase.cpp:24
Interface class for filewriters.
Definition: FileWriterBase.hpp:13
virtual void write(AdaptInfo &adaptInfo, bool force)=0
Pure virtual method to be implemented by derived classes.
virtual ~FileWriterInterface()=default
Virtual destructor.