PRISMS-PF Manual v3.0-pre
Loading...
Searching...
No Matches
variableAttributeLoader.h
1#ifndef VARIABLEATTRIBUTELOADER_H
2#define VARIABLEATTRIBUTELOADER_H
3
4#include <core/varTypeEnums.h>
5#include <core/variableAttributes.h>
6#include <map>
7#include <string>
8
9using EvalFlags = dealii::EvaluationFlags::EvaluationFlags;
10
15{
16public:
21
25 virtual ~variableAttributeLoader() = default;
26
32 void
34
38 [[nodiscard]] AttributesList
39 get_var_attributes() const;
40
44 [[nodiscard]] AttributesList
45 get_pp_attributes() const;
46
47protected:
51 virtual void
53
57 virtual void
59
66 void
67 set_variable_name(const unsigned int &index, const std::string &name) const;
68
76 void
77 set_variable_type(const unsigned int &index, const fieldType &var_type) const;
78
87 void
88 set_variable_equation_type(const unsigned int &index, const PDEType &var_eq_type) const;
89
98 void
99 set_dependencies_value_term_RHS(const unsigned int &index,
100 const std::string &dependencies);
101
110 void
111 set_dependencies_gradient_term_RHS(const unsigned int &index,
112 const std::string &dependencies);
113
122 void
123 set_dependencies_value_term_LHS(const unsigned int &index,
124 const std::string &dependencies) const;
125
134 void
135 set_dependencies_gradient_term_LHS(const unsigned int &index,
136 const std::string &dependencies) const;
137
146 template <typename Iterable>
147 void
148 insert_dependencies_value_term_RHS(const unsigned int &index,
149 const Iterable &dependencies);
150
159 template <typename Iterable>
160 void
161 insert_dependencies_gradient_term_RHS(const unsigned int &index,
162 const Iterable &dependencies);
163
172 template <typename Iterable>
173 void
174 insert_dependencies_value_term_LHS(const unsigned int &index,
175 const Iterable &dependencies) const;
176
185 template <typename Iterable>
186 void
187 insert_dependencies_gradient_term_LHS(const unsigned int &index,
188 const Iterable &dependencies) const;
189
197 void
198 set_need_value_nucleation(const unsigned int &index, const bool &flag) const;
199
206 void
207 set_allowed_to_nucleate(const unsigned int &index, const bool &flag) const;
208
217 void
218 set_output_integral(const unsigned int &index, const bool &flag) const;
219
220private:
224 AttributesList var_attributes;
225
229 AttributesList pp_attributes;
230
235 AttributesList *relevant_attributes = nullptr;
236
241 void
242 validate_attributes();
243
248 static void
249 validate_variable_name(const std::string &name,
250 const std::set<std::string> &forbidden_names,
251 const std::string &context,
252 unsigned int index);
253
257 static void
258 populate_dependencies(
259 const std::set<std::pair<std::string, std::string>> &reg_delimiters,
260 const std::string &variable_name,
261 unsigned int index,
262 std::set<std::string> &reg_possible_deps,
263 std::map<uint, std::set<std::string>> &change_possible_deps);
264
268 static void
269 validate_dependencies(
270 const std::set<std::string> &dependencies,
271 const std::string &context,
272 unsigned int index,
273 const std::string &variable_name,
274 const std::set<std::string> &reg_possible_deps,
275 const std::map<uint, std::set<std::string>> &change_possible_deps);
276
280 static void
281 validate_postprocess_variable(const std::string &name,
282 const std::set<std::string> &name_list,
283 const std::set<std::string> &reg_possible_deps,
284 const variableAttributes &pp_variable,
285 unsigned int index);
286
290 static std::string
291 strip_whitespace(const std::string &text);
292 // The above function should be moved to a 'utilities' module
293};
294
295// Template derived class for variableAttributeLoader for applications.
296// `loadVariableAttributes()` and `loadPostProcessorVariableAttributes()` are should be
297// filled out in all the applications.
299{
300public:
301 ~customAttributeLoader() override = default;
302
303 void
305
306 void
308};
309
310#endif
Definition variableAttributeLoader.h:299
void loadVariableAttributes() override
User-facing method where the variable attributes are set.
void loadPostProcessorVariableAttributes() override
User-facing method where the postprocessing variable attributes are set.
Class to manage the variable attributes that the user specifies.
Definition variableAttributeLoader.h:15
variableAttributeLoader()=default
Constructor.
void set_variable_type(const unsigned int &index, const fieldType &var_type) const
Set the field type of the variable at index to var_type where var_type can be SCALAR or VECTOR.
Definition variableAttributeLoader.cc:77
AttributesList get_var_attributes() const
getter function for variable attributes list (copy).
Definition variableAttributeLoader.cc:57
void set_output_integral(const unsigned int &index, const bool &flag) const
(Postprocess only) Flag whether the postprocessing variable at index should have its domain integral ...
Definition variableAttributeLoader.cc:105
AttributesList get_pp_attributes() const
getter function for postprocessing attributes list (copy).
Definition variableAttributeLoader.cc:63
virtual void loadVariableAttributes()
User-facing method where the variable attributes are set.
Definition variableAttributeLoader.cc:7
virtual ~variableAttributeLoader()=default
Destructor.
void set_dependencies_gradient_term_LHS(const unsigned int &index, const std::string &dependencies) const
Add dependencies for the gradient term of the LHS equation of the variable at index.
Definition variableAttributeLoader.cc:142
void set_dependencies_value_term_LHS(const unsigned int &index, const std::string &dependencies) const
Add dependencies for the value term of the LHS equation of the variable at index.
Definition variableAttributeLoader.cc:132
void insert_dependencies_gradient_term_LHS(const unsigned int &index, const Iterable &dependencies) const
Insert dependencies for the gradient term of the LHS equation of the variable at index.
Definition variableAttributeLoader.cc:202
void insert_dependencies_value_term_RHS(const unsigned int &index, const Iterable &dependencies)
Insert dependencies for the value term of the RHS equation of the variable at index.
Definition variableAttributeLoader.cc:153
void insert_dependencies_value_term_LHS(const unsigned int &index, const Iterable &dependencies) const
Insert dependencies for the value term of the LHS equation of the variable at index.
Definition variableAttributeLoader.cc:192
void set_dependencies_gradient_term_RHS(const unsigned int &index, const std::string &dependencies)
Add dependencies for the gradient term of the RHS equation of the variable at index.
Definition variableAttributeLoader.cc:122
void set_variable_equation_type(const unsigned int &index, const PDEType &var_eq_type) const
Set the PDE type of the variable at index to var_eq_type where var_eq_typecan be EXPLICIT_TIME_DEPEND...
Definition variableAttributeLoader.cc:84
virtual void loadPostProcessorVariableAttributes()
User-facing method where the postprocessing variable attributes are set.
Definition variableAttributeLoader.cc:11
void set_need_value_nucleation(const unsigned int &index, const bool &flag) const
Flag whether the variable at index is needed to calculate the nucleation probability.
Definition variableAttributeLoader.cc:91
void insert_dependencies_gradient_term_RHS(const unsigned int &index, const Iterable &dependencies)
Insert dependencies for the gradient term of the RHS equation of the variable at index.
Definition variableAttributeLoader.cc:172
void init_variable_attributes()
Initialize the variable attributes from the two user-facing methods loadVariableAttributes() and load...
Definition variableAttributeLoader.cc:15
void set_allowed_to_nucleate(const unsigned int &index, const bool &flag) const
Flag whether the variable at index is can have a nucleation event.
Definition variableAttributeLoader.cc:98
void set_variable_name(const unsigned int &index, const std::string &name) const
Set the name of the variable at index to name.
Definition variableAttributeLoader.cc:70
void set_dependencies_value_term_RHS(const unsigned int &index, const std::string &dependencies)
Add dependencies for the value term of the RHS equation of the variable at index.
Definition variableAttributeLoader.cc:113
Structure to hold the variable attributes that will be passed to a setInputParameters object.
Definition variableAttributes.h:20