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;
509 mutable bool strictlyMonotoneCached;
510 mutable bool monotoneCached;
512 mutable bool strictlyMonotone;
513 mutable bool monotone;
516 mutable bool strictlyDecreasing;
517 mutable bool strictlyIncreasing;
518 mutable bool decreasing;
519 mutable bool increasing;
527 double H00(
double t)
const {
528 return 2*t*t*t - 3*t*t + 1;
530 double H10(
double t)
const {
531 return t*t*t - 2*t*t + t;
533 double H01(
double t)
const {
534 return -2*t*t*t + 3*t*t;
536 double H11(
double t)
const {
541 void computeInternalFunctionData()
const ;
550 void computeSimpleDerivatives()
const ;
559 void adjustDerivativesForMonotoneness()
const ;
570 bool isMonotoneCoeff(
double alpha,
double beta)
const {
571 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:277
std::vector< double > get_fVector() const
Provide a copy of tghe function data as a vector.
Definition MonotCubicInterpolator.cpp:260
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:245
int getSize() const
Definition MonotCubicInterpolator.hpp:436
void addPair(double newx, double newf)
Definition MonotCubicInterpolator.cpp:168
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:304
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:338
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:715
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:183
std::pair< double, double > getMinimumF() const
Minimum f-value, returns both x and f in a pair.
Definition MonotCubicInterpolator.cpp:361
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