Commit fdcf73b7 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#873 Parameter: introduce local storage of time dependency to pave the way for...

#873 Parameter: introduce local storage of time dependency to pave the way for vector and matrix support.
parent 18e1a179
......@@ -27,8 +27,11 @@ namespace HappyHeart
{
double ApplyTimeFactor(double value_without_time_factor, double time_factor)
double ApplyTimeFactor(double value_without_time_factor,
double unused,
double time_factor)
{
static_cast<void>(unused);
return value_without_time_factor * time_factor;
}
......
......@@ -31,7 +31,9 @@ namespace HappyHeart
{
double ApplyTimeFactor(double value_without_time_factor, double time_factor);
double ApplyTimeFactor(double value_without_time_factor,
double unused,
double time_factor);
......
......@@ -131,6 +131,20 @@ namespace HappyHeart
*/
void UpdateNtimesModifiedAtLastUpdate();
/*!
* \brief Non constant accessor to the mutable object used to contain the value with the time factor
* currently applied.
*
* This is handy for local matrices and vectors not to reallocate each time a brand
* new object.
*
* The method is marked const as it acts solely upon a mutable data attribute.
*/
storage_type& GetNonCstValueWithTimeFactor() const noexcept;
private:
/*!
......@@ -159,6 +173,10 @@ namespace HappyHeart
private:
/*!
* \brief Mutable object used to contain the value with the time factor currently applied. This is
* handy for local matrices and vectors not to reallocate each time a brand new object.
*/
mutable storage_type value_with_time_factor_;
};
......
......@@ -55,8 +55,9 @@ namespace HappyHeart
typename Base<TypeT, FunctorT>::return_type Base<TypeT, FunctorT>
::ApplyTimeFactor(return_type value_without_time_factor) const
{
std::cout << "ADD CHANGES" << std::endl;
return Private::ApplyTimeFactor(value_without_time_factor, GetCurrentTimeFactor());
return Private::ApplyTimeFactor(value_without_time_factor,
GetNonCstValueWithTimeFactor(),
GetCurrentTimeFactor());
}
......@@ -121,6 +122,18 @@ namespace HappyHeart
}
template
<
ParameterNS::Type TypeT,
class FunctorT
>
inline typename Base<TypeT, FunctorT>::storage_type& Base<TypeT, FunctorT>
::GetNonCstValueWithTimeFactor() const noexcept
{
return value_with_time_factor_;
}
} // namespace TimeDependencyNS
......
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