MoorDyn
MoorDyn2.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2022, Matt Hall
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  * 1. Redistributions of source code must retain the above copyright notice,
8  * this list of conditions and the following disclaimer.
9  *
10  * 2. Redistributions in binary form must reproduce the above copyright notice,
11  * this list of conditions and the following disclaimer in the documentation
12  * and/or other materials provided with the distribution.
13  *
14  * 3. Neither the name of the copyright holder nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28  * POSSIBILITY OF SUCH DAMAGE.
29  */
30 
35 #pragma once
36 
37 #include "MoorDynAPI.h"
38 #include "IO.hpp"
39 #include "Misc.hpp"
40 
41 #include "Time.hpp"
42 #include "Waves.hpp"
43 #include "MoorDyn.h"
44 #include "Line.hpp"
45 #include "Point.hpp"
46 #include "Rod.hpp"
47 #include "Body.hpp"
48 #include "Seafloor.hpp"
49 #include <limits>
50 
51 namespace moordyn {
52 
59 class MoorDyn final : public io::IO
60 {
61  public:
70  DECLDIR MoorDyn(const char* infilename = NULL,
71  int log_level = MOORDYN_MSG_LEVEL);
72 
75  DECLDIR ~MoorDyn();
76 
90  moordyn::error_id DECLDIR Init(const double* x,
91  const double* xd,
92  bool skip_ic = false);
93 
106  Step(const double* x, const double* xd, double* f, double& t, double& dt);
107 
110  inline vector<Body*> GetBodies() const { return BodyList; }
111 
114  inline vector<Rod*> GetRods() const { return RodList; }
115 
118  inline vector<Point*> GetPoints() const { return PointList; }
119 
122  inline vector<Line*> GetLines() const { return LineList; }
123 
129  inline void SetDisableOutput(bool disable) { disableOutput = disable; }
130 
146  inline unsigned int NCoupledDOF() const
147  {
148  std::size_t n = 6 * CpldBodyIs.size() + 3 * CpldPointIs.size();
149  for (auto rodi : CpldRodIs) {
150  if (RodList[rodi]->type == Rod::COUPLED)
151  n += 6; // cantilevered rods
152  else
153  n += 3; // pinned rods
154  }
155  return static_cast<unsigned int>(n);
156  }
157 
165  inline moordyn::WavesRef DECLDIR GetWaves() const { return waves; }
166 
173  inline moordyn::SeafloorRef GetSeafloor() const { return seafloor; }
174 
180  inline unsigned int ExternalWaveKinInit()
181  {
182  const auto& points = waves->getWaveKinematicsPoints();
183  npW = static_cast<unsigned int>(points.size());
184 
185  return npW;
186  }
187 
196  inline unsigned int ExternalWaveKinGetN() const { return npW; }
197 
210  {
211  const auto& points = ExternalWaveKinGetPoints();
212  unsigned int i = 0;
213  for (const auto& vec : points) {
214  moordyn::vec2array(vec, r + i);
215  i += 3;
216  }
217 
218  return MOORDYN_SUCCESS;
219  }
220 
229  inline std::vector<vec> ExternalWaveKinGetPoints() const
230  {
231  return waves->getWaveKinematicsPoints();
232  }
233 
245  inline void DEPRECATED SetWaveKin(std::vector<vec> const& U,
246  std::vector<vec> const& Ud,
247  double t)
248  {
249  ExternalWaveKinSet(U, Ud, t);
250  }
251 
263  inline void ExternalWaveKinSet(std::vector<vec> const& U,
264  std::vector<vec> const& Ud,
265  double t)
266 
267  {
268  waves->setWaveKinematics(U, Ud);
269  }
270 
280  std::vector<uint64_t> Serialize(void);
281 
288  uint64_t* Deserialize(const uint64_t* data);
289 
305  void saveVTK(const char* filename) const;
306 
310  inline real GetDt() const { return dtM0; }
311 
316  inline void SetDt(real dt)
317  {
318  this->dtM0 = dt;
319  this->cfl = 0.0;
320  for (auto obj : LineList)
321  cfl = (std::max)(cfl, obj->dt2cfl(dtM0));
322  for (auto obj : PointList)
323  cfl = (std::max)(cfl, obj->dt2cfl(dtM0));
324  for (auto obj : RodList)
325  cfl = (std::max)(cfl, obj->dt2cfl(dtM0));
326  for (auto obj : BodyList)
327  cfl = (std::max)(cfl, obj->dt2cfl(dtM0));
328  }
329 
333  inline real GetCFL() const { return cfl; }
334 
339  inline void SetCFL(real cfl)
340  {
341  this->cfl = cfl;
342  this->dtM0 = (std::numeric_limits<real>::max)();
343  for (auto obj : LineList)
344  dtM0 = (std::min)(dtM0, obj->cfl2dt(cfl));
345  for (auto obj : PointList)
346  dtM0 = (std::min)(dtM0, obj->cfl2dt(cfl));
347  for (auto obj : RodList)
348  dtM0 = (std::min)(dtM0, obj->cfl2dt(cfl));
349  for (auto obj : BodyList)
350  dtM0 = (std::min)(dtM0, obj->cfl2dt(cfl));
351  }
352 
356  inline time::Scheme* GetTimeScheme() const { return _t_integrator; }
357 
361  inline void SetTimeScheme(time::Scheme* tscheme)
362  {
363  if (_t_integrator)
364  delete _t_integrator;
365  _t_integrator = tscheme;
366  _t_integrator->SetGround(GroundBody);
367  for (auto obj : BodyList)
368  _t_integrator->AddBody(obj);
369  for (auto obj : RodList)
370  _t_integrator->AddRod(obj);
371  for (auto obj : PointList)
372  _t_integrator->AddPoint(obj);
373  for (auto obj : LineList)
374  _t_integrator->AddLine(obj);
375  _t_integrator->SetCFL(cfl);
376  _t_integrator->Init();
377  }
378 
379  protected:
391 
400  moordyn::error_id readFileIntoBuffers(vector<string>& in_txt);
401 
409  int findStartOfSection(vector<string>& in_txt, vector<string> sectionName);
410 
418  LineProps* readLineProps(string inputText, int lineNum);
419 
427  RodProps* readRodProps(string inputText, int lineNum);
428 
436  Rod* readRod(string inputText, int lineNum);
437 
445  Body* readBody(string inputText, int lineNum);
446 
453  void readOptionsLine(vector<string>& in_txt, int index);
454 
462  bool checkNumberOfEntriesInLine(vector<string> entries,
463  int supposedNumberOfEntries,
464  int lineNum);
465 
470 
476 
484  inline moordyn::error_id GetForces(double* f) const
485  {
486  if (!NCoupledDOF()) {
487  if (f)
489  << "Warning: Forces have been asked on "
490  << "the coupled entities, but there are no such entities"
491  << std::endl;
492  return MOORDYN_SUCCESS;
493  }
494  if (NCoupledDOF() && !f) {
496  << "Error: " << __PRETTY_FUNC_NAME__
497  << " called with a NULL forces pointer, but there are "
498  << NCoupledDOF() << " coupled Degrees Of Freedom" << std::endl;
499  return MOORDYN_INVALID_VALUE;
500  }
501  unsigned int ix = 0;
502  for (auto l : CpldBodyIs) {
503  // BUG: These conversions will not be needed in the future
504  const vec6 f_i = BodyList[l]->getFnet();
505  if (BodyList[l]->type == Body::COUPLED) {
506  moordyn::vec62array(f_i, f + ix);
507  ix += 6; // for coupled bodies 6 entries will be taken
508  } else {
509  moordyn::vec2array(f_i(Eigen::seqN(0, 3)), f + ix);
510  ix += 3; // for pinned bodies 3 entries will be taken
511  }
512  }
513  for (auto l : CpldRodIs) {
514  const vec6 f_i = RodList[l]->getFnet();
515  if (RodList[l]->type == Rod::COUPLED) {
516  moordyn::vec62array(f_i, f + ix);
517  ix += 6; // for cantilevered rods 6 entries will be taken
518  } else {
519  moordyn::vec2array(f_i(Eigen::seqN(0, 3)), f + ix);
520  ix += 3; // for pinned rods 3 entries will be taken
521  }
522  }
523  for (auto l : CpldPointIs) {
524  vec fnet;
525  PointList[l]->getFnet(fnet);
526  moordyn::vec2array(fnet, f + ix);
527  ix += 3;
528  }
529  return MOORDYN_SUCCESS;
530  }
531 
532  private:
534  string _filepath;
536  string _basename;
538  string _basepath;
539 
540  // factor by which to boost drag coefficients during dynamic relaxation IC
541  // generation
542  real ICDfac;
543  // convergence analysis time step for IC generation
544  real ICdt;
545  // max time for IC generation
546  real ICTmax;
547  // threshold for relative change in tensions to call it converged
548  real ICthresh;
549  // use dynamic (true) or stationary (false) initial condition solver
550  bool ICgenDynamic;
551  // Load the initial state (before the initial condition solver) from a
552  // file. Empty to do not load it.
553  string ICfile;
554  // temporary wave kinematics flag used to store input value while keeping
555  // env.WaveKin=0 for IC gen
556  moordyn::waves::waves_settings WaveKinTemp;
558  real dtM0;
560  real cfl;
563  real dtOut;
564 
566  time::Scheme* _t_integrator;
567 
569  EnvCondRef env;
571  Body* GroundBody;
573  WavesRef waves{};
576  moordyn::SeafloorRef seafloor;
577 
579  vector<LineProps*> LinePropList;
581  vector<RodProps*> RodPropList;
583  vector<FailProps*> FailList;
585  vector<Body*> BodyList;
587  vector<Rod*> RodList;
589  vector<moordyn::Point*> PointList;
591  vector<moordyn::Line*> LineList;
592 
594  vector<unsigned int> FreeBodyIs;
596  vector<unsigned int> FixedBodyIs;
598  vector<unsigned int> CpldBodyIs;
599 
602  vector<unsigned int> FreeRodIs;
604  vector<unsigned int> CpldRodIs;
605 
607  vector<unsigned int> FreePointIs;
609  vector<unsigned int> CpldPointIs;
610 
613  unsigned int npW;
614 
616  bool disableOutput = false;
617 
619  bool disableOutTime = false;
620 
622  ofstream outfileMain;
623 
625  vector<shared_ptr<ofstream>> outfiles;
626 
628  vector<OutChanProps> outChans;
629 
635  inline moordyn::error_id SetupLog()
636  {
637  // env.writeLog = 0 -> MOORDYN_NO_OUTPUT
638  // env.writeLog = 1 -> MOORDYN_WRN_LEVEL
639  // env.writeLog = 2 -> MOORDYN_MSG_LEVEL
640  // env.writeLog >= 3 -> MOORDYN_DBG_LEVEL
641  int log_level = MOORDYN_ERR_LEVEL - env->writeLog;
642  if (log_level >= MOORDYN_ERR_LEVEL)
643  log_level = MOORDYN_NO_OUTPUT;
644  if (log_level < MOORDYN_DBG_LEVEL)
645  log_level = MOORDYN_DBG_LEVEL;
646  GetLogger()->SetLogLevel(log_level);
647 
648  if (env->writeLog > 0) {
650  string err_msg;
651  stringstream filepath;
652  filepath << _basepath << _basename << ".log";
653  try {
654  GetLogger()->SetFile(filepath.str().c_str());
655  }
656  MOORDYN_CATCHER(err, err_msg);
657  if (err != MOORDYN_SUCCESS)
658  LOGERR << "Unable to create the log at '" << filepath.str()
659  << "': " << std::endl
660  << err_msg << std::endl;
661  else
662  LOGMSG << "MoorDyn v2 log file with output level "
663  << log_level_name(GetLogger()->GetLogLevel()) << " at '"
664  << filepath.str() << "'" << std::endl;
665  return err;
666  }
667 
668  return MOORDYN_SUCCESS;
669  }
670 
682  moordyn::error_id read_curve(const char* entry,
683  vector<double>& x,
684  vector<double>& y)
685  {
686  try {
687  y.push_back((real)std::stold(entry));
688  // If we reach this point, it is a valid number
689  x.push_back(0.0);
690  return MOORDYN_SUCCESS;
691  } catch (std::out_of_range) {
692  LOGERR << "" << std::endl;
693  return MOORDYN_INVALID_INPUT;
694  } catch (std::invalid_argument) {
695  // Do nothing, just proceed to read the curve file
696  }
697 
698  string fpath = _basepath + entry;
699  LOGMSG << "Loading a curve from '" << fpath << "'..." << std::endl;
700  ifstream f(fpath);
701  if (!f.is_open()) {
702  LOGERR << "Cannot read the file '" << fpath << "'" << std::endl;
704  }
705 
706  vector<string> flines;
707  int i = 0;
708  while (f.good()) {
709  string fline;
710  getline(f, fline);
711  if (i > 2) { // skip first three lines as headers
712  moordyn::str::rtrim(fline);
713  flines.push_back(fline);
714  }
715  i++;
716  }
717  f.close();
718 
719  if (i < 5) {
720  LOGERR << "Error: Not enough curve data in curve file" << endl;
721  return MOORDYN_INVALID_INPUT;
722  }
723 
724  for (auto fline : flines) {
725  vector<string> entries = moordyn::str::split(fline, ' ');
726  if (entries.size() < 2) {
727  LOGERR << "Error: Bad curve point" << std::endl
728  << "\t'" << fline << "'" << std::endl
729  << "\t2 fields required, but just " << entries.size()
730  << " are provided" << std::endl;
731  return MOORDYN_INVALID_INPUT;
732  }
733  x.push_back(atof(entries[0].c_str()));
734  y.push_back(atof(entries[1].c_str()));
735  LOGDBG << "(" << x.back() << ", " << y.back() << ")" << std::endl;
736  }
737 
738  LOGMSG << (i - 3) << " lines of curve successfully loaded" << std::endl;
739  return MOORDYN_SUCCESS;
740  }
741 
756  moordyn::error_id read_curve(const char* entry,
757  double* c,
758  int* n,
759  double* x,
760  double* y)
761  {
762  vector<double> xv, yv;
763  const moordyn::error_id error = read_curve(entry, xv, yv);
764  if (error != MOORDYN_SUCCESS)
765  return error;
766 
767  if (xv.size() == 1) {
768  *c = yv.back();
769  n = 0;
770  return MOORDYN_SUCCESS;
771  }
772 
773  if (xv.size() > nCoef) {
775  << "Error: Too much points in the curve" << std::endl
776  << "\t" << xv.size() << " points given, but just " << nCoef
777  << " are accepted" << std::endl;
778  return MOORDYN_INVALID_INPUT;
779  }
780 
781  *c = 0.0;
782  *n = static_cast<unsigned int>(xv.size());
783  memcpy(x, xv.data(), xv.size() * sizeof(double));
784  memcpy(y, yv.data(), yv.size() * sizeof(double));
785 
786  return MOORDYN_SUCCESS;
787  }
788 
827  moordyn::error_id read_syrope_working_curves(const char* entry,
828  string& owc_path,
829  string& wc_formula,
830  double& k1,
831  double& k2);
832 
839  inline double GetOutput(const OutChanProps channel) const
840  {
841  if (channel.OType == 1)
842  return LineList[channel.ObjID - 1]->GetLineOutput(channel);
843  else if (channel.OType == 2)
844  return PointList[channel.ObjID - 1]->GetPointOutput(channel);
845  else if (channel.OType == 3)
846  return RodList[channel.ObjID - 1]->GetRodOutput(channel);
847  else if (channel.OType == 4)
848  return BodyList[channel.ObjID - 1]->GetBodyOutput(channel);
849  stringstream s;
850  s << "Error: output type of " << channel.Name
851  << " does not match a supported object type";
852  MOORDYN_THROW(MOORDYN_INVALID_VALUE, s.str().c_str());
853  return 0.0;
854  }
855 
859  void detachLines(FailProps* failure);
860 
869  moordyn::error_id WriteOutputs(double t, double dt);
870 };
871 
872 } // ::moordyn
#define LOGDBG
Log a debug message, without extra info about the source code.
Definition: Log.hpp:63
#define LOGMSG
Log an info message, without extra info about the source code.
Definition: Log.hpp:65
#define LOGERR
Log an error.
Definition: Log.hpp:69
#define DECLDIR
Prefix to export C functions on the compiled library.
Definition: MoorDynAPI.h:68
#define __PRETTY_FUNC_NAME__
Macro that is substituted by the beautified function name.
Definition: MoorDynAPI.h:102
#define DEPRECATED
Prefix for deprecated functions that will be removed on a future version.
Definition: MoorDynAPI.h:85
A rigid body.
Definition: Body.hpp:72
@ COUPLED
Is coupled, i.e. is controlled by the user.
Definition: Body.hpp:155
void SetFile(const char *file_path)
Set the log file path.
Definition: Log.cpp:142
void SetLogLevel(const int level)
Set the log file printing level.
Definition: Log.hpp:190
MultiStream & Cout(const int level=MOORDYN_MSG_LEVEL) const
Get a stream to log data.
Definition: Log.cpp:118
Log * GetLogger() const
Get the log handler.
Definition: Log.hpp:248
Log * _log
The log handler.
Definition: Log.hpp:252
A Mooring system.
Definition: MoorDyn2.hpp:60
void SetDisableOutput(bool disable)
Set whether console and file output is disabled.
Definition: MoorDyn2.hpp:129
void DEPRECATED SetWaveKin(std::vector< vec > const &U, std::vector< vec > const &Ud, double t)
Set the kinematics of the waves.
Definition: MoorDyn2.hpp:245
moordyn::error_id ReadInFile()
Read the input file, setting up all the required objects and their relationships.
Definition: MoorDyn2.cpp:907
bool checkNumberOfEntriesInLine(vector< string > entries, int supposedNumberOfEntries, int lineNum)
Check that the provided entries match the expected ones.
Definition: MoorDyn2.cpp:2570
Body * readBody(string inputText, int lineNum)
Helper function to read a new body given a line from the input file.
Definition: MoorDyn2.cpp:2144
void SetTimeScheme(time::Scheme *tscheme)
Set the current time integrator.
Definition: MoorDyn2.hpp:361
moordyn::error_id icLegacy()
Compute an initial condition using the legacy upscaled drag dynamic solver.
Definition: MoorDyn2.cpp:197
moordyn::error_id readFileIntoBuffers(vector< string > &in_txt)
Read the input file and store it as a set of strings, one per line.
Definition: MoorDyn2.cpp:1910
real GetDt() const
Get the model time step.
Definition: MoorDyn2.hpp:310
DECLDIR ~MoorDyn()
Destructor.
Definition: MoorDyn2.cpp:163
std::vector< vec > ExternalWaveKinGetPoints() const
Get the points where the waves kinematics shall be provided.
Definition: MoorDyn2.hpp:229
void readOptionsLine(vector< string > &in_txt, int index)
Helper function to read an option given a line from the input file.
Definition: MoorDyn2.cpp:2453
unsigned int NCoupledDOF() const
Return the number of coupled Degrees Of Freedom (DOF)
Definition: MoorDyn2.hpp:146
real GetCFL() const
Get the model Courant–Friedrichs–Lewy factor.
Definition: MoorDyn2.hpp:333
unsigned int ExternalWaveKinInit()
Initializes the external Wave kinetics.
Definition: MoorDyn2.hpp:180
int findStartOfSection(vector< string > &in_txt, vector< string > sectionName)
Get the file line index where a section starts.
Definition: MoorDyn2.cpp:1929
moordyn::error_id DECLDIR Init(const double *x, const double *xd, bool skip_ic=false)
Initializes Moordyn, reading the input file and setting up the mooring lines.
Definition: MoorDyn2.cpp:433
moordyn::error_id DECLDIR Step(const double *x, const double *xd, double *f, double &t, double &dt)
Runs a time step of the MoorDyn system.
Definition: MoorDyn2.cpp:653
vector< Body * > GetBodies() const
Get the points.
Definition: MoorDyn2.hpp:110
moordyn::error_id icStationary()
Compute an initial condition using the stationary solver.
Definition: MoorDyn2.cpp:348
unsigned int ExternalWaveKinGetN() const
Get the number of points where the waves kinematics shall be provided.
Definition: MoorDyn2.hpp:196
DECLDIR MoorDyn(const char *infilename=NULL, int log_level=MOORDYN_MSG_LEVEL)
Constructor.
Definition: MoorDyn2.cpp:90
Rod * readRod(string inputText, int lineNum)
Helper function to read a new rod given a line from the input file.
Definition: MoorDyn2.cpp:2303
vector< Rod * > GetRods() const
Get the points.
Definition: MoorDyn2.hpp:114
std::vector< uint64_t > Serialize(void)
Produce the packed data to be saved.
Definition: MoorDyn2.cpp:799
void SetDt(real dt)
Set the model time step.
Definition: MoorDyn2.hpp:316
time::Scheme * GetTimeScheme() const
Get the current time integrator.
Definition: MoorDyn2.hpp:356
LineProps * readLineProps(string inputText, int lineNum)
Helper function to read a new line property given a line from the input file.
Definition: MoorDyn2.cpp:1949
RodProps * readRodProps(string inputText, int lineNum)
Helper function to read a new rod property given a line from the input file.
Definition: MoorDyn2.cpp:2112
moordyn::SeafloorRef GetSeafloor() const
Get the 3D seafloor instance.
Definition: MoorDyn2.hpp:173
vector< Line * > GetLines() const
Get the lines.
Definition: MoorDyn2.hpp:122
void SetCFL(real cfl)
Set the model Courant–Friedrichs–Lewy factor.
Definition: MoorDyn2.hpp:339
void ExternalWaveKinSet(std::vector< vec > const &U, std::vector< vec > const &Ud, double t)
Set the kinematics of the waves.
Definition: MoorDyn2.hpp:263
moordyn::error_id DEPRECATED GetWaveKinCoordinates(double *r) const
Get the points where the waves kinematics shall be provided.
Definition: MoorDyn2.hpp:209
uint64_t * Deserialize(const uint64_t *data)
Unpack the data to restore the Serialized information.
Definition: MoorDyn2.cpp:830
moordyn::WavesRef DECLDIR GetWaves() const
Get the wave kinematics instance.
Definition: MoorDyn2.hpp:165
moordyn::error_id GetForces(double *f) const
Get the forces.
Definition: MoorDyn2.hpp:484
void saveVTK(const char *filename) const
Save the whole system on a VTK (.vtm) file.
Definition: MoorDyn2.cpp:856
vector< Point * > GetPoints() const
Get the points.
Definition: MoorDyn2.hpp:118
A cylindrical rod.
Definition: Rod.hpp:65
@ COUPLED
Is attached rigidly to a coupling point (6dof)
Definition: Rod.hpp:235
A base class for all the entities that must save/load data to/from disk.
Definition: IO.hpp:60
Time scheme abstraction.
Definition: Time.hpp:59
virtual void AddPoint(Point *obj)
Add a point.
Definition: Time.hpp:106
virtual void AddLine(Line *obj)
Add a line.
Definition: Time.hpp:73
virtual void AddBody(Body *obj)
Add a body.
Definition: Time.hpp:172
virtual void AddRod(Rod *obj)
Add a rod.
Definition: Time.hpp:139
void SetGround(Body *obj)
Set the ground body.
Definition: Time.hpp:67
void SetCFL(const real &cfl)
Set the CFL factor.
Definition: Time.hpp:229
virtual void Init()=0
Create an initial state for all the entities.
struct moordyn::_FailProps FailProps
Failure conditions.
#define MOORDYN_INVALID_INPUT_FILE
Invalid input file path.
Definition: MoorDynAPI.h:145
#define MOORDYN_INVALID_VALUE
Invalid values.
Definition: MoorDynAPI.h:155
#define MOORDYN_INVALID_INPUT
Invalid input in the input file.
Definition: MoorDynAPI.h:149
#define MOORDYN_SUCCESS
Successfully dispatched task.
Definition: MoorDynAPI.h:143
#define MOORDYN_CATCHER(err, msg)
Definition: Misc.hpp:662
int error_id
Error identifier.
Definition: Misc.hpp:594
#define MOORDYN_THROW(err, msg)
Exception thrown for invalid input files.
Definition: Misc.hpp:628
#define MOORDYN_DBG_LEVEL
Debug message.
Definition: MoorDynAPI.h:126
#define MOORDYN_WRN_LEVEL
Warning message.
Definition: MoorDynAPI.h:122
#define MOORDYN_MSG_LEVEL
Info message.
Definition: MoorDynAPI.h:124
#define MOORDYN_ERR_LEVEL
Error message.
Definition: MoorDynAPI.h:120
#define MOORDYN_NO_OUTPUT
Disable the output since no output will never reach this level.
Definition: MoorDynAPI.h:128
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
std::string log_level_name(int level)
Name the log level.
Definition: Log.cpp:39
Eigen::Vector6d vec6
6-D vector of real numbers
Definition: Misc.hpp:126
double real
Real numbers wrapper. It is either double or float.
Definition: Misc.hpp:118
void vec62array(const vec6 &v, T *a)
Convert a vector to a C-ish array.
Definition: Misc.hpp:384
std::shared_ptr< Seafloor > SeafloorRef
Shared pointer.
Definition: Seafloor.hpp:109
void vec2array(const vec &v, T *a)
Convert a vector to a C-ish array.
Definition: Misc.hpp:358
Definition: Misc.hpp:1146
Definition: Misc.hpp:1292
Definition: Misc.hpp:1188