Commit 4a2213e4 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#873 Parameter: introduce the method ApplyTimeDependancyFactor() which will...

#873 Parameter: introduce the method ApplyTimeDependancyFactor() which will pave the way to the full computation of the time factor for all types of parameters.
parent 025749d0
......@@ -209,6 +209,10 @@ namespace HappyHeart
private:
return_type ApplyTimeDependancyFactor(return_type value_without_time_factor) const;
/*!
* \brief Returns the constant value (if the parameters is constant).
*
......
......@@ -56,10 +56,25 @@ namespace HappyHeart
{
assert(IsConstant() && "This method is relevant only for spatially constant parameters.");
return SupplGetConstantValue();
return ApplyTimeDependancyFactor(SupplGetConstantValue());
}
template
<
ParameterNS::Type TypeT,
template<ParameterNS::Type> class TimeDependencyT
>
typename Parameter<TypeT, TimeDependencyT>::return_type
Parameter<TypeT, TimeDependencyT>
::ApplyTimeDependancyFactor(typename Parameter<TypeT, TimeDependencyT>::return_type value_without_time) const
{
return value_without_time;
}
template
<
ParameterNS::Type TypeT,
......@@ -69,9 +84,10 @@ namespace HappyHeart
::GetValue(const QuadraturePoint& quad_pt, const GeometricElt& geom_elt) const
{
if (IsConstant())
return GetConstantValue();
return GetConstantValue(); // ApplyTimeDependancyFactor not called here because it is already applied within
// GetConstantValue().
return SupplGetValue(quad_pt, geom_elt);
return ApplyTimeDependancyFactor(SupplGetValue(quad_pt, geom_elt));
}
......
......@@ -79,6 +79,17 @@ namespace HappyHeart
///@}
/*!
* \brief Init the class before first use.
*
* It is here for instance that the local vectors or matrices (depending on \a TypeT) in which time
* factor have been correctly applied.
*
* \todo #873 NOT YET DONE!
*/
void Init();
/*!
* \brief Update the value of the time dependent factor.
*/
......@@ -132,6 +143,20 @@ namespace HappyHeart
*/
const FunctorT functor_;
private:
//! Alias to traits class related to TypeT.
using traits = Traits<TypeT>;
//! Alias to the return type.
using return_type = typename traits::return_type;
//! Alias to the type of the value actually stored.
using storage_type = std::decay_t<return_type>;
storage_type value_with_time_factor_;
};
......
......@@ -36,6 +36,16 @@ namespace HappyHeart
{ }
template
<
ParameterNS::Type TypeT,
class FunctorT
>
void Base<TypeT, FunctorT>::Init()
{
}
template
<
ParameterNS::Type TypeT,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment