OGS
ParameterLib::ConstantParameter< T > Struct Template Referencefinal

Detailed Description

template<typename T>
struct ParameterLib::ConstantParameter< T >

Single, constant value parameter.

Definition at line 19 of file ConstantParameter.h.

#include <ConstantParameter.h>

Inheritance diagram for ParameterLib::ConstantParameter< T >:
[legend]
Collaboration diagram for ParameterLib::ConstantParameter< T >:
[legend]

Public Member Functions

 ConstantParameter (std::string const &name_, T const &value)
 Construction with single value.
 
 ConstantParameter (std::string const &name_, std::vector< T > values)
 
bool isTimeDependent () const override
 
int getNumberOfGlobalComponents () const override
 
std::vector< T > operator() (double const, SpatialPosition const &pos) const override
 Returns the parameter value at the given time and position.
 
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > getNodalValuesOnElement (MeshLib::Element const &element, double const) const override
 Returns a matrix of values for all nodes of the given element.
 
- Public Member Functions inherited from ParameterLib::Parameter< T >
 ~Parameter () override=default
 
 ParameterBase (std::string name_, MeshLib::Mesh const *mesh=nullptr)
 
- Public Member Functions inherited from ParameterLib::ParameterBase
 ParameterBase (std::string name_, MeshLib::Mesh const *mesh=nullptr)
 
virtual ~ParameterBase ()=default
 
void setCoordinateSystem (CoordinateSystem const &coordinate_system)
 
virtual void initialize (std::vector< std::unique_ptr< ParameterBase > > const &)
 
MeshLib::Mesh const * mesh () const
 

Private Attributes

std::vector< T > const _values
 

Additional Inherited Members

- Public Attributes inherited from ParameterLib::ParameterBase
std::string const name
 
- Protected Member Functions inherited from ParameterLib::ParameterBase
std::vector< double > rotateWithCoordinateSystem (std::vector< double > const &values, SpatialPosition const &pos) const
 
- Protected Attributes inherited from ParameterLib::ParameterBase
std::optional< CoordinateSystem_coordinate_system
 
MeshLib::Mesh const * _mesh
 

Constructor & Destructor Documentation

◆ ConstantParameter() [1/2]

template<typename T >
ParameterLib::ConstantParameter< T >::ConstantParameter ( std::string const & name_,
T const & value )
inlineexplicit

Construction with single value.

Definition at line 22 of file ConstantParameter.h.

23 : Parameter<T>(name_), _values({value})
24 {
25 }

◆ ConstantParameter() [2/2]

template<typename T >
ParameterLib::ConstantParameter< T >::ConstantParameter ( std::string const & name_,
std::vector< T > values )
inlineexplicit

Construction with a tuple. The given tuple must be non-empty.

Definition at line 29 of file ConstantParameter.h.

30 : Parameter<T>(name_), _values(std::move(values))
31 {
32 assert(!_values.empty());
33 }

References ParameterLib::ConstantParameter< T >::_values.

Member Function Documentation

◆ getNodalValuesOnElement()

template<typename T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > ParameterLib::ConstantParameter< T >::getNodalValuesOnElement ( MeshLib::Element const & element,
double const t ) const
inlineoverridevirtual

Returns a matrix of values for all nodes of the given element.

Reimplemented from ParameterLib::Parameter< T >.

Definition at line 53 of file ConstantParameter.h.

55 {
56 auto const n_nodes = element.getNumberOfNodes();
57 Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> result(
59
60 // Column vector of values, copied for each node.
61 auto const row_values =
62 Eigen::Map<Eigen::Matrix<T, Eigen::Dynamic, 1> const>(
63 _values.data(), _values.size());
64 for (unsigned i = 0; i < n_nodes; ++i)
65 {
66 result.row(i) = row_values;
67 }
68 return result;
69 }
int getNumberOfGlobalComponents() const override

References ParameterLib::ConstantParameter< T >::_values, ParameterLib::ConstantParameter< T >::getNumberOfGlobalComponents(), and MeshLib::Element::getNumberOfNodes().

◆ getNumberOfGlobalComponents()

template<typename T >
int ParameterLib::ConstantParameter< T >::getNumberOfGlobalComponents ( ) const
inlineoverridevirtual

Returns the number of components this Parameter has at every position and point in time.

Implements ParameterLib::Parameter< T >.

Definition at line 37 of file ConstantParameter.h.

38 {
39 return static_cast<int>(_values.size());
40 }

References ParameterLib::ConstantParameter< T >::_values.

Referenced by ParameterLib::ConstantParameter< T >::getNodalValuesOnElement().

◆ isTimeDependent()

template<typename T >
bool ParameterLib::ConstantParameter< T >::isTimeDependent ( ) const
inlineoverridevirtual

Implements ParameterLib::ParameterBase.

Definition at line 35 of file ConstantParameter.h.

35{ return false; }

◆ operator()()

template<typename T >
std::vector< T > ParameterLib::ConstantParameter< T >::operator() ( double const t,
SpatialPosition const & pos ) const
inlineoverridevirtual

Returns the parameter value at the given time and position.

Implements ParameterLib::Parameter< T >.

Definition at line 42 of file ConstantParameter.h.

44 {
45 if (!this->_coordinate_system)
46 {
47 return _values;
48 }
49
50 return this->rotateWithCoordinateSystem(_values, pos);
51 }
std::vector< double > rotateWithCoordinateSystem(std::vector< double > const &values, SpatialPosition const &pos) const
Definition Parameter.h:76
std::optional< CoordinateSystem > _coordinate_system
Definition Parameter.h:126

References ParameterLib::ParameterBase::_coordinate_system, ParameterLib::ConstantParameter< T >::_values, and ParameterLib::ParameterBase::rotateWithCoordinateSystem().

Member Data Documentation

◆ _values


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