C API

group new_c_api

External Wave Kinematics

The functions for setting external wave kinematics.

int DECLDIR MoorDyn_ExternalWaveKinInit(MoorDyn system, unsigned int *n)

Initializes the external Wave kinematics.

This is useless unless the WaveKin option is set to 1 in the input file. If that is the case, remember to call this function after MoorDyn_Init()

Parameters:
  • system – The Moordyn system

  • n – The number of points where the wave kinematics shall be provided

Returns:

MOORDYN_SUCESS If the external waves are correctly initialized, an error code otherwise (see Errors reported by MoorDyn)

int DECLDIR MoorDyn_ExternalWaveKinGetN(MoorDyn system, unsigned int *n)

Get the number of points where the waves kinematics shall be provided.

This is useless unless WaveKin option is set to 1 in the input file

Parameters:
  • system – The Moordyn system

  • n – The output number of points where the wave kinematics shall be provided

Returns:

MOORDYN_SUCESS

int DECLDIR MoorDyn_ExternalWaveKinGetCoordinates(MoorDyn system, double *r)

Get the points where the waves kinematics shall be provided.

The kinematics on those points shall be provided just if WaveKin is set to 1 in the input file. The pointer r should be to an array with enough space for 3 * N doubles, where N is the value from MoorDyn_ExternalWaveKinGetN or MoorDyn_ExternalWaveKinInit.

Parameters:
  • system – The Moordyn system

  • r – The output coordinates (3 components per point)

Returns:

MOORDYN_SUCESS If the data is correctly set, an error code otherwise (see Errors reported by MoorDyn)

inline int DECLDIR DEPRECATED MoorDyn_GetWaveKinCoordinates (MoorDyn system, double *r)

Get the points where the waves kinematics shall be provided.

The kinematics on those points shall be provided just if WaveKin is set to 1 in the input file

Deprecated:

This function has been renamed as MoorDyn_ExternalWaveKinGetCoordinates()

Parameters:
  • system – The Moordyn system

  • r – The output coordinates (3 components per point)

Returns:

MOORDYN_SUCESS If the data is correctly set, an error code otherwise (see Errors reported by MoorDyn)

int DECLDIR MoorDyn_ExternalWaveKinSet(MoorDyn system, const double *U, const double *Ud, double t)

Set the kinematics of the waves.

Use this function if the WaveKin option is set to 1 in the input file

Parameters:
  • system – The Moordyn system

  • U – The velocities at the points (3 components per point)

  • Ud – The accelerations at the points (3 components per point)

  • t – Simulation time

Returns:

MOORDYN_SUCCESS If the data is correctly set, an error code otherwise (see Errors reported by MoorDyn)

inline int DECLDIR DEPRECATED MoorDyn_SetWaveKin (MoorDyn system, const double *U, const double *Ud, double t)

Set the kinematics of the waves.

Use this function if WaveKin option is set to 1 in the input file

Deprecated:

This function has been renamed as MoorDyn_ExternalWaveKinSet()

Parameters:
  • system – The Moordyn system

  • U – The velocities at the points (3 components per point)

  • Ud – The accelerations at the points (3 components per point)

  • t – Simulation time

Returns:

MOORDYN_SUCESS If the data is correctly set, an error code otherwise (see Errors reported by MoorDyn)

Typedefs

typedef struct __MoorDynBody *MoorDynBody

A mooring line instance.

typedef struct __MoorDynLine *MoorDynLine

A mooring line instance.

typedef struct __MoorDyn *MoorDyn

A mooring system instance.

typedef struct __MoorDynPoint *MoorDynPoint

A mooring point instance.

typedef struct __MoorDynRod *MoorDynRod

A mooring line instance.

typedef struct __MoorDynSeafloor *MoorDynSeafloor

A seafloor descriptor.

typedef struct __MoorDynWaves *MoorDynWaves

A mooring point instance.

Functions

int DECLDIR MoorDyn_GetBodyID(MoorDynBody b, int *id)

Get the body identifier.

Parameters:
  • b – The Moordyn body

  • id – The output id

Returns:

MOORDYN_INVALID_VALUE if a NULL point is provided, MOORDYN_SUCCESS otherwise

int DECLDIR MoorDyn_GetBodyType(MoorDynBody b, int *t)

Get the point type.

