OGS
Curve.cpp
Go to the documentation of this file.
1
11#include "Curve.h"
12
13namespace MaterialPropertyLib
14{
15Curve::Curve(std::string name,
16 Variable const independent_variable,
18 : independent_variable_(independent_variable), curve_(curve)
19{
20 name_ = std::move(name);
21}
22
24 ParameterLib::SpatialPosition const& /*pos*/,
25 double const /*t*/, double const /*dt*/) const
26{
27 auto const x = std::get<double>(variable_array[independent_variable_]);
28 return curve_.getValue(x);
29}
30
32 Variable const variable,
33 ParameterLib::SpatialPosition const& /*pos*/,
34 double const /*t*/, double const /*dt*/) const
35{
36 if (variable != independent_variable_)
37 {
38 return 0.0;
39 }
40
41 auto const x = std::get<double>(variable_array[independent_variable_]);
42 return curve_.getDerivative(x);
43}
44} // namespace MaterialPropertyLib
PropertyDataType dValue(VariableArray const &variable_array, Variable const variable, ParameterLib::SpatialPosition const &, double const, double const) const override
Definition Curve.cpp:31
MathLib::PiecewiseLinearInterpolation const & curve_
The curve used by the property.
Definition Curve.h:48
Variable const independent_variable_
The variable type that the curve property depends on.
Definition Curve.h:46
Curve(std::string name, Variable const independent_variable, MathLib::PiecewiseLinearInterpolation const &curve)
Definition Curve.cpp:15
virtual PropertyDataType value() const
Definition Property.cpp:76
double getDerivative(double const pnt_to_interpolate) const
Calculates derivative using quadratic interpolation and central difference quotient.
double getValue(double pnt_to_interpolate) const
Calculates the interpolation value.
std::variant< double, Eigen::Matrix< double, 2, 1 >, Eigen::Matrix< double, 3, 1 >, Eigen::Matrix< double, 2, 2 >, Eigen::Matrix< double, 3, 3 >, Eigen::Matrix< double, 4, 1 >, Eigen::Matrix< double, 6, 1 >, Eigen::MatrixXd > PropertyDataType
Definition Property.h:31