25#ifndef MATHUTILS_PIECEWISE_H
26#define MATHUTILS_PIECEWISE_H
31#include "ElementsKernel/Export.h"
61 auto knotsBegin =
m_knots.begin();
62 if (x < *knotsBegin) {
65 if (x == *knotsBegin) {
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.
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.
virtual ~Piecewise()=default
Default destructor.
Piecewise(std::vector< double > knots, std::vector< std::shared_ptr< Function > > functions)
double integrate(const double x1, const double x2) const override
double operator()(const double) const override
std::vector< std::unique_ptr< Function > > m_functions
A vector where the sub-functions are kept.
const std::vector< std::unique_ptr< Function > > & getFunctions() const
Returns the functions in the ranges between the knots.
std::unique_ptr< Function > clone() const override