svMultiPhysics
Public Member Functions | Public Attributes | List of all members
Parameter< T > Class Template Reference

The Parameter class template is used to store a named paramater and its scalar value as a basic type: bool, double, int and string. More...

#include <Parameters.h>

Public Member Functions

 Parameter (const std::string &name, T value, bool required, std::vector< T > range={})
 
std::string name () const
 
value () const
 
operator() () const
 
bool defined () const
 
std::string svalue ()
 Get the value of a parameter as a string. More...
 
void set (const std::string &name, bool required, T value)
 Set the parameter name and value, and if it is required. More...
 
void set (const std::string &str_value)
 Set the parameter value from a string. More...
 
bool check_required_set ()
 

Public Attributes

value_ = T{0}
 
std::string name_ = ""
 
bool required_ = false
 
bool value_set_ = false
 
std::vector< T > range_
 

Detailed Description

template<typename T>
class Parameter< T >

The Parameter class template is used to store a named paramater and its scalar value as a basic type: bool, double, int and string.

The classes defined here are used to process svFSIplus simulation parameters read in from an Extensible Markup Language (XML) format file. XML is a simple text-based format for representing structured information.

An XML document is formed as an element tree. The XML tree starts at a root element and branches from the root to sub-elements. All elements can have sub-elements:

<svMultiPhysicsFile>
<element>
<subelement>.....</subelement>
</element>
</svMultiPhysicsFile>

The elements in the svFSIplus simulation file are represented by sections of related parameters. Sub-elements are refered to as sub-sections.


Parameters class

The Parameters class is the top level class. It contains objects used to store parameters for the sections making up an XML simulation parameters file

1) General (GeneralSimulationParameters) 2) Mesh (MeshParameters) 3) Equation (EquationParameters) 4) Projection (ProjectionParameters)

Each object contains methods to parse the XML file for the parameters defined for it. These section objects may also contain objects representing the sub-sections defined for each section.


Section objects

Each section object contains objects representing parameters. A parameter's name and value is stored using either a Parameter and VectorParamater template objects. A parameter value is stored as a basic type: bool, double, int and string.

Parameter objects in a section class are named using the same XML element name with the 1st character lower case.

Example: GeneralSimulationParameters class

Parameter<bool> verbose; // <Verbose>
Parameter<double> spectral_radius_of_infinite_time_step; // <Spectral_radius_of_infinite_time_step>
Parameter<double> time_step_size; // <Time_step_size>

The name and default value for each parameter is defined in a section object's constructor.

Parameter values are set using the set_values() method which contains calls to tinyxml2
to parse parameter values from an XML file.

Each section object inherits from the ParameterLists class. This class provides methods to store parameters in a map and process iterated over them for setting values and other operations.

Member Function Documentation

◆ set() [1/2]

template<typename T >
void Parameter< T >::set ( const std::string &  name,
bool  required,
value 
)
inline

Set the parameter name and value, and if it is required.

◆ set() [2/2]

template<typename T >
void Parameter< T >::set ( const std::string &  str_value)
inline

Set the parameter value from a string.

◆ svalue()

template<typename T >
std::string Parameter< T >::svalue ( )
inline

Get the value of a parameter as a string.


The documentation for this class was generated from the following file: