svFSIplus
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.

Copyright (c) Stanford University, The Regents of the University of California, and others.

All Rights Reserved.

See Copyright-SimVascular.txt for additional details.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

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:

<svFSIFile>
<element>
<subelement>.....</subelement>
</element>
</svFSIFile>

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: