MoorDyn
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
moordyn::Point Class Referencefinal

A point for a line endpoint. More...

#include <Point.hpp>

Inheritance diagram for moordyn::Point:
Inheritance graph
[legend]
Collaboration diagram for moordyn::Point:
Collaboration graph
[legend]

Classes

struct  _attachment
 Attached lines to the point. More...
 

Public Types

enum  types {
  COUPLED = -1 , FREE = 0 , FIXED = 1 , VESSEL = COUPLED ,
  FAIRLEAD = COUPLED , POINT = FREE , ANCHOR = FIXED
}
 Types of points. More...
 
typedef struct moordyn::Point::_attachment attachment
 Attached lines to the point.
 

Public Member Functions

 Point (moordyn::Log *log, size_t id)
 Constructor. More...
 
 ~Point ()
 Destructor.
 
void setTime (real time)
 Set the line simulation time. More...
 
void setup (int number_in, types type_in, vec r0_in, double M_in, double V_in, vec F_in, double CdA_in, double Ca_in, EnvCondRef env_in)
 Setup the point. More...
 
void addLine (moordyn::Line *theLine, EndPoints end_point)
 Attach a line endpoint to this point. More...
 
EndPoints removeLine (Line *line)
 Detach a line. More...
 
std::vector< attachmentgetLines () const
 Get the list of attachments. More...
 
std::pair< vec, vecinitialize ()
 Initialize the FREE point state. More...
 
void initialize (InstanceStateVarView r)
 Initialize a free instance. More...
 
const vecgetPosition () const
 Get the point position. More...
 
const vecgetVelocity () const
 Get the point velocity. More...
 
void getState (vec &r_out, vec &rd_out)
 Get the point state. More...
 
std::pair< vec, vecgetState ()
 Get the point state. More...
 
void getFnet (vec &Fnet_out) const
 Get the force on the point. More...
 
const vecgetFnet () const
 Get the force on the point. More...
 
void getM (mat &M_out) const
 Get the mass matrix. More...
 
const matgetM () const
 Get the mass matrix. More...
 
real GetPointOutput (OutChanProps outChan)
 Get the output. More...
 
void setWaves (moordyn::WavesRef waves_in, moordyn::SeafloorRef seafloor_in)
 Set the environmental data. More...
 
void scaleDrag (real scaler)
 Multiply the drag by a factor. More...
 
void initiateStep (vec rFairIn, vec rdFairIn)
 Initialize the time step integration. More...
 
void updateFairlead (real time)
 Take the kinematics from the fairlead information. More...
 
void setKinematics (vec r_in, vec rd_in)
 Take the kinematics from the fairlead information. More...
 
- Public Member Functions inherited from moordyn::Instance
 Instance (moordyn::Log *log)
 Costructor. More...
 
virtual ~Instance ()=default
 Destructor.
 
const size_t id () const
 Get the unique identifier of this instance. More...
 
- Public Member Functions inherited from moordyn::io::IO
 IO (moordyn::Log *log)
 Costructor. More...
 
virtual ~IO ()=default
 Destructor.
 
void Save (const std::string filepath)
 Save the entity into a file. More...
 
void Load (const std::string filepath)
 Loads the entity from a file. More...
 
- Public Member Functions inherited from moordyn::LogUser
 LogUser (Log *log=NULL)
 Constructor. More...
 
 ~LogUser ()
 Destructor.
 
void SetLogger (Log *log)
 Set the log handler. More...
 
LogGetLogger () const
 Get the log handler. More...
 

Static Public Member Functions

static string TypeName (types t)
 Return a string with the name of a type. More...
 

Public Attributes

size_t pointId
 Point ID.
 
int number
 Point number.
 
types type
 Point type.
 
void setState (vec pos, vec vel)
 Set the state variables. More...
 
void setState (const InstanceStateVarView r)
 Set the point state. More...
 
