49 virtual PetscErrorCode
findProc(
const PetscInt &i, PetscMPIInt &
p)
const;
67 virtual PetscErrorCode
readBody(
const std::string &filepath);
69 virtual PetscErrorCode
writeBody(
const std::string &filepath);
82 PetscErrorCode
init(
const MPI_Comm &
comm,
const PetscInt &
dim,
Base (abstract) class for a single body.
std::string name
Name of the body.
MPI_Comm comm
MPI communicator.
PetscInt dim
Number of dimensions.
std::string filePath
Path of the file with the body coordinates.
An implementation of body::SingleBodyBase that uses point data as input.
virtual PetscErrorCode writeBody(const std::string &filepath)
virtual PetscErrorCode updateMeshIdx(const type::Mesh &mesh)
Get the index of closest Eulerian mesh cell for each local Lagrangian point.
PetscErrorCode createInfoString()
Create a string used to print information about the body.
virtual ~SingleBodyPoints()=default
Default destructor.
PetscErrorCode init(const MPI_Comm &comm, const PetscInt &dim, const std::string &name, const std::string &filePath)
Initialize the body, reading coordinates from given file.
virtual PetscErrorCode getGlobalIndex(const PetscInt &i, const PetscInt &dof, PetscInt &idx) const
Get the global index of a Lagrangian point in a DMDA object given its degree of freedom.
SingleBodyPoints(const MPI_Comm &comm, const PetscInt &dim, const std::string &name, const std::string &filePath)
Constructor. Initialize a single body.
PetscErrorCode createDMDA()
Create a parallel layout (1D DMDA object) of the body.
virtual PetscErrorCode findProc(const PetscInt &i, PetscMPIInt &p) const
Get the process id owning a given Lagrangian point.
virtual PetscErrorCode readBody(const std::string &filepath)
virtual PetscErrorCode calculateAvgForces(const Vec &f, type::RealVec1D &fAvg) const
Calculate the averaged force of this body.
std::shared_ptr< mesh::MeshBase > Mesh
Type definition of Mesh.
std::vector< PetscReal > RealVec1D
1D std::vector holding PetscReal.
A toolbox for building flow solvers.
body::SingleBodyBase, type::SingleBody factory function.