See also

Point::types

Parameters:
  • b – The Moordyn body

  • t – The output type

Returns:

MOORDYN_INVALID_VALUE if a NULL point is provided, MOORDYN_SUCCESS otherwise

int DECLDIR MoorDyn_GetBodyState(MoorDynBody b, double r[6], double rd[6])

Get the body state.

Parameters:
  • b – The Moordyn body

  • r – The output position (6dof)

  • rd – The output velocity (6dof)

Returns:

MOORDYN_INVALID_VALUE if a NULL body is provided, MOORDYN_SUCCESS otherwise

int DECLDIR MoorDyn_SaveBodyVTK(MoorDynBody b, const char *filename)

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

Note

If MoorDyn has been built without VTK support, this function will return a MOORDYN_NON_IMPLEMENTED error, but it will be still available anyway

Parameters:
  • b – The Moordyn body

  • filename – The output maximum tension module

Returns:

MOORDYN_SUCCESS if the file is correctly written, an error code otherwise

int DECLDIR MoorDyn_UseBodyVTK(MoorDynBody b, const char *filename)

Load the model that would represent the body.

The model can have one of the following formats:

  • VTK PolyData (.vtp)

  • Stereo Lithography (.stl)

Note

If MoorDyn has been built without VTK support, this function will return a MOORDYN_NON_IMPLEMENTED error, but it will be still available anyway

Parameters:
  • b – The Moordyn body

  • filename – The output maximum tension module

Returns:

MOORDYN_SUCCESS if the file is correctly written, an error code otherwise

int DECLDIR MoorDyn_GetLineID(MoorDynLine l, int *id)

Get the line identifier.

Parameters:
  • l – The Moordyn line

  • id – The output id

Returns:

MOORDYN_INVALID_VALUE if a NULL point is provided, MOORDYN_SUCCESS otherwise

int DECLDIR MoorDyn_GetLineN(MoorDynLine l, unsigned int *n)

Get the line number of segments.

The number of nodes is equal to this value plus 1

Parameters:
  • l – The Moordyn line

  • n – The output number of nodes

Returns:

MOORDYN_INVALID_VALUE if a NULL line is provided, MOORDYN_SUCCESS otherwise

int DECLDIR MoorDyn_GetLineNumberNodes(MoorDynLine l, unsigned int *n)

Get the line number of nodes.

Parameters:
  • l – The Moordyn line

  • n – The output number of nodes

Returns:

MOORDYN_INVALID_VALUE if a NULL line is provided, MOORDYN_SUCCESS otherwise

int DECLDIR MoorDyn_GetLineUnstretchedLength(MoorDynLine l, double *ul)

Get the line unstretched length.

Parameters:
  • l – The Moordyn line

  • ul – The output length

Returns:

MOORDYN_INVALID_VALUE if a NULL line is provided, MOORDYN_SUCCESS otherwise

int DECLDIR MoorDyn_SetLineUnstretchedLength(MoorDynLine l, double ul)

Set the line unstretched length.

Parameters:
  • l – The Moordyn line

  • ul – The new length

Returns:

MOORDYN_INVALID_VALUE if a NULL line is provided, MOORDYN_SUCCESS otherwise

int DECLDIR MoorDyn_SetLineUnstretchedLengthVel(MoorDynLine l, double v)

Set the line unstretched length rate of change.

Parameters:
  • l – The Moordyn line

  • v – The rate of change

Returns:

MOORDYN_INVALID_VALUE if a NULL line is provided, MOORDYN_SUCCESS otherwise

int DECLDIR MoorDyn_IsLineConstantEA(MoorDynLine l, int *b)

Get whether the line is governed by a non-linear stiffness or a constant one.

Parameters:
  • l – The Moordyn line

  • b – 1 if the stiffness of the line is constant, 0 if a non-linear stiffness has been set

Returns:

MOORDYN_INVALID_VALUE if a NULL line is provided, MOORDYN_SUCCESS otherwise

int DECLDIR MoorDyn_GetLineConstantEA(MoorDynLine l, double *EA)

Get the constant stiffness of the line.

This value is useless if non-linear stiffness is considered

Parameters:
  • l – The Moordyn line

  • EA – The constant stiffness EA value

Returns:

