16 lower_(lower), upper_(upper), edges_(nodes-2) {
17 stepinv_ = (nodes-1)/(upper - lower);
21 Scalar
step()
const {
return 1./stepinv_;}
22 Scalar
lower()
const {
return lower_;}
23 Scalar
upper()
const {
return upper_;}
24 int nodes()
const {
return edges_+2;}
25 int cells()
const {
return edges_+1;}
27 Scalar
node(
int i)
const {
return i*
step() + lower();}
30 return i>=0 && i<=edges_;
36 f = modff((a-lower())*stepinv_, &b);
46 else if (ind>edges_) {
54 Scalar
b = (a-lower())/
step();
57 return tmp*
step()+lower();
62 int ind =
static_cast<int>((a-lower())/
step());
int index(Scalar a) const
returns valid index, or -1 if the value is outside range +/- one cell.
bool inRange(int i) const
Scalar closestNode(Scalar a) const
std::vector< std::vector< double > > tmp
void normalize(int &ind, Scalar &f) const
Grid1D(Scalar lower, Scalar upper, int nodes)
int index(Scalar a, Scalar &f) const