Skip to content
Snippets Groups Projects
Commit c05f8161 authored by Christoph Lehmann's avatar Christoph Lehmann Committed by Dmitri Naumov
Browse files

[PL] renamed member

parent 6053dedc
No related branches found
No related tags found
No related merge requests found
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
#include <map> #include <map>
#include "MathLib/InterpolationAlgorithms/PiecewiseLinearInterpolation.h" #include "MathLib/InterpolationAlgorithms/PiecewiseLinearInterpolation.h"
#include "ProcessLib/Utils/ProcessUtils.h"
#include "Parameter.h" #include "Parameter.h"
#include "ProcessLib/Utils/ProcessUtils.h"
namespace ProcessLib namespace ProcessLib
{ {
...@@ -21,19 +21,20 @@ template <typename T> ...@@ -21,19 +21,20 @@ template <typename T>
struct CurveScaledParameter final : public Parameter<T> { struct CurveScaledParameter final : public Parameter<T> {
CurveScaledParameter(std::string const& name_, CurveScaledParameter(std::string const& name_,
MathLib::PiecewiseLinearInterpolation const& curve, MathLib::PiecewiseLinearInterpolation const& curve,
std::string const& parameter_name) std::string const& referenced_parameter_name)
: Parameter<T>(name_), _curve(curve), _parameter_name(parameter_name) : Parameter<T>(name_),
_curve(curve),
_referenced_parameter_name(referenced_parameter_name)
{ {
} }
bool isTimeDependent() const override { return true; } bool isTimeDependent() const override { return true; }
void initialize( void initialize(
std::vector< std::vector<std::unique_ptr<ProcessLib::ParameterBase>> const&
std::unique_ptr<ProcessLib::ParameterBase>> const& parameters) parameters) override
override
{ {
_parameter = &findParameter<T>(_parameter_name, parameters, 0); _parameter =
&findParameter<T>(_referenced_parameter_name, parameters, 0);
_cache.resize(_parameter->getNumberOfComponents()); _cache.resize(_parameter->getNumberOfComponents());
} }
...@@ -49,7 +50,7 @@ struct CurveScaledParameter final : public Parameter<T> { ...@@ -49,7 +50,7 @@ struct CurveScaledParameter final : public Parameter<T> {
auto const scaling = _curve.getValue(t); auto const scaling = _curve.getValue(t);
auto const num_comp = _parameter->getNumberOfComponents(); auto const num_comp = _parameter->getNumberOfComponents();
for (std::size_t c=0; c<num_comp; ++c) { for (std::size_t c = 0; c < num_comp; ++c) {
_cache[c] = scaling * tup[c]; _cache[c] = scaling * tup[c];
} }
return _cache; return _cache;
...@@ -59,7 +60,7 @@ private: ...@@ -59,7 +60,7 @@ private:
MathLib::PiecewiseLinearInterpolation const& _curve; MathLib::PiecewiseLinearInterpolation const& _curve;
Parameter<double> const* _parameter; Parameter<double> const* _parameter;
mutable std::vector<double> _cache; mutable std::vector<double> _cache;
std::string const _parameter_name; std::string const _referenced_parameter_name;
}; };
std::unique_ptr<ParameterBase> createCurveScaledParameter( std::unique_ptr<ParameterBase> createCurveScaledParameter(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment