PetIBM 0.5.4
Toolbox and applications of the immersed-boundary method for distributed-memory architectures
|
Objects for meshes and domain decompositions. More...
Namespaces | |
namespace | petibm::mesh |
Collection of classes and utilities regarding mesh. | |
Classes | |
class | petibm::mesh::CartesianMesh |
Class of composite staggered Cartesian mesh. More... | |
class | petibm::mesh::MeshBase |
Base (abstract) class of mesh. More... | |
Typedefs | |
typedef std::shared_ptr< mesh::MeshBase > | petibm::type::Mesh |
Type definition of Mesh. More... | |
Functions | |
PetscErrorCode | petibm::mesh::createMesh (const MPI_Comm &comm, const YAML::Node &node, type::Mesh &mesh) |
Factory function for creating a Mesh object. More... | |
Objects for meshes and domain decompositions.
So far, we only have stretched Cartesian mesh in our code. However, in order to consider future extension of different kinds of mesh, we still design a base (abstract) class, MeshBase, to unify the interfaces of potential mesh classes. Currently, there is only a child derived from the base class: CartesianMesh.
The design of PetIBM is to use std::shared_ptr
to hold the base class for instances of different kinds of derived classes, so that we can call the public APIs regardless the types of the derived classes. Mesh is defined as a shared pointer to MeshBase. Users should use Mesh instead of using classes directly. And users should also initialize mesh instances with the factory function, createMesh, instead of initializing the instances directly.
The domain decomposition is done with PETSc DMDA objects. And the information of sub-domains are retrieved into mesh classes.
typedef std::shared_ptr<mesh::MeshBase> petibm::type::Mesh |
Type definition of Mesh.
Please use petibm::mesh::createMesh to create a Mesh object.
Example usage:
PetscErrorCode petibm::mesh::createMesh | ( | const MPI_Comm & | comm, |
const YAML::Node & | node, | ||
type::Mesh & | mesh | ||
) |
Factory function for creating a Mesh object.
comm | [in] MPI Communicator. |
node | [in] YAML configuration node. |
mesh | [out] Structured Cartesian mesh object. |
This function will look into the key mesh
in node
for mesh settings. An example of 2D stretched Cartesian mesh settings in the YAML node is shown as the following:
Or in an ASCII YAML file:
We then pass this YAML node into the factory function: