OGS
ParameterLib::CurveScaledParameter< T > Struct Template Referencefinal

Detailed Description

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

Definition at line 22 of file CurveScaledParameter.h.

#include <CurveScaledParameter.h>

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

Public Member Functions

 CurveScaledParameter (std::string const &name_, MathLib::PiecewiseLinearInterpolation const &curve, std::string referenced_parameter_name)
 
bool isTimeDependent () const override
 
void initialize (std::vector< std::unique_ptr< ParameterBase > > const &parameters) override
 
int getNumberOfGlobalComponents () const override
 
std::vector< T > operator() (double const t, SpatialPosition const &pos) const override
 Returns the parameter value at the given time and position.
 
- Public Member Functions inherited from ParameterLib::Parameter< T >
 ~Parameter () override=default
 
virtual Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > getNodalValuesOnElement (MeshLib::Element const &element, double const t) const
 Returns a matrix of values for all nodes of the given element.
 
 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)
 
MeshLib::Mesh const * mesh () const
 

Private Attributes

MathLib::PiecewiseLinearInterpolation const & _curve
 
Parameter< T > const * _parameter = nullptr
 
std::string const _referenced_parameter_name
 

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

◆ CurveScaledParameter()

template<typename T >
ParameterLib::CurveScaledParameter< T >::CurveScaledParameter ( std::string const & name_,
MathLib::PiecewiseLinearInterpolation const & curve,
std::string referenced_parameter_name )
inline

Definition at line 24 of file CurveScaledParameter.h.

27 : Parameter<T>(name_),
28 _curve(curve),
29 _referenced_parameter_name(std::move(referenced_parameter_name))
30 {
31 }
MathLib::PiecewiseLinearInterpolation const & _curve

Member Function Documentation

◆ getNumberOfGlobalComponents()

template<typename T >
int ParameterLib::CurveScaledParameter< 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 42 of file CurveScaledParameter.h.

43 {
44 return _parameter->getNumberOfGlobalComponents();
45 }

References ParameterLib::CurveScaledParameter< T >::_parameter.

◆ initialize()

template<typename T >
void ParameterLib::CurveScaledParameter< T >::initialize ( std::vector< std::unique_ptr< ParameterBase > > const & )
inlineoverridevirtual

Parameters might depend on each other; this method allows to set up the dependencies between parameters after they have been constructed.

Reimplemented from ParameterLib::ParameterBase.

Definition at line 34 of file CurveScaledParameter.h.

36 {
40 }
OGS_NO_DANGLING Parameter< ParameterDataType > & findParameter(std::string const &parameter_name, std::vector< std::unique_ptr< ParameterBase > > const &parameters, int const num_components, MeshLib::Mesh const *const mesh=nullptr)
Definition Utils.h:102
MeshLib::Mesh const * _mesh
Definition Parameter.h:130

References ParameterLib::ParameterBase::_mesh, ParameterLib::CurveScaledParameter< T >::_parameter, ParameterLib::CurveScaledParameter< T >::_referenced_parameter_name, and ParameterLib::findParameter().

◆ isTimeDependent()

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

Implements ParameterLib::ParameterBase.

Definition at line 33 of file CurveScaledParameter.h.

33{ return true; }

◆ operator()()

template<typename T >
std::vector< T > ParameterLib::CurveScaledParameter< 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 47 of file CurveScaledParameter.h.

49 {
50 // No local coordinate transformation here, which might happen twice
51 // otherwise.
52 assert(!this->_coordinate_system ||
53 "Coordinate system not expected to be set for curve scaled "
54 "parameters.");
55
56 auto const& tup = (*_parameter)(t, pos);
57 auto const scaling = _curve.getValue(t);
58
59 auto const num_comp = _parameter->getNumberOfGlobalComponents();
60 std::vector<T> cache(num_comp);
61 for (int c = 0; c < num_comp; ++c)
62 {
63 cache[c] = scaling * tup[c];
64 }
65 return cache;
66 }
double getValue(double pnt_to_interpolate) const
Calculates the interpolation value.
std::optional< CoordinateSystem > _coordinate_system
Definition Parameter.h:126

References ParameterLib::ParameterBase::_coordinate_system, ParameterLib::CurveScaledParameter< T >::_curve, ParameterLib::CurveScaledParameter< T >::_parameter, and MathLib::PiecewiseLinearInterpolation::getValue().

Member Data Documentation

◆ _curve

template<typename T >
MathLib::PiecewiseLinearInterpolation const& ParameterLib::CurveScaledParameter< T >::_curve
private

◆ _parameter

◆ _referenced_parameter_name

template<typename T >
std::string const ParameterLib::CurveScaledParameter< T >::_referenced_parameter_name
private

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