16#ifndef CABANA_GRID_LOCALGRID_SPARSE_HPP
17#define CABANA_GRID_LOCALGRID_SPARSE_HPP
34template <
class MeshType>
43template <
class Scalar, std::
size_t NumSpaceDim>
63 const int halo_cell_width,
const long cell_num_per_tile_dim );
94 int neighborRank(
const std::array<int, num_space_dim>& off_ijk )
const;
106 int neighborRank(
const int off_i,
const int off_j,
const int off_k )
const;
117 template <
class DecompositionTag,
class EntityType,
class IndexType>
119 IndexType t3 )
const;
133 template <
unsigned long long cellBitsPerTileDim,
class DecompositionTag,
137 const std::array<int, num_space_dim>& off_ijk,
138 const int halo_width = -1 )
const;
155 template <
unsigned long long cellBitsPerTileDim,
class DecompositionTag,
157 std::enable_if_t<3 == NSD, TileIndexSpace<3, cellBitsPerTileDim>>
159 const int off_j,
const int off_k,
160 const int halo_width = -1 )
const;
164 template <
class DecompositionTag,
class IndexType>
166 IndexType t3 )
const;
168 template <
unsigned long long cellBitsPerTileDim,
class DecompositionTag>
170 sharedTileIndexSpaceImpl( DecompositionTag t1,
Node,
171 const std::array<int, num_space_dim>& off_ijk,
172 const int halo_width )
const;
175 template <
class DecompositionTag,
class IndexType>
177 IndexType t3 )
const;
179 template <
unsigned long long cellBitsPerTileDim,
class DecompositionTag>
181 sharedTileIndexSpaceImpl( DecompositionTag t1,
Cell,
182 const std::array<int, num_space_dim>& off_ijk,
183 const int halo_width )
const;
186 template <
class DecompositionTag,
class IndexType>
188 IndexType t3 )
const;
189 template <
class DecompositionTag,
class IndexType>
191 IndexType t3 )
const;
192 template <
class DecompositionTag,
class IndexType>
194 IndexType t3 )
const;
196 template <
unsigned long long cellBitsPerTileDim,
class DecompositionTag>
198 sharedTileIndexSpaceImpl( DecompositionTag t1,
Face<Dim::I>,
199 const std::array<int, num_space_dim>& off_ijk,
200 const int halo_width )
const;
201 template <
unsigned long long cellBitsPerTileDim,
class DecompositionTag>
203 sharedTileIndexSpaceImpl( DecompositionTag t1,
Face<Dim::J>,
204 const std::array<int, num_space_dim>& off_ijk,
205 const int halo_width )
const;
206 template <
unsigned long long cellBitsPerTileDim,
class DecompositionTag>
208 sharedTileIndexSpaceImpl( DecompositionTag t1,
Face<Dim::K>,
209 const std::array<int, num_space_dim>& off_ijk,
210 const int halo_width )
const;
213 template <
class DecompositionTag,
class IndexType>
215 IndexType t3 )
const;
216 template <
class DecompositionTag,
class IndexType>
218 IndexType t3 )
const;
219 template <
class DecompositionTag,
class IndexType>
221 IndexType t3 )
const;
223 template <
unsigned long long cellBitsPerTileDim,
class DecompositionTag>
225 sharedTileIndexSpaceImpl( DecompositionTag t1,
Edge<Dim::I>,
226 const std::array<int, num_space_dim>& off_ijk,
227 const int halo_width )
const;
228 template <
unsigned long long cellBitsPerTileDim,
class DecompositionTag>
230 sharedTileIndexSpaceImpl( DecompositionTag t1,
Edge<Dim::J>,
231 const std::array<int, num_space_dim>& off_ijk,
232 const int halo_width )
const;
233 template <
unsigned long long cellBitsPerTileDim,
class DecompositionTag>
235 sharedTileIndexSpaceImpl( DecompositionTag t1,
Edge<Dim::K>,
236 const std::array<int, num_space_dim>& off_ijk,
237 const int halo_width )
const;
247 template <
unsigned long long cellBitsPerTileDim>
249 sharedTileIndexSpaceImpl(
Own,
250 const std::array<int, num_space_dim>& off_ijk,
251 const int halo_width )
const;
252 template <
unsigned long long cellBitsPerTileDim>
254 sharedTileIndexSpaceImpl(
Ghost,
255 const std::array<int, num_space_dim>& off_ijk,
256 const int halo_width )
const;
259 std::shared_ptr<GlobalGrid<mesh_type>> _global_grid;
260 int _halo_cell_width;
261 const long _cell_num_per_tile_dim;
278template <
class MeshType>
279std::shared_ptr<LocalGrid<MeshType>>
281 const int halo_cell_width,
282 const int cell_num_per_tile_dim )
285 "createSparseLocalGrid supports only SparseMesh" );
286 return std::make_shared<LocalGrid<MeshType>>( global_grid, halo_cell_width,
287 cell_num_per_tile_dim );
299#include <Cabana_Grid_SparseLocalGrid_impl.hpp>
std::shared_ptr< LocalGrid< MeshType > > createSparseLocalGrid(const std::shared_ptr< GlobalGrid< MeshType > > &global_grid, const int halo_cell_width, const int cell_num_per_tile_dim)
Create a local grid.
Definition Cabana_Grid_SparseLocalGrid.hpp:280
std::enable_if_t< 3==NSD, TileIndexSpace< 3, cellBitsPerTileDim > > sharedTileIndexSpace(DecompositionTag t1, EntityType t2, const int off_i, const int off_j, const int off_k, const int halo_width=-1) const
Given the relative offsets of a neighbor rank, get the set of global entity indices shared with that ...
TileIndexSpace< num_space_dim, cellBitsPerTileDim > sharedTileIndexSpace(DecompositionTag t1, EntityType t2, const std::array< int, num_space_dim > &off_ijk, const int halo_width=-1) const
Given the relative offsets of a neighbor rank, get the set of global entity indices shared with that ...
LocalGrid(const std::shared_ptr< GlobalGrid< mesh_type > > &global_grid, const int halo_cell_width, const long cell_num_per_tile_dim)
Constructor.
Definition Cabana_Grid_SparseLocalGrid_impl.hpp:25
int neighborRank(const std::array< int, num_space_dim > &off_ijk) const
Get the global index of a neighbor given neighbor rank offsets relative to this local grid.
Definition Cabana_Grid_SparseLocalGrid_impl.hpp:98
const GlobalGrid< mesh_type > & globalGrid() const
Get the global grid that owns the local grid.
Definition Cabana_Grid_SparseLocalGrid_impl.hpp:43
int totalNumCell(const int d) const
Get the total number of local cells per dimension (owned + halo).
Definition Cabana_Grid_SparseLocalGrid_impl.hpp:76
int haloCellWidth() const
Get the number of cells in the halo.
Definition Cabana_Grid_SparseLocalGrid_impl.hpp:60
IndexSpace< num_space_dim > indexSpace(DecompositionTag t1, EntityType t2, IndexType t3) const
Given a decomposition type, entity type, and index type, get the contiguous set of indices that span ...
int haloTileWidth() const
Get the number of tiles in the halo.
Definition Cabana_Grid_SparseLocalGrid_impl.hpp:68
SparseMesh< Scalar, NumSpaceDim > mesh_type
Mesh type.
Definition Cabana_Grid_SparseLocalGrid.hpp:48
static constexpr std::size_t num_space_dim
Spatial dimension.
Definition Cabana_Grid_SparseLocalGrid.hpp:51
Definition Cabana_Grid_SparseLocalGrid.hpp:35
Global logical grid.
Definition Cabana_Grid_GlobalGrid.hpp:39
Structured index space.
Definition Cabana_Grid_IndexSpace.hpp:37
Index space with tile as unit; _min and _max forms the tile range. Note this is for sparse grid only,...
Definition Cabana_Grid_SparseIndexSpace.hpp:1137
Core: particle data structures and algorithms.
Definition Cabana_AoSoA.hpp:36
Mesh cell tag.
Definition Cabana_Grid_Types.hpp:49
Mesh edge tag.
Definition Cabana_Grid_Types.hpp:95
Mesh face tag.
Definition Cabana_Grid_Types.hpp:64
Ghosted decomposition tag.
Definition Cabana_Grid_Types.hpp:197
Global index tag.
Definition Cabana_Grid_Types.hpp:215
Local index tag.
Definition Cabana_Grid_Types.hpp:208
Mesh node tag.
Definition Cabana_Grid_Types.hpp:56
Owned decomposition tag.
Definition Cabana_Grid_Types.hpp:190
Sparse mesh tag.
Definition Cabana_Grid_Types.hpp:253
static constexpr std::size_t num_space_dim
Definition Cabana_Grid_Types.hpp:258
Definition Cabana_Grid_Types.hpp:337