From a498a836cef8f9c3db74f0c74b78705907282112 Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Wed, 19 Jul 2017 19:03:22 +0200 Subject: [PATCH] Tabulated functions: method to change interpolation type --- lib/TabFunction.cpp | 23 +++++------------------ lib/TabFunction.hpp | 7 +------ 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/lib/TabFunction.cpp b/lib/TabFunction.cpp index 84af9c7..da5685b 100644 --- a/lib/TabFunction.cpp +++ b/lib/TabFunction.cpp @@ -29,18 +29,11 @@ using namespace Latan; // constructors //////////////////////////////////////////////////////////////// TabFunction::TabFunction(const DVec &x, const DVec &y, const InterpType interpType) -: interpType_(interpType) { setData(x, y); + setInterpolationType(interpType); } -//TabFunction::TabFunction(const XYStatData &data, const Index i, const Index j, -// const InterpType interpType) -//: interpType_(interpType) -//{ -// setData(data, i, j); -//} - // access ////////////////////////////////////////////////////////////////////// void TabFunction::setData(const DVec &x, const DVec &y) { @@ -54,10 +47,10 @@ void TabFunction::setData(const DVec &x, const DVec &y) } } -//void TabFunction::setData(const XYStatData &data, const Index i, const Index j) -//{ -// setData(data.x(i), data.y(j)); -//} +void TabFunction::setInterpolationType(const InterpType interpType) +{ + interpType_ = interpType; +} // function call /////////////////////////////////////////////////////////////// double TabFunction::operator()(const double *arg) const @@ -154,12 +147,6 @@ DoubleFunction Latan::interpolate(const DVec &x, const DVec &y, return TabFunction(x, y, interpType).makeFunction(); } -//DoubleFunction Latan::interpolate(const XYStatData &data, const Index i, -// const Index j, const InterpType interpType) -//{ -// return TabFunction(data, i, j, interpType).makeFunction(); -//} - map::const_iterator TabFunction::nearest(const double x) const { map::const_iterator ret; diff --git a/lib/TabFunction.hpp b/lib/TabFunction.hpp index 4df8f45..d285dd6 100644 --- a/lib/TabFunction.hpp +++ b/lib/TabFunction.hpp @@ -45,13 +45,11 @@ public: TabFunction(void) = default; TabFunction(const DVec &x, const DVec &y, const InterpType interpType = InterpType::LINEAR); - //TabFunction(const XYStatData &data, const Index i = 0, const Index j = 0, - // const InterpType interpType = InterpType::LINEAR); // destructor virtual ~TabFunction(void) = default; // access void setData(const DVec &x, const DVec &y); - // void setData(const XYStatData &data, const Index i = 0, const Index j = 0); + void setInterpolationType(const InterpType interpType); // function call double operator()(const double *arg) const; // factory @@ -65,9 +63,6 @@ private: DoubleFunction interpolate(const DVec &x, const DVec &y, const InterpType interpType = InterpType::LINEAR); -//DoubleFunction interpolate(const XYStatData &data, const Index i = 0, -// const Index j = 0, -// const InterpType interpType = InterpType::LINEAR); END_LATAN_NAMESPACE