|
Celeritas 0.7.0-dev.264+develop.12c52268
|
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 | |
| NonuniformGrid (ItemRangeT const &values, Storage const &storage) | |
| Construct with a range indexing into backend storage. | |
| size_type | size () const |
| Number of grid points. | |
| value_type | front () const |
| Minimum/first value. | |
| value_type | back () const |
| Maximum/last value. | |
| value_type | operator[] (size_type i) const |
| Get the value at the given grid point. | |
| size_type | find (value_type value) const |
| Find the value bin such that data[result] <= value < data[result + 1]. | |
| ItemRangeT | offset () const |
| Low-level access to offsets for downstream utilities. | |
| 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. The grid is closed on the lower bound and open on the upper, and the same treatment is used for coincident grid points: the higher of the points will be chosen.
|
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.