MoReFEM
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
MoReFEM::Parameter< TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT > Class Template Referenceabstract

Abstract class used to define a Parameter. More...

#include <Parameter.hpp>

Inheritance diagram for MoReFEM::Parameter< TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT >:
Collaboration diagram for MoReFEM::Parameter< TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT >:

Public Types

using self = Parameter<TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT>
 Alias to the type of the class.
 
using unique_ptr = std::unique_ptr<self>
 Alias to unique pointer.
 
using const_unique_ptr = std::unique_ptr<const self>
 Alias to unique pointer to const object.
 
template<std::size_t N>
using array_unique_ptr = std::array<unique_ptr, N>
 Alias to array of unique pointer.
 
using traits = Internal::ParameterNS::Traits<TypeT>
 Alias to traits.
 
using return_type = typename traits::return_type
 Alias to return type.
 
using value_type = typename traits::value_type
 Alias to storage type.
 
using time_dependency_type = TimeDependencyT<TypeT, TimeManagerT>
 Alias to time dependency.
 

Public Member Functions

virtual void TimeUpdate ()
 Apply the time dependency if relevant.
 
virtual void TimeUpdate (double time)
 Apply the time dependency if relevant.
 
void SetTimeDependency (typename time_dependency_type::unique_ptr &&time_dependency)
 Set the time dependency functor.
 
return_type GetValue (const LocalCoordsT &local_coords, const GeometricElt &geom_elt) const
 Get the value of the parameter at a given local position in a given geom_elt.
 
return_type GetConstantValue () const
 Returns the constant value (if the parameter is constant).
 
virtual void SetConstantValue (value_type value)=0
 Enables to modify the constant value of a parameter.
 
virtual bool IsConstant () const =0
 Whether the parameter varies spatially or not.
 
void Write (std::ostream &stream) const
 Write the content of the Parameter in a stream.
 
void Write (const FilesystemNS::File &filename) const
 Write the content of the Parameter in a file.
 
const DomainGetDomain () const noexcept
 Returns the Domain upon which the parameter is defined.
 
const time_dependency_typeGetTimeDependency () const noexcept
 Constant accessor to the object which handles if relevant the time dependency (computation of the time related factor, etc...).
 

Static Public Member Functions

static constexpr bool IsTimeDependent ()
 Whether the class is time-dependent or not.
 

Protected Member Functions

const std::string & GetName () const
 Name that will appear in outputs.
 

Private Member Functions

time_dependency_typeGetNonCstTimeDependency () noexcept
 Non constant accessor to the object which handles if relevant the time dependency (computation of the time related factor, etc...).
 
virtual return_type SupplGetConstantValue () const =0
 Returns the constant value (if the parameters is constant).
 
virtual return_type SupplGetAnyValue () const =0
 Returns a stored value (Any: the point is actually to assert its type for some functions overload).
 
virtual return_type SupplGetValue (const LocalCoordsT &local_coords, const GeometricElt &geom_elt) const =0
 Get the (spatially-only) value of the parameter at a given local position in a given geom_elt.
 
virtual void SupplWrite (std::ostream &stream) const =0
 Write the content of the Parameter in a stream.
 
virtual void SupplTimeUpdate ()=0
 Add here any additional TimeUpdate that might be relevant.
 
virtual void SupplTimeUpdate (double time)=0
 Add here any additional TimeUpdate that might be relevant.
 

Private Attributes

std::string name_
 Name that will appear in outputs.
 
const Domaindomain_
 Domain upon which the parameter is defined. Must be consistent with mesh.
 
time_dependency_type::unique_ptr time_dependency_ = nullptr
 Object which handles if relevant the time dependency (computation of the time related factor, etc...).
 

Special members.

template<class T >
 Parameter (T &&name, const Domain &domain)
 Constructor.
 
virtual ~Parameter ()=default
 Destructor.
 
 Parameter (const Parameter &rhs)=delete
 The copy constructor.
 
 Parameter (Parameter &&rhs)=delete
 The move constructor.
 
Parameteroperator= (const Parameter &rhs)=delete
 The (copy) operator=.
 
Parameteroperator= (Parameter &&rhs)=delete
 The (move) operator=.
 

Detailed Description

template<ParameterNS::Type TypeT, class LocalCoordsT, TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< ParameterNS::Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT = ParameterNS::TimeDependencyNS::None>
class MoReFEM::Parameter< TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT >

Abstract class used to define a Parameter.

