91 Parameter(
const std::string& name, T value,
bool required, std::vector<T> range = {}) :
92 value_(value), name_(name), required_(required)
98 std::string name()
const {
return name_; };
99 T value()
const {
return value_; };
100 T operator()()
const {
return value_; };
101 bool defined()
const {
return value_set_; };
106 std::ostringstream str_stream;
107 str_stream << value_;
108 return str_stream.str();
111 friend std::ostream& operator << (std::ostream& out,
const Parameter<T>& param)
113 out << param.value();
118 void set(
const std::string& name,
bool required, T value) {
120 required_ = required;
125 void set(
const std::string& str_value)
127 if (str_value ==
"") {
131 auto str = str_value;
132 std::string::iterator end_pos = std::remove(str.begin(), str.end(),
' ');
133 str.erase(end_pos, str.end());
135 std::istringstream str_stream(str);
136 if (!(str_stream >> value_)) {
137 std::istringstream str_stream(str);
138 if (!(str_stream >> std::boolalpha >> value_)) {
139 throw std::runtime_error(
"Incorrect value '" + str +
"' for '" + name_ +
"'.");
146 bool check_required_set()
155 std::string name_ =
"";
156 bool required_ =
false;
157 bool value_set_ =
false;
158 std::vector<T> range_;
170 VectorParameter(
const std::string& name,
const std::vector<T>& value,
bool required, std::vector<T> range = {}) :
171 value_(value), name_(name), required_(required)
177 std::string name()
const {
return name_; };
178 std::vector<T> value()
const {
return value_; };
179 bool defined()
const {
return value_set_; };
180 int size()
const {
return value_.size(); };
182 std::vector<T> operator()()
const {
return value_; };
183 const double& operator[](
const int i)
const {
return value_[i]; };
190 if constexpr (std::is_same<T, std::string>::value) {
191 for (
auto v : value_) {
192 str +=
" " + v +
" ";
195 for (
auto v : value_) {
196 str +=
" " + std::to_string(v);
205 for (
int i = 0; i < param.size(); i++) {
206 out << param.value_[i];
212 void set(
const std::string& name,
bool required,
const std::vector<T>& value)
215 required_ = required;
220 void set(
const std::string& str_value)
222 if (str_value ==
"") {
226 std::string error_msg =
"Improper vector format '" + str_value +
"' found in '" + name_ +
"'." +
" Vector format is: (x,y,z)";
227 std::regex sep(
"\\(|\\)|\\,");
228 auto str = std::regex_replace(str_value, sep,
" ");
230 if constexpr (std::is_same<T, std::string>::value) {
231 std::stringstream ssin(str);
233 while (ssin >> value) {
234 value_.push_back(value);
238 std::istringstream ssin(str);
239 while (ssin >> value) {
240 value_.push_back(value);
245 bool check_required_set()
253 std::vector<T> value_;
255 bool required_ =
false;
256 bool value_set_ =
false;
257 std::vector<T> range_;
275 void set_xml_element_name(
const std::string& name)
277 xml_element_name = name;
283 param.
set(name, required, value);
289 param.
set(name, required, value);
295 param.
set(name, required, value);
301 param.
set(name, required, value);
305 void set_parameter(
const std::string& name, std::initializer_list<std::string> value,
bool required,
308 param.
set(name, required, value);
314 param.
set(name, required, value);
320 param.
set(name, required, value);
328 throw std::runtime_error(
"Unknown " + xml_element_name +
" XML element '" + name +
"'.");
334 if (name ==
"Activation_functions") {
336 (*vec_param)->value_.clear();
337 (*vec_param)->set(value);
339 throw std::runtime_error(
"Activation_functions is not a VectorParameter<int>.");
343 else if (name ==
"Weights") {
345 (*vec_param)->value_.clear();
346 (*vec_param)->set(value);
348 throw std::runtime_error(
"Weights is not a VectorParameter<double>.");
353 std::visit([&](
auto&& p) ->
void {
365 throw std::runtime_error(
"Unknown " + xml_element_name +
" XML element '" + name +
"'.");
368 std::visit([value](
auto&& p) { p->set(value); },
params_map[name]);
374 bool unset_found =
false;
377 if (std::visit([](
auto&& p) {
378 return !p->check_required_set();
380 throw std::runtime_error(xml_element_name +
" XML element '" + key +
"' has not been set.");
388 std::map<std::string,std::string> params;
391 std::visit([¶ms](
auto&& p) {
392 params[p->name()] = p->svalue();
403 std::cout << key <<
": ";
404 std::visit([](
auto& p) {
405 std::cout << p->name_ << std::endl;
406 std::cout << p->svalue() << std::endl;
416 std::string xml_element_name =
"";
430 bool defined()
const {
return value_set; };
431 void set_values(tinyxml2::XMLElement* con_model_params);
432 void print_parameters();
438 bool value_set =
false;
445 bool defined()
const {
return value_set; };
446 void set_values(tinyxml2::XMLElement* con_model_params);
447 void print_parameters();
452 bool value_set =
false;
462 bool defined()
const {
return value_set; };
463 void set_values(tinyxml2::XMLElement* con_model_params);
464 void print_parameters();
476 bool value_set =
false;
483 bool defined()
const {
return value_set; };
484 void set_values(tinyxml2::XMLElement* con_model_params);
485 void print_parameters();
491 bool value_set =
false;
498 bool defined()
const {
return value_set; };
499 void set_values(tinyxml2::XMLElement* con_model_params);
500 void print_parameters();
503 bool value_set =
false;
510 void set_values(tinyxml2::XMLElement* modl_params);
511 void print_parameters();
512 bool value_set =
false;
519 void set_values(tinyxml2::XMLElement* modl_params);
520 void print_parameters();
521 bool value_set =
false;
531 void print_parameters();
532 void set_values(tinyxml2::XMLElement* xml_elem);
559 bool defined()
const {
return value_set; };
560 void set_values(tinyxml2::XMLElement* con_model_params);
561 void print_parameters();
563 std::vector<CANNRowParameters*> rows;
565 bool value_set =
false;
574 void print_parameters();
576 bool defined()
const {
return value_set; };
577 void set_values(tinyxml2::XMLElement* modl_params);
581 static const std::string GUCCIONE_MODEL;
582 static const std::string HGO_MODEL;
583 static const std::string HOLZAPFEL_OGDEN_MODEL;
584 static const std::string HOLZAPFEL_OGDEN_MA_MODEL;
585 static const std::string LEE_SACKS;
586 static const std::string NEOHOOKEAN_MODEL;
587 static const std::string STVENANT_KIRCHHOFF_MODEL;
588 static const std::string CANN_MODEL;
603 bool value_set =
false;
614 bool defined()
const {
return value_set; };
615 void set_values(tinyxml2::XMLElement* xml_elem);
616 void print_parameters();
629 bool value_set =
false;
640 bool defined()
const {
return value_set; };
641 void set_values(tinyxml2::XMLElement* xml_elem);
649 bool value_set =
false;
661 static const std::string xml_element_name_;
663 bool defined()
const {
return value_set; };
664 void set_values(tinyxml2::XMLElement* xml_elem);
674 bool value_set =
false;
690 void print_parameters();
691 void set_values(tinyxml2::XMLElement* xml_elem);
726 static const std::string xml_element_name_;
728 void set_values(tinyxml2::XMLElement* xml_elem);
729 void print_parameters();
737 bool value_set =
false;
746 void print_parameters();
747 void set_values(tinyxml2::XMLElement* bc_params);
814 void print_parameters();
815 void set_values(tinyxml2::XMLElement* xml_elem);
822 std::vector<Parameter<bool>> output_list;
825 std::vector<Parameter<std::string>> alias_list;
842 void set_values(tinyxml2::XMLElement* xml_elem);
844 static const std::string xml_element_name_;
865 void set_values(tinyxml2::XMLElement* xml_elem);
882 bool defined()
const {
return value_set; };
883 void set_values(tinyxml2::XMLElement* xml_elemnt);
887 bool value_set =
false;
902 void print_parameters();
903 void set_values(tinyxml2::XMLElement* equation_params);
911 void print_parameters();
912 void set_values(tinyxml2::XMLElement* xml_elem);
925 void print_parameters();
926 void set_values(tinyxml2::XMLElement* xml_elem);
939 static const std::string CONSTANT_MODEL;
940 static const std::string CARREAU_YASUDA_MODEL;
941 static const std::string CASSONS_MODEL;
942 static const std::set<std::string> model_names;
944 void print_parameters();
945 void set_values(tinyxml2::XMLElement* xml_elem);
965 void print_parameters();
966 void set_values(tinyxml2::XMLElement* equation_params);
974 void print_parameters();
975 void set_values(tinyxml2::XMLElement* equation_params);
986 static const std::string NEWTONIAN_MODEL;
987 static const std::string POTENTIAL_MODEL;
988 static const std::set<std::string> model_names;
990 void print_parameters();
991 void set_values(tinyxml2::XMLElement* xml_elem);
1008 void print_parameters();
1009 void set_values(tinyxml2::XMLElement* fsi_file);
1010 bool defined()
const {
return values_set_; };
1012 bool values_set_ =
false;
1027 void print_parameters();
1028 void set_values(tinyxml2::XMLElement* fsi_file);
1069 bool defined()
const {
return value_set; };
1070 void print_parameters();
1071 void set_values(tinyxml2::XMLElement* xml_elem);
1080 bool value_set =
false;
1090 bool defined()
const {
return value_set; };
1091 void print_parameters();
1092 void set_values(tinyxml2::XMLElement* xml_elem);
1098 bool value_set =
false;
1118 bool defined()
const {
return value_set; };
1119 void print_parameters();
1120 void set_values(tinyxml2::XMLElement* xml_elem);
1128 bool value_set =
false;
1151 void print_parameters();
1152 void set_values(tinyxml2::XMLElement* xml_elem);
1234 bool values_set_ =
false;
1236 bool defined()
const {
return values_set_; };
1237 void print_parameters();
1238 double get_edge_size(
const std::string& name)
const {
return max_edge_sizes_.at(name); }
1239 bool has_edge_size(
const std::string& name)
const {
return max_edge_sizes_.count(name) == 1; }
1240 void set_values(tinyxml2::XMLElement* mesh_elem);
1243 std::map<std::string, double> max_edge_sizes_;
1262 void print_parameters();
1263 void set_values(tinyxml2::XMLElement* xml_elem);
1296 void print_parameters();
1297 void set_values(tinyxml2::XMLElement* xml_elem);
1332 std::vector<BodyForceParameters*> body_forces;
1334 std::vector<BoundaryConditionParameters*> boundary_conditions;
1343 std::vector<DomainParameters*> domains;
1347 std::vector<OutputParameters*> outputs;
1388 void print_parameters();
1389 void set_values(tinyxml2::XMLElement* xml_element);
1391 std::string xml_element_name;
1430 void print_parameters();
1431 void set_values(tinyxml2::XMLElement* xml_elem);
1472 void print_parameters();
1473 void set_values(tinyxml2::XMLElement* mesh_elem);
1474 std::string get_name()
const {
return name.value(); };
1475 std::string get_path()
const {
return mesh_file_path.value(); };
1477 std::vector<FaceParameters*> face_parameters;
1489 std::vector<VectorParameter<double>> fiber_directions;
1524 void set_values(tinyxml2::XMLElement* xml_elem);
1542 void print_parameters();
1543 void set_values(tinyxml2::XMLElement* xml_elem);
1578 void print_parameters();
1579 void set_values(tinyxml2::XMLElement* mesh_elem);
1580 std::string get_name()
const {
return name.value(); };
1583 std::vector<URISFaceParameters*> URIS_face_parameters;
1607 static const std::set<std::string> constitutive_model_names;
1608 static const std::set<std::string> equation_names;
1609 static const std::string FSI_FILE;
1611 void get_logging_levels(
int& verbose,
int& warning,
int& debug);
1612 void print_parameters();
1613 void read_xml(std::string file_name);
1615 void set_contact_values(tinyxml2::XMLElement* root_element);
1616 void set_equation_values(tinyxml2::XMLElement* root_element);
1617 void set_mesh_values(tinyxml2::XMLElement* root_element);
1618 void set_precomputed_solution_values(tinyxml2::XMLElement* root_element);
1619 void set_projection_values(tinyxml2::XMLElement* root_element);
1620 void set_svzerodsolver_interface_values(tinyxml2::XMLElement* root_element);
1622 void set_RIS_projection_values(tinyxml2::XMLElement* root_element);
1623 void set_URIS_mesh_values(tinyxml2::XMLElement* root_element);
1628 std::vector<MeshParameters*> mesh_parameters;
1629 std::vector<EquationParameters*> equation_parameters;
1630 std::vector<ProjectionParameters*> projection_parameters;
1633 std::vector<RISProjectionParameters*> RIS_projection_parameters;
1634 std::vector<URISMeshParameters*> URIS_mesh_parameters;
Body force over a mesh using the "Add_BF" command.
Definition Parameters.h:687
static const std::string xml_element_name_
Define the XML element name for boundary condition parameters.
Definition Parameters.h:692
The BoundaryConditionParameters stores paramaters for various type of boundary conditions under the A...
Definition Parameters.h:743
static const std::string xml_element_name_
Define the XML element name for equation boundary condition parameters.
Definition Parameters.h:748
RCR values for Neumann BC type.
Definition Parameters.h:722
BoundaryConditionRCRParameters()
RCR values for Neumann BC type.
Definition Parameters.cpp:344
The CANNParameters class stores the parameters table rows for xml element "Constitutive_model type=CA...
Definition Parameters.h:555
CANNParameters()
Constructor for CANNParameters class. Initializes parameter table.
Definition Parameters.cpp:851
~CANNParameters()
Destructor for CANNParameters class. Deletes memory dynamically allocated to the rows of the table.
Definition Parameters.cpp:863
The CANNRowParameters class is used to store the parameters for each row of the CANN table for the xm...
Definition Parameters.h:527
static const std::string xml_element_name_
Process parameters for the "Add_row" xml element.
Definition Parameters.h:534
The ConstitutiveModelParameters class store parameters for various constitutive models.
Definition Parameters.h:571
void check_constitutive_model(const Parameter< std::string > &eq_type)
Check if a constitutive model is valid for the given equation.
Definition Parameters.cpp:963
static const std::map< std::string, std::string > constitutive_model_types
Supported constitutive model types and their aliases.
Definition Parameters.h:510
static const std::string xml_element_name_
Process parameters for various constitutive models.
Definition Parameters.h:578
Couple to reduced-order models.
Definition Parameters.h:608
static const std::string xml_element_name_
Couple to reduced-order models.
Definition Parameters.h:612
Coupling to GenBC.
Definition Parameters.h:634
static const std::string xml_element_name_
Coupling to GenBC.
Definition Parameters.h:638
The DomainParameters class stores parameters for the XML 'Domain' element to specify properties for s...
Definition Parameters.h:1145
static const std::string xml_element_name_
Define the XML element name for domain parameters.
Definition Parameters.h:1149
Definition Parameters.h:1084
static const std::string xml_element_name_
Define the XML element name for ECG leads parameters.
Definition Parameters.h:1088
The EquationParameters class stores parameters for the 'Add_equation' XML element used to specify an ...
Definition Parameters.h:1290
static const std::string xml_element_name_
Define the XML element name for equation parameters.
Definition Parameters.h:1294
The FaceParameters class is used to store parameters for the 'Add_face' XML element.
Definition Parameters.h:1426
static const std::string xml_element_name_
Process parameters for the 'Add_face' XML element.
Definition Parameters.h:1433
The FiberReinforcementStressParameters class stores fiber reinforcement stress parameters for the 'Fi...
Definition Parameters.h:1112
static const std::string xml_element_name_
Define the XML element name for fiber reinforcement stress parameters.
Definition Parameters.h:1116
Definition Parameters.h:908
Definition Parameters.h:922
Definition Parameters.h:899
Definition Parameters.h:933
static const std::string xml_element_name_
Process parameters for various fluid viscosity models.
Definition Parameters.h:937
The GeneralSimulationParameters class stores paramaters for the 'GeneralSimulationParameters' XML ele...
Definition Parameters.h:1384
GeneralSimulationParameters()
Process paramaters for the 'GeneralSimulationParameters' XML element.
Definition Parameters.cpp:2148
void set_values(tinyxml2::XMLElement *xml_element)
Set general parameters values from XML.
Definition Parameters.cpp:2207
Definition Parameters.h:442
Definition Parameters.h:480
Definition Parameters.h:459
Definition Parameters.h:427
The LinearAlgebraParameters class stores parameters for the 'Linear_algebra' XML element.
Definition Parameters.h:1003
void check_input_parameters()
Check the validity of the input parameters.
Definition Parameters.cpp:2833
static const std::string xml_element_name_
Define the XML element name for equation output parameters.
Definition Parameters.h:1005
The LinearSolverParameters class stores parameters for the 'LS' XML element.
Definition Parameters.h:1023
static const std::string xml_element_name_
Define the XML element name for equation output parameters.
Definition Parameters.h:1030
The MeshParameters class is used to store paramaters for the 'Add_mesh' XML element.
Definition Parameters.h:1466
static const std::string xml_element_name_
Define the XML element name for mesh parameters.
Definition Parameters.h:1470
Definition Parameters.h:495
Definition Parameters.h:507
NeoHookeanParameters()
There are no parameters associated with a Neohookean model.
Definition Parameters.cpp:748
The OutputParameters class stores parameters for the Output XML element under Add_equation.
Definition Parameters.h:808
std::string get_alias_value(const std::string &name)
Get the value of an alias by name.
Definition Parameters.cpp:1191
bool get_output_value(const std::string &name)
Get the value of an output by name.
Definition Parameters.cpp:1203
static const std::string xml_element_name_
Define the XML element name for equation output parameters.
Definition Parameters.h:812
The Parameter class template is used to store a named paramater and its scalar value as a basic type:...
Definition Parameters.h:87
void set(const std::string &name, bool required, T value)
Set the parameter name and value, and if it is required.
Definition Parameters.h:118
void set(const std::string &str_value)
Set the parameter value from a string.
Definition Parameters.h:125
std::string svalue()
Get the value of a parameter as a string.
Definition Parameters.h:104
Defines parameter name and value, and stores them in maps for settng values from XML.
Definition Parameters.h:270
void check_required()
Check if any required parameters have not been set.
Definition Parameters.h:372
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:281
void set_parameter_value_CANN(const std::string &name, const std::string &value)
set_parameter function to handle CANNRow
Definition Parameters.h:325
std::map< std::string, std::string > get_parameter_list()
Get the defined parameters as a map of strings.
Definition Parameters.h:386
void set_parameter_value(const std::string &name, const std::string &value)
Set the value of a paramter from a string.
Definition Parameters.h:362
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:414
void print_parameter_list()
Print the parameters.
Definition Parameters.h:400
The Parameters class stores parameter values read in from a solver input file.
Definition Parameters.h:1602
void read_xml(std::string file_name)
Set the simulation parameter values given in an XML format file.
Definition Parameters.cpp:123
The PrecomputedSolutionParameters class stores parameters for the 'Precomputed_solution' XML element ...
Definition Parameters.h:838
The ProjectionParameters class stores parameters for the 'Add_projection' XML element used for fluid-...
Definition Parameters.h:861
static const std::string xml_element_name_
Define the XML element name for mesh parameters.
Definition Parameters.h:867
The RISProjectionParameters class stores parameters for the 'Add_RIS_projection' XML element used for...
Definition Parameters.h:1520
static const std::string xml_element_name_
Define the XML element name for mesh parameters.
Definition Parameters.h:1526
The RemesherParameters class stores parameters for the 'Remesher' XML element used for remeshing.
Definition Parameters.h:1229
static const std::string xml_element_name_
Define the XML element name for mesh parameters.
Definition Parameters.h:1233
Definition Parameters.h:962
Definition Parameters.h:980
static const std::string xml_element_name_
Process parameters for various solid viscosity models.
Definition Parameters.h:984
Definition Parameters.h:971
Definition Parameters.h:516
StVenantKirchhoffParameters()
There are no parameters associated with a StVenantKirchhoff model.
Definition Parameters.cpp:762
The StimulusParameters class stores parameters for 'Stimulus' XML element used to parameters for pace...
Definition Parameters.h:1063
static const std::string xml_element_name_
Define the XML element name for equation output parameters.
Definition Parameters.h:1067
The URISFaceParameters class is used to store parameters for the 'Add_URIS_face' XML element.
Definition Parameters.h:1538
static const std::string xml_element_name_
Process parameters for the 'Add_URIS_face' XML element.
Definition Parameters.h:1545
The URISMeshParameters class is used to store paramaters for the 'Add_URIS_mesh' XML element.
Definition Parameters.h:1572
static const std::string xml_element_name_
Define the XML element name for mesh parameters.
Definition Parameters.h:1576
The VariableWallPropsParameters class stores parameters for variable wall properties for the CMM equa...
Definition Parameters.h:878
static const std::string xml_element_name_
The VariableWallPropsParameters class stores parameters for variable wall properties for the CMM equa...
Definition Parameters.h:881
The VectorParameter class template is used to store a named paramater and its vector of values as a b...
Definition Parameters.h:166
void set(const std::string &str_value)
Set the parameter value from a string.
Definition Parameters.h:220
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:212
std::string svalue()
Get the string representation of the parameter value.
Definition Parameters.h:186
Definition Parameters.h:657
struct to define a row of CANN model parameter table
Definition Parameters.h:261