37 #ifndef NUMERIC_INTERPOLATOR_LINEAR_H_
38 #define NUMERIC_INTERPOLATOR_LINEAR_H_
41 #include <AMReX_MultiFab.H>
49 namespace Interpolator
66 Linear(
const std::vector<T> _data_points,
const std::vector<Set::Scalar> _interval_points)
68 define(_data_points,_interval_points);
73 std::string str = a_str;
84 std::string str_time = splitstr[0];
85 std::string str_val = splitstr[1];
90 if (str_time_arr.size() != str_val_arr.size())
Util::Abort(
INFO,
"Mismatched number of time values vs array values while trying to parse ", str);
92 for (
unsigned int i = 0; i < str_time_arr.size(); i++)
106 void define(
const std::vector<T> _data_points,
const std::vector<Set::Scalar> _interval_points)
111 Util::Abort(
INFO,
"Data points and interval points have different sizes");
131 start = std::max(start,0);
176 for (
unsigned int i = 0; i < b.
data_points.size(); i++)
190 std::vector<Set::Scalar> theta, w;
192 while (std::getline(input, line))
194 theta.push_back(std::stof(dat[0]));
195 w.push_back(std::stof(dat[1]));
201 else if (derivative == 1)
203 std::vector<Set::Scalar> thetasmall, dw;
204 for (
unsigned int i = 1; i < theta.size() - 1; i++)
206 thetasmall.push_back(theta[i]);
207 dw.push_back((w[i + 1] - w[i - 1]) / (theta[i + 1] - theta[i - 1]));
211 else if (derivative == 2)
213 std::vector<Set::Scalar> thetasmall, ddw;
214 for (
unsigned int i = 1; i < theta.size() - 1; i++)
216 thetasmall.push_back(theta[i]);
217 ddw.push_back((w[i + 1] - 2.0 * w[i] + w[i - 1]) / ((theta[i + 1] - theta[i]) * (theta[i] - theta[i - 1])));