|
MoorDyn
|
A base class for all the entities that must save/load data to/from disk. More...
#include <IO.hpp>


Public Member Functions | |
| 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... | |
| virtual std::vector< uint64_t > | Serialize (void)=0 |
| Produce the packed data to be saved. More... | |
| virtual uint64_t * | Deserialize (const uint64_t *data)=0 |
| Unpack the data to restore the Serialized information. 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... | |
| Log * | GetLogger () const |
| Get the log handler. More... | |
Protected Member Functions | |
| 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... | |
Additional Inherited Members | |
Protected Attributes inherited from moordyn::LogUser | |
| Log * | _log |
| The log handler. | |
A base class for all the entities that must save/load data to/from disk.
| moordyn::io::IO::IO | ( | moordyn::Log * | log | ) |
Costructor.
| log | Logging handler |
|
pure virtual |
Unpack the data to restore the Serialized information.
This is the function that each inherited class must implement, and should be the inverse of Serialize(void)
| data | The packed data |
Implemented in moordyn::time::ABScheme< order, local >, moordyn::time::SchemeBase< NSTATE, NDERIV >, moordyn::time::SchemeBase< 2, 2 >, moordyn::time::SchemeBase< 1, 2 >, moordyn::time::SchemeBase< 2, 1 >, moordyn::time::SchemeBase< 1, 1 >, moordyn::time::SchemeBase< 5, 4 >, moordyn::state::State, moordyn::Rod, moordyn::Point, moordyn::MoorDyn, moordyn::Line, and moordyn::Body.

|
inlineprotected |
Unpack an arbitrarily large matrix.
| in | The pointer to the next unread value |
| out | The unpacked vector |
|
protected |
Unpack a loaded integer.
| in | The pointer to the next unread value |
| out | The unpacked value |

|
protected |
Unpack a loaded 3x3 matrix.
| in | The pointer to the next unread value |
| out | The unpacked value |

|
protected |
Unpack a loaded 6x6 matrix.
| in | The pointer to the next unread value |
| out | The unpacked value |

|
protected |
Unpack a loaded quaternion.
| in | The pointer to the next unread value |
| out | The unpacked value |

|
protected |
Unpack a loaded floating point number.
| in | The pointer to the next unread value |
| out | The unpacked value |

|
protected |
Unpack a loaded list of 3x3 matrices.
| in | The pointer to the next unread value |
| out | The unpacked value |

|
protected |
Unpack a loaded list of 6x6 matrices.
| in | The pointer to the next unread value |
| out | The unpacked value |

|
protected |
Unpack a loaded list of floating point numbers.
| in | The pointer to the next unread value |
| out | The unpacked value |

|
inlineprotected |
Unpack a loaded list of lists.
This function might works recursively
| in | The pointer to the next unread value |
| out | The unpacked value |
|
protected |
Unpack a loaded list of 3D vectors.
| in | The pointer to the next unread value |
| out | The unpacked value |

|
protected |
Unpack a loaded list of 6D vectors.
| in | The pointer to the next unread value |
| out | The unpacked value |

|
protected |
Unpack a loaded unsigned integer.
| in | The pointer to the next unread value |
| out | The unpacked value |
|
protected |
Unpack a loaded 3D vector.
| in | The pointer to the next unread value |
| out | The unpacked value |

|
protected |
Unpack a loaded 6D vector.
| in | The pointer to the next unread value |
| out | The unpacked value |

|
protected |
Unpack a loaded XYZQuat.
| in | The pointer to the next unread value |
| out | The unpacked value |

| void moordyn::io::IO::Load | ( | const std::string | filepath | ) |
Loads the entity from a file.
It is the inverse of Save(filepath)
| filepath | The output file path |

|
protected |
Open an input file and load the data.
| filepath | The input file path |

|
protected |
Create an output file and write the MoorDyn magic header.
| filepath | The output file path |

| void moordyn::io::IO::Save | ( | const std::string | filepath | ) |
Save the entity into a file.
It is of course possible to save each entity in a separate file. However, since this function is just redirecting the work to save(void), which might produce the data to save recursively, actually the whole system can be saved in the same file
| filepath | The output file path |

|
inlineprotected |
Pack an arbitrarily large matrix.
| l | The matrix |
|
protected |
Pack an integer to make it writable.
| i | The integer number |

|
protected |
Pack a 3x3 matrix to make it writable.
| m | The matrix |

|
protected |
Pack a 6x6 matrix to make it writable.
| m | The matrix |

|
protected |
Pack a quaternion to make it writable.
| m | The quaternion |

|
protected |
Pack a float to make it writable.
| f | The float number |

|
protected |
Pack a list of 3x3 matrices to make it writable.
| l | The list |

|
protected |
Pack a list of 6x6 matrices to make it writable.
| l | The list |

|
protected |
Pack a list of floating point numbers to make it writable.
| l | The list |

|
inlineprotected |
Pack a list of lists to make it writable This function might act recursively.
| l | The list |
|
protected |
Pack a list of 3D vectors to make it writable.
| l | The list |

|
protected |
Pack a list of 6D vectors to make it writable.
| l | The list |

|
protected |
Pack an unsigned integer to make it writable.
| i | The unsigned integer number |
|
protected |
Pack a 3D vector to make it writable.
| m | The matrix |

|
protected |
Pack a 6D vector to make it writable.
| m | The matrix |

|
protected |
|
pure virtual |
Produce the packed data to be saved.
The produced data can be used afterwards to restore the saved information afterwards calling Deserialize(void).
This is the function that each inherited class must implement
Implemented in moordyn::time::ABScheme< order, local >, moordyn::time::SchemeBase< NSTATE, NDERIV >, moordyn::time::SchemeBase< 2, 2 >, moordyn::time::SchemeBase< 1, 2 >, moordyn::time::SchemeBase< 2, 1 >, moordyn::time::SchemeBase< 1, 1 >, moordyn::time::SchemeBase< 5, 4 >, moordyn::state::State, moordyn::Rod, moordyn::Point, moordyn::MoorDyn, moordyn::Line, and moordyn::Body.
