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

#1050 Improve ScalarParameterFromFile by disabling entirely the time...

#1050 Improve ScalarParameterFromFile by disabling entirely the time dependency of the internal parameter, to avoid any ambiguity.
parent 12a04874
......@@ -159,6 +159,7 @@ namespace HappyHeart
GetScalarParameterY().TimeUpdate();
GetScalarParameterZ().TimeUpdate();
}
template
<
......
......@@ -86,6 +86,14 @@ namespace HappyHeart
//! Alias to the parent
using parent = Parameter<ParameterNS::Type::scalar, ParameterNS::TimeDependencyFromFile>;
//! Alias to internal parameter.
using internal_param_type =
Parameter
<
ParameterNS::Type::scalar,
ParameterNS::TimeDependencyNS::None
>;
public:
/// \name Special members.
......@@ -184,16 +192,16 @@ namespace HappyHeart
private:
//! Constant accessor to the internal parameter.
const parent& GetInternalParameter() const noexcept;
const internal_param_type& GetInternalParameter() const noexcept;
//! Non constant accessor to the internal parameter.
parent& GetNonCstInternalParameter() noexcept;
internal_param_type& GetNonCstInternalParameter() noexcept;
private:
//! Internal parameter which varies in time.
typename parent::unique_ptr internal_parameter_ = nullptr;
typename internal_param_type::unique_ptr internal_parameter_ = nullptr;
};
......
......@@ -28,12 +28,12 @@ namespace HappyHeart
<
ParameterNS::Type::scalar,
ParameterNS::Policy::Constant,
ParameterNS::TimeDependencyFromFile
ParameterNS::TimeDependencyNS::None
>;
internal_parameter_ = std::make_unique<parameter_type>(std::forward<T>(name),
domain,
1.);
domain,
1.);
auto time_dep = std::make_unique<ParameterNS::TimeDependencyFromFile<ParameterNS::Type::scalar>>(time_manager,
file);
......@@ -72,21 +72,20 @@ namespace HappyHeart
inline void ScalarParameterFromFile::SupplTimeUpdate()
{
GetNonCstInternalParameter().SupplTimeUpdate();
}
{ }
inline const ScalarParameterFromFile::parent& ScalarParameterFromFile::GetInternalParameter() const noexcept
inline const ScalarParameterFromFile::internal_param_type& ScalarParameterFromFile
::GetInternalParameter() const noexcept
{
assert(!(!internal_parameter_));
return *internal_parameter_;
}
inline ScalarParameterFromFile::parent& ScalarParameterFromFile::GetNonCstInternalParameter() noexcept
inline ScalarParameterFromFile::internal_param_type& ScalarParameterFromFile::GetNonCstInternalParameter() noexcept
{
return const_cast<parent&>(GetInternalParameter());
return const_cast<internal_param_type&>(GetInternalParameter());
}
......
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