void getStateDeriv (InstanceStateVarView drdt)
 Calculate the forces and state derivatives of the point. More...
 
void getNetForceAndMass (vec6 &Fnet_out, mat6 &M_out, vec rBody=vec::Zero(), vec6 vBody=vec6::Zero())
 Calculate the force and mass contributions of the point on the parent body. More...
 
moordyn::error_id doRHS ()
 Calculates the forces and mass on the point, including from attached lines. More...
 
const size_t stateN () const
 Get the number of state variables required by this instance. More...
 
const size_t stateDims () const
 Get the dimension of the state variable. More...
 
std::vector< uint64_t > Serialize (void)
 Produce the packed data to be saved. More...
 
uint64_t * Deserialize (const uint64_t *data)
 Unpack the data to restore the Serialized information. More...
 
void saveVTK (const char *filename)
 Save the point on a VTK (.vtp) file. More...
 
const leanvtk::VTPWriter * getVTK () const
 Get the VTK writer. More...
 

Additional Inherited Members

- Protected Member Functions inherited from moordyn::io::IO
ofstream MakeFile (const std::string filepath) const
 Create an output file and write the MoorDyn magic header. More...
 
std::tuple< uint64_t, uint64_t * > LoadFile (const std::string filepath) const
 Open an input file and load the data. More...
 
uint64_t Serialize (const uint64_t &i)
 Pack an unsigned integer to make it writable. More...
 
uint64_t Serialize (const int64_t &i)
 Pack an integer to make it writable. More...
 
uint64_t Serialize (const real &f)
 Pack a float to make it writable. More...
 
std::vector< uint64_t > Serialize (const vec &m)
 Pack a 3D vector to make it writable. More...
 
std::vector< uint64_t > Serialize (const vec6 &m)
 Pack a 6D vector to make it writable. More...
 
std::vector< uint64_t > Serialize (const mat &m)
 Pack a 3x3 matrix to make it writable. More...
 
std::vector< uint64_t > Serialize (const mat6 &m)
 Pack a 6x6 matrix to make it writable. More...
 
std::vector< uint64_t > Serialize (const quaternion &m)
 Pack a quaternion to make it writable. More...
 
std::vector< uint64_t > Serialize (const XYZQuat &m)
 Pack an XYZQuat to make it writable. More...
 
std::vector< uint64_t > Serialize (const std::vector< real > &l)
 Pack a list of floating point numbers to make it writable. More...
 
std::vector< uint64_t > Serialize (const std::vector< vec > &l)
 Pack a list of 3D vectors to make it writable. More...
 
std::vector< uint64_t > Serialize (const std::vector< vec6 > &l)
 Pack a list of 6D vectors to make it writable. More...
 
std::vector< uint64_t > Serialize (const std::vector< mat > &l)
 Pack a list of 3x3 matrices to make it writable. More...
 
std::vector< uint64_t > Serialize (const std::vector< mat6 > &l)
 Pack a list of 6x6 matrices to make it writable. More...
 
std::vector< uint64_t > Serialize (const Eigen::Matrix< real, Eigen::Dynamic, Eigen::Dynamic > &l)
 Pack an arbitrarily large matrix. More...
 
template<typename T >
std::vector< uint64_t > Serialize (const std::vector< std::vector< T >> &l)
 Pack a list of lists to make it writable This function might act recursively. More...
 
uint64_t * Deserialize (const uint64_t *in, uint64_t &out)
 Unpack a loaded unsigned integer. More...
 
uint64_t * Deserialize (const uint64_t *in, int64_t &out)
 Unpack a loaded integer. More...
 
uint64_t * Deserialize (const uint64_t *in, real &out)
 Unpack a loaded floating point number. More...
 
uint64_t * Deserialize (const uint64_t *in, vec &out)
 Unpack a loaded 3D vector. More...
 
uint64_t * Deserialize (const uint64_t *in, vec6 &out)
 Unpack a loaded 6D vector. More...
 
uint64_t * Deserialize (const uint64_t *in, mat &out)
 Unpack a loaded 3x3 matrix. More...
 
uint64_t * Deserialize (const uint64_t *in, mat6 &out)
 Unpack a loaded 6x6 matrix. More...
 
uint64_t * Deserialize (const uint64_t *in, quaternion &out)
 Unpack a loaded quaternion. More...
 
uint64_t * Deserialize (const uint64_t *in, XYZQuat &out)
 Unpack a loaded XYZQuat. More...
 
uint64_t * Deserialize (const uint64_t *in, std::vector< real > &out)
 Unpack a loaded list of floating point numbers. More...
 
uint64_t * Deserialize (const uint64_t *in, std::vector< vec > &out)
 Unpack a loaded list of 3D vectors. More...
 
uint64_t * Deserialize (const uint64_t *in, std::vector< vec6 > &out)
 Unpack a loaded list of 6D vectors. More...
 
uint64_t * Deserialize (const uint64_t *in, std::vector< mat > &out)
 Unpack a loaded list of 3x3 matrices. More...
 
uint64_t * Deserialize (const uint64_t *in, std::vector< mat6 > &out)
 Unpack a loaded list of 6x6 matrices. More...
 
uint64_t * Deserialize (const uint64_t *in, Eigen::Matrix< real, Eigen::Dynamic, Eigen::Dynamic > &out)
 Unpack an arbitrarily large matrix. More...
 
template<typename T >
uint64_t * Deserialize (const uint64_t *in, std::vector< std::vector< T >> &out)
 Unpack a loaded list of lists. More...
 
- Protected Attributes inherited from moordyn::LogUser
Log_log
 The log handler.
 

Detailed Description

A point for a line endpoint.

Each line must have 2 points at each endpoint, which are used to define how those points are moving. There are 3 basic types of points:

Member Enumeration Documentation

◆ types

Types of points.

Enumerator
COUPLED 

Is coupled, i.e. is controlled by the user.

FREE 

Is free to move, controlled by MoorDyn.

FIXED 

Is fixed, either to a location or to another moving entity.

Constructor & Destructor Documentation

◆ Point()

moordyn::Point::Point ( moordyn::Log log,
size_t  id 
)

Constructor.

Parameters
logLogging handler
idUnique identifier of this instance

Member Function Documentation

◆ addLine()

void moordyn::Point::addLine ( moordyn::Line theLine,
EndPoints  end_point 
)

Attach a line endpoint to this point.

Parameters
theLineThe line to be attached
end_pointThe line endpoint
Here is the call graph for this function:

◆ Deserialize()

uint64_t * moordyn::Point::Deserialize ( const uint64_t *  data)
virtual

Unpack the data to restore the Serialized information.

This is the inverse of Serialize(void)

Parameters
dataThe packed data
Returns
A pointer to the end of the file, for debugging purposes

Implements moordyn::io::IO.

Here is the call graph for this function:

◆ doRHS()

moordyn::error_id moordyn::Point::doRHS ( )

Calculates the forces and mass on the point, including from attached lines.

Returns
MOORDYN_SUCCESS upon success, an error code otherwise
Here is the caller graph for this function:

◆ getFnet() [1/2]

const vec& moordyn::Point::getFnet ( ) const
inline

Get the force on the point.

Returns
The output force [x,y,z]

◆ getFnet() [2/2]

void moordyn::Point::getFnet ( vec Fnet_out) const
inline

Get the force on the point.

Parameters
Fnet_outThe output force [x,y,z]

◆ getLines()

std::vector<attachment> moordyn::Point::getLines ( ) const
inline

Get the list of attachments.

Returns
The list of attachments

◆ getM() [1/2]

const mat& moordyn::Point::getM ( ) const
inline

Get the mass matrix.

Returns
The mass matrix

