template<>
Rodin::Geometry::Mesh<Context::Sequential> class

Represents the subdivision of some domain into faces of (possibly) different geometries.

Base classes

class MeshBase
Abstract base class for Mesh objects.

Derived classes

class Rodin::External::MMG::Mesh
Mesh class which has support for MMG functionalities.
template<>
class SubMesh<Context::Sequential> final
A SubMesh object represents a subregion of a Mesh object.

Public types

template<>
class Builder
Class used to build Mesh<Context::Sequential> instances.

Public static functions

static auto Build() -> Builder
Generates a Builder instance to build a Mesh object.
static auto UniformGrid(Polytope::Type g, const Array<size_t>& shape) -> Mesh
Generates a uniform grid for a given geometry.

Constructors, destructors, conversion operators

Mesh()
Constructs an empty mesh with no cells.
Mesh(const Mesh& other)
Performs a copy of another mesh.
Mesh(Mesh&& other)
Move constructs the mesh from another mesh.

Public functions

auto operator=(Mesh&&) -> Mesh&
Move assigns the mesh from another mesh.
template<class FunctionDerived>
auto displace(const Variational::FunctionBase<FunctionDerived>& u) -> Mesh&
Displaces the mesh nodes by the displacement $ u $ .
auto skin() const -> SubMesh<Context> virtual
Skins the mesh to obtain its boundary mesh.
auto trim(Attribute attr) const -> SubMesh<Context> virtual
Trims the cells with the given attribute.
auto trim(const FlatSet<Attribute>& attrs) const -> SubMesh<Context> virtual
Trims the cells with the given attribute.
auto keep(Attribute attr) const -> SubMesh<Context> virtual
Keeps the cells with the given attribute.
auto keep(const FlatSet<Attribute>& attrs) const -> SubMesh<Context> virtual
Trims the cells with the given attributes.
auto load(const boost::filesystem::path& filename, IO::FileFormat fmt = IO::FileFormat::MFEM) -> Mesh& override
Loads a mesh from file in the given format.
void save(const boost::filesystem::path& filename, IO::FileFormat fmt = IO::FileFormat::MFEM, size_t precison = 16) const override
Saves a mesh to file in the given format.
auto getPolytopeCount(size_t dimension) const -> size_t override
Gets the count of polytope of the given dimension.
auto getPolytopeCount(Polytope::Type g) const -> size_t override
Gets the count of polytope of the given type.
auto getBoundary() const -> FaceIterator override
Gets a FaceIterator for the boundary faces.
auto getInterface() const -> FaceIterator override
Gets a FaceIterator for the interface faces.
auto getCell(Index idx = 0) const -> CellIterator override
Gets an CellIterator to the cells of the mesh.
auto getFace(Index idx = 0) const -> FaceIterator override
Gets a FaceIterator to the faces of the mesh.
auto getVertex(Index idx = 0) const -> VertexIterator override
Gets a VertexIterator to the vertices of the mesh.
auto getPolytope(size_t dimension, Index idx = 0) const -> PolytopeIterator override
Gets a PolytopeIterator to the polytopes of the given dimension of the mesh.
auto isSubMesh() const -> bool override
Indicates whether the mesh is a submesh or not.
auto isBoundary(Index faceIdx) const -> bool override
Determines whether a face of the mesh is on the boundary.
auto getDimension() const -> size_t override
Gets the dimension of the cells.
auto getSpaceDimension() const -> size_t override
Gets the dimension of the ambient space.
auto getGeometry(size_t dimension, Index idx) const -> Polytope::Type override
auto getAttribute(size_t dimension, Index index) const -> Attribute override
auto getConnectivity() -> Connectivity<Context>& override
Gets a reference to the mesh connectivity.
auto getConnectivity() const -> const Connectivity<Context>& override
Gets a constant reference to the mesh connectivity.
auto getVertexCoordinates(Index idx) const -> Eigen::Map<const Math::SpatialVector<Real>> override
Gets the space coordinates of the vertex at the given index.
auto getAttributes(size_t d) const -> const FlatSet<Attribute>& override
Gets the labels of the domain cells in the mesh.
auto setAttribute(const std::pair<size_t, Index>& p, Attribute attr) -> Mesh& override
auto setVertexCoordinates(Index idx, Real s, size_t i) -> Mesh& override
Sets the space coordinate of the vertex at the given index for the given coordinate index.
auto setVertexCoordinates(Index idx, const Math::SpatialVector<Real>& coords) -> Mesh& override
Sets the space coordinate of the vertex at the given index for the given coordinate index.
auto getPolytopeTransformation(size_t dimension, Index idx) const -> const PolytopeTransformation& override
Gets the PolytopeTransformation associated to the $ (d, i) $ -polytope.

