#include <Grid1D.h>
Public Types | |
typedef float | Scalar |
Public Member Functions | |
int | cells () const |
Scalar | closestNode (Scalar a) const |
Grid1D (Scalar lower, Scalar upper, int nodes) | |
Grid1D () | |
int | index (Scalar a, Scalar &f) const |
int | index (Scalar a) const |
returns valid index, or -1 if the value is outside range +/- one cell. | |
bool | inRange (int i) const |
Scalar | lower () const |
Scalar | node (int i) const |
int | nodes () const |
void | normalize (int &ind, Scalar &f) const |
Scalar | step () const |
Scalar | upper () const |
Private Attributes | |
int | edges_ |
Scalar | lower_ |
Scalar | stepinv_ |
Scalar | upper_ |
typedef float Grid1D::Scalar |
int Grid1D::cells | ( | ) | const [inline] |
int Grid1D::index | ( | Scalar | a | ) | const [inline] |
returns valid index, or -1 if the value is outside range +/- one cell.
Definition at line 60 of file Grid1D.h.
References cells(), lower(), max(), min, and step().
{ int ind = static_cast<int>((a-lower())/step()); // FIXME: this causes an exception to be thrown later. Should be tested // more carefully before release // if (ind < -1 || ind > cells()) { // std::cout << "**** ind = " << ind << " cells: " << cells() << std::endl; // return -1; // } return std::max(0, std::min( cells()-1, ind)); }
Definition at line 33 of file Grid1D.h.
References b, lower(), and stepinv_.
Referenced by MFGrid3D::index(), LinearGridInterpolator3D::interpolate(), and RectangularCylindricalMFGrid::uncheckedValueInTesla().
bool Grid1D::inRange | ( | int | i | ) | const [inline] |
Scalar Grid1D::lower | ( | ) | const [inline] |
Definition at line 21 of file Grid1D.h.
References lower_.
Referenced by closestNode(), RectangularCylindricalMFGrid::dump(), RectangularCartesianMFGrid::dump(), TrapezoidalCartesianMFGrid::dump(), index(), node(), LinearGridInterpolator3D::throwGridInterpolator3DException(), TrapezoidalCartesianMFGrid::TrapezoidalCartesianMFGrid(), and RectangularCylindricalMFGrid::uncheckedValueInTesla().
{return lower_;}
Scalar Grid1D::node | ( | int | i | ) | const [inline] |
Definition at line 26 of file Grid1D.h.
References lower(), and step().
Referenced by Grid3D::dump(), LinearGridInterpolator3D::interpolate(), MFGrid3D::nodePosition(), and RectangularCylindricalMFGrid::uncheckedValueInTesla().
int Grid1D::nodes | ( | ) | const [inline] |
Definition at line 23 of file Grid1D.h.
References edges_.
Referenced by closestNode(), MFGrid3D::dimensions(), RectangularCylindricalMFGrid::dump(), Grid3D::dump(), TrapezoidalCartesianMFGrid::dump(), RectangularCartesianMFGrid::dump(), Grid3D::Grid3D(), and LinearGridInterpolator3D::interpolate().
{return edges_+2;}
void Grid1D::normalize | ( | int & | ind, |
Scalar & | f | ||
) | const [inline] |
Scalar Grid1D::step | ( | ) | const [inline] |
Definition at line 20 of file Grid1D.h.
References stepinv_.
Referenced by closestNode(), RectangularCylindricalMFGrid::dump(), TrapezoidalCartesianMFGrid::dump(), RectangularCartesianMFGrid::dump(), index(), node(), and RectangularCylindricalMFGrid::uncheckedValueInTesla().
{return 1./stepinv_;}
Scalar Grid1D::upper | ( | ) | const [inline] |
Definition at line 22 of file Grid1D.h.
References upper_.
Referenced by LinearGridInterpolator3D::throwGridInterpolator3DException(), and TrapezoidalCartesianMFGrid::TrapezoidalCartesianMFGrid().
{return upper_;}
int Grid1D::edges_ [private] |
Scalar Grid1D::lower_ [private] |
Scalar Grid1D::stepinv_ [private] |
Scalar Grid1D::upper_ [private] |