MoReFEM
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
MoReFEM::Internal::ParameterNS::ParameterInstance< TypeT, NaturePolicyT, TimeManagerT, TimeDependencyT, Args > Class Template Referencefinal

Template class that provides actual instantiation of a parameter. More...

#include <ParameterInstance.hpp>

Inheritance diagram for MoReFEM::Internal::ParameterNS::ParameterInstance< TypeT, NaturePolicyT, TimeManagerT, TimeDependencyT, Args >:
Collaboration diagram for MoReFEM::Internal::ParameterNS::ParameterInstance< TypeT, NaturePolicyT, TimeManagerT, TimeDependencyT, Args >:

Public Types

using nature_policy = NaturePolicyT<TypeT, TimeManagerT, Args...>
 Alias to nature policy (constant, Lua function, etc...).
 
using self = ParameterInstance<TypeT, NaturePolicyT, TimeManagerT, TimeDependencyT, Args...>
 Alias to the type of the class.
 
using local_coords_type = typename nature_policy::local_coords_type
 Convenient alias to decide where a Parameter is computed.
 
using parent = Parameter<TypeT, local_coords_type, TimeManagerT, TimeDependencyT>
 Alias to base class.
 
using return_type = typename parent::return_type
 Alias to return type.
 
using value_type = typename parent::value_type
 Alias.
 
using traits = typename parent::traits
 Alias to traits of parent class.
 
using unique_ptr = std::unique_ptr<self>
 Alias to unique_ptr.
 
using const_unique_ptr = std::unique_ptr<const self>
 Alias to constant unique_ptr.
 
template<std::size_t N>
using array_unique_ptr = std::array<unique_ptr, N>
 Alias to array of unique_ptr.
 
using time_dependency_type
 Alias to time dependency.
 

Public Member Functions

return_type SupplGetValue (const local_coords_type &local_coords, const GeometricElt &geom_elt) const override
 Get the (spatially-only) value of the parameter at a given local position in a given geom_elt.
 
return_type SupplGetConstantValue () const override
 Returns the constant value (if the parameters is constant).
 
return_type SupplGetAnyValue () const override
 Returns a stored value (Any: the point is actually to assert its type for some functions overload).
 
void SupplWrite (std::ostream &stream) const override
 Write the content of the Parameter in a stream.
 
void SupplTimeUpdate () override
 Add here any additional TimeUpdate that might be relevant.
 
void SupplTimeUpdate (double time) override
 Add here any additional TimeUpdate that might be relevant.
 
bool IsConstant () const override
 Whether the parameter varies spatially or not.
 
void SetConstantValue (value_type value) override
 Enables to modify the constant value of a parameter.
 
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 NaturePolicyT< TypeT, TimeManagerT, Args... >::local_coords_type &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).
 
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...).
 
Special members.
template<class T , typename... ConstructorArgs>
 ParameterInstance (T &&name, const Domain &domain, ConstructorArgs &&... arguments)
 Constructor.
 
virtual ~ParameterInstance () override=default
 Destructor.
 
 ParameterInstance (const ParameterInstance &rhs)=delete
 The copy constructor.
 
 ParameterInstance (ParameterInstance &&rhs)=delete
 The move constructor.
 
ParameterInstanceoperator= (const ParameterInstance &rhs)=delete
 The (copy) operator=.
 
ParameterInstanceoperator= (ParameterInstance &&rhs)=delete
 The (move) operator=.
 

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

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_
 Object which handles if relevant the time dependency (computation of the time related factor, etc...).
 

Detailed Description

template<Type TypeT, template< Type, typename... Args > class NaturePolicyT, TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT, typename... Args>
class MoReFEM::Internal::ParameterNS::ParameterInstance< TypeT, NaturePolicyT, TimeManagerT, TimeDependencyT, Args >

Template class that provides actual instantiation of 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.
NaturePolicyTPolicy that determines how to handle the parameter. Policies are enclosed in ParameterNS::Policy namespace. Policies might be for instance Constant (same value everywhere), LuaFunction (value is provided by a function defined in the input data file; additional arguments are chosen here with the variadic template argument Args.).

Member Typedef Documentation

◆ self

template<Type TypeT, template< Type, typename... Args > class NaturePolicyT, TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT, typename... Args>
using MoReFEM::Internal::ParameterNS::ParameterInstance< TypeT, NaturePolicyT, TimeManagerT, TimeDependencyT, Args >::self = ParameterInstance<TypeT, NaturePolicyT, TimeManagerT, TimeDependencyT, Args...>

Alias to the type of the class.

◆ local_coords_type

template<Type TypeT, template< Type, typename... Args > class NaturePolicyT, TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT, typename... Args>
using MoReFEM::Internal::ParameterNS::ParameterInstance< TypeT, NaturePolicyT, TimeManagerT, TimeDependencyT, Args >::local_coords_type = typename nature_policy::local_coords_type