MOORDYN_INVALID_VALUE if a NULL line is provided, MOORDYN_SUCCESS otherwise

int DECLDIR MoorDyn_SetLineConstantEA(MoorDynLine l, double EA)

Set the constant stiffness of the line.

This value is useless if non-linear stiffness is considered

Parameters:
  • l – The Moordyn line

  • EA – The constant stiffness EA value

Returns:

MOORDYN_INVALID_VALUE if a NULL line is provided, MOORDYN_SUCCESS otherwise

int DECLDIR MoorDyn_GetLineNodePos(MoorDynLine l, unsigned int i, double pos[3])

Get a line node position.

Parameters:
  • l – The Moordyn line

  • i – The node index

  • pos – The output node position

Returns:

MOORDYN_INVALID_VALUE if a NULL line is provided or if the node index is bigger than the number of segments, MOORDYN_SUCCESS otherwise

int DECLDIR MoorDyn_GetLineNodeTen(MoorDynLine l, unsigned int i, double t[3])

Get a line node tension.

Parameters:
  • l – The Moordyn line

  • i – The node index

  • t – The output node tension

Returns:

MOORDYN_INVALID_VALUE if a NULL line is provided or if the node index is bigger than the number of segments, MOORDYN_SUCCESS otherwise

int DECLDIR MoorDyn_GetLineNodeCurv(MoorDynLine l, unsigned int i, double *c)

Get a line curvature at a node.

Note

The curvature is only computed if bending stiffness (moordyn::Line::EI) is not zero. Otherwise the curvature of every single node will be zero.

Parameters:
  • l – The Moordyn line

  • i – The node index

  • c – The output line curvature

Returns:

MOORDYN_INVALID_VALUE if a NULL line is provided or if the node index is bigger than the number of segments, MOORDYN_SUCCESS otherwise

int DECLDIR MoorDyn_GetLineFairTen(MoorDynLine l, double *t)

Get the tension module at the end point B (the fairlead)

Parameters:
  • l – The Moordyn line

  • t – The output node tension module

Returns:

MOORDYN_INVALID_VALUE if a NULL line is provided, MOORDYN_SUCCESS otherwise

int DECLDIR MoorDyn_GetLineMaxTen(MoorDynLine l, double *t)

Get the maximum tension module.

Parameters:
  • l – The Moordyn line

  • t – The output maximum tension module

Returns:

MOORDYN_INVALID_VALUE if a NULL line is provided, MOORDYN_SUCCESS otherwise

int DECLDIR MoorDyn_SaveLineVTK(MoorDynLine l, const char *filename)

Save the line to a VTK (.vtp) file.

Note

If MoorDyn has been built without VTK support, this function will return a MOORDYN_NON_IMPLEMENTED error, but it will be still available anyway

Parameters:
  • l – The Moordyn line

  • filename – The output maximum tension module

Returns:

MOORDYN_SUCCESS if the file is correctly written, an error code otherwise

MoorDyn DECLDIR MoorDyn_Create(const char *infilename)

Creates a MoorDyn instance.

At the time of creating a new MoorDyn instance, the input file is read and all the objects and structures are created. You must call afterwards MoorDyn_Init() to compute the initial conditions

Parameters:

infilename – The input file, if either NULL or “”, then “Mooring/lines.txt” will be considered

Returns:

The mooring instance, NULL if errors happened

int DECLDIR MoorDyn_NCoupledDOF(MoorDyn system, unsigned int *n)

Get the number of coupled Degrees Of Freedom (DOFs)

The number of components for some parameters in MoorDyn_Init() and MoorDyn_Step() can be known using this function

Returns:

MOORDYN_INVALID_VALUE if system is NULL, MOORDYN_SUCESS otherwise

int DECLDIR MoorDyn_SetVerbosity(MoorDyn system, int verbosity)

Set the instance verbosity level.

Parameters:
  • system – The Moordyn system

  • verbosity – The verbosity level. It can take the following values

    • MOORDYN_DBG_LEVEL Every single message will be printed

    • MOORDYN_MSG_LEVEL Messages specially designed to help debugging the code will be omitted

    • MOORDYN_WRN_LEVEL Just errors and warnings will be reported

    • MOORDYN_ERR_LEVEL Just errors will be reported

    • MOORDYN_NO_OUTPUT No info will be reported

Returns:

