PetIBM 0.5.4
Toolbox and applications of the immersed-boundary method for distributed-memory architectures
|
Base (abstract) class for a pack of bodies. More...
#include <bodypack.h>
Public Member Functions | |
BodyPackBase ()=default | |
Default constructor. More... | |
BodyPackBase (const MPI_Comm &comm, const PetscInt &dim, const YAML::Node &node) | |
Constructor. Initialize the pack of bodies. More... | |
virtual | ~BodyPackBase () |
Default destructor. More... | |
virtual PetscErrorCode | destroy () |
Manually destroy data. More... | |
PetscErrorCode | printInfo () const |
Print information about the bodies. More... | |
PetscErrorCode | findProc (const PetscInt &bIdx, const PetscInt &ptIdx, PetscMPIInt &proc) const |
Find which process owns the target Lagrangian point of target body. More... | |
PetscErrorCode | getGlobalIndex (const PetscInt &bIdx, const PetscInt &ptIdx, const PetscInt &dof, PetscInt &idx) const |
Find unpacked global index of a DoF of Lagrangian point of a body. More... | |
PetscErrorCode | getGlobalIndex (const PetscInt &bIdx, const MatStencil &s, PetscInt &idx) const |
Find unpacked global index of a DoF of Lagrangian point of a body. More... | |
PetscErrorCode | getPackedGlobalIndex (const PetscInt &bIdx, const PetscInt &ptIdx, const PetscInt &dof, PetscInt &idx) const |
Find packed global index of a DoF of Lagrangian point of a body. More... | |
PetscErrorCode | getPackedGlobalIndex (const PetscInt &bIdx, const MatStencil &s, PetscInt &idx) const |
Find packed global index of a DoF of Lagrangian point of a body. More... | |
PetscErrorCode | calculateAvgForces (const Vec &f, type::RealVec2D &fAvg) |
Calculate the averaged force of each body. More... | |
PetscErrorCode | updateMeshIdx (const type::Mesh &mesh) |
Get the index of closest Eulerian mesh cell for each local Lagrangian point. More... | |
Public Attributes | |
PetscInt | dim |
Dimension. More... | |
PetscInt | nBodies |
Number of bodies in this pack. More... | |
PetscInt | nPts |
Total number of Lagrangian points. More... | |
PetscInt | nLclPts |
Total number of local Lagrangian points. More... | |
std::vector< type::SingleBody > | bodies |
Vector of SingleBody objects. More... | |
DM | dmPack |
DMComposite of DMDA objects of all SingleBody objects. More... | |
std::string | info |
String used to print information. More... | |
Protected Member Functions | |
PetscErrorCode | init (const MPI_Comm &comm, const PetscInt &dim, const YAML::Node &node) |
Initialize the pack of bodies. More... | |
PetscErrorCode | createDmPack () |
Create DMComposite object for all bodies. More... | |
PetscErrorCode | createInfoString () |
Create a string used to print information. More... | |
Protected Attributes | |
MPI_Comm | comm |
Reference to the MPI communicator. More... | |
PetscMPIInt | mpiSize |
Total number of processes. More... | |
PetscMPIInt | mpiRank |
Rank of the local process. More... | |
type::IntVec1D | nLclAllProcs |
Number of local packed variables of all processes. More... | |
type::IntVec1D | offsetsAllProcs |
Offsets of packed variables of all processes. More... | |
Base (abstract) class for a pack of bodies.
This class is designed to be an abstract class though, it actually has full implementations of all members because there is currently no necessary to do otherwise. It's just simply a collection of bodies, though it also deals with indexing of all Lagrangian points in a globally packed Vec.
Definition at line 70 of file bodypack.h.
|
default |
Default constructor.
petibm::body::BodyPackBase::BodyPackBase | ( | const MPI_Comm & | comm, |
const PetscInt & | dim, | ||
const YAML::Node & | node | ||
) |
Constructor. Initialize the pack of bodies.
comm | [in] MPI communicator. |
dim | [in] Number of dimensions. |
node | [in] YAML configuration node. |
Definition at line 15 of file bodypack.cpp.
|
virtual |
Default destructor.
Definition at line 21 of file bodypack.cpp.
PetscErrorCode petibm::body::BodyPackBase::calculateAvgForces | ( | const Vec & | f, |
type::RealVec2D & | fAvg | ||
) |
Calculate the averaged force of each body.
f | [in] Packed force Vec of Lagrangian points. |
fAvg | [out] Averaged force for each body. |
Note: if fAvg
doesn't have the correct size, the function will resize it.
Definition at line 298 of file bodypack.cpp.
|
protected |
Create DMComposite object for all bodies.
Definition at line 144 of file bodypack.cpp.
|
protected |
Create a string used to print information.
Definition at line 174 of file bodypack.cpp.
|
virtual |
Manually destroy data.
Definition at line 35 of file bodypack.cpp.
PetscErrorCode petibm::body::BodyPackBase::findProc | ( | const PetscInt & | bIdx, |
const PetscInt & | ptIdx, | ||
PetscMPIInt & | proc | ||
) | const |
Find which process owns the target Lagrangian point of target body.
bIdx | [in] Index of target body. |
ptIdx | [in] Index of target point. |
proc | [out] Process index. |
Definition at line 211 of file bodypack.cpp.
PetscErrorCode petibm::body::BodyPackBase::getGlobalIndex | ( | const PetscInt & | bIdx, |
const MatStencil & | s, | ||
PetscInt & | idx | ||
) | const |
Find unpacked global index of a DoF of Lagrangian point of a body.
bIdx | [in] Index of target body. |
s | [in] PETSc MatStencil object of target point. |
idx | [out] Unpacked global index. |
Definition at line 248 of file bodypack.cpp.
PetscErrorCode petibm::body::BodyPackBase::getGlobalIndex | ( | const PetscInt & | bIdx, |
const PetscInt & | ptIdx, | ||
const PetscInt & | dof, | ||
PetscInt & | idx | ||
) | const |
Find unpacked global index of a DoF of Lagrangian point of a body.
bIdx | [in] Index of target body. |
ptIdx | [in] Index of target point. |
dof | [in] Index of target DoF. |
idx | [out] Unpacked global index. |
Definition at line 229 of file bodypack.cpp.
PetscErrorCode petibm::body::BodyPackBase::getPackedGlobalIndex | ( | const PetscInt & | bIdx, |
const MatStencil & | s, | ||
PetscInt & | idx | ||
) | const |
Find packed global index of a DoF of Lagrangian point of a body.
bIdx | [in] Index of target body. |
s | [in] PETSc MatStencil object of target point. |
idx | [in] Packed global index. |
Definition at line 285 of file bodypack.cpp.
PetscErrorCode petibm::body::BodyPackBase::getPackedGlobalIndex | ( | const PetscInt & | bIdx, |
const PetscInt & | ptIdx, | ||
const PetscInt & | dof, | ||
PetscInt & | idx | ||
) | const |
Find packed global index of a DoF of Lagrangian point of a body.
bIdx | [in] Index of target body. |
ptIdx | [in] Index of target point. |
dof | [in] Index of target DoF. |
idx | [out] Packed global index. |
Definition at line 261 of file bodypack.cpp.
|
protected |
Initialize the pack of bodies.
comm | [in] MPI communicator. |
dim | [in] Number of dimensions. |
node | [in] YAML configuration node. |
Definition at line 55 of file bodypack.cpp.
PetscErrorCode petibm::body::BodyPackBase::printInfo | ( | ) | const |
Print information about the bodies.
Definition at line 195 of file bodypack.cpp.
PetscErrorCode petibm::body::BodyPackBase::updateMeshIdx | ( | const type::Mesh & | mesh | ) |
Get the index of closest Eulerian mesh cell for each local Lagrangian point.
mesh | [in] Structured Cartesian mesh. |
Definition at line 160 of file bodypack.cpp.
std::vector<type::SingleBody> petibm::body::BodyPackBase::bodies |
Vector of SingleBody objects.
Definition at line 86 of file bodypack.h.
|
protected |
Reference to the MPI communicator.
Definition at line 222 of file bodypack.h.
PetscInt petibm::body::BodyPackBase::dim |
Dimension.
Definition at line 74 of file bodypack.h.
DM petibm::body::BodyPackBase::dmPack |
DMComposite of DMDA objects of all SingleBody objects.
Definition at line 89 of file bodypack.h.
std::string petibm::body::BodyPackBase::info |
String used to print information.
Definition at line 92 of file bodypack.h.
|
protected |
Rank of the local process.
Definition at line 228 of file bodypack.h.
|
protected |
Total number of processes.
Definition at line 225 of file bodypack.h.
PetscInt petibm::body::BodyPackBase::nBodies |
Number of bodies in this pack.
Definition at line 77 of file bodypack.h.
|
protected |
Number of local packed variables of all processes.
Definition at line 231 of file bodypack.h.
PetscInt petibm::body::BodyPackBase::nLclPts |
Total number of local Lagrangian points.
Definition at line 83 of file bodypack.h.
PetscInt petibm::body::BodyPackBase::nPts |
Total number of Lagrangian points.
Definition at line 80 of file bodypack.h.
|
protected |
Offsets of packed variables of all processes.
Definition at line 234 of file bodypack.h.