MoReFEM
|
Template class that provides actual instantiation of a parameter. More...
#include <ParameterInstance.hpp>
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 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...). | |
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. | |
ParameterInstance & | operator= (const ParameterInstance &rhs)=delete |
The (copy) operator=. | |
ParameterInstance & | operator= (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_type & | GetNonCstTimeDependency () 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 Domain & | domain_ |
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...). | |
Template class that provides actual instantiation of 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. |
NaturePolicyT | Policy 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.). |
using MoReFEM::Internal::ParameterNS::ParameterInstance< TypeT, NaturePolicyT, TimeManagerT, TimeDependencyT, Args >::self = ParameterInstance<TypeT, NaturePolicyT, TimeManagerT, TimeDependencyT, Args...> |
Alias to the type of the class.
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).
|
explicit |
Constructor.
[in] | name | Name of the Parameter built. |
[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. |
[in] | arguments | Potential additional arguments required by specific Parameter. |
|
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. |
|
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.
[in] | geom_elt | GeometricElt inside which the value is computed. |
[in] | local_coords | Local object at which the Parameter is evaluated. |
|
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.
|
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.
|
overridevirtual |
Write the content of the Parameter in a stream.
[in,out] | stream | Stream upon which object information are written. |
|
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.
|
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.
[in] | time | Time for the update. |
|
overridevirtual |
Whether the parameter varies spatially or not.
|
overridevirtual |
Enables to modify the constant value of a parameter.
[in] | value | New value to set. |
|
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.
[in] | time | Time for the update. |
|
inherited |
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. |
|
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.
[in] | local_coords | Local object at which the Parameter is evaluated. |
[in] | geom_elt | GeometricElt inside which the value is computed. |
|
inherited |
Returns the constant value (if the parameter is constant).
If not constant, an assert is raised (in debug mode).
|
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.
[in,out] | stream | Stream upon which object information are written. |
|
inherited |
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. |
|
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...
|
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.