A container for storing items in a set of bins using "sparse" storage. More...
#include <AMReX_SparseBins.H>
Public Types | |
using | BinIteratorFactory = SparseBinIteratorFactory< T > |
using | bin_type = IntVect |
using | index_type = int |
using | const_pointer_type = std::conditional_t< IsParticleTileData< T >(), T, const T * > |
using | const_pointer_input_type = std::conditional_t< IsParticleTileData< T >(), const T &, const T * > |
Public Member Functions | |
template<typename N , typename F > | |
void | build (N nitems, const_pointer_input_type v, const Box &bx, F const &f) |
Populate the bins with a set of items. More... | |
Long | numItems () const noexcept |
the number of items in the container More... | |
Long | numBins () const noexcept |
the number of bins in the container More... | |
index_type * | permutationPtr () noexcept |
returns the pointer to the permutation array More... | |
index_type * | offsetsPtr () noexcept |
returns the pointer to the offsets array More... | |
index_type * | getNonZeroBinsPtr () noexcept |
returns the pointer to the array of non-zero bins More... | |
const index_type * | permutationPtr () const noexcept |
returns const pointer to the permutation array More... | |
const index_type * | offsetsPtr () const noexcept |
returns const pointer to the offsets array More... | |
const index_type * | getNonZeroBinsPtr () const noexcept |
returns the pointer to the array of non-zero bins More... | |
SparseBinIteratorFactory< T > | getBinIteratorFactory () const noexcept |
returns a GPU-capable object that can create iterators over the items in a bin. More... | |
Private Attributes | |
const_pointer_type | m_items |
Gpu::DeviceVector< index_type > | m_bins |
Gpu::DeviceVector< index_type > | m_offsets |
Gpu::DeviceVector< index_type > | m_perm |
A container for storing items in a set of bins using "sparse" storage.
The underlying data structure consists of three arrays. The first is a sorted array of bin numbers with a size equal to the number of non-zero bins. The second is an array of size nitems defining a permutation of the items in the container that puts them in bin-sorted order. Finally, there is an offsets array that stores, for each non-zero bin, the offsets into the permutation array where each bin starts.
The storage for the bins is "sparse" in the sense that users pass in a Box that defines the space over which the bins will be defined, and empty bins will still take up space.
The | type of items we hold |
using amrex::SparseBins< T >::bin_type = IntVect |
using amrex::SparseBins< T >::BinIteratorFactory = SparseBinIteratorFactory<T> |
using amrex::SparseBins< T >::const_pointer_input_type = std::conditional_t<IsParticleTileData<T>(), const T&, const T* > |
using amrex::SparseBins< T >::const_pointer_type = std::conditional_t<IsParticleTileData<T>(), T, const T* > |
using amrex::SparseBins< T >::index_type = int |
|
inline |
Populate the bins with a set of items.
N | the 'size' type that can enumerate all the items |
F | a function that maps items to IntVect bins |
nitems | the number of items to put in the bins |
v | pointer to the start of the items |
bx | the Box that defines the space over which the bins will be defined |
f | a function object that maps items to bins |
|
inlinenoexcept |
returns a GPU-capable object that can create iterators over the items in a bin.
|
inlinenoexcept |
returns the pointer to the array of non-zero bins
|
inlinenoexcept |
returns the pointer to the array of non-zero bins
|
inlinenoexcept |
the number of bins in the container
|
inlinenoexcept |
the number of items in the container
|
inlinenoexcept |
returns const pointer to the offsets array
|
inlinenoexcept |
returns the pointer to the offsets array
|
inlinenoexcept |
returns const pointer to the permutation array
|
inlinenoexcept |
returns the pointer to the permutation array
|
private |
|
private |
|
private |
|
private |