101 virtual PetscErrorCode
destroy();
122 PetscMPIInt &
p)
const = 0;
136 PetscInt &idx)
const = 0;
148 PetscInt &idx)
const = 0;
173 virtual PetscErrorCode
readBody(
const std::string &filepath) = 0;
175 virtual PetscErrorCode
writeBody(
const std::string &filepath) = 0;
227 const std::string &type,
228 const std::string &name,
229 const std::string &filePath,
Base (abstract) class for a pack of bodies.
Base (abstract) class for a single body.
PetscInt nPts
Total number of Lagrangian points.
std::string name
Name of the body.
virtual PetscErrorCode calculateAvgForces(const Vec &f, type::RealVec1D &fAvg) const =0
Calculate the averaged force of this body.
virtual PetscErrorCode writeBody(const std::string &filepath)=0
PetscInt edPt
Global index of the last local Lagrangian point.
MPI_Comm comm
MPI communicator.
PetscMPIInt mpiRank
Rank of the local process.
virtual PetscErrorCode readBody(const std::string &filepath)=0
type::RealVec2D coords0
Initial coordinates of ALL Lagrangian points.
virtual PetscErrorCode findProc(const PetscInt &i, PetscMPIInt &p) const =0
Get the process id owning a given Lagrangian point.
PetscMPIInt mpiSize
Total number of processes.
PetscInt bgPt
Global index of the first local Lagrangian point.
PetscInt dim
Number of dimensions.
virtual PetscErrorCode destroy()
Manually destroy data.
DM da
Parallel layout of the body (as a 1D DMDA object).
PetscErrorCode printInfo() const
Print information about the body.
type::IntVec1D offsetsAllProcs
Offset on each process.
virtual PetscErrorCode getGlobalIndex(const PetscInt &i, const PetscInt &dof, PetscInt &idx) const =0
Get the global index of a Lagrangian point in a DMDA object given its degree of freedom.
type::IntVec2D meshIdx
Index of the closest Eulerian mesh cell for each local Lagrangian point.
virtual PetscErrorCode getGlobalIndex(const MatStencil &s, PetscInt &idx) const =0
Get the global index of a Lagrangian point in a DMDA object given a MatStencil.
type::IntVec1D nLclAllProcs
Vector with the number of local unknowns on each process.
std::string filePath
Path of the file with the body coordinates.
type::RealVec2D coords
Coordinates of ALL Lagrangian points.
SingleBodyBase()=default
Default constructor.
std::string info
String with information about the body.
virtual PetscErrorCode updateMeshIdx(const type::Mesh &mesh)=0
Get the index of closest Eulerian mesh cell for each local Lagrangian point.
PetscInt nLclPts
Local number of Lagrangian points.
virtual ~SingleBodyBase()
Default destructor.
PetscErrorCode createSingleBody(const MPI_Comm &comm, const PetscInt &dim, const std::string &type, const std::string &name, const std::string &filePath, type::SingleBody &body)
Factory function to create a single body.
std::shared_ptr< body::SingleBodyBase > SingleBody
Definition of type::SingleBody.
std::shared_ptr< mesh::MeshBase > Mesh
Type definition of Mesh.
std::vector< IntVec1D > IntVec2D
2D std::vector holding PetscInt.
std::vector< RealVec1D > RealVec2D
2D std::vector holding PetscReal.
std::vector< PetscInt > IntVec1D
1D std::vector holding PetscInt.
std::vector< PetscReal > RealVec1D
1D std::vector holding PetscReal.
Prototype of mesh::MeshBase, type::Mesh, and factory function.
A toolbox for building flow solvers.
Definition of user-defined types for convenience.