3#ifndef _MONOTCUBICINTERPOLATOR_H
4#define _MONOTCUBICINTERPOLATOR_H
76 if (!
read(datafilename)) {
77 throw(
"Unable to constuct MonotCubicInterpolator from file.") ;
97 if (!
read(std::string(datafilename))) {
98 throw(
"Unable to constuct MonotCubicInterpolator from file.") ;
113 if (!
read(std::string(datafilename),xColumn,fColumn)) {
114 throw(
"Unable to constuct MonotCubicInterpolator from file.") ;
128 if (!
read(datafilename,xColumn,fColumn)) {
129 throw(
"Unable to constuct MonotCubicInterpolator from file.") ;
142 const std::vector<double> & f);
167 bool read(
const std::string & datafilename) {
168 return read(datafilename,1,2) ;
179 bool read(
const std::string & datafilename,
int xColumn,
int fColumn) ;
228 double evaluate(
double x,
double & errorestimate_output )
const ;
238 return *data.begin();
249 return *data.rbegin();
305 if (strictlyMonotoneCached) {
306 return strictlyMonotone;
309 computeInternalFunctionData();
310 return strictlyMonotone;
320 if (monotoneCached) {
324 computeInternalFunctionData();
338 if (strictlyMonotoneCached) {
339 return (strictlyMonotone && strictlyIncreasing);
342 computeInternalFunctionData();
343 return (strictlyMonotone && strictlyIncreasing);
353 if (monotoneCached) {
354 return (monotone && increasing);
357 computeInternalFunctionData();
358 return (monotone && increasing);
371 if (strictlyMonotoneCached) {
372 return (strictlyMonotone && strictlyDecreasing);
375 computeInternalFunctionData();
376 return (strictlyMonotone && strictlyDecreasing);
386 if (monotoneCached) {
387 return (monotone && decreasing);
390 computeInternalFunctionData();
391 return (monotone && decreasing);
410 void addPair(
double newx,
double newf);
498 std::map<double, double> data{};
501 mutable std::map<double, double> ddata{};
508 mutable bool strictlyMonotoneCached{
false};
509 mutable bool monotoneCached{
false};
511 mutable bool strictlyMonotone{
false};
512 mutable bool monotone{
false};
515 mutable bool strictlyDecreasing{
false};
516 mutable bool strictlyIncreasing{
false};
517 mutable bool decreasing{
false};
518 mutable bool increasing{
false};
526 double H00(
double t)
const {
527 return 2*t*t*t - 3*t*t + 1;
529 double H10(
double t)
const {
530 return t*t*t - 2*t*t + t;
532 double H01(
double t)
const {
533 return -2*t*t*t + 3*t*t;
535 double H11(
double t)
const {
540 void computeInternalFunctionData()
const ;
549 void computeSimpleDerivatives()
const ;
558 void adjustDerivativesForMonotoneness()
const ;
569 bool isMonotoneCoeff(
double alpha,
double beta)
const {
570 if ((alpha*alpha + beta*beta) <= 9) {
Class to represent a one-dimensional function f with single-valued argument x.
Definition MonotCubicInterpolator.hpp:62
double evaluate(double x, double &errorestimate_output) const
bool isStrictlyDecreasing()
Determines if the current function-value-data is strictly decreasing.
Definition MonotCubicInterpolator.hpp:368
bool read(const std::string &datafilename)
Definition MonotCubicInterpolator.hpp:167
std::string toString() const
Constructs a string containing the data in a table.
Definition MonotCubicInterpolator.cpp:271
std::vector< double > get_fVector() const
Provide a copy of tghe function data as a vector.
Definition MonotCubicInterpolator.cpp:258
std::pair< double, double > getMinimumX() const
Minimum x-value, returns both x and f in a pair.
Definition MonotCubicInterpolator.hpp:236
std::pair< double, double > getMaximumX() const
Maximum x-value, returns both x and f in a pair.
Definition MonotCubicInterpolator.hpp:247
bool isStrictlyMonotone()
Determines if the current function-value-data is strictly monotone.
Definition MonotCubicInterpolator.hpp:302
std::vector< double > get_xVector() const
Provide a copy of the x-data as a vector.
Definition MonotCubicInterpolator.cpp:246
int getSize() const
Definition MonotCubicInterpolator.hpp:436
void addPair(double newx, double newf)
Definition MonotCubicInterpolator.cpp:169
std::pair< double, double > getMissingX() const
Returns an x-value that is believed to yield the best improvement in global accuracy for the interpol...
Definition MonotCubicInterpolator.cpp:298
MonotCubicInterpolator(const std::string &datafilename)
Definition MonotCubicInterpolator.hpp:74
bool isMonotoneDecreasing() const
Determines if the current function-value-data is monotone and decreasing.
Definition MonotCubicInterpolator.hpp:385
std::pair< double, double > getMaximumF() const
Maximum f-value, returns both x and f in a pair.
Definition MonotCubicInterpolator.cpp:332
MonotCubicInterpolator(const char *datafilename, int xColumn, int fColumn)
Definition MonotCubicInterpolator.hpp:111
MonotCubicInterpolator()
No input, an empty function object is created.
Definition MonotCubicInterpolator.hpp:150
MonotCubicInterpolator(const char *datafilename)
Definition MonotCubicInterpolator.hpp:95
void shrinkFlatAreas()
Wrapper function for shrinkFlatAreas(const double) providing a default epsilon parameter.
Definition MonotCubicInterpolator.hpp:489
bool isMonotoneIncreasing() const
Determines if the current function-value-data is monotone and increasing.
Definition MonotCubicInterpolator.hpp:352
void scaleData(double factor)
Definition MonotCubicInterpolator.cpp:709
bool isStrictlyIncreasing()
Determines if the current function-value-data is strictly increasing.
Definition MonotCubicInterpolator.hpp:335
double operator()(double x) const
Definition MonotCubicInterpolator.hpp:194
double evaluate(double x) const
Definition MonotCubicInterpolator.cpp:184
std::pair< double, double > getMinimumF() const
Minimum f-value, returns both x and f in a pair.
Definition MonotCubicInterpolator.cpp:355
MonotCubicInterpolator(const std::string &datafilename, int xColumn, int fColumn)
Definition MonotCubicInterpolator.hpp:126
bool isMonotone() const
Determines if the current function-value-data is monotone.
Definition MonotCubicInterpolator.hpp:319
void chopFlatEndpoints()
Wrapper function for chopFlatEndpoints(const double) providing a default epsilon parameter.
Definition MonotCubicInterpolator.hpp:465
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30