FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
CModelWriter Class Reference

Contains static functions to write properties for fhSim from model to string and strings to model file. More...

#include <CModelWriter.h>

+ Inheritance diagram for CModelWriter:
+ Collaboration diagram for CModelWriter:

Public Member Functions

 CModelWriter (std::string outDir, std::string name, bool usePlaceholders=false)
 
std::string MakePosForceConnectionString (std::string forceOutObject, std::string forceOutPort, std::string posInPort, std::string velInPort, std::string posOutObject, std::string posOutPort, std::string velOutPort, std::string forceInPort, bool dropForceFeedback=false, short iMainIndent=kMainIndent, short iEqualIndent=kEqualIndent)
 Makes a force-pos-vel connection for the fhSim input file.
 
void SetIntegratorOptions (IntegratorOptions IntOptions)
 Sets the integrator options of the system.
 
bool SendToFile (const std::string sFileName, const std::string *const psOutputString)
 Creates a file with the input string as its content.
 
void SetOutDirectory (std::string outDir)
 
void SetName (std::string name)
 
std::string GetName () const
 

Static Public Member Functions

static std::string ArrayToText (double *adProperty, unsigned short iSize)
 Creates a string of a double array.
 
static std::string MakePropString (std::string sName, double val, std::string placeholder, bool usePlaceholder)
 Makes a property string which is replaced with a placeholder if value is NaN or usePlaceholder is true.
 
static std::string MakePropString (std::string sName, std::string sProperty, short iMainIndent=kMainIndent, short iEqualIndent=kEqualIndent)
 Makes a property string for the fhSim input file from a string value.
 
static std::string MakePropString (std::string sName, double *adProperty, unsigned short iSize, short iMainIndent=kMainIndent, short iEqualIndent=kEqualIndent)
 Makes a property string for the fhSim input file from a double array value.
 
static std::string MakePropString (std::string sName, int iProperty, short iMainIndent=kMainIndent, short iEqualIndent=kEqualIndent)
 Makes a property string for the fhSim input file from an integer value.
 
static std::string MakePropString (std::string sName, std::tuple< double, double, double > adProperty, short iMainIndent=kMainIndent, short iEqualIndent=kEqualIndent)
 Makes a property string for the fhSim input file from a three value tuple value.
 
static std::string MakePropString (std::string sName, int *aiProperty, unsigned short iSize, short iMainIndent=kMainIndent, short iEqualIndent=kEqualIndent)
 Makes a property string for the fhSim input file from an integer array value.
 
static std::string MakePropString (std::string sName, double dProperty, short iMainIndent=kMainIndent, short iEqualIndent=kEqualIndent)
 Makes a property string for the fhSim input file from a double value.
 
static std::string MakePropString (std::string sName, double dProperty1, double dProperty2, double dProperty3, short iMainIndent=kMainIndent, short iEqualIndent=kEqualIndent)
 Makes a property string for the fhSim input file from three double values.
 
static std::string MakePropString (std::string sName, double dProperty1, double dProperty2, short iMainIndent=kMainIndent, short iEqualIndent=kEqualIndent)
 Makes a property string for the fhSim input file from a two double values.
 
static std::string MakePropString (std::string sName, sfh::linalg::Vec2 SProperty, short iMainIndent=kMainIndent, short iEqualIndent=kEqualIndent)
 Makes a property string for the fhSim input file from a 2D vector value.
 
static std::string MakePropString (std::string sName, sfh::linalg::Vec3 SProperty, short iMainIndent=kMainIndent, short iEqualIndent=kEqualIndent)
 Makes a property string for the fhSim input file from a 3D vector value.
 
static std::string MakePropString (std::string sName, std::vector< double > VdProperty, short iMainIndent=kMainIndent, short iEqualIndent=kEqualIndent)
 Makes a property string for the fhSim input file from a vector value.
 
static std::string MakePropString (std::string sName, std::vector< int > ViProperty, short iMainIndent=kMainIndent, short iEqualIndent=kEqualIndent)
 Makes a property string for the fhSim input file from a vector value.
 
static std::string MakePropString (std::string sName, std::vector< std::string > VsProperty, short iMainIndent=kMainIndent, short iEqualIndent=kEqualIndent)
 Makes a property string for the fhSim input file from a vector value.
 
static std::string MakePosForceConnectionString (std::string forceObject, int forcePortIndex, std::string posObject, int posPortIndex, std::string forcePortPrefix="", std::string posPortPrefix="", bool dropForceFeedback=false, short iMainIndent=kMainIndent, short iEqualIndent=kEqualIndent)
 Makes a force-pos-vel connection for the fhSim input file.
 

Protected Member Functions

bool AddIntegration ()
 Adds the integration options to the model string.
 

Protected Attributes

IntegratorOptions m_IntegratorOptions
 The integrator options.
 
std::string m_sModel
 The model string to be written to the model file.
 
std::string m_sBaseFileName
 The name of the main model file.
 
std::string m_name
 The name of the model in the main model file.
 
std::string m_outDir
 
bool m_usePlaceholders
 

Static Protected Attributes

static const unsigned short kEqualIndent = 45
 The default position of the equal sign in the property strings.
 
static const unsigned short kMainIndent = 3
 The default number of tabulations before the property names.
 

Detailed Description

Author
Karl-Johan Reite

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