CartesianMPI.h

template<typename T, typename Mesh, Cubism::EntityType Entity = Cubism::EntityType::Cell, size_t RANK = 0, typename UserState = Block::FieldState, template<typename> class Alloc = AlignedBlockAllocator>
class Cubism::Grid::CartesianMPI : public Cubism::Grid::Cartesian<T, Mesh, Entity, RANK, UserState, Alloc>

Cartesian MPI block (tensor) field.

Cartesian topology composed of block Field.h for the specified entity type. As opposed to an individual block Field.h, this class manages a structure of arrays (SoA) memory layout for all the blocks in the rank local Cartesian topology instead of just individual blocks. See the Cartesian.h grid section for a non-distributed variant of this class as well as the UserState extension.

Template Parameters
  • T: Field data type

  • Mesh: Mesh type to be associated with fields

  • Entity: Entity type

  • RANK: Rank of (tensor) fields

  • Alloc: Allocator for field data

Public Types

using BaseType = typename Assembler::BaseType

Block (scalar, tensor, face) field type.

using DataType = typename Assembler::DataType

Data type of carried fields.

using FieldContainer = typename Assembler::FieldContainer

Container type for field views.

using IndexFunctor = Block::PeriodicIndexFunctor<FieldContainer, BaseType::Class, RANK>

Periodic block field access by index.

using IndexRangeType = typename MeshType::IndexRangeType

Index range type.

using MeshType = Mesh

Type of mesh.

using MultiIndex = typename IndexRangeType::MultiIndex

Type for higher dimensional index.

using PointType = typename MeshType::PointType

Type of point in physical domain.

using RangeType = typename MeshType::RangeType

Type for physical domain ranges spanned by MeshType

using RealType = typename MeshType::RealType

Type float used to describe the mesh topology.

Public Functions

inline CartesianMPI(const MPI_Comm &comm, const MultiIndex &nprocs, const MultiIndex &nblocks, const MultiIndex &block_cells, const PointType &begin = PointType(0), const PointType &end = PointType(1), const PointType &gbegin = PointType(0), const PointType &gend = PointType(1))

Main constructor for a Cartesian MPI block field topology.

Parameters
  • comm: MPI communicator for this Cartesian topology

  • nprocs: Number of MPI processes in each dimension

  • nblocks: Number of blocks per rank

  • block_cells: Number of cells in each block

  • begin: Physical origin for the full (all ranks) Cartesian grid (lower left)

  • end: Physical end for the full (all ranks) Cartesian grid (top right)

  • gbegin: Global begin of physical domain

  • gend: Global end of physical domain

CartesianMPI() = default

Default constructor.

CartesianMPI(const CartesianMPI &c) = delete

Deleted copy constructor.

CartesianMPI(CartesianMPI &&c) = delete

Deleted move constructor.

CartesianMPI &operator=(const CartesianMPI &c) = default

Default copy assignment.

CartesianMPI &operator=(CartesianMPI &&c) = delete

Deleted move assignment.

inline virtual MultiIndex getGlobalSize() const override

Global size of the grid in all dimensions.

Return

Number of blocks in all dimensions in the global grid

inline MultiIndex getNumProcs() const

MPI processes in the topology.

Return

Number of processes in the MPI topology

inline MultiIndex getProcIndex() const

Cartesian index of MPI process.

Return

Multi-dimensional index of the process

inline int getCartRank() const

MPI rank.

Return

Rank of the process in the Cartesian communicator

inline MPI_Comm getCartComm() const

MPI communicator.

Return

Cartesian MPI communicator

inline bool isRoot() const

Test for root process.

Return

True if this is the root rank