Sparse index space, with a hierarchical structure (cell->tile->block) More...
#include <Cabana_Grid_SparseIndexSpace.hpp>
Public Types | |
using | key_type = Key |
Tile hash key type. | |
using | value_type = Value |
Tile number type. | |
using | memory_space = MemorySpace |
memory space | |
Public Member Functions | |
SparseMap (const std::array< int, rank > size, const unsigned int pre_alloc_size) | |
(Host) Constructor | |
KOKKOS_INLINE_FUNCTION void | insertCell (int cell_i, int cell_j, int cell_k) const |
(Device) Insert a cell | |
KOKKOS_INLINE_FUNCTION void | insertTile (int tile_i, int tile_j, int tile_k) const |
(Device) Insert a tile (to hash table); Note that the tile ijk should be global | |
KOKKOS_INLINE_FUNCTION value_type | queryTile (int cell_i, int cell_j, int cell_k) const |
(Device) Query the 1D tile key from the 3D cell ijk | |
KOKKOS_INLINE_FUNCTION value_type | queryTileFromTileId (const int tile_i, const int tile_j, const int tile_k) const |
(Device) Query the 1D tile key from the 3D tile ijk | |
KOKKOS_INLINE_FUNCTION value_type | queryTileFromTileKey (const key_type tile_key) const |
(Device) Query the 1D tile key from the 1D tile key | |
KOKKOS_INLINE_FUNCTION value_type | queryCell (int cell_i, int cell_j, int cell_k) const |
(Device) Query the 1D cell key from the 3D cell ijk | |
void | clear () |
(Host) Clear tile hash table (required by unordered map clear()) | |
bool | reserve (const value_type capacity) |
(Host) Set new capacity lower bound on the unordered map | |
KOKKOS_INLINE_FUNCTION uint32_t | capacity () const |
(Host/Device) Require capacity of the index hash table | |
value_type | size () const |
(Host) Valid tile number inside current block (MPI rank) | |
value_type | sizeTile () const |
(Host) Valid tile number inside current block (MPI rank) | |
value_type | sizeCell () const |
(Host) Valid cell number inside current block (MPI rank) | |
template<typename T> | |
value_type | reservedTileSize (T factor) const |
(Host) Reserved tile number inside current block (MPI rank) | |
template<typename T> | |
value_type | reservedCellSize (T factor) const |
(Host) Reserved cell number inside current block (MPI rank) | |
KOKKOS_INLINE_FUNCTION bool | valid_at (uint32_t index) const |
(Device) Valid block at index | |
KOKKOS_INLINE_FUNCTION bool | isValidKey (key_type key) const |
(Device) Check if the tile key is valid. | |
KOKKOS_INLINE_FUNCTION key_type | key_at (uint32_t index) const |
(Device) Get block key at index | |
KOKKOS_INLINE_FUNCTION value_type | value_at (uint32_t index) const |
(Device) get tile id value at index | |
KOKKOS_INLINE_FUNCTION void | key2ijk (key_type &key, int &tile_i, int &tile_j, int &tile_k) const |
(Device) Transfer tile hash key to tile ijk | |
KOKKOS_INLINE_FUNCTION key_type | ijk2key (int tile_i, int tile_j, int tile_k) const |
(Device) Transfer tile ijk to til key | |
KOKKOS_INLINE_FUNCTION value_type | cell_local_id (const int cell_i, const int cell_j, const int cell_k) const |
(Device) Get local cell ID from cell IJK | |
Static Public Attributes | |
static constexpr int | rank = 3 |
Number of dimensions, 3 = ijk. | |
static constexpr unsigned long long | cell_bits_per_tile_dim |
Number of bits (per dimension) needed to index the cells inside a tile. | |
static constexpr unsigned long long | cell_num_per_tile_dim |
static constexpr unsigned long long | cell_mask_per_tile_dim |
static constexpr unsigned long long | cell_bits_per_tile |
Number of bits (total) needed to index the cells inside a tile. | |
static constexpr unsigned long long | cell_mask_per_tile |
Cell mask (combine all dimensions dimension) | |
static constexpr unsigned long long | cell_num_per_tile |
Number of cells (total) inside each tile. | |
static constexpr HashTypes | hash_type = Hash |
Hash table type. | |
Sparse index space, with a hierarchical structure (cell->tile->block)
MemorySpace | Memory space to store the Map(Hash Table) |
CellPerTileDim | Cell number inside each tile per dimension |
Hash | Hash type (lexicographical or morton) |
Key | Type of the tile/cell hash key |
Value | Type of the tile/cell No. |
|
inline |
(Host) Constructor
size | The size of the block (MPI rank) (Unit: cell) |
pre_alloc_size | Expected capacity of the allocator to store the tiles when tile nums exceed the capacity |
|
inline |
(Device) Get local cell ID from cell IJK
cell_i,cell_j,cell_k | Cell ID in each dimension (both local and global IJK work) |
|
inline |
(Device) Transfer tile ijk to til key
tile_i,tile_j,tile_k | Tile ID in each dimension |
|
inline |
(Device) Insert a cell
cell_i,cell_j,cell_k | Cell ID in each dimension |
Given a cell ijk, insert the tile where the cell reside in to hash table; Note that the ijk should be global
|
inline |
(Device) Insert a tile (to hash table); Note that the tile ijk should be global
tile_i,tile_j,tile_k | Tile ID in each dimension |
|
inline |
(Device) Check if the tile key is valid.
key | tile key to check |
|
inline |
(Device) Transfer tile hash key to tile ijk
key | Tile hash key |
tile_i,tile_j,tile_k | Tile ID in each dimension |
|
inline |
(Device) Get block key at index
index | index number in Kokkos unordered_map |
|
inline |
(Device) Query the 1D cell key from the 3D cell ijk
cell_i,cell_j,cell_k | Cell ID in each dimension |
|
inline |
(Device) Query the 1D tile key from the 3D cell ijk
cell_i,cell_j,cell_k | Cell ID in each dimension |
|
inline |
(Device) Query the 1D tile key from the 3D tile ijk
tile_i,tile_j,tile_k | Tile ID in each dimension |
|
inline |
(Device) Query the 1D tile key from the 1D tile key
tile_key | 1D tile key |
|
inline |
(Host) Set new capacity lower bound on the unordered map
capacity | New capacity lower bound |
|
inline |
(Host) Reserved cell number inside current block (MPI rank)
factor | scale up the real size as reserved space |
|
inline |
(Host) Reserved tile number inside current block (MPI rank)
factor | scale up the real size as reserved space |
|
inline |
(Device) Valid block at index
index | index number in Kokkos unordered_map |
|
inline |
(Device) get tile id value at index
index | index value in kokkos unordered map |
|
staticconstexpr |
Number of bits (total) needed to index the cells inside a tile.
|
staticconstexpr |
Number of bits (per dimension) needed to index the cells inside a tile.
|
staticconstexpr |
Cell mask (combine all dimensions dimension)
|
staticconstexpr |
Cell mask (per dimension), indicating which part of the tile address(binary bits) will index the cells inside each tile
|
staticconstexpr |
Number of cells (total) inside each tile.
|
staticconstexpr |
Number of cells inside each tile (per dimension), tile size reset to power of 2