◆ getM() [2/2]

void moordyn::Point::getM ( mat M_out) const
inline

Get the mass matrix.

Parameters
M_outThe output mass matrix

◆ getNetForceAndMass()

void moordyn::Point::getNetForceAndMass ( vec6 Fnet_out,
mat6 M_out,
vec  rBody = vec::Zero(),
vec6  vBody = vec6::Zero() 
)

Calculate the force and mass contributions of the point on the parent body.

Parameters
Fnet_outOutput Force about body ref point
M_outOutput Mass matrix about body ref point
rBodyThe body position
vBodyThe body velocity
Here is the call graph for this function:

◆ GetPointOutput()

real moordyn::Point::GetPointOutput ( OutChanProps  outChan)

Get the output.

Parameters
outChanThe query
Returns
The data, 0.0 if no such data can be found

◆ getPosition()

const vec& moordyn::Point::getPosition ( ) const
inline

Get the point position.

Returns
The position [x,y,z]

◆ getState() [1/2]

std::pair<vec, vec> moordyn::Point::getState ( )
inline

Get the point state.

Returns
The position and velocity

◆ getState() [2/2]

void moordyn::Point::getState ( vec r_out,
vec rd_out 
)
inline

Get the point state.

Parameters
r_outThe output position [x,y,z]
rd_outThe output velocity [x,y,z]

◆ getStateDeriv()

void moordyn::Point::getStateDeriv ( InstanceStateVarView  drdt)
virtual

Calculate the forces and state derivatives of the point.

Parameters
drdtThe states derivatives, i.e. the velocity and the acceleration
Exceptions
moordyn::invalid_value_errorIf it is not a FREE point

Implements moordyn::Instance.

Here is the call graph for this function:

◆ getVelocity()

const vec& moordyn::Point::getVelocity ( ) const
inline

Get the point velocity.

Returns
The velocity [x,y,z]

◆ getVTK()

const leanvtk::VTPWriter* moordyn::Point::getVTK ( ) const
inline

Get the VTK writer.

This function is useful for writing multiblock .vtm files

Returns
The VTK .vtu writer

◆ initialize() [1/2]

std::pair< vec, vec > moordyn::Point::initialize ( )

Initialize the FREE point state.

Parameters
rThe output state variable
Returns
The position (first) and the velocity (second)
Exceptions
moordyn::invalid_value_errorIf it is not a FREE point

◆ initialize() [2/2]

void moordyn::Point::initialize ( InstanceStateVarView  r)
inlinevirtual

Initialize a free instance.

Parameters
rThe output state variable
Exceptions
moordyn::invalid_value_errorIf the instance does not have free states. e.g. a coupled body controlled from outside

Implements moordyn::Instance.

◆ initiateStep()

void moordyn::Point::initiateStep ( vec  rFairIn,
vec  rdFairIn 
)

Initialize the time step integration.

Called at the beginning of each coupling step to update the boundary conditions (fairlead kinematics) for the proceeding line time steps

Parameters
rFairInFairlead position
rdFairInFairlead velocity
Exceptions
moordyn::invalid_value_errorIf it is not a COUPLED point
Here is the call graph for this function:

◆ removeLine()

EndPoints moordyn::Point::removeLine ( Line line)

Detach a line.

Parameters
lineThe line
Returns
The line end point that was attached to the point
Exceptions
moordyn::invalid_value_errorIf there is no an attached line with the provided lineID

◆ saveVTK()

void moordyn::Point::saveVTK ( const char *  filename)

Save the point on a VTK (.vtp) file.

Parameters
filenameThe output file name
Exceptions
output_file_errorIf the file cannot be saved

◆ scaleDrag()

void moordyn::Point::scaleDrag ( real  scaler)
inline

Multiply the drag by a factor.

function for boosting drag coefficients during IC generation

Parameters
scalerDrag factor

◆ Serialize()