MOORDYN_SUCESS If the verbosity level is correctly set, an error code otherwise (see Errors reported by MoorDyn)

int DECLDIR MoorDyn_SetLogFile(MoorDyn system, const char *log_path)

Set the instance log file.

Parameters:
  • system – The Moordyn system

  • log_path – The file path to print the log file

Returns:

MOORDYN_SUCESS If the log file is correctly set, an error code otherwise (see Errors reported by MoorDyn)

int DECLDIR MoorDyn_SetLogLevel(MoorDyn system, int verbosity)

Set the instance log file printing level.

Parameters:
  • system – The Moordyn system

  • verbosity – The log file print level. It can take the following values

    • MOORDYN_DBG_LEVEL Every single message will be printed

    • MOORDYN_MSG_LEVEL Messages specially designed to help debugging the code will be omitted

    • MOORDYN_WRN_LEVEL Just errors and warnings will be reported

    • MOORDYN_ERR_LEVEL Just errors will be reported

    • MOORDYN_NO_OUTPUT No info will be reported

Returns:

MOORDYN_SUCESS If the printing level is correctly set, an error code otherwise (see Errors reported by MoorDyn)

int DECLDIR MoorDyn_Log(MoorDyn system, int level, const char *msg)

Log a message.

Note

This messages are subjected to the same rules than the inner messages, i.e. if level is lower than the threshold levels set with MoorDyn_SetVerbosity() and MoorDyn_SetLogLevel(), the message will not be logged in the terminal and the log file respectively

Note

This function will not log the file, line and function where it is called from, not even in case of warnings or errors

Parameters:
  • system – The Moordyn system

  • level – The message level. It can take the following values

    • MOORDYN_DBG_LEVEL for debugging messages

    • MOORDYN_MSG_LEVEL for regular information messages

    • MOORDYN_WRN_LEVEL for warnings

    • MOORDYN_ERR_LEVEL for errors

  • msg – The message to log

Returns:

MOORDYN_SUCESS If the printing level is correctly set, an error code otherwise (see Errors reported by MoorDyn)

int DECLDIR MoorDyn_Init(MoorDyn system, const double *x, const double *xd)

Compute the initial condition of a MoorDyn system.

At the time of creating a new MoorDyn instance, the input file is read and all the objects and structures are created. You must call afterwards MoorDyn_Init() to compute the initial conditions

Note

MoorDyn_NCoupledDOF() can be used to know the number of components required for x and xd

Parameters:
  • system – The Moordyn system

  • x – Position vector (6 components per coupled body or cantilevered rod and 3 components per pinned rod or coupled point)

  • xd – Velocity vector (6 components per coupled body or cantilevered rod and 3 components per pinned rod or coupled point)

Returns:

MOORDYN_SUCESS If the mooring system is correctly initialized, an error code otherwise (see Errors reported by MoorDyn)

int DECLDIR MoorDyn_Init_NoIC(MoorDyn system, const double *x, const double *xd)

The same than MoorDyn_Init(), but the initial condition is not computed at all.

This is of use when you are loading a state file afterwards with Moordyn_Load()

Note

MoorDyn_NCoupledDOF() can be used to know the number of components required for x and xd

Parameters:
  • system – The Moordyn system

  • x – Position vector (6 components per coupled body or cantilevered rod and 3 components per pinned rod or coupled point)

  • xd – Velocity vector (6 components per coupled body or cantilevered rod and 3 components per pinned rod or coupled point)

Returns:

MOORDYN_SUCESS If the mooring system is correctly initialized, an error code otherwise (see Errors reported by MoorDyn)

int DECLDIR MoorDyn_Step(MoorDyn system, const double *x, const double *xd, double *f, double *t, double *dt)

Runs a time step of the MoorDyn system.

Note

MoorDyn_NCoupledDOF() can be used to know the number of components required for x, xd and f

Parameters:
  • system – The Moordyn system

  • x – Position vector

  • xd – Velocity vector

  • f – Output forces

  • t – Simulation time

  • dt – Time step

Returns:

MOORDYN_SUCESS if the mooring system has correctly evolved, an error code otherwise (see Errors reported by MoorDyn)

int DECLDIR MoorDyn_Close(MoorDyn system)

Releases MoorDyn allocated resources.

Parameters:

