MoorDyn
Public Member Functions | List of all members
moordyn::state::State Class Referencefinal

The collection of state variables of the whole system. More...

#include <State.hpp>

Inheritance diagram for moordyn::state::State:
Inheritance graph
[legend]
Collaboration diagram for moordyn::state::State:
Collaboration graph
[legend]

Public Member Functions

 State (moordyn::Log *log)
 Constructor. More...
 
 State (const State &rhs)
 Copy constructor. More...
 
 ~State ()
 Destructor.
 
void addInstance (moordyn::Instance *obj)
 Add an instance capable of holding state variables. More...
 
unsigned int removeInstance (moordyn::Instance *obj)
 Remove an instance. More...
 
StateVarView get ()
 Get the state variables.
 
InstanceStateVarView get (moordyn::Instance *obj)
 Get the state variables associated to an instance. 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...
 
Stateoperator= (const State &rhs)
 Assignment operator. More...
 
const Eigen::Index indexer (moordyn::Instance *obj)
 Get the index within a state var for a particular instance. More...
 
const std::vector< Eigen::Index > indexer (std::vector< moordyn::Instance * > obj)
 
- 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...
 

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

The collection of state variables of the whole system.

Constructor & Destructor Documentation

◆ State() [1/2]

moordyn::state::State::State ( moordyn::Log log)
inline

Constructor.

Parameters
logThe logger

◆ State() [2/2]

moordyn::state::State::State ( const State rhs)
inline

Copy constructor.

Parameters
rhsState to copy

Member Function Documentation

◆ addInstance()

void moordyn::state::State::addInstance ( moordyn::Instance obj)

Add an instance capable of holding state variables.

Parameters
objThe instance
Exceptions
moordyn::invalid_value_errorIf it has been already registered
Here is the call graph for this function:

◆ Deserialize()

uint64_t * moordyn::state::State::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.

◆ get()

InstanceStateVarView moordyn::state::State::get ( moordyn::Instance obj)
inline

Get the state variables associated to an instance.

Parameters
objThe instance
Exceptions
moordyn::invalid_value_errorIf the instance has not been registered, or it was already removed
Here is the call graph for this function:

◆ indexer()

const Eigen::Index moordyn::state::State::indexer ( moordyn::Instance obj)
inline

Get the index within a state var for a particular instance.

Parameters
objThe objects
Returns
The indexes
Exceptions
moordyn::invalid_value_errorIf the instance has not been registered, or it was already removed
Here is the call graph for this function:

◆ operator=()

State& moordyn::state::State::operator= ( const State rhs)
inline

Assignment operator.

Parameters
rhsThe entity to copy

◆ removeInstance()

unsigned int moordyn::state::State::removeInstance ( moordyn::Instance obj)

Remove an instance.

Parameters
objThe instance
Exceptions
moordyn::invalid_value_errorIf the instance has not been registered, or it was already removed

◆ Serialize()

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

Produce the packed data to be saved.

The produced data can be used afterwards to restore the saved information 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.


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