25 #ifndef MATHUTILS_PIECEWISE_H
26 #define MATHUTILS_PIECEWISE_H
61 auto knotsBegin = m_knots.begin();
62 if (x < *knotsBegin) {
65 if (x == *knotsBegin) {
68 auto knotsEnd = m_knots.end();
70 return findX - knotsBegin;
115 double operator()(
const double)
const override;
132 double integrate(
const double x1,
const double x2)
const override;
Interface representing an integrable function.
Represents a piecewise function.
ssize_t findKnot(double x) const
PiecewiseBase(std::vector< double > knots)
virtual ~PiecewiseBase()=default
std::vector< double > m_knots
A vector where the knots are kept.
const std::vector< double > & getKnots() const
Returns the knots of the piecewise function.
Represents a piecewise function.
virtual ~Piecewise()=default
Default destructor.
std::vector< std::unique_ptr< Function > > m_functions
A vector where the sub-functions are kept.
ELEMENTS_API double integrate(const Function &function, const double min, const double max, std::unique_ptr< NumericalIntegrationScheme > numericalIntegrationScheme=nullptr)