#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::index | ( | Scalar | a | ) | const [inline] |
returns valid index, or -1 if the value is outside range +/- one cell.
Definition at line 61 of file Grid1D.h.
References max(), min, and launcher::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)); }
bool Grid1D::inRange | ( | int | i | ) | const [inline] |
Scalar Grid1D::lower | ( | ) | const [inline] |
Definition at line 22 of file Grid1D.h.
Referenced by RectangularCylindricalMFGrid::dump(), RectangularCartesianMFGrid::dump(), TrapezoidalCartesianMFGrid::dump(), LinearGridInterpolator3D::throwGridInterpolator3DException(), TrapezoidalCartesianMFGrid::TrapezoidalCartesianMFGrid(), and RectangularCylindricalMFGrid::uncheckedValueInTesla().
{return lower_;}
Scalar Grid1D::node | ( | int | i | ) | const [inline] |
Definition at line 27 of file Grid1D.h.
References launcher::step.
Referenced by Grid3D::dump(), LinearGridInterpolator3D::interpolate(), and RectangularCylindricalMFGrid::uncheckedValueInTesla().
int Grid1D::nodes | ( | ) | const [inline] |
Definition at line 24 of file Grid1D.h.
Referenced by RectangularCylindricalMFGrid::dump(), Grid3D::dump(), RectangularCartesianMFGrid::dump(), TrapezoidalCartesianMFGrid::dump(), and LinearGridInterpolator3D::interpolate().
{return edges_+2;}
void Grid1D::normalize | ( | int & | ind, |
Scalar & | f | ||
) | const [inline] |
Scalar Grid1D::step | ( | ) | const [inline] |
Definition at line 21 of file Grid1D.h.
Referenced by RectangularCylindricalMFGrid::dump(), RectangularCartesianMFGrid::dump(), TrapezoidalCartesianMFGrid::dump(), and RectangularCylindricalMFGrid::uncheckedValueInTesla().
{return 1./stepinv_;}
Scalar Grid1D::upper | ( | ) | const [inline] |
Definition at line 23 of file Grid1D.h.
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] |