system – The Moordyn system

Returns:

MOORDYN_SUCESS If the mooring system is correctly destroyed, an error code otherwise (see Errors reported by MoorDyn)

MoorDynWaves DECLDIR MoorDyn_GetWaves(MoorDyn system)

Get the wave kinematics instance.

The wave kinematics instance is only useful if WaveKin option is set to 2 in the input file.

Parameters:

system – The Moordyn system

Returns:

The waves instance, NULL if errors happened

MoorDynSeafloor DECLDIR MoorDyn_GetSeafloor(MoorDyn system)

Get the 3D seafloor instance.

The seafloor instance is only not null if a SeafloorPath was given as an option.

Parameters:

system – The Moordyn system

Returns:

The Seafloor instance, NULL if errors happened or there is no 3D seafloor

int DECLDIR MoorDyn_GetNumberBodies(MoorDyn system, unsigned int *n)

Get the number of bodies.

Remember that the first body index is 1

Parameters:
  • system – The Moordyn system

  • n – The output number of bodies

Returns:

MOORDYN_SUCESS If the number is successfully got, an error code otherwise (see Errors reported by MoorDyn)

MoorDynBody DECLDIR MoorDyn_GetBody(MoorDyn system, unsigned int b)

Get a rigid body.

Remember that the first body index is 1

Parameters:
  • system – The Moordyn system

  • b – The body index

Returns:

The body instance, NULL if errors happened

int DECLDIR MoorDyn_GetNumberRods(MoorDyn system, unsigned int *n)

Get the number of rods.

Remember that the first rod index is 1

Parameters:
  • system – The Moordyn system

  • n – The output number of rods

Returns:

MOORDYN_SUCESS If the number is successfully got, an error code otherwise (see Errors reported by MoorDyn)

MoorDynRod DECLDIR MoorDyn_GetRod(MoorDyn system, unsigned int r)

Get a rod.

Parameters:
  • system – The Moordyn system

  • r – The rod

Returns:

The rod instance, NULL if errors happened

int DECLDIR MoorDyn_GetNumberPoints(MoorDyn system, unsigned int *n)

Get the number of points.

Remember that the first point index is 1

Parameters:
  • system – The Moordyn system

  • n – The output number of points

Returns:

MOORDYN_SUCESS If the number is successfully got, an error code otherwise (see Errors reported by MoorDyn)

MoorDynPoint DECLDIR MoorDyn_GetPoint(MoorDyn system, unsigned int c)

Get a point.

Parameters:
  • system – The Moordyn system

  • c – The point

Returns:

The point instance, NULL if errors happened

int DECLDIR MoorDyn_GetNumberLines(MoorDyn system, unsigned int *n)

Get the number of lines.

Remember that the first line index is 1

Parameters:
  • system – The Moordyn system

  • n – The output number of lines

Returns:

MOORDYN_SUCESS If the number is successfully got, an error code otherwise (see Errors reported by MoorDyn)

MoorDynLine DECLDIR MoorDyn_GetLine(MoorDyn system, unsigned int l)

Get a line instance.

Parameters:
  • system – The Moordyn system

  • l – The line identifier (from 1 to the number of lines)

Returns:

The line instance, NULL if errors happened

int DECLDIR MoorDyn_GetFASTtens(MoorDyn system, const int *numLines, float FairHTen[], float FairVTen[], float AnchHTen[], float AnchVTen[])

Function for providing FASTv7 customary line tension quantities.

Parameters:
  • system – The Moordyn system

  • numLines – The number of lines

  • FairHTen – Allocated memory for the numLines horizontal forces at the fairlead

  • FairVTen – Allocated memory for the numLines vertical forces at the fairlead

  • AnchHTen – Allocated memory for the numLines horizontal forces at the anchor

  • AnchVTen – Allocated memory for the numLines vertical forces at the anchor

Returns:

MOORDYN_SUCESS If the data is correctly set, an error code otherwise (see Errors reported by MoorDyn)

int DECLDIR MoorDyn_Serialize(MoorDyn system, size_t *size, uint64_t *data)

Serialize the system to bytes.

Typically you want to call this function twice. A first call to know the amount of memory to be allocated for the bytes array and a second one to actually get the bytes array

The returned bytes can be used afterwards to restore the model calling to MoorDyn_Deserialize()

