118 Parameter(
const std::string& name, T value,
bool required, std::vector<T> range = {}) :
119 value_(value), name_(name), required_(required)
125 std::string name()
const {
return name_; };
126 T value()
const {
return value_; };
127 T operator()()
const {
return value_; };
128 bool defined()
const {
return value_set_; };
133 std::ostringstream str_stream;
134 str_stream << value_;
135 return str_stream.str();
138 friend std::ostream& operator << (std::ostream& out,
const Parameter<T>& param)
140 out << param.value();
145 void set(
const std::string& name,
bool required, T value) {
147 required_ = required;
152 void set(
const std::string& str_value)
154 if (str_value ==
"") {
158 auto str = str_value;
159 std::string::iterator end_pos = std::remove(str.begin(), str.end(),
' ');
160 str.erase(end_pos, str.end());
162 std::istringstream str_stream(str);
163 if (!(str_stream >> value_)) {
164 std::istringstream str_stream(str);
165 if (!(str_stream >> std::boolalpha >> value_)) {
166 throw std::runtime_error(
"Incorrect value '" + str +
"' for '" + name_ +
"'.");
173 bool check_required_set()
182 std::string name_ =
"";
183 bool required_ =
false;
184 bool value_set_ =
false;
185 std::vector<T> range_;
197 VectorParameter(
const std::string& name,
const std::vector<T>& value,
bool required, std::vector<T> range = {}) :
198 value_(value), name_(name), required_(required)
204 std::string name()
const {
return name_; };
205 std::vector<T> value()
const {
return value_; };
206 bool defined()
const {
return value_set_; };
207 int size()
const {
return value_.size(); };
209 std::vector<T> operator()()
const {
return value_; };
210 const double& operator[](
const int i)
const {
return value_[i]; };
217 if constexpr (std::is_same<T, std::string>::value) {
218 for (
auto v : value_) {
219 str +=
" " + v +
" ";
222 for (
auto v : value_) {
223 str +=
" " + std::to_string(v);
232 for (
int i = 0; i < param.size(); i++) {
233 out << param.value_[i];
239 void set(
const std::string& name,
bool required,
const std::vector<T>& value)
242 required_ = required;
247 void set(
const std::string& str_value)
249 if (str_value ==
"") {
253 std::string error_msg =
"Improper vector format '" + str_value +
"' found in '" + name_ +
"'." +
" Vector format is: (x,y,z)";
254 std::regex sep(
"\\(|\\)|\\,");
255 auto str = std::regex_replace(str_value, sep,
" ");
257 if constexpr (std::is_same<T, std::string>::value) {
258 std::stringstream ssin(str);
260 while (ssin >> value) {
261 value_.push_back(value);
265 std::istringstream ssin(str);
266 while (ssin >> value) {
267 value_.push_back(value);
272 bool check_required_set()
280 std::vector<T> value_;
282 bool required_ =
false;
283 bool value_set_ =
false;
284 std::vector<T> range_;
302 void set_xml_element_name(
const std::string& name)
304 xml_element_name = name;
310 param.
set(name, required, value);
316 param.
set(name, required, value);
322 param.
set(name, required, value);
328 param.
set(name, required, value);
332 void set_parameter(
const std::string& name, std::initializer_list<std::string> value,
bool required,
335 param.
set(name, required, value);
341 param.
set(name, required, value);
347 param.
set(name, required, value);
355 throw std::runtime_error(
"Unknown " + xml_element_name +
" XML element '" + name +
"'.");
361 if (name ==
"Activation_functions") {
363 (*vec_param)->value_.clear();
364 (*vec_param)->set(value);
366 throw std::runtime_error(
"Activation_functions is not a VectorParameter<int>.");
370 else if (name ==
"Weights") {
372 (*vec_param)->value_.clear();
373 (*vec_param)->set(value);
375 throw std::runtime_error(
"Weights is not a VectorParameter<double>.");
380 std::visit([&](
auto&& p) ->
void {
392 throw std::runtime_error(
"Unknown " + xml_element_name +
" XML element '" + name +
"'.");
395 std::visit([value](
auto&& p) { p->set(value); },
params_map[name]);
401 bool unset_found =
false;
404 if (std::visit([](
auto&& p) {
405 return !p->check_required_set();
407 throw std::runtime_error(xml_element_name +
" XML element '" + key +
"' has not been set.");
415 std::map<std::string,std::string> params;
418 std::visit([¶ms](
auto&& p) {
419 params[p->name()] = p->svalue();
430 std::cout << key <<
": ";
431 std::visit([](
auto& p) {
432 std::cout << p->name_ << std::endl;
433 std::cout << p->svalue() << std::endl;
443 std::string xml_element_name =
"";
457 bool defined()
const {
return value_set; };
458 void set_values(tinyxml2::XMLElement* con_model_params);
459 void print_parameters();
465 bool value_set =
false;
472 bool defined()
const {
return value_set; };
473 void set_values(tinyxml2::XMLElement* con_model_params);
474 void print_parameters();
479 bool value_set =
false;
489 bool defined()
const {
return value_set; };
490 void set_values(tinyxml2::XMLElement* con_model_params);
491 void print_parameters();
503 bool value_set =
false;
510 bool defined()
const {
return value_set; };
511 void set_values(tinyxml2::XMLElement* con_model_params);
512 void print_parameters();
518 bool value_set =
false;
525 bool defined()
const {
return value_set; };
526 void set_values(tinyxml2::XMLElement* con_model_params);
527 void print_parameters();
530 bool value_set =
false;
537 void set_values(tinyxml2::XMLElement* modl_params);
538 void print_parameters();
539 bool value_set =
false;
546 void set_values(tinyxml2::XMLElement* modl_params);
547 void print_parameters();
548 bool value_set =
false;
558 void print_parameters();
559 void set_values(tinyxml2::XMLElement* xml_elem);
586 bool defined()
const {
return value_set; };
587 void set_values(tinyxml2::XMLElement* con_model_params);
588 void print_parameters();
590 std::vector<CANNRowParameters*> rows;
592 bool value_set =
false;
601 void print_parameters();
603 bool defined()
const {
return value_set; };
604 void set_values(tinyxml2::XMLElement* modl_params);
608 static const std::string GUCCIONE_MODEL;
609 static const std::string HGO_MODEL;
610 static const std::string HOLZAPFEL_OGDEN_MODEL;
611 static const std::string HOLZAPFEL_OGDEN_MA_MODEL;
612 static const std::string LEE_SACKS;
613 static const std::string NEOHOOKEAN_MODEL;
614 static const std::string STVENANT_KIRCHHOFF_MODEL;
615 static const std::string CANN_MODEL;
630 bool value_set =
false;
641 bool defined()
const {
return value_set; };
642 void set_values(tinyxml2::XMLElement* xml_elem);
643 void print_parameters();
656 bool value_set =
false;
667 bool defined()
const {
return value_set; };
668 void set_values(tinyxml2::XMLElement* xml_elem);
676 bool value_set =
false;
688 static const std::string xml_element_name_;
690 bool defined()
const {
return value_set; };
691 void set_values(tinyxml2::XMLElement* xml_elem);
701 bool value_set =
false;
717 void print_parameters();
718 void set_values(tinyxml2::XMLElement* xml_elem);
753 static const std::string xml_element_name_;
755 void set_values(tinyxml2::XMLElement* xml_elem);
756 void print_parameters();
764 bool value_set =
false;
773 void print_parameters();
774 void set_values(tinyxml2::XMLElement* bc_params);
841 void print_parameters();
842 void set_values(tinyxml2::XMLElement* xml_elem);
849 std::vector<Parameter<bool>> output_list;
852 std::vector<Parameter<std::string>> alias_list;
869 void set_values(tinyxml2::XMLElement* xml_elem);
871 static const std::string xml_element_name_;
892 void set_values(tinyxml2::XMLElement* xml_elem);
909 bool defined()
const {
return value_set; };
910 void set_values(tinyxml2::XMLElement* xml_elemnt);
914 bool value_set =
false;
929 void print_parameters();
930 void set_values(tinyxml2::XMLElement* equation_params);
938 void print_parameters();
939 void set_values(tinyxml2::XMLElement* xml_elem);
952 void print_parameters();
953 void set_values(tinyxml2::XMLElement* xml_elem);
966 static const std::string CONSTANT_MODEL;
967 static const std::string CARREAU_YASUDA_MODEL;
968 static const std::string CASSONS_MODEL;
969 static const std::set<std::string> model_names;
971 void print_parameters();
972 void set_values(tinyxml2::XMLElement* xml_elem);
992 void print_parameters();
993 void set_values(tinyxml2::XMLElement* equation_params);
1001 void print_parameters();
1002 void set_values(tinyxml2::XMLElement* equation_params);
1013 static const std::string NEWTONIAN_MODEL;
1014 static const std::string POTENTIAL_MODEL;
1015 static const std::set<std::string> model_names;
1017 void print_parameters();
1018 void set_values(tinyxml2::XMLElement* xml_elem);
1035 void print_parameters();
1036 void set_values(tinyxml2::XMLElement* fsi_file);
1037 bool defined()
const {
return values_set_; };
1039 bool values_set_ =
false;
1054 void print_parameters();
1055 void set_values(tinyxml2::XMLElement* fsi_file);
1096 bool defined()
const {
return value_set; };
1097 void print_parameters();
1098 void set_values(tinyxml2::XMLElement* xml_elem);
1107 bool value_set =
false;
1117 bool defined()
const {
return value_set; };
1118 void print_parameters();
1119 void set_values(tinyxml2::XMLElement* xml_elem);
1125 bool value_set =
false;
1145 bool defined()
const {
return value_set; };
1146 void print_parameters();
1147 void set_values(tinyxml2::XMLElement* xml_elem);
1155 bool value_set =
false;
1178 void print_parameters();
1179 void set_values(tinyxml2::XMLElement* xml_elem);
1261 bool values_set_ =
false;
1263 bool defined()
const {
return values_set_; };
1264 void print_parameters();
1265 double get_edge_size(
const std::string& name)
const {
return max_edge_sizes_.at(name); }
1266 bool has_edge_size(
const std::string& name)
const {
return max_edge_sizes_.count(name) == 1; }
1267 void set_values(tinyxml2::XMLElement* mesh_elem);
1270 std::map<std::string, double> max_edge_sizes_;
1289 void print_parameters();
1290 void set_values(tinyxml2::XMLElement* xml_elem);
1323 void print_parameters();
1324 void set_values(tinyxml2::XMLElement* xml_elem);
1359 std::vector<BodyForceParameters*> body_forces;
1361 std::vector<BoundaryConditionParameters*> boundary_conditions;
1370 std::vector<DomainParameters*> domains;
1374 std::vector<OutputParameters*> outputs;
1415 void print_parameters();
1416 void set_values(tinyxml2::XMLElement* xml_element);
1418 std::string xml_element_name;
1457 void print_parameters();
1458 void set_values(tinyxml2::XMLElement* xml_elem);
1499 void print_parameters();
1500 void set_values(tinyxml2::XMLElement* mesh_elem);
1501 std::string get_name()
const {
return name.value(); };
1502 std::string get_path()
const {
return mesh_file_path.value(); };
1504 std::vector<FaceParameters*> face_parameters;
1516 std::vector<VectorParameter<double>> fiber_directions;
1551 void set_values(tinyxml2::XMLElement* xml_elem);
1569 void print_parameters();
1570 void set_values(tinyxml2::XMLElement* xml_elem);
1605 void print_parameters();
1606 void set_values(tinyxml2::XMLElement* mesh_elem);
1607 std::string get_name()
const {
return name.value(); };
1610 std::vector<URISFaceParameters*> URIS_face_parameters;
1634 static const std::set<std::string> constitutive_model_names;
1635 static const std::set<std::string> equation_names;
1636 static const std::string FSI_FILE;
1638 void get_logging_levels(
int& verbose,
int& warning,
int& debug);
1639 void print_parameters();
1640 void read_xml(std::string file_name);
1642 void set_contact_values(tinyxml2::XMLElement* root_element);
1643 void set_equation_values(tinyxml2::XMLElement* root_element);
1644 void set_mesh_values(tinyxml2::XMLElement* root_element);
1645 void set_precomputed_solution_values(tinyxml2::XMLElement* root_element);
1646 void set_projection_values(tinyxml2::XMLElement* root_element);
1647 void set_svzerodsolver_interface_values(tinyxml2::XMLElement* root_element);
1649 void set_RIS_projection_values(tinyxml2::XMLElement* root_element);
1650 void set_URIS_mesh_values(tinyxml2::XMLElement* root_element);
1655 std::vector<MeshParameters*> mesh_parameters;
1656 std::vector<EquationParameters*> equation_parameters;
1657 std::vector<ProjectionParameters*> projection_parameters;
1660 std::vector<RISProjectionParameters*> RIS_projection_parameters;
1661 std::vector<URISMeshParameters*> URIS_mesh_parameters;
Body force over a mesh using the "Add_BF" command.
Definition Parameters.h:714
static const std::string xml_element_name_
Define the XML element name for boundary condition parameters.
Definition Parameters.h:719
The BoundaryConditionParameters stores paramaters for various type of boundary conditions under the A...
Definition Parameters.h:770
static const std::string xml_element_name_
Define the XML element name for equation boundary condition parameters.
Definition Parameters.h:775
RCR values for Neumann BC type.
Definition Parameters.h:749
BoundaryConditionRCRParameters()
RCR values for Neumann BC type.
Definition Parameters.cpp:371
The CANNParameters class stores the parameters table rows for xml element "Constitutive_model type=CA...
Definition Parameters.h:582
CANNParameters()
Constructor for CANNParameters class. Initializes parameter table.
Definition Parameters.cpp:878
~CANNParameters()
Destructor for CANNParameters class. Deletes memory dynamically allocated to the rows of the table.
Definition Parameters.cpp:890
The CANNRowParameters class is used to store the parameters for each row of the CANN table for the xm...
Definition Parameters.h:554
static const std::string xml_element_name_
Process parameters for the "Add_row" xml element.
Definition Parameters.h:561
The ConstitutiveModelParameters class store parameters for various constitutive models.
Definition Parameters.h:598
void check_constitutive_model(const Parameter< std::string > &eq_type)
Check if a constitutive model is valid for the given equation.
Definition Parameters.cpp:990
static const std::map< std::string, std::string > constitutive_model_types
Supported constitutive model types and their aliases.
Definition Parameters.h:537
static const std::string xml_element_name_
Process parameters for various constitutive models.
Definition Parameters.h:605
Couple to reduced-order models.
Definition Parameters.h:635
static const std::string xml_element_name_
Couple to reduced-order models.
Definition Parameters.h:639
Coupling to GenBC.
Definition Parameters.h:661
static const std::string xml_element_name_
Coupling to GenBC.
Definition Parameters.h:665
The DomainParameters class stores parameters for the XML 'Domain' element to specify properties for s...
Definition Parameters.h:1172
static const std::string xml_element_name_
Define the XML element name for domain parameters.
Definition Parameters.h:1176
Definition Parameters.h:1111
static const std::string xml_element_name_
Define the XML element name for ECG leads parameters.
Definition Parameters.h:1115
The EquationParameters class stores parameters for the 'Add_equation' XML element used to specify an ...
Definition Parameters.h:1317
static const std::string xml_element_name_
Define the XML element name for equation parameters.
Definition Parameters.h:1321
The FaceParameters class is used to store parameters for the 'Add_face' XML element.
Definition Parameters.h:1453
static const std::string xml_element_name_
Process parameters for the 'Add_face' XML element.
Definition Parameters.h:1460
The FiberReinforcementStressParameters class stores fiber reinforcement stress parameters for the 'Fi...
Definition Parameters.h:1139
static const std::string xml_element_name_
Define the XML element name for fiber reinforcement stress parameters.
Definition Parameters.h:1143
Definition Parameters.h:935
Definition Parameters.h:949
Definition Parameters.h:926
Definition Parameters.h:960
static const std::string xml_element_name_
Process parameters for various fluid viscosity models.
Definition Parameters.h:964
The GeneralSimulationParameters class stores paramaters for the 'GeneralSimulationParameters' XML ele...
Definition Parameters.h:1411
GeneralSimulationParameters()
Process paramaters for the 'GeneralSimulationParameters' XML element.
Definition Parameters.cpp:2175
void set_values(tinyxml2::XMLElement *xml_element)
Set general parameters values from XML.
Definition Parameters.cpp:2234
Definition Parameters.h:469
Definition Parameters.h:507
Definition Parameters.h:486
Definition Parameters.h:454
The LinearAlgebraParameters class stores parameters for the 'Linear_algebra' XML element.
Definition Parameters.h:1030
void check_input_parameters()
Check the validity of the input parameters.
Definition Parameters.cpp:2860
static const std::string xml_element_name_
Define the XML element name for equation output parameters.
Definition Parameters.h:1032
The LinearSolverParameters class stores parameters for the 'LS' XML element.
Definition Parameters.h:1050
static const std::string xml_element_name_
Define the XML element name for equation output parameters.
Definition Parameters.h:1057
The MeshParameters class is used to store paramaters for the 'Add_mesh' XML element.
Definition Parameters.h:1493
static const std::string xml_element_name_
Define the XML element name for mesh parameters.
Definition Parameters.h:1497
Definition Parameters.h:522
Definition Parameters.h:534
NeoHookeanParameters()
There are no parameters associated with a Neohookean model.
Definition Parameters.cpp:775
The OutputParameters class stores parameters for the Output XML element under Add_equation.
Definition Parameters.h:835
std::string get_alias_value(const std::string &name)
Get the value of an alias by name.
Definition Parameters.cpp:1218
bool get_output_value(const std::string &name)
Get the value of an output by name.
Definition Parameters.cpp:1230
static const std::string xml_element_name_
Define the XML element name for equation output parameters.
Definition Parameters.h:839
The Parameter class template is used to store a named paramater and its scalar value as a basic type:...
Definition Parameters.h:114
void set(const std::string &name, bool required, T value)
Set the parameter name and value, and if it is required.
Definition Parameters.h:145
void set(const std::string &str_value)
Set the parameter value from a string.
Definition Parameters.h:152
std::string svalue()
Get the value of a parameter as a string.
Definition Parameters.h:131
Defines parameter name and value, and stores them in maps for settng values from XML.
Definition Parameters.h:297
void check_required()
Check if any required parameters have not been set.
Definition Parameters.h:399
void set_parameter(const std::string &name, const bool value, bool required, Parameter< bool > ¶m)
Set the name, default value and the parameter required flag.
Definition Parameters.h:308
void set_parameter_value_CANN(const std::string &name, const std::string &value)
set_parameter function to handle CANNRow
Definition Parameters.h:352
std::map< std::string, std::string > get_parameter_list()
Get the defined parameters as a map of strings.
Definition Parameters.h:413
void set_parameter_value(const std::string &name, const std::string &value)
Set the value of a paramter from a string.
Definition Parameters.h:389
std::map< std::string, std::variant< Parameter< bool > *, Parameter< double > *, Parameter< int > *, Parameter< std::string > *, VectorParameter< double > *, VectorParameter< int > *, VectorParameter< std::string > * > > params_map
Map used for storing parameters by name / Parameter template union.
Definition Parameters.h:441
void print_parameter_list()
Print the parameters.
Definition Parameters.h:427
The Parameters class stores parameter values read in from a solver input file.
Definition Parameters.h:1629
void read_xml(std::string file_name)
Set the simulation parameter values given in an XML format file.
Definition Parameters.cpp:150
The PrecomputedSolutionParameters class stores parameters for the 'Precomputed_solution' XML element ...
Definition Parameters.h:865
The ProjectionParameters class stores parameters for the 'Add_projection' XML element used for fluid-...
Definition Parameters.h:888
static const std::string xml_element_name_
Define the XML element name for mesh parameters.
Definition Parameters.h:894
The RISProjectionParameters class stores parameters for the 'Add_RIS_projection' XML element used for...
Definition Parameters.h:1547
static const std::string xml_element_name_
Define the XML element name for mesh parameters.
Definition Parameters.h:1553
The RemesherParameters class stores parameters for the 'Remesher' XML element used for remeshing.
Definition Parameters.h:1256
static const std::string xml_element_name_
Define the XML element name for mesh parameters.
Definition Parameters.h:1260
Definition Parameters.h:989
Definition Parameters.h:1007
static const std::string xml_element_name_
Process parameters for various solid viscosity models.
Definition Parameters.h:1011
Definition Parameters.h:998
Definition Parameters.h:543
StVenantKirchhoffParameters()
There are no parameters associated with a StVenantKirchhoff model.
Definition Parameters.cpp:789
The StimulusParameters class stores parameters for 'Stimulus' XML element used to parameters for pace...
Definition Parameters.h:1090
static const std::string xml_element_name_
Define the XML element name for equation output parameters.
Definition Parameters.h:1094
The URISFaceParameters class is used to store parameters for the 'Add_URIS_face' XML element.
Definition Parameters.h:1565
static const std::string xml_element_name_
Process parameters for the 'Add_URIS_face' XML element.
Definition Parameters.h:1572
The URISMeshParameters class is used to store paramaters for the 'Add_URIS_mesh' XML element.
Definition Parameters.h:1599
static const std::string xml_element_name_
Define the XML element name for mesh parameters.
Definition Parameters.h:1603
The VariableWallPropsParameters class stores parameters for variable wall properties for the CMM equa...
Definition Parameters.h:905
static const std::string xml_element_name_
The VariableWallPropsParameters class stores parameters for variable wall properties for the CMM equa...
Definition Parameters.h:908
The VectorParameter class template is used to store a named paramater and its vector of values as a b...
Definition Parameters.h:193
void set(const std::string &str_value)
Set the parameter value from a string.
Definition Parameters.h:247
void set(const std::string &name, bool required, const std::vector< T > &value)
Set the parameter name and value, and if it is required.
Definition Parameters.h:239
std::string svalue()
Get the string representation of the parameter value.
Definition Parameters.h:213
Definition Parameters.h:684
struct to define a row of CANN model parameter table
Definition Parameters.h:288