14#include <petscdmcomposite.h>
17#include <yaml-cpp/yaml.h>
150 MeshBase(
const MPI_Comm &world,
const YAML::Node &node){};
156 virtual PetscErrorCode
destroy();
166 virtual PetscErrorCode
write(
const std::string &filePath)
const = 0;
180 virtual PetscErrorCode
getLocalIndex(
const PetscInt &f,
const MatStencil &s,
181 PetscInt &idx)
const = 0;
196 const PetscInt &j,
const PetscInt &k,
197 PetscInt &idx)
const = 0;
211 PetscInt &idx)
const = 0;
228 const PetscInt &j,
const PetscInt &k,
229 PetscInt &idx)
const = 0;
244 PetscInt &idx)
const = 0;
262 const PetscInt &j,
const PetscInt &k,
263 PetscInt &idx)
const = 0;
280 PetscInt &idx)
const = 0;
302 PetscInt &idx)
const = 0;
317 virtual PetscErrorCode
init(
const MPI_Comm &world,
318 const YAML::Node &node) = 0;
348typedef std::shared_ptr<mesh::MeshBase>
Mesh;
420PetscErrorCode
createMesh(
const MPI_Comm &comm,
const YAML::Node &node,
Base (abstract) class of mesh.
type::RealVec1D max
Maximum coordinates of boundaries in all directions.
type::IntVec2D n
Total number of points of all fields and in all directions.
virtual PetscErrorCode destroy()
Manually destroy data.
DM UPack
DMComposte of velocity DMs.
MPI_Comm comm
Communicator.
virtual PetscErrorCode write(const std::string &filePath) const =0
Write the mesh object into a HDF5 file.
type::IntVec2D ed
The ending index of all fields in all directions of this process.
virtual PetscErrorCode getLocalIndex(const PetscInt &f, const PetscInt &i, const PetscInt &j, const PetscInt &k, PetscInt &idx) const =0
Get the local index of a point by providing i, j, and k.
std::string info
A string for printing information.
PetscMPIInt mpiRank
Rank of this process.
virtual PetscErrorCode getPackedGlobalIndex(const PetscInt &f, const MatStencil &s, PetscInt &idx) const =0
Get the global index of a point in packed DM by providing MatStencil.
type::IntVec2D bg
The beginning index of all fields in all directions of this process.
virtual PetscBool isPointOnLocalProc(const type::RealVec1D &point, const type::Field &field)=0
PetscInt UNLocal
Total number of velocity points local to this process.
virtual PetscErrorCode getNaturalIndex(const PetscInt &f, const MatStencil &s, PetscInt &idx) const =0
Get the natural index of a point by providing MatStencil.
type::IntVec1D nProc
Number of processes in all directions.
virtual PetscErrorCode getNaturalIndex(const PetscInt &f, const PetscInt &i, const PetscInt &j, const PetscInt &k, PetscInt &idx) const =0
Get the natural index of a point by providing i, j, and k.
type::GhostedVec3D coord
Coordinates of mesh points of all fields and in all directions.
virtual ~MeshBase()
Default destructor.
PetscErrorCode printInfo() const
Print information to standard output.
MeshBase()=default
Default constructor.
virtual PetscErrorCode getGlobalIndex(const PetscInt &f, const PetscInt &i, const PetscInt &j, const PetscInt &k, PetscInt &idx) const =0
Get the global index of a point in unpacked DM by providing i, j, and k.
PetscInt UN
Total number of velocity points.
MeshBase(const MPI_Comm &world, const YAML::Node &node)
Constructor.
type::GhostedVec3D dL
Spacings of mesh points of all fields and in all directions.
PetscMPIInt mpiSize
Total number of processes.
PetscInt pNLocal
Total number of pressure points local to this process.
virtual PetscErrorCode getLocalIndex(const PetscInt &f, const MatStencil &s, PetscInt &idx) const =0
Get the local index of a point by providing MatStencil.
virtual PetscErrorCode init(const MPI_Comm &world, const YAML::Node &node)=0
Initialization.
std::vector< DM > da
A vector of DMs of all fields.
type::RealVec1D min
Minimum coordinates of boundaries in all directions.
type::BoolVec2D periodic
Bools indicating if any direction is periodic.
PetscInt pN
Total number of pressure points.
type::IntVec2D m
The number of points of all fields in all directions of this process.
virtual PetscErrorCode getPackedGlobalIndex(const PetscInt &f, const PetscInt &i, const PetscInt &j, const PetscInt &k, PetscInt &idx) const =0
Get the global index of a point in packed DM by providing i, j, and k.
virtual PetscErrorCode getGlobalIndex(const PetscInt &f, const MatStencil &s, PetscInt &idx) const =0
Get the global index of a point in unpacked DM by providing MatStencil.
std::shared_ptr< mesh::MeshBase > Mesh
Type definition of Mesh.
PetscErrorCode createMesh(const MPI_Comm &comm, const YAML::Node &node, type::Mesh &mesh)
Factory function for creating a Mesh object.
std::vector< IntVec1D > IntVec2D
2D std::vector holding PetscInt.
std::vector< BoolVec1D > BoolVec2D
2D std::vector holding PetscBool.
std::vector< PetscInt > IntVec1D
1D std::vector holding PetscInt.
std::vector< PetscReal > RealVec1D
1D std::vector holding PetscReal.
std::vector< GhostedVec2D > GhostedVec3D
a vector of vector pointers to mimic ghosted 2D vectors. type
A toolbox for building flow solvers.
Definition of user-defined types for convenience.