MoReFEM
|
Abstract class used to define a Parameter. More...
#include <Parameter.hpp>
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 Domain & | GetDomain () const noexcept |
Returns the Domain upon which the parameter is defined. | |
const time_dependency_type & | GetTimeDependency () 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_type & | GetNonCstTimeDependency () 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 Domain & | domain_ |
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. | |
Parameter & | operator= (const Parameter &rhs)=delete |
The (copy) operator=. | |
Parameter & | operator= (Parameter &&rhs)=delete |
The (move) operator=. | |
Abstract class used to define a Parameter.
TypeT | Type 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. |
LocalCoordsT | This 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).
using MoReFEM::Parameter< TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT >::self = Parameter<TypeT, LocalCoordsT, TimeManagerT, TimeDependencyT> |
Alias to the type of the class.
|
explicitprotected |
Constructor.
[in] | name | Name that will appear in outputs. |
[in] | domain | Domain 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. |
T | Type 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).
|
delete |
The copy constructor.
[in] | rhs | The object from which the construction occurs. |
|
delete |
The move constructor.
[in] | rhs | The object from which the construction occurs. |
|
delete |
The (copy) operator=.
[in] | rhs | The object from which the affectation occurs. |
|
delete |
The (move) operator=.
[in] | rhs | The object from which the affectation occurs. |
|
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.
[in] | time | Time for the update. |
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.
[in] | time_dependency | Unique pointer to the time dependency object to set. |
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.
[in] | local_coords | Local object at which the Parameter is evaluated. |
[in] | geom_elt | GeometricElt inside which the value is computed. |
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).
|
pure virtual |
Enables to modify the constant value of a parameter.
[in] | value | Value to modify the constant value with. |
Implemented in MoReFEM::Internal::ParameterNS::ParameterInstance< TypeT, NaturePolicyT, TimeManagerT, TimeDependencyT, Args >, MoReFEM::ParameterNS::ThreeDimensionalCoumpoundParameter< TimeManagerT, TimeDependencyT >, MoReFEM::ParameterNS::GradientBasedElasticityTensor< TimeManagerT, ConfigurationT >, MoReFEM::ParameterNS::LameLambda< TimeManagerT >, and MoReFEM::ParameterNS::LameMu< TimeManagerT >.
|
pure virtual |
Whether the parameter varies spatially or not.
Implemented in MoReFEM::FiberList< FiberPolicyT, TypeT, TimeManagerT >, MoReFEM::FiberList< FiberNS::AtNodeOrAtQuadPt::at_node, ParameterNS::Type::scalar >, MoReFEM::ParameterNS::ThreeDimensionalCoumpoundParameter< TimeManagerT, TimeDependencyT >, MoReFEM::ParameterNS::GradientBasedElasticityTensor< TimeManagerT, ConfigurationT >, MoReFEM::ParameterNS::LameLambda< TimeManagerT >, MoReFEM::ParameterNS::LameMu< TimeManagerT >, and MoReFEM::Internal::ParameterNS::ParameterInstance< TypeT, NaturePolicyT, TimeManagerT, TimeDependencyT, Args >.
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.
[in,out] | stream | Stream upon which object information are written. |
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.
[in] | filename | Path 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. |
|
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...
|
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.
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 >.
|
privatepure virtual |
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.
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 >.
|
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.
[in] | geom_elt | GeometricElt inside which the value is computed. |
[in] | local_coords | Local 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 >.
|
privatepure virtual |
Write the content of the Parameter in a stream.
[in,out] | stream | Stream upon which object information are written. |
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 >.
|
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.
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 >.
|
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.
[in] | time | Time 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 >.
|
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.