44 #include "Util/CFL.hpp"
45 #include "leanvtk/leanvtk.hpp"
207 void setup(
int number,
217 shared_ptr<ofstream> outfile);
232 void addRod(
Rod* rod,
vec6 coords);
244 void initializeUnfreeBody(
vec6 r = vec6::Zero(),
245 vec6 rd = vec6::Zero(),
246 vec6 rdd = vec6::Zero());
265 std::pair<XYZQuat, vec6> initialize();
269 const auto [pos, vel] = initialize();
270 r.row(0).head<7>() = pos.toVec7();
271 r.row(0).tail<6>() = vel;
299 void setDependentStates();
316 return std::make_pair(r7, v6);
340 return v6(Eigen::seqN(3, 3));
346 const vec6 getFnet()
const;
384 void updateFairlead(
real time);
408 void Output(
real time);
413 inline const size_t stateN()
const {
return 1; }
431 std::vector<uint64_t> Serialize(
void);
439 uint64_t* Deserialize(
const uint64_t* data);
445 void saveVTK(
const char* filename);
452 const leanvtk::VTPWriter*
getVTK()
const {
return &vtk; }
455 leanvtk::VTPWriter vtk;
#define DECLDIR
Prefix to export C functions on the compiled library.
Definition: MoorDynAPI.h:68
A rigid body.
Definition: Body.hpp:72
types
Types of bodies.
Definition: Body.hpp:153
const vec getVelocity() const
Get the body velocity.
Definition: Body.hpp:333
const size_t stateN() const
Get the number of state variables required by this instance.
Definition: Body.hpp:413
vec6 rd_ves
fairlead velocity for coupled bodies [x/y/z]
Definition: Body.hpp:130
EnvCondRef env
Global struct that holds environmental settings.
Definition: Body.hpp:86
size_t bodyId
Body ID.
Definition: Body.hpp:187
const leanvtk::VTPWriter * getVTK() const
Get the VTK writer.
Definition: Body.hpp:452
vec6 bodyCdA
The product of the drag coefficient and the frontal area (m^2)
Definition: Body.hpp:114
void initializeBody(XYZQuat r=XYZQuat::Zero(), vec6 rd=vec6::Zero())
Initialize the free body.
std::vector< vec6 > r6RodRel
Attachment points of each rod.
Definition: Body.hpp:99
std::vector< Rod * > attachedR
Rods attached to this body.
Definition: Body.hpp:94
real bodyV
The volume.
Definition: Body.hpp:110
void setWaves(moordyn::WavesRef waves_in)
Set the environmental data.
Definition: Body.hpp:292
const vec getAngles() const
Get the body Euler XYZ angles.
Definition: Body.hpp:327
real bodyM
The mass.
Definition: Body.hpp:108
static string TypeName(types t)
Return a string with the name of a type.
Definition: Body.hpp:171
vec6 body_r6
The reference point.
Definition: Body.hpp:104
WavesRef waves
global Waves object
Definition: Body.hpp:88
void scaleDrag(real scaler)
Scale the drag coefficients.
Definition: Body.hpp:364
vec6 F6net
total force and moment vector on body
Definition: Body.hpp:135
vec6 bodyCa
The added mass coefficients.
Definition: Body.hpp:116
vec6 a6
body 6dof acceleration[x/y/z]
Definition: Body.hpp:125
vec body_rCG
The center of gravity.
Definition: Body.hpp:106
void initialize(InstanceStateVarView r)
Initialize a free instance.
Definition: Body.hpp:267
vec6 v6
body 6dof velocity[x/y/z]
Definition: Body.hpp:123
const vec getPosition() const
Get the body position.
Definition: Body.hpp:322
const size_t stateDims() const
Get the dimension of the state variable.
Definition: Body.hpp:420
XYZQuat r7
body 6dof position [x/y/z]
Definition: Body.hpp:120
const mat6 & getM() const
Get the mass and intertia matrix.
Definition: Body.hpp:351
vec6 r_ves
fairlead position for coupled bodies [x/y/z]
Definition: Body.hpp:128
std::vector< vec > rPointRel
Attachment points of each point.
Definition: Body.hpp:97
mat6 M
total body mass + added mass matrix including all elements
Definition: Body.hpp:138
mat6 M0
Definition: Body.hpp:141
std::vector< moordyn::Point * > attachedP
Points attached to this body.
Definition: Body.hpp:92
vec bodyI
The inertia diagonal components.
Definition: Body.hpp:112
vec6 rdd_ves
fairlead acceleration for coupled bodies [x/y/z]
Definition: Body.hpp:132
std::pair< XYZQuat, vec6 > getState() const
Get the body kinematics.
Definition: Body.hpp:314
ofstream * outfile
Pointer to moordyn::MoorDyn::outfileMain.
Definition: Body.hpp:148
types type
Type of body.
Definition: Body.hpp:191
vec6 getUnfreeVel() const
Get the last setted velocity for an unfree body.
Definition: Body.hpp:254
void getState(XYZQuat &pos, vec6 &vel) const
Get the body kinematics.
Definition: Body.hpp:305
const vec getAngularVelocity() const
Get the body angular velocity.
Definition: Body.hpp:338
int number
Body number.
Definition: Body.hpp:189
mat OrMat
Definition: Body.hpp:145
A generic instance.
Definition: Instance.hpp:55
A Logging utility.
Definition: Log.hpp:149
A point for a line endpoint.
Definition: Point.hpp:69
A cylindrical rod.
Definition: Rod.hpp:65
MoorDyn2 C++ API namespace.
Definition: Body.cpp:27
vec3 vec
vec3 renaming
Definition: Misc.hpp:130
std::shared_ptr< Waves > WavesRef
Definition: Body.hpp:53
Eigen::Block< InstanceStateVar, Eigen::Dynamic > InstanceStateVarView
View of the State variables for a particular instance.
Definition: Misc.hpp:167
Eigen::Vector6d vec6
6-D vector of real numbers
Definition: Misc.hpp:126
Eigen::Matrix6d mat6
6x6 matrix of real numbers
Definition: Misc.hpp:138
double real
Real numbers wrapper. It is either double or float.
Definition: Misc.hpp:118
mat3 mat
mat3 renaming
Definition: Misc.hpp:142
Definition: Misc.hpp:1292
Joint of a point and a quaternion.
Definition: Misc.hpp:304