Template Parameters
TypeTType of the parameter considered. If 'scalar', the underlying storage is a double. If 'vector', the underlying storage is a LocalVector. If 'matrix', the underlying storage is a LocalMatrix.
LocalCoordsTThis type describe the object at which the evaluation of the Parameter may occur. There are two expected possibilities: LocalCoords and QuadraturePoint.

A Parameter is first and foremost a spatial-dependent data: its main purpose is to describe the value of a physical parameter at a given local position. However, we might also want to apply a decoupled time dependency, i.e. consider value of the parameter might be determined by:

P(x, t) = f(x) * g(t)

In this case, g(t) is stored as a function and is recomputed at each Parameter::TimeUpdate() calls (such calls should therefore be located in Model::InitializeStep() where the time update actually occur).

There are two distinct categories of Parameter:

Most of the instantiated classes actually derives from ParameterInstance, which itself derives from current template class (but not all - see FiberList for a counter-example).

Member Typedef Documentation

◆ self

template<ParameterNS::Type TypeT, class LocalCoordsT , TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< ParameterNS::Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT = ParameterNS::TimeDependencyNS::None>
using MoReFEM::Parameter< TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT >::self = Parameter<TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT>

Alias to the type of the class.

Constructor & Destructor Documentation

◆ Parameter() [1/3]

template<ParameterNS::Type TypeT, class LocalCoordsT , TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< ParameterNS::Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT = ParameterNS::TimeDependencyNS::None>
template<class T >
MoReFEM::Parameter< TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT >::Parameter ( T && name,
const Domain & domain )
explicitprotected

Constructor.

Parameters
[in]nameName that will appear in outputs.
Parameters
[in]domainDomain upon which the Parameter is defined; this Domain MUST be associated with a Mesh (more often than not domain encompasses all the Coords of its associated Mesh). The reason it is a Domain and not a Mesh is that in some cases (fibers for instance) we might want to define it only on a subset of a Mesh.
Template Parameters
TType of name, in forwarding reference idiom. It must be convertible to a std::string.

A Parameter is first and foremost a spatial-dependent data: its main purpose is to describe the value of a physical parameter at a given local position. However, we might also want to apply a decoupled time dependency, i.e. consider value of the parameter might be determined by:

P(x, t) = f(x) * g(t)

In this case, g(t) is stored as a function and is recomputed at each Parameter::TimeUpdate() calls (such calls should therefore be located in Model::InitializeStep() where the time update actually occur).

◆ Parameter() [2/3]

template<ParameterNS::Type TypeT, class LocalCoordsT , TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< ParameterNS::Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT = ParameterNS::TimeDependencyNS::None>
MoReFEM::Parameter< TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT >::Parameter ( const Parameter< TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT > & rhs)
delete

The copy constructor.

Parameters
[in]rhsThe object from which the construction occurs.

◆ Parameter() [3/3]

template<ParameterNS::Type TypeT, class LocalCoordsT , TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< ParameterNS::Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT = ParameterNS::TimeDependencyNS::None>
MoReFEM::Parameter< TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT >::Parameter ( Parameter< TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT > && rhs)
delete

The move constructor.

Parameters
[in]rhsThe object from which the construction occurs.

Member Function Documentation

◆ operator=() [1/2]

template<ParameterNS::Type TypeT, class LocalCoordsT , TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< ParameterNS::Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT = ParameterNS::TimeDependencyNS::None>
Parameter & MoReFEM::Parameter< TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT >::operator= ( const Parameter< TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT > & rhs)
delete

The (copy) operator=.

Parameters
[in]rhsThe object from which the affectation occurs.
Returns
Reference to the object (to enable chained affectation).

◆ operator=() [2/2]

template<ParameterNS::Type TypeT, class LocalCoordsT , TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< ParameterNS::Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT = ParameterNS::TimeDependencyNS::None>
Parameter & MoReFEM::Parameter< TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT >::operator= ( Parameter< TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT > && rhs)
delete

The (move) operator=.

Parameters
[in]rhsThe object from which the affectation occurs.
Returns
Reference to the object (to enable chained affectation).

◆ TimeUpdate()

template<ParameterNS::Type TypeT, class LocalCoordsT , TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< ParameterNS::Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT = ParameterNS::TimeDependencyNS::None>
virtual void MoReFEM::Parameter< TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT >::TimeUpdate ( double time)
virtual

Apply the time dependency if relevant.

One should prefer to use the default one if one wants to use the current time. Extra security to verify the synchro of the parameter to the current time is done in he default one. This method is for particular cases only when the user knows exactly what is he doing.

Parameters
[in]timeTime for the update.

◆ SetTimeDependency()

