Celeritas
0.5.0-86+4a8eea4
|
Interact with a nonuniform grid of increasing values. More...
#include <NonuniformGrid.hh>
Public Types | |
Type aliases | |
using | value_type = T |
using | Storage = Collection< value_type, Ownership::const_reference, MemSpace::native > |
using | ItemRangeT = ItemRange< value_type > |
using | SpanConstT = typename Storage::SpanConstT |
Public Member Functions | |
CELER_FUNCTION | NonuniformGrid (ItemRangeT const &values, Storage const &storage) |
Construct with a range indexing into backend storage. | |
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 storage[result] <= value < data[result + 1]. More... | |
CELER_FORCEINLINE_FUNCTION ItemRangeT | offset () const |
Low-level access to offsets for downstream utilities. | |
CELER_FUNCTION SpanConstT | values () const |
Construct a span referring to the grid points. | |
Interact with a nonuniform grid of increasing values.
This should have the same interface (aside from constructor) as UniformGrid.
|
inline |
Find the value bin such that storage[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.