Convenient alias to decide where a Parameter is computed.

Parameters are by construct objects that are evaluated at a local position in a given GeometricElt. Depending on the exact type of the Parameter, the local position might be given by either a LocalCoords or a QuadraturePoint (the latter being a child of the former).

Constructor & Destructor Documentation

◆ ParameterInstance() [1/3]

template<Type TypeT, template< Type, typename... Args > class NaturePolicyT, TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT, typename... Args>
template<class T , typename... ConstructorArgs>
MoReFEM::Internal::ParameterNS::ParameterInstance< TypeT, NaturePolicyT, TimeManagerT, TimeDependencyT, Args >::ParameterInstance ( T && name,
const Domain & domain,
ConstructorArgs &&... arguments )
explicit

Constructor.

Parameters
[in]nameName of the Parameter built.
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.
[in]argumentsPotential additional arguments required by specific Parameter.

◆ ParameterInstance() [2/3]

template<Type TypeT, template< Type, typename... Args > class NaturePolicyT, TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT, typename... Args>
MoReFEM::Internal::ParameterNS::ParameterInstance< TypeT, NaturePolicyT, TimeManagerT, TimeDependencyT, Args >::ParameterInstance ( const ParameterInstance< TypeT, NaturePolicyT, TimeManagerT, TimeDependencyT, Args > & rhs)
delete

The copy constructor.

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

◆ ParameterInstance() [3/3]

template<Type TypeT, template< Type, typename... Args > class NaturePolicyT, TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT, typename... Args>
MoReFEM::Internal::ParameterNS::ParameterInstance< TypeT, NaturePolicyT, TimeManagerT, TimeDependencyT, Args >::ParameterInstance ( ParameterInstance< TypeT, NaturePolicyT, TimeManagerT, TimeDependencyT, Args > && rhs)
delete

The move constructor.

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

Member Function Documentation

◆ operator=() [1/2]

