Cabana 0.8.0-dev
 
Loading...
Searching...
No Matches
Cabana::Grid::Experimental::SparseArrayLayout< DataTypes, EntityType, MeshType, SparseMapType > Class Template Reference

Entity layout for sparse array data on the local sparse mesh. More...

#include <Cabana_Grid_SparseArray.hpp>

Public Types

using mesh_type = MeshType
 Mesh Type, should be SparseMesh.
 
using scalar_type = typename mesh_type::scalar_type
 Scalar Type.
 
using entity_type = EntityType
 Entity Type.
 
using member_types = DataTypes
 Array member types, such as Cabana::MemberTypes<double, float[3]>
 
using sparse_map_type = SparseMapType
 Abbreviation for Sparse Map Type.
 
using value_type = typename sparse_map_type::value_type
 value type in sparse map, i.e., the tile ID (array ID) type
 
using key_type = typename sparse_map_type::key_type
 key type in sparse map, i.e., the tile key type
 
using memory_space = typename sparse_map_type::memory_space
 Memory space, the same memory space in sparse map.
 

Public Member Functions

 SparseArrayLayout (const std::shared_ptr< LocalGrid< MeshType > > &local_grid, SparseMapType &sparse_map, const float over_allocation)
 (Host) Constructor
 
SparseMapType & sparseMap ()
 get reference of sparse map
 
const std::shared_ptr< LocalGrid< MeshType > > localGrid () const
 Get the local grid over which this layout is defined.
 
uint64_t sizeCell () const
 array size in cell
 
uint64_t sizeTile () const
 array size in tile
 
uint64_t reservedCellSize (float factor) const
 array reservation size in cell
 
uint64_t arraySize () const
 Array size in cell (default size measurse: cell)
 
void clear ()
 clear valid info inside array layout; i.e. clear sparse map
 
template<class ExecSpace, class PositionSliceType>
void registerSparseMap (PositionSliceType &positions, const int particle_num, const int p2g_radius=1)
 Register valid grids in sparse map according to input particle positions.
 
KOKKOS_FORCEINLINE_FUNCTION value_type queryCell (const int cell_i, const int cell_j, const int cell_k) const
 (Device) Query the 1D cell ID from the 3D cell ijk
 
KOKKOS_FORCEINLINE_FUNCTION value_type queryTile (const int cell_i, const int cell_j, const int cell_k) const
 (Device) Query the 1D tile ID from the 3D tile ijk
 
KOKKOS_FORCEINLINE_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_FORCEINLINE_FUNCTION value_type queryTileFromTileKey (const key_type tile_key) const
 (Device) Query the 1D tile key from the 1D tile key
 
