Flow123d  last_with_con_2.0.0-4-g42e6930
equation_output.hh
Go to the documentation of this file.
1 /*
2  * equation_output.hh
3  *
4  * Created on: Jul 8, 2016
5  * Author: jb
6  */
7 
8 #ifndef SRC_IO_EQUATION_OUTPUT_HH_
9 #define SRC_IO_EQUATION_OUTPUT_HH_
10 
11 #include <memory>
12 #include <unordered_map>
13 #include <unordered_set>
14 
15 #include "tools/time_marks.hh"
16 #include "fields/field_set.hh"
19 #include "io/output_time_set.hh"
20 class TimeStep;
21 
22 
23 /**
24  * A class responsible for check for output times of individual fields
25  * and store their values into the connected output stream.
26  */
27 class EquationOutput : public FieldSet {
28 public:
29 
30 
31  /**
32  * Make Input::Type for the output record. Particular selection of output fields is created
33  * from the contents of *this FeildSet using provided equation name and additional description.
34  */
35  const Input::Type::Instance &make_output_type(const string &equation_name, const string &aditional_description = "");
36 
37  /**
38  * Setup the object. Set output stream for field and observe output, input record for configuration of the object and
39  * TimeGovernor. The time governor is used to get the equation time mark type, the initial and the end time of the equation.
40  */
41  void initialize(std::shared_ptr<OutputTime> stream, Input::Record in_rec, const TimeGovernor & tg);
42 
43  /**
44  * Returns true if @param field is marked for output in the given time @param step.
45  */
46  bool is_field_output_time(const FieldCommon &field, TimeStep step) const;
47 
48  /**
49  * Performs output of the fields marked for output in the time @param step.
50  */
51  void output(TimeStep step);
52 
53 
54 private:
55  /**
56  * Input type of the configuration record.
57  */
59 
60  /**
61  * Read from the input, set output times and time marks. Must be called after set_stream.
62  * TODO: add output_stream times. Optional or always?
63  */
64  void read_from_input(Input::Record in_rec, const TimeGovernor & tg);
65 
66  /**
67  * Add a time grid to the common_output_times.
68  */
69  void add_output_times(double begin, double step, double end);
70 
71 
72  /// output stream (may be shared by more equation)
73  std::shared_ptr<OutputTime> stream_;
74  /// The time mark type of the equation.
76  /// The fixed time mark type of the equation.
78  /// The time set used for the fields without explicit time set.
80 
81  /// Time sets of individual fields.
82  std::unordered_map<string, OutputTimeSet> field_output_times_;
83 
84  /// Set of observed fields. The observe points are given within the observe stream.
85  std::unordered_set<string> observe_fields_;
86 };
87 
88 
89 #endif /* SRC_IO_EQUATION_OUTPUT_HH_ */
void add_output_times(double begin, double step, double end)
Common abstract parent of all Field<...> classes.
Definition: field_common.hh:60
Container for various descendants of FieldCommonBase.
Definition: field_set.hh:61
unsigned long int Type
Definition: time_marks.hh:51
std::unordered_set< string > observe_fields_
Set of observed fields. The observe points are given within the observe stream.
void output(TimeStep step)
void initialize(std::shared_ptr< OutputTime > stream, Input::Record in_rec, const TimeGovernor &tg)
TimeMark::Type equation_fixed_type_
The fixed time mark type of the equation.
Helper class that stores data of generic types.
Definition: type_generic.hh:88
Basic time management functionality for unsteady (and steady) solvers (class Equation).
void read_from_input(Input::Record in_rec, const TimeGovernor &tg)
FieldCommon * field(const std::string &field_name) const
Definition: field_set.cc:128
Accessor to the data with type Type::Record.
Definition: accessors.hh:277
std::shared_ptr< OutputTime > stream_
output stream (may be shared by more equation)
std::unordered_map< string, OutputTimeSet > field_output_times_
Time sets of individual fields.
static Input::Type::Record & get_input_type()
Record type proxy class.
Definition: type_record.hh:171
bool is_field_output_time(const FieldCommon &field, TimeStep step) const
const Input::Type::Instance & make_output_type(const string &equation_name, const string &aditional_description="")
OutputTimeSet common_output_times_
The time set used for the fields without explicit time set.
TimeMark::Type equation_type_
The time mark type of the equation.
Representation of one time step..