template<Type TypeT, template< Type, typename... Args > class NaturePolicyT, TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT, typename... Args>
ParameterInstance & MoReFEM::Internal::ParameterNS::ParameterInstance< TypeT, NaturePolicyT, TimeManagerT, TimeDependencyT, Args >::operator= ( const ParameterInstance< TypeT, NaturePolicyT, TimeManagerT, TimeDependencyT, Args > & 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<Type TypeT, template< Type, typename... Args > class NaturePolicyT, TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT, typename... Args>
ParameterInstance & MoReFEM::Internal::ParameterNS::ParameterInstance< TypeT, NaturePolicyT, TimeManagerT, TimeDependencyT, Args >::operator= ( ParameterInstance< TypeT, NaturePolicyT, TimeManagerT, TimeDependencyT, Args > && rhs)
delete

The (move) operator=.

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

◆ SupplGetValue()

template<Type TypeT, template< Type, typename... Args > class NaturePolicyT, TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT, typename... Args>
return_type MoReFEM::Internal::ParameterNS::ParameterInstance< TypeT, NaturePolicyT, TimeManagerT, TimeDependencyT, Args >::SupplGetValue ( const local_coords_type & local_coords,
const GeometricElt & geom_elt ) const
override

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.

◆ SupplGetConstantValue()

template<Type TypeT, template< Type, typename... Args > class NaturePolicyT, TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT, typename... Args>
return_type MoReFEM::Internal::ParameterNS::ParameterInstance< TypeT, NaturePolicyT, TimeManagerT, TimeDependencyT, Args >::SupplGetConstantValue ( ) const
overridevirtual

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.

Implements MoReFEM::Parameter< TypeT, NaturePolicyT< TypeT, TimeManagerT, Args... >::local_coords_type, TimeManagerT, TimeDependencyT >.

◆ SupplGetAnyValue()

template<Type TypeT, template< Type, typename... Args > class NaturePolicyT, TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT, typename... Args>
return_type MoReFEM::Internal::ParameterNS::ParameterInstance< TypeT, NaturePolicyT, TimeManagerT, TimeDependencyT, Args >::SupplGetAnyValue ( ) const
overridevirtual

Returns a stored value (Any: the point is actually to assert its type for some functions overload).

[internal] The point here is not the value itself, but the information that might be retrieved from it, such as number of rows and columns if TypeT == Type::matrix.

Returns
Any value of the relevant type for the Parameter.

Implements MoReFEM::Parameter< TypeT, NaturePolicyT< TypeT, TimeManagerT, Args... >::local_coords_type, TimeManagerT, TimeDependencyT >.

◆ SupplWrite()

template<Type TypeT, template< Type, typename... Args > class NaturePolicyT, TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT, typename... Args>
void MoReFEM::Internal::ParameterNS::ParameterInstance< TypeT, NaturePolicyT, TimeManagerT, TimeDependencyT, Args >::SupplWrite ( std::ostream & stream) const
overridevirtual

Write the content of the Parameter in a stream.

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

Implements MoReFEM::Parameter< TypeT, NaturePolicyT< TypeT, TimeManagerT, Args... >::local_coords_type, TimeManagerT, TimeDependencyT >.

◆ SupplTimeUpdate() [1/2]

template<Type TypeT, template< Type, typename... Args > class NaturePolicyT, TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT, typename... Args>
void MoReFEM::Internal::ParameterNS::ParameterInstance< TypeT, NaturePolicyT, TimeManagerT, TimeDependencyT, Args >::SupplTimeUpdate ( )
overridevirtual

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.

Implements MoReFEM::Parameter< TypeT, NaturePolicyT< TypeT, TimeManagerT, Args... >::local_coords_type, TimeManagerT, TimeDependencyT >.

◆ SupplTimeUpdate() [2/2]

template<Type TypeT, template< Type, typename... Args > class NaturePolicyT, TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT, typename... Args>
void MoReFEM::Internal::ParameterNS::ParameterInstance< TypeT, NaturePolicyT, TimeManagerT, TimeDependencyT, Args >::SupplTimeUpdate ( double time)
overridevirtual

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.

Implements MoReFEM::Parameter< TypeT, NaturePolicyT< TypeT, TimeManagerT, Args... >::local_coords_type, TimeManagerT, TimeDependencyT >.

◆ IsConstant()

template<Type TypeT, template< Type, typename... Args > class NaturePolicyT, TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT, typename... Args>
bool MoReFEM::Internal::ParameterNS::ParameterInstance< TypeT, NaturePolicyT, TimeManagerT, TimeDependencyT, Args >::IsConstant ( ) const
overridevirtual

◆ SetConstantValue()

template<Type TypeT, template< Type, typename... Args > class NaturePolicyT, TIME_MANAGER_TEMPLATE_KEYWORD TimeManagerT, template< Type, TIME_MANAGER_TEMPLATE_KEYWORD > class TimeDependencyT, typename... Args>
void MoReFEM::Internal::ParameterNS::ParameterInstance< TypeT, NaturePolicyT, TimeManagerT, TimeDependencyT, Args >::SetConstantValue ( value_type value)
overridevirtual

Enables to modify the constant value of a parameter.

Parameters
[in]valueNew value to set.

Implements MoReFEM::Parameter< TypeT, NaturePolicyT< TypeT, TimeManagerT, Args... >::local_coords_type, TimeManagerT, TimeDependencyT >.

◆ TimeUpdate()

virtual void MoReFEM::Parameter< TypeT, NaturePolicyT< TypeT, TimeManagerT, Args... >::local_coords_type , TimeManagerT, TimeDependencyT >::TimeUpdate ( double time)
virtualinherited

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()

void MoReFEM::Parameter< TypeT, NaturePolicyT< TypeT, TimeManagerT, Args... >::local_coords_type , TimeManagerT, TimeDependencyT >::SetTimeDependency ( typename time_dependency_type::unique_ptr && time_dependency)
inherited

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()

return_type MoReFEM::Parameter< TypeT, NaturePolicyT< TypeT, TimeManagerT, Args... >::local_coords_type , TimeManagerT, TimeDependencyT >::GetValue ( const NaturePolicyT< TypeT, TimeManagerT, Args... >::local_coords_type & local_coords,
const GeometricElt & geom_elt ) const
inherited

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()

return_type MoReFEM::Parameter< TypeT, NaturePolicyT< TypeT, TimeManagerT, Args... >::local_coords_type , TimeManagerT, TimeDependencyT >::GetConstantValue ( ) const
inherited

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.

◆ Write() [1/2]

void MoReFEM::Parameter< TypeT, NaturePolicyT< TypeT, TimeManagerT, Args... >::local_coords_type , TimeManagerT, TimeDependencyT >::Write ( std::ostream & stream) const
inherited

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]

void MoReFEM::Parameter< TypeT, NaturePolicyT< TypeT, TimeManagerT, Args... >::local_coords_type , TimeManagerT, TimeDependencyT >::Write ( const FilesystemNS::File & filename) const
inherited

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()

const time_dependency_type & MoReFEM::Parameter< TypeT, NaturePolicyT< TypeT, TimeManagerT, Args... >::local_coords_type , TimeManagerT, TimeDependencyT >::GetTimeDependency ( ) const
noexceptinherited

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.

Field Documentation

◆ time_dependency_

time_dependency_type::unique_ptr MoReFEM::Parameter< TypeT, NaturePolicyT< TypeT, TimeManagerT, Args... >::local_coords_type , TimeManagerT, TimeDependencyT >::time_dependency_
privateinherited

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: