Celeritas  0.5.0-56+6b053cd
Public Member Functions | List of all members
celeritas::NonuniformGrid< T > Class Template Reference

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.
 

Detailed Description

template<class T>
class celeritas::NonuniformGrid< T >

Interact with a nonuniform grid of increasing values.

This should have the same interface (aside from constructor) as UniformGrid.

Member Function Documentation

◆ find()

template<class T >
CELER_FUNCTION size_type celeritas::NonuniformGrid< T >::find ( value_type  value) const
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.


The documentation for this class was generated from the following file: