v0.13.1
SeriesRecorder.hpp
Go to the documentation of this file.
1/** \file SeriesRecorder.hpp
2 * \brief MoFEM interface
3 *
4 * Interface for recording and saving data series, for example in time or load
5 * stepping problems.
6 *
7 * \ingroup mofem_series
8 */
9
10#ifndef __SERIESRECORDER_HPP__
11#define __SERIESRECORDER_HPP__
12
13#include "UnknownInterface.hpp"
14
15namespace MoFEM {
16
17/** Record (time) data series
18 * \ingroup mofem_series
19
20 Is abstraction of Core interface.
21
22 \bug fix names of this interface to follow naming convention
23
24 */
26
27 MoFEMErrorCode query_interface(boost::typeindex::type_index type_index,
28 UnknownInterface **iface) const;
29
31 SeriesRecorder(const MoFEM::Core &core);
32
33 /// destructor
35
36 /**
37 * \brief get tags handlers used on meshsets
38
39 */
40 MoFEMErrorCode getTags(int verb = -1);
41
42 inline Tag get_th_SeriesName() { return th_SeriesName; }
43
44 /**
45 * \brief clear multi-index container
46 * @return error code
47 */
49
50 /**
51 * \brier initialize container form data on mesh
52 * @return error code
53 */
55
56 /**
57 * \brief return pointer to meshset manager
58 */
60
61 /**
62 * \brief return pointer to meshset manager
63 */
64 const SeriesRecorder *get_series_recorder_ptr() const { return this; }
65
66 /**
67 * \ingroup mofem_series
68 * Add series recorder
69 *
70 * \param name of series
71 */
72 virtual MoFEMErrorCode add_series_recorder(const std::string &series_name);
73
74 /**
75 * \ingroup mofem_series
76 * delete recorded series
77 *
78 * \param name of series
79 */
80 virtual MoFEMErrorCode delete_recorder_series(const std::string &series_name);
81
82 /**
83 * \ingroup mofem_series
84 * initialize sries for recording
85 *
86 * \param series name
87 */
88 virtual MoFEMErrorCode
89 initialize_series_recorder(const std::string &serie_name);
90
91 /**
92 * \ingroup mofem_series
93 * finalize series for recording, recorded data are not accessible until
94 * finalize
95 *
96 * \param series name
97 */
98 virtual MoFEMErrorCode
99 finalize_series_recorder(const std::string &serie_name);
100
101 /**
102 * \ingroup mofem_series
103 * begin series recording
104 *
105 * \param series name
106 */
107 virtual MoFEMErrorCode record_begin(const std::string &serie_name);
108
109 /**
110 * \ingroup mofem_series
111 * record problem
112 *
113 * \param series name
114 * \param problem pointer
115 * \param rc could be Row or Col
116 */
117 virtual MoFEMErrorCode record_problem(const std::string &serie_name,
118 const Problem *problemPtr,
119 RowColData rc);
120
121 /**
122 * \ingroup mofem_series
123 * record problem
124 *
125 * \param series name
126 * \param problem name
127 * \param rc could be Row or Col
128 */
129 virtual MoFEMErrorCode record_problem(const std::string &serie_name,
130 const std::string &problem_name,
131 RowColData rc);
132
133 /**
134 * \ingroup mofem_series
135 * record field
136 *
137 * \param field name
138 * \param bit ref level
139 * \param mask for bit ref level
140 */
141 virtual MoFEMErrorCode record_field(const std::string &serie_name,
142 const std::string &field_name,
143 const BitRefLevel &bit,
144 const BitRefLevel &mask);
145
146 /**
147 * \ingroup mofem_series
148 * end series recording
149 *
150 * \param series name
151 */
152 virtual MoFEMErrorCode record_end(const std::string &serie_name,
153 double time = 0);
154
155 /**
156 * \ingroup mofem_series
157 * load data from series into dofs database
158 *
159 * \param series name
160 * \param step number
161 */
162 virtual MoFEMErrorCode load_series_data(const std::string &serie_name,
163 const int step_number);
164
165 /**
166 * \ingroup mofem_series
167 * print series
168 */
170
171 /** \brief check if series is in database
172 * \ingroup mofem_series
173 *
174 * \param name field name
175 * \return true if field exist
176 *
177 */
178 virtual bool check_series(const std::string &name) const;
179
180 virtual SeriesStep_multiIndex::index<SeriesName_mi_tag>::type::iterator
181 get_series_steps_byName_begin(const std::string &name);
182 virtual SeriesStep_multiIndex::index<SeriesName_mi_tag>::type::iterator
183 get_series_steps_byName_end(const std::string &name);
184
185protected:
186 Tag th_SeriesName; ///< Recorded series name
187
188 Series_multiIndex sEries; ///< recorded series
189 SeriesStep_multiIndex seriesSteps; ///< recorded series steps
190
191/** \brief loop over recorded series step
192 * \ingroup mofem_series
193 *
194 * \param NAME series name
195 * \parma IT iterator variable
196 *
197 * Example: \code
198 for(_IT_SERIES_STEPS_BY_NAME_FOR_LOOP_(recorder_ptr,"TEST_SERIES1",sit)) {
199
200 ierr = mField.load_series_data("TEST_SERIES1",sit->get_step_number());
201 CHKERRG(ierr);
202 * } \endcode
203 *
204 */
205#define _IT_SERIES_STEPS_BY_NAME_FOR_LOOP_(RECORDER, NAME, IT) \
206 SeriesStep_multiIndex::index<SeriesName_mi_tag>::type::iterator IT = \
207 (RECORDER)->get_series_steps_byName_begin(NAME); \
208 IT != (RECORDER)->get_series_steps_byName_end(NAME); \
209 IT++
210};
211
212} // namespace MoFEM
213
214#endif // __SERIESRECORDER_HPP__
215
216/**
217 * \defgroup mofem_series Recording and reading series
218 * Recorder for time steps and solution sequences
219 *
220 * \ingroup mofem
221 */
MoFEM interface.
RowColData
RowColData.
Definition: definitions.h:123
virtual MoFEMErrorCode load_series_data(const std::string &serie_name, const int step_number)
virtual MoFEMErrorCode print_series_steps()
virtual MoFEMErrorCode finalize_series_recorder(const std::string &serie_name)
virtual bool check_series(const std::string &name) const
check if series is in database
virtual MoFEMErrorCode record_problem(const std::string &serie_name, const Problem *problemPtr, RowColData rc)
virtual MoFEMErrorCode record_field(const std::string &serie_name, const std::string &field_name, const BitRefLevel &bit, const BitRefLevel &mask)
virtual MoFEMErrorCode initialize_series_recorder(const std::string &serie_name)
virtual MoFEMErrorCode add_series_recorder(const std::string &series_name)
virtual MoFEMErrorCode record_begin(const std::string &serie_name)
virtual MoFEMErrorCode record_end(const std::string &serie_name, double time=0)
virtual MoFEMErrorCode delete_recorder_series(const std::string &series_name)
multi_index_container< FieldSeriesStep, indexed_by< ordered_unique< tag< Composite_SeriesID_And_Step_mi_tag >, composite_key< FieldSeriesStep, const_mem_fun< FieldSeriesStep::interface_type_FieldSeries, EntityID, &FieldSeriesStep::get_meshset_id >, member< FieldSeriesStep, int, &FieldSeriesStep::step_number > > >, ordered_unique< tag< Composite_SeriesName_And_Step_mi_tag >, composite_key< FieldSeriesStep, const_mem_fun< FieldSeriesStep::interface_type_FieldSeries, boost::string_ref, &FieldSeriesStep::getNameRef >, member< FieldSeriesStep, int, &FieldSeriesStep::step_number > > >, ordered_non_unique< tag< SeriesName_mi_tag >, const_mem_fun< FieldSeriesStep::interface_type_FieldSeries, boost::string_ref, &FieldSeriesStep::getNameRef > >, ordered_non_unique< tag< Composite_SeriesName_And_Time_mi_tag >, composite_key< FieldSeriesStep, const_mem_fun< FieldSeriesStep::interface_type_FieldSeries, boost::string_ref, &FieldSeriesStep::getNameRef >, const_mem_fun< FieldSeriesStep, double, &FieldSeriesStep::get_time > > > > > SeriesStep_multiIndex
Step multi index.
multi_index_container< FieldSeries, indexed_by< ordered_unique< tag< SeriesID_mi_tag >, const_mem_fun< FieldSeries, EntityID, &FieldSeries::get_meshset_id > >, ordered_unique< tag< SeriesName_mi_tag >, const_mem_fun< FieldSeries, boost::string_ref, &FieldSeries::getNameRef > > > > Series_multiIndex
Series multi index.
auto bit
set bit
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
std::bitset< BITREFLEVEL_SIZE > BitRefLevel
Bit structure attached to each entity identifying to what mesh entity is attached.
Definition: Types.hpp:40
implementation of Data Operators for Forces and Sources
Definition: MoFEM.hpp:24
constexpr auto field_name
Core (interface) class.
Definition: Core.hpp:82
keeps basic data about problem
virtual SeriesStep_multiIndex::index< SeriesName_mi_tag >::type::iterator get_series_steps_byName_begin(const std::string &name)
Series_multiIndex sEries
recorded series
MoFEMErrorCode clearMap()
clear multi-index container
SeriesStep_multiIndex seriesSteps
recorded series steps
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
const SeriesRecorder * get_series_recorder_ptr() const
return pointer to meshset manager
SeriesRecorder(const MoFEM::Core &core)
Tag th_SeriesName
Recorded series name.
MoFEMErrorCode getTags(int verb=-1)
get tags handlers used on meshsets
virtual SeriesStep_multiIndex::index< SeriesName_mi_tag >::type::iterator get_series_steps_byName_end(const std::string &name)
SeriesRecorder * get_series_recorder_ptr()
return pointer to meshset manager
MoFEMErrorCode initialiseDatabaseFromMesh(int verb=0)
base class for all interface classes