Cabana 0.8.0-dev
 
Loading...
Searching...
No Matches
Cabana::Grid::LocalGrid< MeshType > Class Template Reference

Local logical grid. More...

#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_dimindexSpace (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_dimsharedIndexSpace (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_dimboundaryIndexSpace (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.
 

Detailed Description

template<class MeshType>
class Cabana::Grid::LocalGrid< MeshType >

Local logical grid.

Template Parameters
MeshTypeMesh type: UniformMesh, NonUniformMesh, or SparseMesh

Constructor & Destructor Documentation

◆ LocalGrid()

template<class MeshType>
Cabana::Grid::LocalGrid< MeshType >::LocalGrid ( const std::shared_ptr< GlobalGrid< MeshType > > & global_grid,
const int halo_cell_width )

Constructor.

Parameters
global_gridThe global grid from which the local grid will be constructed.
halo_cell_widthThe number of halo cells surrounding the locally owned cells.

Member Function Documentation

◆ boundaryIndexSpace() [1/3]

template<class MeshType>
template<class DecompositionTag, class EntityType, std::size_t NSD = num_space_dim>
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.

Parameters
t1Decomposition type: Own or Ghost
t2Entity: Cell, Node, Edge, or Face
off_i,off_jNeighbor offset index in a given dimension.
halo_widthOptional 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.

◆ boundaryIndexSpace() [2/3]

template<class MeshType>
template<class DecompositionTag, class EntityType, std::size_t NSD = num_space_dim>
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.

Parameters
t1Decomposition type: Own or Ghost
t2Entity: Cell, Node, Edge, or Face
off_i,off_j,off_kNeighbor offset index in a given dimension.
halo_widthOptional 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.

◆ boundaryIndexSpace() [3/3]

template<class MeshType>
template<class DecompositionTag, class EntityType>
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.

Parameters
t1Decomposition type: Own or Ghost
t2Entity: Cell, Node, Edge, or Face
off_ijkArray of neighbor offset indices.
halo_widthOptional 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()

template<class MeshType>
template<class DecompositionTag, class EntityType, class IndexType>
IndexSpace< num_space_dim > Cabana::Grid::LocalGrid< MeshType >::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.

Parameters
t1Decomposition type: Own or Ghost
t2Entity type: Cell, Node, Edge, or Face
t3Index type: Local or Global

◆ neighborRank() [1/3]

template<class MeshType>
template<std::size_t NSD>
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.

Parameters
off_i,off_jNeighbor 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.

◆ neighborRank() [2/3]

template<class MeshType>
template<std::size_t NSD>
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.

Parameters
off_i,off_j,off_kNeighbor 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.

◆ neighborRank() [3/3]

template<class MeshType>
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.

Parameters
off_ijkArray 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.

◆ sharedIndexSpace() [1/3]

template<class MeshType>
template<class DecompositionTag, class EntityType, std::size_t NSD = num_space_dim>
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.

Template Parameters
DecompositionTagDecomposition type: Own or Ghost
EntityTypeEntity: Cell, Node, Edge, or Face
Parameters
t1Decomposition type: Own or Ghost
t2Entity: Cell, Node, Edge, or Face
off_i,off_jNeighbor offset index in a given dimension.
halo_widthOptional 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.

◆ sharedIndexSpace() [2/3]

template<class MeshType>
template<class DecompositionTag, class EntityType, std::size_t NSD = num_space_dim>
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.

Template Parameters
DecompositionTagDecomposition type: Own or Ghost
EntityTypeEntity: Cell, Node, Edge, or Face
Parameters
t1Decomposition type: Own or Ghost
t2Entity: Cell, Node, Edge, or Face
off_i,off_j,off_kNeighbor offset index in a given dimension.
halo_widthOptional 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.

◆ sharedIndexSpace() [3/3]

template<class MeshType>
template<class DecompositionTag, class EntityType>
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.

Parameters
t1Decomposition type: Own or Ghost
t2Entity: Cell, Node, Edge, or Face
off_ijkArray of neighbor offset indices.
halo_widthOptional 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.

◆ totalNumCell()

template<class MeshType>
int Cabana::Grid::LocalGrid< MeshType >::totalNumCell ( const int d) const

Get the total number of local cells per dimension (owned + halo).

Parameters
dSpatial dimension.

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