StructuredBase.h¶
-
template<typename
TReal
, size_tDIM
>
classCubism::Mesh
::
StructuredBase
¶ Structured mesh base class.
Defines the (pure virtual) interface for a structured mesh.
- Template Parameters
TReal
: Float type for mesh entitiesDIM
: Mesh dimension
Subclassed by Cubism::Mesh::StructuredUniform< TReal, DIM >
Public Types
-
using
IndexRangeType
= Core::IndexRange<DIM>¶ Index range used to address discrete mesh entities.
-
using
MultiIndex
= typename IndexRangeType::MultiIndex¶ Multi-dimensional index.
-
using
EntityType
= Cubism::EntityType¶ Mesh entity type.
-
using
MeshIntegrity
= Cubism::MeshIntegrity¶ Mesh integrity.
-
using
iterator
= typename EntityIterator::iterator¶ Mesh entity iterator.
Public Functions
-
inline
StructuredBase
(const PointType &begin, const PointType &end, const MultiIndex &cells, const MeshIntegrity type)¶ Standard mesh constructor.
- Parameters
begin
: Lower left point of physical domainend
: Upper right point of physical domaincells
: Number of cells in meshtype
: Mesh integrity type (full mesh or sub-mesh)
-
inline
StructuredBase
(const PointType &end, const MultiIndex &cells, const MeshIntegrity type)¶ Standard mesh constructor.
Physical begin at 0
- Parameters
end
: Upper right point of physical domaincells
: Number of cells in meshtype
: Mesh integrity type (full mesh or sub-mesh)
-
inline
StructuredBase
(const MultiIndex &cells)¶ Standard mesh constructor.
Physical domain [0, 1], always a full mesh type
- Parameters
cells
: Number of cells in mesh
-
inline
StructuredBase
(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 meshrange
: Domain range spanned by this meshcrange
: Cell range spanned by this meshtype
: Mesh integrity type (full mesh or sub-mesh)
-
inline
StructuredBase
(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 meshrange
: Domain range spanned by this meshcrange
: Cell range spanned by this meshnrange
: Node range spanned by this meshfrange
: Face range spanned by this meshtype
: Mesh integrity type (full mesh or sub-mesh)
-
inline EntityIterator
getIterator
(const EntityType t, const size_t d = 0)¶ Get iterator for a mesh entity.
- Return
Entity iterator class
- Parameters
t
: Entity typed
: Direction indicator (for Face entities only)
-
template<typename
Dir
>
inline EntityIteratorgetIterator
(const EntityType t, const Dir d)¶ Get iterator for a mesh entity.
Can be used with
Cubism::Dir::X
for example.- Return
Entity iterator class
- Template Parameters
Dir
: Special type that defines a cast tosize_t
- Parameters
t
: Entity typed
: Direction indicator (for Face entities only)
-
inline Entity
operator[]
(const EntityType t) const¶ Iterable mesh entities.
Assume
m
is a mesh instance. The access operator can be used in the following manner:for (auto c : m[EntityType::Cell]) {} // c is a cell index auto faces = m[EntityType::Face]; // iterators for faces for (auto fx : faces) {} // fx is a X-face index for (auto fx : faces[Dir::X]) {} // fx is a X-face index for (auto fy : faces[Dir::Y]) {} // fy is a Y-face index for (auto fz : faces[Dir::Z]) {} // fz is a Z-face index
- Return
Entity iterator container
- Parameters
t
: Entity type
-
inline size_t
size
(const EntityType t, const size_t d = 0) const¶ Total size of mesh entities.
- Return
Number of entities
- Parameters
t
: Entity typed
: Direction indicator (for Face entities only)
-
template<typename
Dir
>
inline size_tsize
(const EntityType t, const Dir d) const¶ Total size of mesh entities.
- Return
Number of entities
- Template Parameters
Dir
: Special type that defines a cast tosize_t
- Parameters
t
: Entity typed
: Direction indicator (for Face entities only)
-
inline MultiIndex
getSize
(const EntityType t, const size_t d = 0) const¶ Size of mesh entities.
- Return
Number of entities along all directions
- Parameters
t
: Entity typed
: Direction indicator (for Face entities only)
-
template<typename
Dir
>
inline MultiIndexgetSize
(const EntityType t, const Dir d) const¶ Size of mesh entities.
- Return
Number of entities along all directions
- Template Parameters
Dir
: Special type that defines a cast tosize_t
- Parameters
t
: Entity typed
: Direction indicator (for Face entities only)
-
inline IndexRangeType
getIndexRange
(const EntityType t, const size_t d = 0) const¶ Index range for an entity type.
- Return
Index range
- Parameters
t
: Entity typed
: Direction indicator (for Face entities only)
-
template<typename
Dir
>
inline IndexRangeTypegetIndexRange
(const EntityType t, const Dir d) const¶ Index range for an entity type.
- Return
Index range
- Template Parameters
Dir
: Special type that defines a cast tosize_t
- Parameters
t
: Entity typed
: Direction indicator (for Face entities only)
-
inline bool
isSubMesh
() const¶ Test if this is a sub-mesh.
- Return
True if this is a sub-mesh of some full mesh
-
inline MultiIndex
getMultiIndex
(const size_t i, const EntityType t, const size_t d = 0) const¶ Convert local flat index to multi-dimensional index.
- Return
Local multi-dimensional index
- Parameters
i
: Local flat indext
: Entity typed
: Direction indicator (for Face entities only)
-
template<typename
Dir
>
inline MultiIndexgetMultiIndex
(const size_t i, const EntityType t, const Dir d) const¶ Convert local flat index to multi-dimensional index.
- Return
Local multi-dimensional index
- Template Parameters
Dir
: Special type that defines a cast tosize_t
- Parameters
i
: Local flat indext
: Entity typed
: Direction indicator (for Face entities only)
-
inline MultiIndex
getGlobalIndex
(const size_t i, const EntityType t, const size_t d = 0) const¶ Convert local flat index to global multi-dimensional index.
- Return
Global multi-dimensional index
- Parameters
i
: Local flat indext
: Entity typed
: Direction indicator (for Face entities only)
-
template<typename
Dir
>
inline MultiIndexgetGlobalIndex
(const size_t i, const EntityType t, const Dir d) const¶ Convert local flat index to global multi-dimensional index.
- Return
Global multi-dimensional index
- Template Parameters
Dir
: Special type that defines a cast tosize_t
- Parameters
i
: Local flat indext
: Entity typed
: Direction indicator (for Face entities only)
-
inline MultiIndex
getGlobalIndex
(const MultiIndex &p, const EntityType t, const size_t d = 0) const¶ Convert local multi-dimensional index to global multi-dimensional index.
- Return
Global multi-dimensional index
- Parameters
p
: Local multi-dimensional indext
: Entity typed
: Direction indicator (for Face entities only)
-
template<typename
Dir
>
inline MultiIndexgetGlobalIndex
(const MultiIndex &p, const EntityType t, const Dir d) const¶ Convert local multi-dimensional index to global multi-dimensional index.
- Return
Global multi-dimensional index
- Template Parameters
Dir
: Special type that defines a cast tosize_t
- Parameters
p
: Local multi-dimensional indext
: Entity typed
: Direction indicator (for Face entities only)
-
inline PointType
getGlobalCoords
(const size_t i, const EntityType t, const size_t d = 0) const¶ Convert local flat index to global coordinates.
- Return
Global coordinates
- Parameters
i
: Local flat indext
: Entity typed
: Direction indicator (for Face entities only)
-
template<typename
Dir
>
inline PointTypegetGlobalCoords
(const size_t i, const EntityType t, const Dir d) const¶ Convert local flat index to global coordinates.
- Return
Global coordinates
- Template Parameters
Dir
: Special type that defines a cast tosize_t
- Parameters
i
: Local flat indext
: Entity typed
: Direction indicator (for Face entities only)
-
inline PointType
getGlobalCoords
(const MultiIndex &p, const EntityType t, const size_t d = 0) const¶ Convert local multi-dimensional index to global coordinates.
- Return
Global coordinates
- Parameters
p
: Local multi-dimensional indext
: Entity typed
: Direction indicator (for Face entities only)
-
template<typename
Dir
>
inline PointTypegetGlobalCoords
(const MultiIndex &p, const EntityType t, const Dir d) const¶ Convert local multi-dimensional index to global coordinates.
- Return
Global coordinates
- Template Parameters
Dir
: Special type that defines a cast tosize_t
- Parameters
p
: Local multi-dimensional indext
: Entity typed
: Direction indicator (for Face entities only)
-
inline PointType
getGlobalCoords
(const iterator &it) const¶ Convert entity iterator to global coordinates.
- Return
Global coordinates
- Parameters
it
: Entity iterator
-
inline PointType
getCoords
(const size_t i, const EntityType t, const size_t d = 0) const¶ Convert local flat index to local coordinates.
- Return
Local coordinates
- Parameters
i
: Local flat indext
: Entity typed
: Direction indicator (for Face entities only)
-
template<typename
Dir
>
inline PointTypegetCoords
(const size_t i, const EntityType t, const Dir d) const¶ Convert local flat index to local coordinates.
- Return
Local coordinates
- Template Parameters
Dir
: Special type that defines a cast tosize_t
- Parameters
i
: Local flat indext
: Entity typed
: Direction indicator (for Face entities only)
-
inline PointType
getCoords
(const MultiIndex &p, const EntityType t, const size_t d = 0) const¶ Convert local multi-dimensional index to local coordinates.
- Return
Local coordinates
- Parameters
p
: Local multi-dimensional indext
: Entity typed
: Direction indicator (for Face entities only)
-
template<typename
Dir
>
inline PointTypegetCoords
(const MultiIndex &p, const EntityType t, const Dir d) const¶ Convert local multi-dimensional index to local coordinates.
- Return
Local coordinates
- Template Parameters
Dir
: Special type that defines a cast tosize_t
- Parameters
p
: Local multi-dimensional indext
: Entity typed
: Direction indicator (for Face entities only)
-
inline PointType
getCoords
(const iterator &it) const¶ Convert entity iterator to local coordinates.
- Return
Local coordinates
- Parameters
it
: Entity iterator
-
inline PointType
getGlobalCoordsCell
(const MultiIndex &p) const¶ Get global cell coordinates.
Contains one virtual call. This method is overloaded in the derived class without virtual calls. 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.
Contains one virtual call. This method is overloaded in the derived class without virtual calls. 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 PointTypegetGlobalCoordsFace
(const MultiIndex &p, const Dir dir) const¶ Get global face coordinates.
Contains one virtual call. This method is overloaded in the derived class without virtual calls. Prefer this method for excessive coordinate lookup in loops.
- Return
Global face coordinates
- Template Parameters
Dir
: Special type that defines a cast tosize_t
- Parameters
p
: Local multi-dimensional face indexdir
: Face direction identifier
-
inline PointType
getCoordsCell
(const MultiIndex &p) const¶ Get local cell coordinates.
Contains one virtual call. This method is overloaded in the derived class without virtual calls. 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.
Contains one virtual call. This method is overloaded in the derived class without virtual calls. 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 PointTypegetCoordsFace
(const MultiIndex &p, const Dir dir) const¶ Get local face coordinates.
Contains one virtual call. This method is overloaded in the derived class without virtual calls. Prefer this method for excessive coordinate lookup in loops.
- Return
Local face coordinates
- Template Parameters
Dir
: Special type that defines a cast tosize_t
- Parameters
p
: Local multi-dimensional face indexdir
: Face direction identifier
-
inline RealType
getCellVolume
(const size_t i) const¶ Get cell volume.
- Return
Cell volume
- Parameters
i
: Local flat cell index
-
inline RealType
getCellVolume
(const MultiIndex &p) const¶ Get cell volume.
- Return
Cell volume
- Parameters
p
: Local multi-dimensional cell index
-
inline RealType
getCellVolume
(const iterator &it) const¶ Get cell volume.
- Return
Cell volume
- Parameters
it
: Cell entity iterator
-
inline PointType
getCellSize
(const size_t i) const¶ Get cell size.
- Return
Cell size
- Parameters
i
: Local flat cell index
-
inline PointType
getCellSize
(const MultiIndex &p) const¶ Get cell size.
- Return
Cell size
- Parameters
p
: Local multi-dimensional cell index
-
inline PointType
getCellSize
(const iterator &it) const¶ Get cell size.
- Return
Cell size
- Parameters
it
: Cell entity iterator
-
inline PointType
getSurface
(const size_t i, const size_t ci, const size_t d) const¶ Get surface vector for a face.
The vector points outward of the specified reference cell
ci
.- Return
Face surface vector
- Parameters
i
: Local flat face indexci
: Local flat index of reference celld
: Direction of face
-
template<typename
Dir
>
inline PointTypegetSurface
(const size_t i, const size_t ci, const Dir d) const¶ Get surface vector for a face.
The vector points outward of the specified reference cell
ci
.- Return
Face surface vector
- Template Parameters
Dir
: Special type that defines a cast tosize_t
- Parameters
i
: Local flat face indexci
: Local flat index of reference celld
: Direction of face
-
inline PointType
getSurface
(const MultiIndex &p, const MultiIndex &ci, const size_t d) const¶ Get surface vector for a face.
The vector points outward of the specified reference cell
ci
.- Return
Face surface vector
- Parameters
p
: Local multi-dimensional face indexci
: Local multi-dimensional index of reference celld
: Direction of face
-
template<typename
Dir
>
inline PointTypegetSurface
(const MultiIndex &p, const MultiIndex &ci, const Dir d) const¶ Get surface vector for a face.
The vector points outward of the specified reference cell
ci
.- Return
Face surface vector
- Template Parameters
Dir
: Special type that defines a cast tosize_t
- Parameters
p
: Local multi-dimensional face indexci
: Local multi-dimensional index of reference celld
: Direction of face
-
inline RealType
getSurfaceArea
(const size_t i, const size_t ci, const size_t d) const¶ Get surface area for a face.
- Return
Face surface area
- Parameters
i
: Local flat face indexci
: Local flat index of reference celld
: Direction of face
-
template<typename
Dir
>
inline RealTypegetSurfaceArea
(const size_t i, const size_t ci, const Dir d) const¶ Get surface area for a face.
- Return
Face surface area
- Template Parameters
Dir
: Special type that defines a cast tosize_t
- Parameters
i
: Local flat face indexci
: Local flat index of reference celld
: Direction of face
-
inline RealType
getSurfaceArea
(const MultiIndex &p, const MultiIndex &ci, const size_t d) const¶ Get surface area for a face.
- Return
Face surface area
- Parameters
p
: Local multi-dimensional face indexci
: Local multi-dimensional index of reference celld
: Direction of face
-
template<typename
Dir
>
inline RealTypegetSurfaceArea
(const MultiIndex &p, const MultiIndex &ci, const Dir d) const¶ Get surface area for a face.
- Return
Face surface area
- Template Parameters
Dir
: Special type that defines a cast tosize_t
- Parameters
p
: Local multi-dimensional face indexci
: Local multi-dimensional index of reference celld
: Direction of face
-
inline PointType
getSurfaceNormal
(const size_t i, const size_t ci, const size_t d) const¶ Get surface normal for a face.
The vector points outward of the specified reference cell
ci
.- Return
Face surface normal
- Parameters
i
: Local flat face indexci
: Local flat index of reference celld
: Direction of face
-
template<typename
Dir
>
inline PointTypegetSurfaceNormal
(const size_t i, const size_t ci, const Dir d) const¶ Get surface normal for a face.
The vector points outward of the specified reference cell
ci
.- Return
Face surface normal
- Template Parameters
Dir
: Special type that defines a cast tosize_t
- Parameters
i
: Local flat face indexci
: Local flat index of reference celld
: Direction of face
-
inline PointType
getSurfaceNormal
(const MultiIndex &p, const MultiIndex &ci, const size_t d) const¶ Get surface normal for a face.
The vector points outward of the specified reference cell
ci
.- Return
Face surface normal
- Parameters
p
: Local multi-dimensional face indexci
: Local multi-dimensional index of reference celld
: Direction of face
-
template<typename
Dir
>
inline PointTypegetSurfaceNormal
(const MultiIndex &p, const MultiIndex ci, const Dir d) const¶ Get surface normal for a face.
The vector points outward of the specified reference cell
ci
.- Return
Face surface normal
- Template Parameters
Dir
: Special type that defines a cast tosize_t
- Parameters
p
: Local multi-dimensional face indexci
: Local multi-dimensional index of reference celld
: Direction of face