Chi-Tech
piecewise_linear_1D.h
Go to the documentation of this file.
1#ifndef CHITECH_CHI_MATH_FUNCTIONS_PIECEWISELINEAR1D_H
2#define CHITECH_CHI_MATH_FUNCTIONS_PIECEWISELINEAR1D_H
3
5
7{
9{
10public:
12
13 explicit PiecewiseLinear1D(const chi::InputParameters& params);
14
15 std::vector<double>
16 Evaluate(const std::vector<double>& values) const override;
17 std::vector<double>
18 EvaluateSlope(const std::vector<double>& values) const override;
19
20 double ScalarFunction1Parameter(double x) const override;
21 double ScalarFunctionSlope1Parameter(double x) const override;
22
23 bool HasSlope() const override {return true;}
24 bool HasCurvature() const override {return false;}
25private:
26 // Inputs
27 /**Independent variable values.*/
28 const std::vector<double> x_values_;
29 /**Dependent variable values.*/
30 const std::vector<double> y_values_;
31
32 std::vector<double> slopes_;
33
34 // Determined during construction
35 /**The number of items in the discrete function values*/
36 const size_t num_vals_;
37 /**Distance between independent variable values. Used for interpolation.*/
38 std::vector<double> delta_x_values_;
39};
40} // namespace chi_math::functions
41
42#endif // CHITECH_CHI_MATH_FUNCTIONS_PIECEWISELINEAR1D_H
static chi::InputParameters GetInputParameters()
double ScalarFunctionSlope1Parameter(double x) const override
std::vector< double > Evaluate(const std::vector< double > &values) const override
std::vector< double > EvaluateSlope(const std::vector< double > &values) const override
const std::vector< double > x_values_
PiecewiseLinear1D(const chi::InputParameters &params)
const std::vector< double > y_values_
double ScalarFunction1Parameter(double x) const override