StructuredUniform.h

template<typename TReal, size_t DIM>
class Cubism::Mesh::StructuredUniform : public Cubism::Mesh::StructuredBase<TReal, DIM>

Structured uniform mesh.

Template Parameters
  • TReal: Float type for mesh entities

  • DIM: Mesh dimension

Public Types

using BaseMesh = StructuredBase<TReal, DIM>

Base mesh type.

using EntityType = Cubism::EntityType

Mesh entity type.

using IndexRangeType = Core::IndexRange<DIM>

Index range used to address discrete mesh entities.

using MeshIntegrity = Cubism::MeshIntegrity

Mesh integrity.

using MultiIndex = typename IndexRangeType::MultiIndex

Multi-dimensional index.

using PointType = typename RangeType::PointType

Point type in mesh.

using RangeType = Core::Range<TReal, DIM>

Range that spans the rectangular domain.

using RealType = typename RangeType::DataType

Float type to describe mesh entities.

Public Functions

inline StructuredUniform(const PointType &begin, const PointType &end, const MultiIndex &cells, const MeshIntegrity type)

Standard mesh constructor.

Parameters
  • begin: Lower left point of physical domain

  • end: Upper right point of physical domain

  • cells: Number of cells in mesh

  • type: Mesh integrity type (full mesh or sub-mesh)

inline StructuredUniform(const PointType &end, const MultiIndex &cells, const MeshIntegrity type)

Standard mesh constructor.

Physical begin at 0

Parameters
  • end: Upper right point of physical domain

  • cells: Number of cells in mesh

  • type: Mesh integrity type (full mesh or sub-mesh)

inline StructuredUniform(const MultiIndex &cells)

Standard mesh constructor.

Physical domain [0, 1], always a full mesh type

Parameters
  • cells: Number of cells in mesh

inline StructuredUniform(const RangeType &grange, const RangeType &range, const IndexRangeType &crange, const MeshIntegrity type)

Standard mesh constructor.

Used for MPI subdomains

Parameters
  • grange: Global domain range spanned by this mesh

  • range: Domain range spanned by this mesh

  • crange: Cell range spanned by this mesh

  • type: Mesh integrity type (full mesh or sub-mesh)

inline StructuredUniform(const RangeType &grange, const RangeType &range, const IndexRangeType &crange, const IndexRangeType &nrange, const std::vector<IndexRangeType> &frange, const MeshIntegrity type)

Low-level mesh constructor.

Used for grid topology classes and sub-meshes

Parameters
  • grange: Global domain range spanned by this mesh

  • range: Domain range spanned by this mesh

  • crange: Cell range spanned by this mesh

  • nrange: Node range spanned by this mesh

  • frange: Face range spanned by this mesh

  • type: Mesh integrity type (full mesh or sub-mesh)

inline virtual std::unique_ptr<StructuredUniform> getSubMesh(const IndexRangeType &range, const EntityType entity, const size_t d = 0) const

Get sub-mesh instance.

An empty mesh is returned if there is no common intersection. If range is larger it will be clipped to the boundaries of this mesh.

Note

This method is not part of the BaseMesh interface.

Return

New sub-mesh instance

Parameters
  • range: Index range of new mesh

  • entity: Entity type corresponding to range

  • d: Direction indicator (for Face entities only)

inline virtual std::unique_ptr<StructuredUniform> getSubMesh(const PointType &begin, const PointType &end) const

Get sub-mesh instance.

If begin or end is outside of the physical range spanned by this mesh, then they will be adjusted to the begin and/or end points of the range corresponding to this mesh, respectively. The extracted discrete mesh is always guaranteed to include the begin and end points. Therefore, getRange().getBegin() of the extracted sub-mesh may be smaller in any component than begin and vice versa getRange().getEnd() may be larger in any component than end.

Note

This method is not part of the BaseMesh interface.

Return

New sub-mesh instance

Parameters
  • begin: Lower left point of physical domain for sub-mesh

  • end: Upper right point of physical domain for sub-mesh

inline PointType getGlobalCoordsCell(const MultiIndex &p) const

Get global cell coordinates.

This is a non-virtual method. Prefer this method for excessive coordinate lookup in loops.

Return

Global cell coordinates

Parameters
  • p: Local multi-dimensional cell index

inline PointType getGlobalCoordsNode(const MultiIndex &p) const

Get global node coordinates.

This is a non-virtual method. Prefer this method for excessive coordinate lookup in loops.

Return

Global node coordinates

Parameters
  • p: Local multi-dimensional node index

template<typename Dir = size_t>
inline PointType getGlobalCoordsFace(const MultiIndex &p, const Dir dir) const

Get global face coordinates.

This is a non-virtual method. Prefer this method for excessive coordinate lookup in loops.

Return

Global face coordinates

Template Parameters
  • Dir: Special type that defines a cast to size_t

Parameters
  • p: Local multi-dimensional face index

  • dir: Face direction identifier

inline PointType getCoordsCell(const MultiIndex &p) const

Get local cell coordinates.

This is a non-virtual method. Prefer this method for excessive coordinate lookup in loops.

Return

Local cell coordinates

Parameters
  • p: Local multi-dimensional cell index

inline PointType getCoordsNode(const MultiIndex &p) const

Get local node coordinates.

This is a non-virtual method. Prefer this method for excessive coordinate lookup in loops.

Return

Local node coordinates

Parameters
  • p: Local multi-dimensional node index

template<typename Dir = size_t>
inline PointType getCoordsFace(const MultiIndex &p, const Dir dir) const

Get local face coordinates.

This is a non-virtual method. Prefer this method for excessive coordinate lookup in loops.

Return

Local face coordinates

Template Parameters
  • Dir: Special type that defines a cast to size_t

Parameters
  • p: Local multi-dimensional face index

  • dir: Face direction identifier