Celeritas  0.5.0-56+6b053cd
Classes | Functions
FindInterp.hh File Reference
#include "corecel/Assert.hh"
#include "corecel/Macros.hh"
#include "corecel/Types.hh"
This graph shows which files directly or indirectly include this file:

Classes

struct  celeritas::FindInterp< T >
 Result of finding a point on a grid for interpolating. More...
 

Functions

template<class Grid >
CELER_FUNCTION FindInterp< typename Grid::value_type > celeritas::find_interp (Grid const &grid, typename Grid::value_type value)
 Find the index of the value and its fraction between neighboring points. More...
 

Function Documentation

◆ find_interp()

template<class Grid >
CELER_FUNCTION FindInterp<typename Grid::value_type> celeritas::find_interp ( Grid const &  grid,
typename Grid::value_type  value 
)
inline

Find the index of the value and its fraction between neighboring points.

The grid class should have a floating point value and must have methods find, front, back, and operator[] .

The value must be bounded by the grid and less than the final value. The result will always have an index such that its neighbor to the right is a valid point on the grid, and the fraction between neghbors may be zero (in the case where the value is exactly on a grid point) but is always less than one.