std::vector< uint64_t > moordyn::Point::Serialize ( void  )
virtual

Produce the packed data to be saved.

The produced data can be used afterwards to restore the saved information afterwards calling Deserialize(void).

Thus, this function is not processing the information that is extracted from the definition file

Returns
The packed data

Implements moordyn::io::IO.

Here is the call graph for this function:

◆ setKinematics()

void moordyn::Point::setKinematics ( vec  r_in,
vec  rd_in 
)

Take the kinematics from the fairlead information.

sets Point states and ends of attached lines ONLY if this Point is attached to a body, i.e. type = FIXED (otherwise shouldn't be called)

Parameters
r_inPosition
rd_inVelocity
Exceptions
moordyn::invalid_value_errorIf it is not a FIXED point
Here is the call graph for this function:

◆ setState() [1/2]

void moordyn::Point::setState ( const InstanceStateVarView  r)
inlinevirtual

Set the point state.

sets Pointstate and ends of attached lines ONLY if this Point is free, i.e. type = FREE (otherwise shouldn't be called)

Parameters
rThe point state instance
Exceptions
moordyn::invalid_value_errorIf it is not a FREE point
Note
this calls Point::SetState(pos, vel)

Implements moordyn::Instance.

◆ setState() [2/2]

void moordyn::Point::setState ( vec  pos,
vec  vel 
)

Set the state variables.

sets Point position and velocity and ends of attached lines ONLY if this Point is free, i.e. type = FREE (otherwise shouldn't be called)

Parameters
posPosition
velVelocity
Exceptions
moordyn::invalid_value_errorIf it is not a FREE point
Here is the call graph for this function:

◆ setTime()

void moordyn::Point::setTime ( real  time)
inline

Set the line simulation time.

Parameters
timeSimulation time

◆ setup()

void moordyn::Point::setup ( int  number_in,
types  type_in,
vec  r0_in,
double  M_in,
double  V_in,
vec  F_in,
double  CdA_in,
double  Ca_in,
EnvCondRef  env_in 
)

Setup the point.

Always call this function after the constructor

Parameters
number_inThe point identifier. The identifiers starts at 1, not at 0.
type_inOne of COUPLED, FREE or FIXED
r0_inThe initial position
M_inThe mass
V_inThe volume
F_inThe initial force on the node
CdA_inProduct of drag coefficient and projected area
Ca_inAdded mass coefficient used along with V to calculate added mass on node
env_inGlobal struct that holds environmental settings
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setWaves()

void moordyn::Point::setWaves ( moordyn::WavesRef  waves_in,
moordyn::SeafloorRef  seafloor_in 
)
inline

Set the environmental data.

Parameters
waves_inGlobal Waves object
seafloor_inGlobal 3D Seafloor object

◆ stateDims()

const size_t moordyn::Point::stateDims ( ) const
inlinevirtual

Get the dimension of the state variable.

Returns
3 components for positions and 3 components for velocities, i.e. 6 components
Warning
This function shall be called after ::setup()

Reimplemented from moordyn::Instance.

◆ stateN()

const size_t moordyn::Point::stateN ( ) const
inlinevirtual

Get the number of state variables required by this instance.

Returns
1

Reimplemented from moordyn::Instance.

◆ TypeName()

static string moordyn::Point::TypeName ( types  t)
inlinestatic

Return a string with the name of a type.

This tool is useful mainly for debugging

Here is the caller graph for this function:

◆ updateFairlead()

void moordyn::Point::updateFairlead ( real  time)

Take the kinematics from the fairlead information.

Sets Point states and ends of attached lines ONLY if this Point is driven externally, i.e. type = COUPLED (otherwise shouldn't be called)

Parameters
timeLocal time within the time step (from 0 to dt)
Exceptions
moordyn::invalid_value_errorIf it is not a COUPLED point
Here is the call graph for this function:

The documentation for this class was generated from the following files: