Celeritas 0.7.0-dev.245+develop.a7be925e
Loading...
Searching...
No Matches
Public Member Functions | List of all members
celeritas::UniformGrid Class Reference

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

 UniformGrid (UniformGridData const &data)
 Construct with data.
 
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].
 
UniformGridData constdata () const
 Get the data used to construct this class.
 

Detailed Description

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.

Member Function Documentation

◆ find()

size_type celeritas::UniformGrid::find ( value_type  value) const
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.


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