template<ParameterNS::Type TypeT, class LocalCoordsT , TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< ParameterNS::Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT = ParameterNS::TimeDependencyNS::None>
void MoReFEM::Parameter< TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT >::SetTimeDependency ( typename time_dependency_type::unique_ptr && time_dependency)

Set the time dependency functor.

This is relevant only for TimeDependencyT != TimeDependencyNS::None.

Parameters
[in]time_dependencyUnique pointer to the time dependency object to set.

◆ GetValue()

template<ParameterNS::Type TypeT, class LocalCoordsT , TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< ParameterNS::Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT = ParameterNS::TimeDependencyNS::None>
return_type MoReFEM::Parameter< TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT >::GetValue ( const LocalCoordsT & local_coords,
const GeometricElt & geom_elt ) const

Get the value of the parameter at a given local position in a given geom_elt.

[internal] This method is actually called when IsConstant() yields false; if true GetConstantValue() is called instead.

Parameters
[in]local_coordsLocal object at which the Parameter is evaluated.
[in]geom_eltGeometricElt inside which the value is computed.
Returns
Value of the parameter.

◆ GetConstantValue()

template<ParameterNS::Type TypeT, class LocalCoordsT , TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< ParameterNS::Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT = ParameterNS::TimeDependencyNS::None>
return_type MoReFEM::Parameter< TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT >::GetConstantValue ( ) const

Returns the constant value (if the parameter is constant).

If not constant, an assert is raised (in debug mode).

Returns
Constant value of the parameter.

◆ SetConstantValue()

template<ParameterNS::Type TypeT, class LocalCoordsT , TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< ParameterNS::Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT = ParameterNS::TimeDependencyNS::None>
virtual void MoReFEM::Parameter< TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT >::SetConstantValue ( value_type value)
pure virtual

◆ IsConstant()

template<ParameterNS::Type TypeT, class LocalCoordsT , TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< ParameterNS::Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT = ParameterNS::TimeDependencyNS::None>
virtual bool MoReFEM::Parameter< TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT >::IsConstant ( ) const
pure virtual

◆ Write() [1/2]

template<ParameterNS::Type TypeT, class LocalCoordsT , TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< ParameterNS::Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT = ParameterNS::TimeDependencyNS::None>
void MoReFEM::Parameter< TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT >::Write ( std::ostream & stream) const

Write the content of the Parameter in a stream.

In first draft the output format is up to the policy (maybe later we may prefer to write at all quadrature points for all cases); the exact content is indeed defined in the virtual method SupplWrite(), to be defined in each inherited classes.

Parameters
[in,out]streamStream upon which object information are written.

◆ Write() [2/2]

template<ParameterNS::Type TypeT, class LocalCoordsT , TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< ParameterNS::Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT = ParameterNS::TimeDependencyNS::None>
void MoReFEM::Parameter< TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT >::Write ( const FilesystemNS::File & filename) const

Write the content of the Parameter in a file.

This method calls the namesake method that writes on a stream.

Parameters
[in]filenamePath to the file in which value will be written. The path must be valid (all directories must exist) and if a namesake already exists it is overwritten.

◆ GetTimeDependency()

template<ParameterNS::Type TypeT, class LocalCoordsT , TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< ParameterNS::Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT = ParameterNS::TimeDependencyNS::None>
const time_dependency_type & MoReFEM::Parameter< TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT >::GetTimeDependency ( ) const
noexcept

Constant accessor to the object which handles if relevant the time dependency (computation of the time related factor, etc...).

Shouldn't be called very often...

Returns
Time dependency object.

◆ SupplGetConstantValue()

template<ParameterNS::Type TypeT, class LocalCoordsT , TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< ParameterNS::Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT = ParameterNS::TimeDependencyNS::None>
virtual return_type MoReFEM::Parameter< TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT >::SupplGetConstantValue ( ) const
privatepure virtual

Returns the constant value (if the parameters is constant).

If the Parameter gets a time dependency (which is of the form f(x) * g(t)), current method returns only f(x). This method is expected to be called only in GetConstantValue() method, which adds up the g(t) contribution

This choice also makes us respect a C++ idiom that recommends avoiding virtual public methods.

Returns
Constant value of the Parameter. If the Parameter is not constant, this method should never be called.