Parameters:
  • system – The Moordyn system

  • size – Output size of the bytes array. It can be null

  • data – Allocated memory for the output bytes array. It can be null

Returns:

MOORDYN_SUCESS If the data is correctly set, an error code otherwise (see Errors reported by MoorDyn)

int DECLDIR MoorDyn_Deserialize(MoorDyn system, const uint64_t *data)

Load the system from the serialized data before.

You can restore the system to a previous state retrieved calling MoorDyn_Serialize()

See also

MoorDyn_Save

Parameters:
  • system – The Moordyn system

  • data – Bytes array

Returns:

MOORDYN_SUCESS If the data is correctly set, an error code otherwise (see Errors reported by MoorDyn)

int DECLDIR MoorDyn_Save(MoorDyn system, const char *filepath)

Save the system so it can be loaded afterwards.

At the time of loading the system, it is still required to create the system reading the same definition file and calling MoorDyn_Init_NoIC()

See also

MoorDyn_Load

Parameters:
  • system – The Moordyn system

  • filepath – The path of the file to write

Returns:

MOORDYN_SUCESS If the data is correctly set, an error code otherwise (see Errors reported by MoorDyn)

int DECLDIR MoorDyn_Load(MoorDyn system, const char *filepath)

Load the system saved before.

You must still call MoorDyn_Create() and MoorDyn_Init_NoIC() before calling this function

See also

MoorDyn_Save

Parameters:
  • system – The Moordyn system

  • filepath – The path of the MoorDyn saved system

Returns:

MOORDYN_SUCESS If the data is correctly set, an error code otherwise (see Errors reported by MoorDyn)

int DECLDIR MoorDyn_DrawWithGL(MoorDyn system)

Draw the lines and points in the active OpenGL context.

The OpenGL context is assumed to be created by the caller before calling this function

Parameters:

system – The Moordyn system

Returns:

MOORDYN_SUCESS If the data is correctly set, an error code otherwise (see Errors reported by MoorDyn)

int DECLDIR MoorDyn_SaveVTK(MoorDyn system, const char *filename)

Save the whole system to a VTK (.vtm) file.

In general it is more convenient to handle each object independently, using MoorDyn_SaveLineVTK() and MoorDyn_SaveRodVTK() functions. However, if the number of subinstances is large, that would not be an option anymore. In that case you can use this function to pack everything together in a single file

Note

If MoorDyn has been built without VTK support, this function will return a MOORDYN_NON_IMPLEMENTED error, but it will be still available anyway

Parameters:
  • system – The Moordyn system

  • filename – The output maximum tension module

Returns:

MOORDYN_SUCCESS if the file is correctly written, an error code otherwise

int DECLDIR MoorDyn_GetPointID(MoorDynPoint point, int *id)

Get the point identifier.

Parameters:
  • point – The Moordyn point

  • id – The output id

Returns:

MOORDYN_INVALID_VALUE if a NULL point is provided, MOORDYN_SUCCESS otherwise

int DECLDIR MoorDyn_GetPointType(MoorDynPoint point, int *t)

Get the point type.

See also

Point::types

Parameters:
  • point – The Moordyn point

  • t – The output type

Returns:

MOORDYN_INVALID_VALUE if a NULL point is provided, MOORDYN_SUCCESS otherwise

int DECLDIR MoorDyn_GetPointPos(MoorDynPoint point, double pos[3])

Get the position of a point.

Parameters:
  • point – The Moordyn point

  • pos – The output position

Returns:

MOORDYN_SUCCESS If the data is correctly set, an error code otherwise (see Errors reported by MoorDyn)

int DECLDIR MoorDyn_GetPointVel(MoorDynPoint point, double v[3])

Get the velocity of a point.

Parameters:
  • point – The Moordyn point

  • v – The output velocity

Returns:

MOORDYN_SUCCESS If the data is correctly set, an error code otherwise (see Errors reported by MoorDyn)

int DECLDIR MoorDyn_GetPointForce(MoorDynPoint point, double f[3])

Get the force at a point.

Parameters:
  • point – The Moordyn point

  • f – The output force

Returns:

MOORDYN_SUCCESS If the data is correctly set, an error code otherwise (see Errors reported by MoorDyn)

