16#ifndef CABANA_GRID_GLOBALGRID_HPP
17#define CABANA_GRID_GLOBALGRID_HPP
37template <
class MeshType>
56 const std::array<bool, num_space_dim>& periodic,
101 int blockRank(
const std::array<int, num_space_dim>& ijk )
const;
110 template <std::
size_t NSD = num_space_dim>
111 std::enable_if_t<3 == NSD, int>
blockRank(
const int i,
const int j,
121 template <std::
size_t NSD = num_space_dim>
122 std::enable_if_t<2 == NSD, int>
blockRank(
const int i,
const int j )
const;
139 template <std::
size_t NSD = num_space_dim>
141 const int dim )
const;
144 template <std::
size_t NSD = num_space_dim>
146 const int dim )
const;
149 template <std::
size_t NSD = num_space_dim>
151 const int dim )
const;
154 template <std::
size_t NSD = num_space_dim>
156 const int dim )
const;
172 const std::array<int, num_space_dim>& offset );
175 std::shared_ptr<MPI_Comm> _cart_comm_ptr;
176 std::shared_ptr<GlobalMesh<MeshType>> _global_mesh;
177 std::array<bool, num_space_dim> _periodic;
178 std::array<int, num_space_dim> _ranks_per_dim;
179 std::array<int, num_space_dim> _cart_rank;
180 std::array<int, num_space_dim> _owned_num_cell;
181 std::array<int, num_space_dim> _global_cell_offset;
182 std::array<bool, num_space_dim> _boundary_lo;
183 std::array<bool, num_space_dim> _boundary_hi;
197template <
class MeshType>
198std::shared_ptr<GlobalGrid<MeshType>>
201 const std::array<bool, MeshType::num_space_dim>& periodic,
204 return std::make_shared<GlobalGrid<MeshType>>( comm, global_mesh, periodic,
216template <
class Scalar, std::
size_t NumSpaceDim>
226 for (
long unsigned int d = 0; d < NumSpaceDim; ++d )
229 "Sparse grid doesn't support periodic BC so far!" );
230 return std::make_shared<GlobalGrid<SparseMesh<Scalar, NumSpaceDim>>>(
231 comm, global_mesh, periodic, partitioner );
243#include <Cabana_Grid_GlobalGrid_impl.hpp>
std::shared_ptr< GlobalGrid< MeshType > > createGlobalGrid(MPI_Comm comm, const std::shared_ptr< GlobalMesh< MeshType > > &global_mesh, const std::array< bool, MeshType::num_space_dim > &periodic, const BlockPartitioner< MeshType::num_space_dim > &partitioner)
Create a global grid.
Definition Cabana_Grid_GlobalGrid.hpp:199
Multi-node grid partitioner.
Block partitioner base class.
Definition Cabana_Grid_Partitioner.hpp:37
std::enable_if_t< 3==NSD, int > blockRank(const int i, const int j, const int k) const
Get the MPI rank of a block with the given indices. If the rank is out of bounds and the boundary is ...
Definition Cabana_Grid_GlobalGrid_impl.hpp:197
bool onLowBoundary(const int dim) const
Determine if this block is on a low boundary in this dimension.
Definition Cabana_Grid_GlobalGrid_impl.hpp:120
int globalOffset(const int dim) const
Get the global offset in a given dimension. This is where our block starts in the global indexing sch...
Definition Cabana_Grid_GlobalGrid_impl.hpp:311
const GlobalMesh< MeshType > & globalMesh() const
Get the global mesh data.
Definition Cabana_Grid_GlobalGrid_impl.hpp:104
std::enable_if_t< 2==NSD, int > blockRank(const int i, const int j) const
Get the MPI rank of a block with the given indices. If the rank is out of bounds and the boundary is ...
Definition Cabana_Grid_GlobalGrid_impl.hpp:210
int dimBlockId(const int dim) const
Get the id of this block in a given dimension.
Definition Cabana_Grid_GlobalGrid_impl.hpp:154
int totalNumBlock() const
Get the total number of blocks.
Definition Cabana_Grid_GlobalGrid_impl.hpp:144
bool isPeriodic(const int dim) const
Get whether a given dimension is periodic.
Definition Cabana_Grid_GlobalGrid_impl.hpp:112
std::enable_if_t< 3==NSD, int > globalNumEntity(Edge< Dim::K >, const int dim) const
Get the global number of entities in a given dimension.
Definition Cabana_Grid_GlobalGrid_impl.hpp:293
int blockId() const
Get the id of this block.
Definition Cabana_Grid_GlobalGrid_impl.hpp:162
int ownedNumCell(const int dim) const
Get the owned number of cells in a given dimension of this block.
Definition Cabana_Grid_GlobalGrid_impl.hpp:302
int dimNumBlock(const int dim) const
Get the number of blocks in each dimension in the global mesh.
Definition Cabana_Grid_GlobalGrid_impl.hpp:136
int globalNumEntity(Node, const int dim) const
Get the global number of entities in a given dimension.
Definition Cabana_Grid_GlobalGrid_impl.hpp:227
MeshType mesh_type
Mesh type.
Definition Cabana_Grid_GlobalGrid.hpp:42
int globalNumEntity(Face< Dim::I >, const int dim) const
Get the global number of entities in a given dimension.
Definition Cabana_Grid_GlobalGrid_impl.hpp:240
std::enable_if_t< 3==NSD, int > globalNumEntity(Edge< Dim::J >, const int dim) const
Get the global number of entities in a given dimension.
Definition Cabana_Grid_GlobalGrid_impl.hpp:282
GlobalGrid(MPI_Comm comm, const std::shared_ptr< GlobalMesh< MeshType > > &global_mesh, const std::array< bool, num_space_dim > &periodic, const BlockPartitioner< num_space_dim > &partitioner)
Constructor.
Definition Cabana_Grid_GlobalGrid_impl.hpp:26
int blockRank(const std::array< int, num_space_dim > &ijk) const
Get the MPI rank of a block with the given indices. If the rank is out of bounds and the boundary is ...
Definition Cabana_Grid_GlobalGrid_impl.hpp:174
std::enable_if_t< 3==NSD, int > globalNumEntity(Edge< Dim::I >, const int dim) const
Get the global number of entities in a given dimension.
Definition Cabana_Grid_GlobalGrid_impl.hpp:271
bool onHighBoundary(const int dim) const
Determine if this block is on a high boundary in this dimension.
Definition Cabana_Grid_GlobalGrid_impl.hpp:128
static constexpr std::size_t num_space_dim
Definition Cabana_Grid_GlobalGrid.hpp:45
int globalNumEntity(Cell, const int dim) const
Get the global number of entities in a given dimension.
Definition Cabana_Grid_GlobalGrid_impl.hpp:219
std::enable_if_t< 3==NSD, int > globalNumEntity(Face< Dim::K >, const int dim) const
Get the global number of entities in a given dimension.
Definition Cabana_Grid_GlobalGrid_impl.hpp:260
void setNumCellAndOffset(const std::array< int, num_space_dim > &num_cell, const std::array< int, num_space_dim > &offset)
Set number of cells and offset of local part of the grid. Make sure these are consistent across all r...
Definition Cabana_Grid_GlobalGrid_impl.hpp:320
int globalNumEntity(Face< Dim::J >, const int dim) const
Get the global number of entities in a given dimension.
Definition Cabana_Grid_GlobalGrid_impl.hpp:249
Global mesh partial specialization for uniform mesh.
Definition Cabana_Grid_GlobalMesh.hpp:49
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
Mesh node tag.
Definition Cabana_Grid_Types.hpp:56
Sparse mesh tag.
Definition Cabana_Grid_Types.hpp:253
static constexpr std::size_t num_space_dim
Number of spatial dimensions.
Definition Cabana_Grid_Types.hpp:258