#include <Cabana_Grid_LocalGrid.hpp>
Public Types | |
using | mesh_type = MeshType |
Mesh type. | |
Public Member Functions | |
LocalGrid (const std::shared_ptr< GlobalGrid< MeshType > > &global_grid, const int halo_cell_width) | |
Constructor. | |
const GlobalGrid< MeshType > & | globalGrid () const |
Get the global grid that owns the local grid. | |
GlobalGrid< MeshType > & | globalGrid () |
Get a mutable version of the global grid that own the local grid. | |
int | haloCellWidth () const |
Get the number of cells in the halo. | |
int | totalNumCell (const int d) const |
Get the total number of local cells per dimension (owned + halo). | |
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. | |
template<std::size_t NSD = num_space_dim> | |
std::enable_if_t< 3==NSD, int > | neighborRank (const int off_i, const int off_j, const int off_k) const |
Get the global index of a neighbor given neighbor rank offsets relative to this local grid. | |
template<std::size_t NSD = num_space_dim> | |
std::enable_if_t< 2==NSD, int > | neighborRank (const int off_i, const int off_j) const |
Get the global index of a neighbor given neighbor rank offsets relative to this local grid. | |
template<class DecompositionTag, class EntityType, class IndexType> | |
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 the space of those entities in the local domain. | |
template<class DecompositionTag, class EntityType> | |
IndexSpace< num_space_dim > | sharedIndexSpace (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 relative to this local grid's indices get the set of local entity indices shared with that neighbor in the given decomposition. | |
template<class DecompositionTag, class EntityType, std::size_t NSD = num_space_dim> | |
std::enable_if_t< 3==NSD, IndexSpace< 3 > > | sharedIndexSpace (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 relative to this local grid's indices get the set of local entity indices shared with that neighbor in the given decomposition. | |
template<class DecompositionTag, class EntityType, std::size_t NSD = num_space_dim> | |
std::enable_if_t< 2==NSD, IndexSpace< 2 > > | sharedIndexSpace (DecompositionTag t1, EntityType t2, const int off_i, const int off_j, const int halo_width=-1) const |
Given the relative offsets of a neighbor rank relative to this local grid's indices get the set of local entity indices shared with that neighbor in the given decomposition. | |
template<class DecompositionTag, class EntityType> | |
IndexSpace< num_space_dim > | boundaryIndexSpace (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 boundary relative to this local grid's indices get the set of local entity indices associated with that boundary in the given decomposition. | |
template<class DecompositionTag, class EntityType, std::size_t NSD = num_space_dim> | |
std::enable_if_t< 3==NSD, IndexSpace< 3 > > | boundaryIndexSpace (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 boundary relative to this local grid's indices get the set of local entity indices associated with that boundary in the given decomposition. | |
template<class DecompositionTag, class EntityType, std::size_t NSD = num_space_dim> | |
std::enable_if_t< 2==NSD, IndexSpace< 2 > > | boundaryIndexSpace (DecompositionTag t1, EntityType t2, const int off_i, const int off_j, const int halo_width=-1) const |
Given the relative offsets of a boundary relative to this local grid's indices get the set of local entity indices associated with that boundary in the given decomposition. | |
Static Public Attributes | |
static constexpr std::size_t | num_space_dim = mesh_type::num_space_dim |
Spatial dimension. | |
Local logical grid.
MeshType | Mesh type: UniformMesh, NonUniformMesh, or SparseMesh |
Cabana::Grid::LocalGrid< MeshType >::LocalGrid | ( | const std::shared_ptr< GlobalGrid< MeshType > > & | global_grid, |
const int | halo_cell_width ) |
Constructor.
global_grid | The global grid from which the local grid will be constructed. |
halo_cell_width | The number of halo cells surrounding the locally owned cells. |
std::enable_if_t< 2==NSD, IndexSpace< 2 > > Cabana::Grid::LocalGrid< MeshType >::boundaryIndexSpace | ( | DecompositionTag | t1, |
EntityType | t2, | ||
const int | off_i, | ||
const int | off_j, | ||
const int | halo_width = -1 ) const |
Given the relative offsets of a boundary relative to this local grid's indices get the set of local entity indices associated with that boundary in the given decomposition.
t1 | Decomposition type: Own or Ghost |
t2 | Entity: Cell, Node, Edge, or Face |
off_i,off_j | Neighbor offset index in a given dimension. |
halo_width | Optional depth of shared indices within the halo. Must be less than or equal to the halo width of the local grid. Default is to use the halo width of the local grid. |
For example, if the Own decomposition is used, the interior entities that would be affected by a boundary operation are provided whereas if the Ghost decomposition is used the halo entities on the boundary are provided.
std::enable_if_t< 3==NSD, IndexSpace< 3 > > Cabana::Grid::LocalGrid< MeshType >::boundaryIndexSpace | ( | 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 boundary relative to this local grid's indices get the set of local entity indices associated with that boundary in the given decomposition.
t1 | Decomposition type: Own or Ghost |
t2 | Entity: Cell, Node, Edge, or Face |
off_i,off_j,off_k | Neighbor offset index in a given dimension. |
halo_width | Optional depth of shared indices within the halo. Must be less than or equal to the halo width of the local grid. Default is to use the halo width of the local grid. |
For example, if the Own decomposition is used, the interior entities that would be affected by a boundary operation are provided whereas if the Ghost decomposition is used the halo entities on the boundary are provided.
IndexSpace< num_space_dim > Cabana::Grid::LocalGrid< MeshType >::boundaryIndexSpace | ( | 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 boundary relative to this local grid's indices get the set of local entity indices associated with that boundary in the given decomposition.
t1 | Decomposition type: Own or Ghost |
t2 | Entity: Cell, Node, Edge, or Face |
off_ijk | Array of neighbor offset indices. |
halo_width | Optional depth of shared indices within the halo. Must be less than or equal to the halo width of the local grid. Default is to use the halo width of the local grid. |
For example, if the Own decomposition is used, the interior entities that would be affected by a boundary operation are provided whereas if the Ghost decomposition is used the halo entities on the boundary are provided.
IndexSpace< num_space_dim > Cabana::Grid::LocalGrid< MeshType >::indexSpace | ( | DecompositionTag | t1, |
EntityType | t2, | ||
IndexType | t3 ) const |
std::enable_if_t< 2==NSD, int > Cabana::Grid::LocalGrid< MeshType >::neighborRank | ( | const int | off_i, |
const int | off_j ) const |
Get the global index of a neighbor given neighbor rank offsets relative to this local grid.
off_i,off_j | Neighbor offset index in a given dimension. |
If the neighbor rank is out of bounds return -1. Note that in the case of periodic boundaries out of bounds indices are allowed as the indices will be wrapped around the periodic boundary.
std::enable_if_t< 3==NSD, int > Cabana::Grid::LocalGrid< MeshType >::neighborRank | ( | const int | off_i, |
const int | off_j, | ||
const int | off_k ) const |
Get the global index of a neighbor given neighbor rank offsets relative to this local grid.
off_i,off_j,off_k | Neighbor offset index in a given dimension. |
If the neighbor rank is out of bounds return -1. Note that in the case of periodic boundaries out of bounds indices are allowed as the indices will be wrapped around the periodic boundary.
int Cabana::Grid::LocalGrid< MeshType >::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.
off_ijk | Array of neighbor offset indices. |
If the neighbor rank is out of bounds return -1. Note that in the case of periodic boundaries out of bounds indices are allowed as the indices will be wrapped around the periodic boundary.
std::enable_if_t< 2==NSD, IndexSpace< 2 > > Cabana::Grid::LocalGrid< MeshType >::sharedIndexSpace | ( | DecompositionTag | t1, |
EntityType | t2, | ||
const int | off_i, | ||
const int | off_j, | ||
const int | halo_width = -1 ) const |
Given the relative offsets of a neighbor rank relative to this local grid's indices get the set of local entity indices shared with that neighbor in the given decomposition.
DecompositionTag | Decomposition type: Own or Ghost |
EntityType | Entity: Cell, Node, Edge, or Face |
t1 | Decomposition type: Own or Ghost |
t2 | Entity: Cell, Node, Edge, or Face |
off_i,off_j | Neighbor offset index in a given dimension. |
halo_width | Optional depth of shared indices within the halo. Must be less than or equal to the halo width of the local grid. Default is to use the halo width of the local grid. |
std::enable_if_t< 3==NSD, IndexSpace< 3 > > Cabana::Grid::LocalGrid< MeshType >::sharedIndexSpace | ( | 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 relative to this local grid's indices get the set of local entity indices shared with that neighbor in the given decomposition.
DecompositionTag | Decomposition type: Own or Ghost |
EntityType | Entity: Cell, Node, Edge, or Face |
t1 | Decomposition type: Own or Ghost |
t2 | Entity: Cell, Node, Edge, or Face |
off_i,off_j,off_k | Neighbor offset index in a given dimension. |
halo_width | Optional depth of shared indices within the halo. Must be less than or equal to the halo width of the local grid. Default is to use the halo width of the local grid. |
IndexSpace< num_space_dim > Cabana::Grid::LocalGrid< MeshType >::sharedIndexSpace | ( | 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 relative to this local grid's indices get the set of local entity indices shared with that neighbor in the given decomposition.
int Cabana::Grid::LocalGrid< MeshType >::totalNumCell | ( | const int | d | ) | const |
Get the total number of local cells per dimension (owned + halo).
d | Spatial dimension. |