int DECLDIR MoorDyn_GetPointNAttached(MoorDynPoint point, unsigned int *n)

Get the number of connected lines.

Parameters:
  • point – The Moordyn point

  • n – The output number of connected lines

Returns:

MOORDYN_SUCCESS If the data is correctly set, an error code otherwise (see Errors reported by MoorDyn)

int DECLDIR MoorDyn_GetPointAttached(MoorDynPoint point, unsigned int i, MoorDynLine *l, int *e)

Get the number of connected lines.

Parameters:
  • point – The Moordyn point

  • i – The index of the attached line

  • l – The output attached line

  • e – The output endpoint, see moordyn::EndPoints

Returns:

MOORDYN_SUCCESS If the data is correctly set, an error code otherwise (see Errors reported by MoorDyn)

int DECLDIR MoorDyn_SavePointVTK(MoorDynPoint point, const char *filename)

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

Note

If MoorDyn has been built without VTK support, this function will return a MOORDYN_NON_IMPLEMENTED error, but it will be still available anyway

Parameters:
  • point – The Moordyn point

  • filename – The output maximum tension module

Returns:

MOORDYN_SUCCESS if the file is correctly written, an error code otherwise

int DECLDIR MoorDyn_GetRodID(MoorDynRod l, int *id)

Get the line identifier.

Parameters:
  • l – The Moordyn rod

  • id – The output id

Returns:

MOORDYN_INVALID_VALUE if a NULL point is provided, MOORDYN_SUCCESS otherwise

int DECLDIR MoorDyn_GetRodType(MoorDynRod l, int *t)

Get the line type.

Parameters:
  • l – The Moordyn rod

  • t – The output type

Returns:

MOORDYN_INVALID_VALUE if a NULL point is provided, MOORDYN_SUCCESS otherwise

int DECLDIR MoorDyn_GetRodN(MoorDynRod l, unsigned int *n)

Get the line number of segments.

The number of nodes is equal to this value plus 1

Parameters:
  • l – The Moordyn rod

  • n – The output number of nodes

Returns:

MOORDYN_INVALID_VALUE if a NULL line is provided, MOORDYN_SUCCESS otherwise

int DECLDIR MoorDyn_GetRodNumberNodes(MoorDynRod l, unsigned int *n)

Get the line number of nodes.

Parameters:
  • l – The Moordyn rod

  • n – The output number of nodes

Returns:

MOORDYN_INVALID_VALUE if a NULL line is provided, MOORDYN_SUCCESS otherwise

int DECLDIR MoorDyn_GetRodNodePos(MoorDynRod l, unsigned int i, double pos[3])

Get a line node position.

Parameters:
  • l – The Moordyn rod

  • i – The node index

  • pos – The output node position

Returns:

MOORDYN_INVALID_VALUE if a NULL line is provided or if the node index is bigger than the number of segments, MOORDYN_SUCCESS otherwise

int DECLDIR MoorDyn_SaveRodVTK(MoorDynRod l, const char *filename)

Save the line to a VTK (.vtp) file.

Note

If MoorDyn has been built without VTK support, this function will return a MOORDYN_NON_IMPLEMENTED error, but it will be still available anyway

Parameters:
  • l – The Moordyn rod

  • filename – The output maximum tension module

Returns:

MOORDYN_SUCCESS if the file is correctly written, an error code otherwise

int DECLDIR MoorDyn_GetWavesKin(MoorDynWaves waves, double x, double y, double z, double U[3], double Ud[3], double *zeta, double *PDyn, MoorDynSeafloor seafloor)

Get the velocity, acceleration, wave height and dynamic pressure at a specific positon and time.

Parameters:
  • waves – The Waves instance

  • x – The point x coordinate

  • y – The point y coordinate

  • z – The point z coordinate

  • U – The output velocity

  • Ud – The output acceleration

  • zeta – The output wave height

  • PDyn – The output dynamic pressure

  • seafloor – The seafloor instance, see MoorDyn_GetSeafloor()

Returns:

0 If the data is correctly set, an error code otherwise (see Errors reported by MoorDyn)

double DECLDIR WaveNumber(double Omega, double g, double h)

Compute the wave number.

Note

credit: FAST source

Parameters:
  • Omega – The wave angular frequency

  • g – The gravity acceleration

  • h – The water depth

Returns:

The wave number