PetIBM 0.5.4
Toolbox and applications of the immersed-boundary method for distributed-memory architectures
boundary.cpp
Go to the documentation of this file.
1
8#include <petibm/boundary.h>
10
11namespace petibm
12{
13namespace boundary
14{
15// default destructor
17{
18 PetscFunctionBeginUser;
19 PetscErrorCode ierr;
20 PetscBool finalized;
21
22 ierr = PetscFinalized(&finalized); CHKERRV(ierr);
23 if (finalized) return;
24
25 comm = MPI_COMM_NULL;
26} // ~BoundaryBase
27
28PetscErrorCode BoundaryBase::destroy()
29{
30 PetscFunctionBeginUser;
31
32 std::vector<std::vector<type::SingleBoundary>>().swap(bds);
33
34 comm = MPI_COMM_NULL;
35 mpiSize = mpiRank = 0;
36 mesh.reset();
37
38 PetscFunctionReturn(0);
39} // destroy
40
41PetscErrorCode createBoundary(const type::Mesh &mesh, const YAML::Node &node,
42 type::Boundary &boundary)
43{
44 PetscFunctionBeginUser;
45
46 boundary = std::make_shared<BoundarySimple>(mesh, node);
47
48 PetscFunctionReturn(0);
49} // createBoundary
50
51} // end of namespace boundary
52} // end of namespace petibm
boundary::BoundaryBase, type::Boundary, and factory function.
Definition of boundary::BoundarySimple.
PetscMPIInt mpiSize
Size of MPI communicator.
Definition: boundary.h:153
MPI_Comm comm
MPI communicator.
Definition: boundary.h:150
type::Mesh mesh
A shared_ptr to underlying mesh.
Definition: boundary.h:159
virtual ~BoundaryBase()
Default destructor.
Definition: boundary.cpp:16
virtual PetscErrorCode destroy()
Manually destroy data.
Definition: boundary.cpp:28
std::vector< std::vector< type::SingleBoundary > > bds
A 2D vector holding all single boundaries.
Definition: boundary.h:85
PetscMPIInt mpiRank
The rank of this process.
Definition: boundary.h:156
PetscErrorCode createBoundary(const type::Mesh &mesh, const YAML::Node &node, type::Boundary &boundary)
Create a Boundary object.
Definition: boundary.cpp:41
std::shared_ptr< boundary::BoundaryBase > Boundary
Type definition of petibm::type::Boundary.
Definition: boundary.h:175
std::shared_ptr< mesh::MeshBase > Mesh
Type definition of Mesh.
Definition: mesh.h:348
A toolbox for building flow solvers.
Definition: bodypack.h:52