Function documentation

template<> template<class FunctionDerived>
Mesh& Rodin::Geometry::Mesh<Context::Sequential>::displace(const Variational::FunctionBase<FunctionDerived>& u)

Displaces the mesh nodes by the displacement $ u $ .

Parameters
in Displacement at each node
Returns Reference to this (for method chaining)

Given a vector valued function $ \vec{u} $ , the method will perform the displacement

\[ x \mapsto x + \vec{u}(x) \]

at each node $ x $ of the mesh.

template<>
SubMesh<Context> Rodin::Geometry::Mesh<Context::Sequential>::skin() const virtual

Skins the mesh to obtain its boundary mesh.

Returns SubMesh object to the boundary region of the mesh

This function "skins" the mesh to return the boundary as a new SubMesh object. The resulting mesh will be embedded in the original space dimension.

The lower dimensional polytopes of dimension $ 1 \leq d \leq D - 2 $ are included if the connectivity $ (D - 1) \longrightarrow d $ is already computed in the mesh.

template<>
SubMesh<Context> Rodin::Geometry::Mesh<Context::Sequential>::trim(Attribute attr) const virtual

Trims the cells with the given attribute.

Parameters
attr in Attribute to trim
Returns SubMesh of the remaining region mesh

Convenience function to call trim(const std::FlatSet<Attribute>&) with only one attribute.

template<>
SubMesh<Context> Rodin::Geometry::Mesh<Context::Sequential>::trim(const FlatSet<Attribute>& attrs) const virtual

Trims the cells with the given attribute.

Parameters
attrs in Attributes to trim
Returns SubMesh object to the remaining region of the mesh

This function will trim discard all the cells that have an attribute in the given set of attributes.

The lower dimensional polytopes of dimension $ 1 \leq d \leq D - 1 $ are included if the connectivity $ D \longrightarrow d $ is already computed in the mesh.

template<>
SubMesh<Context> Rodin::Geometry::Mesh<Context::Sequential>::keep(Attribute attr) const virtual

Keeps the cells with the given attribute.

Parameters
attr in Attribute to keep
Returns SubMesh of the remaining region mesh

Convenience function to call keep(const std::FlatSet<Attribute>&) with only one attribute.

template<>
SubMesh<Context> Rodin::Geometry::Mesh<Context::Sequential>::keep(const FlatSet<Attribute>& attrs) const virtual

Trims the cells with the given attributes.

Parameters
attrs in Attributes to trim
Returns SubMesh object to the remaining region of the mesh

This function will trim keep only the cells that have an attribute in the given set of attributes.

The lower dimensional polytopes of dimension $ 1 \leq d \leq D - 1 $ are included if the connectivity $ D \longrightarrow d $ is already computed in the mesh.

template<>
Mesh& Rodin::Geometry::Mesh<Context::Sequential>::load(const boost::filesystem::path& filename, IO::FileFormat fmt = IO::FileFormat::MFEM) override

Loads a mesh from file in the given format.

Parameters
filename in Name of file to read
fmt in Mesh file format
Returns Reference to this (for method chaining)

template<>
void Rodin::Geometry::Mesh<Context::Sequential>::save(const boost::filesystem::path& filename, IO::FileFormat fmt = IO::FileFormat::MFEM, size_t precison = 16) const override