Implemented in MoReFEM::ParameterNS::ThreeDimensionalCoumpoundParameter< TimeManagerT, TimeDependencyT >, MoReFEM::ParameterNS::GradientBasedElasticityTensor< TimeManagerT, ConfigurationT >, MoReFEM::ParameterNS::LameLambda< TimeManagerT >, MoReFEM::ParameterNS::LameMu< TimeManagerT >, MoReFEM::Internal::ParameterNS::ParameterInstance< TypeT, NaturePolicyT, TimeManagerT, TimeDependencyT, Args >, MoReFEM::FiberList< FiberPolicyT, TypeT, TimeManagerT >, and MoReFEM::FiberList< FiberNS::AtNodeOrAtQuadPt::at_node, ParameterNS::Type::scalar >.

◆ SupplGetAnyValue()

template<ParameterNS::Type TypeT, class LocalCoordsT , TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< ParameterNS::Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT = ParameterNS::TimeDependencyNS::None>
virtual return_type MoReFEM::Parameter< TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT >::SupplGetAnyValue ( ) const
privatepure virtual

◆ SupplGetValue()

template<ParameterNS::Type TypeT, class LocalCoordsT , TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< ParameterNS::Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT = ParameterNS::TimeDependencyNS::None>
virtual return_type MoReFEM::Parameter< TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT >::SupplGetValue ( const LocalCoordsT & local_coords,
const GeometricElt & geom_elt ) const
privatepure virtual

Get the (spatially-only) value of the parameter at a given local position in a given geom_elt.

If the Parameter gets a time dependency (which is of the form f(x) * g(t)), current method returns only f(x). This method is expected to be called only in GetValue() method, which adds up the g(t) contribution

This choice also makes us respect a C++ idiom that recommends avoiding virtual public methods.

Parameters
[in]geom_eltGeometricElt inside which the value is computed.
Returns
Value of the parameter.
Parameters
[in]local_coordsLocal object at which the Parameter is evaluated.

Implemented in MoReFEM::ParameterNS::GradientBasedElasticityTensor< TimeManagerT, ConfigurationT >, MoReFEM::FiberList< FiberPolicyT, TypeT, TimeManagerT >, and MoReFEM::FiberList< FiberNS::AtNodeOrAtQuadPt::at_node, ParameterNS::Type::scalar >.

◆ SupplWrite()

template<ParameterNS::Type TypeT, class LocalCoordsT , TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< ParameterNS::Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT = ParameterNS::TimeDependencyNS::None>
virtual void MoReFEM::Parameter< TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT >::SupplWrite ( std::ostream & stream) const
privatepure virtual

◆ SupplTimeUpdate() [1/2]

template<ParameterNS::Type TypeT, class LocalCoordsT , TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< ParameterNS::Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT = ParameterNS::TimeDependencyNS::None>
virtual void MoReFEM::Parameter< TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT >::SupplTimeUpdate ( )
privatepure virtual

◆ SupplTimeUpdate() [2/2]

template<ParameterNS::Type TypeT, class LocalCoordsT , TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< ParameterNS::Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT = ParameterNS::TimeDependencyNS::None>
virtual void MoReFEM::Parameter< TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT >::SupplTimeUpdate ( double time)
privatepure virtual

Add here any additional TimeUpdate that might be relevant.

For instance, if a Parameter depends on other parameters, you must make sure those are correctly updated, and possibly some internals might have to be recomputed.

One should prefer to use the default one if one wants to use the current time. Extra security to verify the synchro of the parameter to the current time is done in he default one. This method is for particular cases only when the user knows exactly what is he doing.

Parameters
[in]timeTime for the update.

Implemented in MoReFEM::ParameterNS::ThreeDimensionalCoumpoundParameter< TimeManagerT, TimeDependencyT >, MoReFEM::ParameterNS::GradientBasedElasticityTensor< TimeManagerT, ConfigurationT >, MoReFEM::ParameterNS::LameLambda< TimeManagerT >, MoReFEM::ParameterNS::LameMu< TimeManagerT >, MoReFEM::Internal::ParameterNS::ParameterInstance< TypeT, NaturePolicyT, TimeManagerT, TimeDependencyT, Args >, MoReFEM::FiberList< FiberPolicyT, TypeT, TimeManagerT >, and MoReFEM::FiberList< FiberNS::AtNodeOrAtQuadPt::at_node, ParameterNS::Type::scalar >.

Field Documentation

◆ time_dependency_

template<ParameterNS::Type TypeT, class LocalCoordsT , TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< ParameterNS::Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT = ParameterNS::TimeDependencyNS::None>
time_dependency_type::unique_ptr MoReFEM::Parameter< TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT >::time_dependency_ = nullptr
private

Object which handles if relevant the time dependency (computation of the time related factor, etc...).

May remain nullptr if the policy is there is no time dependency.


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