Celeritas
0.5.0-86+4a8eea4
|
Interact with a uniform grid of increasing values. More...
#include <UniformGrid.hh>
Public Types | |
Type aliases | |
using | size_type = ::celeritas::size_type |
using | value_type = ::celeritas::real_type |
Public Member Functions | |
CELER_FUNCTION | UniformGrid (UniformGridData const &data) |
Construct with data. | |
CELER_FORCEINLINE_FUNCTION size_type | size () const |
Number of grid points. | |
CELER_FORCEINLINE_FUNCTION value_type | front () const |
Minimum/first value. | |
CELER_FORCEINLINE_FUNCTION value_type | back () const |
Maximum/last value. | |
CELER_FUNCTION value_type | operator[] (size_type i) const |
Get the value at the given grid point. | |
CELER_FUNCTION size_type | find (value_type value) const |
Find the value bin such that data[result] <= value < data[result + 1]. More... | |
CELER_FUNCTION UniformGridData const & | data () const |
Get the data used to construct this class. | |
Interact with a uniform grid of increasing values.
This simple class is used by physics vectors and classes that need to do lookups on a uniform grid.
|
inline |
Find the value bin such that data[result] <= value < data[result + 1].
The given value must be in range, because out-of-bounds values usually require different treatment (e.g. clipping to the boundary values rather than interpolating). It's easier to test the exceptional cases (final grid point) outside of the grid view.