Saves a mesh to file in the given format.

Parameters
filename in Name of file to write
fmt in Mesh file format
precison
Returns Reference to this (for method chaining)

template<>
size_t Rodin::Geometry::Mesh<Context::Sequential>::getPolytopeCount(size_t dimension) const override

Gets the count of polytope of the given dimension.

Parameters
dimension in Polytope dimension

template<>
PolytopeIterator Rodin::Geometry::Mesh<Context::Sequential>::getPolytope(size_t dimension, Index idx = 0) const override

Gets a PolytopeIterator to the polytopes of the given dimension of the mesh.

Parameters
dimension in Polytope dimension
idx

template<>
bool Rodin::Geometry::Mesh<Context::Sequential>::isSubMesh() const override

Indicates whether the mesh is a submesh or not.

Returns True if mesh is a submesh, false otherwise.

A Mesh which is also a SubMesh may be casted into down to access the SubMesh functionality. For example:

if (mesh.isSubMesh())
{
  // Cast is well defined
  auto& submesh = static_cast<SubMesh&>(mesh);
}

template<>
size_t Rodin::Geometry::Mesh<Context::Sequential>::getDimension() const override

Gets the dimension of the cells.

Returns Dimension of the cells.

template<>
size_t Rodin::Geometry::Mesh<Context::Sequential>::getSpaceDimension() const override

Gets the dimension of the ambient space.

Returns Dimension of the space which the mesh is embedded in

template<>
Polytope::Type Rodin::Geometry::Mesh<Context::Sequential>::getGeometry(size_t dimension, Index idx) const override

Parameters
dimension
idx in Polytope index

Gets the geometry type of the $ (d, i) $ -polytope.

template<>
Attribute Rodin::Geometry::Mesh<Context::Sequential>::getAttribute(size_t dimension, Index index) const override

Gets the attribute of the $ (d, i) $ -polytope.

template<>
Eigen::Map<const Math::SpatialVector<Real>> Rodin::Geometry::Mesh<Context::Sequential>::getVertexCoordinates(Index idx) const override

Gets the space coordinates of the vertex at the given index.

Parameters
idx in Vertex index

template<>
const FlatSet<Attribute>& Rodin::Geometry::Mesh<Context::Sequential>::getAttributes(size_t d) const override

Gets the labels of the domain cells in the mesh.

Returns Set of all the attributes in the mesh object.

template<>
Mesh& Rodin::Geometry::Mesh<Context::Sequential>::setAttribute(const std::pair<size_t, Index>& p, Attribute attr) override

Parameters
in Pair indicating polytope dimension and index
attr in Attribute of polytope

Sets the attribute of the $ (d, i) $ -polytope.

template<>
Mesh& Rodin::Geometry::Mesh<Context::Sequential>::setVertexCoordinates(Index idx, Real s, size_t i) override

Sets the space coordinate of the vertex at the given index for the given coordinate index.

Parameters
idx in Vertex index
in New coordinate
in Coordinate index

For example, the following code sets the coordinates of the 0-vertex to $ (0, 5, 10) $ in a mesh embedded in three dimensional space.

Mesh mesh;
// Add vertices...
mesh.setVertexCoordinates(0, 0.0, 0);
mesh.setVertexCoordinates(0, 5.0, 1);
mesh.setVertexCoordinates(0, 10.0, 2);

template<>
Mesh& Rodin::Geometry::Mesh<Context::Sequential>::setVertexCoordinates(Index idx, const Math::SpatialVector<Real>& coords) override

Sets the space coordinate of the vertex at the given index for the given coordinate index.

Parameters
idx in Vertex index
coords in New coordinates

template<>
const PolytopeTransformation& Rodin::Geometry::Mesh<Context::Sequential>::getPolytopeTransformation(size_t dimension, Index idx) const override

Gets the PolytopeTransformation associated to the $ (d, i) $ -polytope.

Parameters
dimension
idx in Polytope index