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

Global logical grid. More...

#include <Cabana_Grid_GlobalGrid.hpp>

Public Types

using mesh_type = MeshType
 Mesh type.
 

Public Member Functions

 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.
 
MPI_Comm comm () const
 Get the communicator. This communicator was generated with a Cartesian topology.
 
const GlobalMesh< MeshType > & globalMesh () const
 Get the global mesh data.
 
bool isPeriodic (const int dim) const
 Get whether a given dimension is periodic.
 
bool onLowBoundary (const int dim) const
 Determine if this block is on a low boundary in this dimension.
 
bool onHighBoundary (const int dim) const
 Determine if this block is on a high boundary in this dimension.
 
int dimNumBlock (const int dim) const
 Get the number of blocks in each dimension in the global mesh.
 
int totalNumBlock () const
 Get the total number of blocks.
 
int dimBlockId (const int dim) const
 Get the id of this block in a given dimension.
 
int blockId () const
 Get the id of this block.
 
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 not periodic, return -1 to indicate an invalid rank.
 
template<std::size_t NSD = num_space_dim>
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 not periodic, return -1 to indicate an invalid rank.
 
template<std::size_t NSD = num_space_dim>
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 not periodic, return -1 to indicate an invalid rank.
 
int globalNumEntity (Cell, const int dim) const
 Get the global number of entities in a given dimension.
 
int globalNumEntity (Node, const int dim) const
 Get the global number of entities in a given dimension.
 
int globalNumEntity (Face< Dim::I >, const int dim) const
 Get the global number of entities in a given dimension.
 
int globalNumEntity (Face< Dim::J >, const int dim) const
 Get the global number of entities in a given dimension.
 
template<std::size_t NSD = num_space_dim>
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.
 
template<std::size_t NSD = num_space_dim>
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.
 
template<std::size_t NSD = num_space_dim>
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.
 
template<std::size_t NSD = num_space_dim>
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.
 
int ownedNumCell (const int dim) const
 Get the owned number of cells in a given dimension of this block.
 
int globalOffset (const int dim) const
 Get the global offset in a given dimension. This is where our block starts in the global indexing scheme.
 
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 ranks.
 

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::GlobalGrid< MeshType >

Global logical grid.

Template Parameters
MeshTypeMesh type (uniform, non-uniform, sparse)

Constructor & Destructor Documentation

◆ GlobalGrid()

template<class MeshType>
Cabana::Grid::GlobalGrid< MeshType >::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.

Parameters
commThe communicator over which to define the grid.
global_meshThe global mesh data.
periodicWhether each logical dimension is periodic.
partitionerThe grid partitioner.

Member Function Documentation

◆ blockRank() [1/3]

template<class MeshType>
template<std::size_t NSD>
std::enable_if_t< 2==NSD, int > Cabana::Grid::GlobalGrid< MeshType >::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 not periodic, return -1 to indicate an invalid rank.

Parameters
i,jBlock index.

◆ blockRank() [2/3]

template<class MeshType>
template<std::size_t NSD>
std::enable_if_t< 3==NSD, int > Cabana::Grid::GlobalGrid< MeshType >::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 not periodic, return -1 to indicate an invalid rank.

Parameters
i,j,kBlock index.

◆ blockRank() [3/3]

template<class MeshType>
int Cabana::Grid::GlobalGrid< MeshType >::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 not periodic, return -1 to indicate an invalid rank.

Parameters
ijkArray of block indices.

◆ dimBlockId()

template<class MeshType>
int Cabana::Grid::GlobalGrid< MeshType >::dimBlockId ( const int dim) const

Get the id of this block in a given dimension.

Parameters
dimSpatial dimension.

◆ dimNumBlock()

template<class MeshType>
int Cabana::Grid::GlobalGrid< MeshType >::dimNumBlock ( const int dim) const

Get the number of blocks in each dimension in the global mesh.

Parameters
dimSpatial dimension.

◆ globalNumEntity() [1/8]

template<class MeshType>
int Cabana::Grid::GlobalGrid< MeshType >::globalNumEntity ( Cell ,
const int dim ) const

Get the global number of entities in a given dimension.

Parameters
dimSpatial dimension.

◆ globalNumEntity() [2/8]

template<class MeshType>
template<std::size_t NSD>
std::enable_if_t< 3==NSD, int > Cabana::Grid::GlobalGrid< MeshType >::globalNumEntity ( Edge< Dim::I > ,
const int dim ) const

Get the global number of entities in a given dimension.

Parameters
dimSpatial dimension.

◆ globalNumEntity() [3/8]

template<class MeshType>
template<std::size_t NSD>
std::enable_if_t< 3==NSD, int > Cabana::Grid::GlobalGrid< MeshType >::globalNumEntity ( Edge< Dim::J > ,
const int dim ) const

Get the global number of entities in a given dimension.

Parameters
dimSpatial dimension.

◆ globalNumEntity() [4/8]

template<class MeshType>
template<std::size_t NSD>
std::enable_if_t< 3==NSD, int > Cabana::Grid::GlobalGrid< MeshType >::globalNumEntity ( Edge< Dim::K > ,
const int dim ) const

Get the global number of entities in a given dimension.

Parameters
dimSpatial dimension.

◆ globalNumEntity() [5/8]

template<class MeshType>
int Cabana::Grid::GlobalGrid< MeshType >::globalNumEntity ( Face< Dim::I > ,
const int dim ) const

Get the global number of entities in a given dimension.

Parameters
dimSpatial dimension.

◆ globalNumEntity() [6/8]

template<class MeshType>
int Cabana::Grid::GlobalGrid< MeshType >::globalNumEntity ( Face< Dim::J > ,
const int dim ) const

Get the global number of entities in a given dimension.

Parameters
dimSpatial dimension.

◆ globalNumEntity() [7/8]

template<class MeshType>
template<std::size_t NSD>
std::enable_if_t< 3==NSD, int > Cabana::Grid::GlobalGrid< MeshType >::globalNumEntity ( Face< Dim::K > ,
const int dim ) const

Get the global number of entities in a given dimension.

Parameters
dimSpatial dimension.

◆ globalNumEntity() [8/8]

template<class MeshType>
int Cabana::Grid::GlobalGrid< MeshType >::globalNumEntity ( Node ,
const int dim ) const

Get the global number of entities in a given dimension.

Parameters
dimSpatial dimension.

◆ globalOffset()

template<class MeshType>
int Cabana::Grid::GlobalGrid< MeshType >::globalOffset ( const int dim) const

Get the global offset in a given dimension. This is where our block starts in the global indexing scheme.

Parameters
dimSpatial dimension.

◆ onHighBoundary()

template<class MeshType>
bool Cabana::Grid::GlobalGrid< MeshType >::onHighBoundary ( const int dim) const

Determine if this block is on a high boundary in this dimension.

Parameters
dimSpatial dimension.

◆ onLowBoundary()

template<class MeshType>
bool Cabana::Grid::GlobalGrid< MeshType >::onLowBoundary ( const int dim) const

Determine if this block is on a low boundary in this dimension.

Parameters
dimSpatial dimension.

◆ ownedNumCell()

template<class MeshType>
int Cabana::Grid::GlobalGrid< MeshType >::ownedNumCell ( const int dim) const

Get the owned number of cells in a given dimension of this block.

Parameters
dimSpatial dimension.

◆ setNumCellAndOffset()

template<class MeshType>
void Cabana::Grid::GlobalGrid< MeshType >::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 ranks.

Parameters
num_cellNew number of owned cells for all dimensions.
offsetNew global offset for all dimensions.

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