KOKKOS_FORCEINLINE_FUNCTION value_type cellLocalId (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 unsigned long long cell_bits_per_tile_dim
 
static constexpr unsigned long long cell_num_per_tile_dim
 cell number inside each tile per dimension
 
static constexpr std::size_t num_space_dim = sparse_map_type::rank
 dimension number
 

Detailed Description

template<class DataTypes, class EntityType, class MeshType, class SparseMapType>
class Cabana::Grid::Experimental::SparseArrayLayout< DataTypes, EntityType, MeshType, SparseMapType >

Entity layout for sparse array data on the local sparse mesh.

Template Parameters
DataTypesArray member types (Cabana::MemberTypes)
EntityTypeArray entity type: Cell, Node, Edge, or Face
MeshTypeMesh type: SparseMesh
SparseMapTypesparse map type

Constructor & Destructor Documentation

◆ SparseArrayLayout()

template<class DataTypes, class EntityType, class MeshType, class SparseMapType>
Cabana::Grid::Experimental::SparseArrayLayout< DataTypes, EntityType, MeshType, SparseMapType >::SparseArrayLayout ( const std::shared_ptr< LocalGrid< MeshType > > & local_grid,
SparseMapType & sparse_map,
const float over_allocation )
inline

(Host) Constructor

Parameters
local_gridShared pointer to local grid
sparse_mapReference to sparse map
over_allocationFactor to increase reserved size for Edge and Face entity

Member Function Documentation

◆ cellLocalId()

template<class DataTypes, class EntityType, class MeshType, class SparseMapType>
KOKKOS_FORCEINLINE_FUNCTION value_type Cabana::Grid::Experimental::SparseArrayLayout< DataTypes, EntityType, MeshType, SparseMapType >::cellLocalId ( const int cell_i,
const int cell_j,
const int cell_k ) const
inline

(Device) Get local cell ID from cell IJK

Parameters
cell_i,cell_j,cell_kCell ID in each dimension (both local and global IJK work)

◆ queryCell()

template<class DataTypes, class EntityType, class MeshType, class SparseMapType>
KOKKOS_FORCEINLINE_FUNCTION value_type Cabana::Grid::Experimental::SparseArrayLayout< DataTypes, EntityType, MeshType, SparseMapType >::queryCell ( const int cell_i,
const int cell_j,
const int cell_k ) const
inline

(Device) Query the 1D cell ID from the 3D cell ijk

Parameters
cell_i,cell_j,cell_kCell ID in each dimension

◆ queryTile()

template<class DataTypes, class EntityType, class MeshType, class SparseMapType>
KOKKOS_FORCEINLINE_FUNCTION value_type Cabana::Grid::Experimental::SparseArrayLayout< DataTypes, EntityType, MeshType, SparseMapType >::queryTile ( const int cell_i,
const int cell_j,
const int cell_k ) const
inline

(Device) Query the 1D tile ID from the 3D tile ijk

Parameters
cell_i,cell_j,cell_kCell ID in each dimension

◆ queryTileFromTileId()

template<class DataTypes, class EntityType, class MeshType, class SparseMapType>
KOKKOS_FORCEINLINE_FUNCTION value_type Cabana::Grid::Experimental::SparseArrayLayout< DataTypes, EntityType, MeshType, SparseMapType >::queryTileFromTileId ( const int tile_i,
const int tile_j,
const int tile_k ) const
inline

(Device) Query the 1D tile key from the 3D tile ijk

Parameters
tile_i,tile_j,tile_kTile ID in each dimension

◆ queryTileFromTileKey()

template<class DataTypes, class EntityType, class MeshType, class SparseMapType>
KOKKOS_FORCEINLINE_FUNCTION value_type Cabana::Grid::Experimental::SparseArrayLayout< DataTypes, EntityType, MeshType, SparseMapType >::queryTileFromTileKey ( const key_type tile_key) const
inline

(Device) Query the 1D tile key from the 1D tile key

Parameters
tile_key1D tile key

◆ registerSparseMap()

template<class DataTypes, class EntityType, class MeshType, class SparseMapType>
template<class ExecSpace, class PositionSliceType>
void Cabana::Grid::Experimental::SparseArrayLayout< DataTypes, EntityType, MeshType, SparseMapType >::registerSparseMap ( PositionSliceType & positions,
const int particle_num,
const int p2g_radius = 1 )
inline

Register valid grids in sparse map according to input particle positions.

Parameters
positionsInput particle positions.
particle_numNumber of valid particles inside positions
p2g_radiusThe half range of grids that will be influenced by each particle, depending on the interpolation kernel

◆ reservedCellSize()

template<class DataTypes, class EntityType, class MeshType, class SparseMapType>
uint64_t Cabana::Grid::Experimental::SparseArrayLayout< DataTypes, EntityType, MeshType, SparseMapType >::reservedCellSize ( float factor) const
inline

array reservation size in cell

Parameters
factorscale up the real size as reserved space

Member Data Documentation

◆ cell_bits_per_tile_dim

template<class DataTypes, class EntityType, class MeshType, class SparseMapType>
unsigned long long Cabana::Grid::Experimental::SparseArrayLayout< DataTypes, EntityType, MeshType, SparseMapType >::cell_bits_per_tile_dim
staticconstexpr
Initial value:
=
sparse_map_type::cell_bits_per_tile_dim

least bit number required to represent local cell ids inside a tile per dimension

◆ cell_num_per_tile_dim

template<class DataTypes, class EntityType, class MeshType, class SparseMapType>
unsigned long long Cabana::Grid::Experimental::SparseArrayLayout< DataTypes, EntityType, MeshType, SparseMapType >::cell_num_per_tile_dim
staticconstexpr
Initial value:
=
sparse_map_type::cell_num_per_tile_dim

cell number inside each tile per dimension


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