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

Class used to collect and contain the specification of a trawl net. More...

#include <CTrawlNetAssembler.h>

+ Inheritance diagram for CTrawlNetAssembler:
+ Collaboration diagram for CTrawlNetAssembler:

Classes

struct  SLineVisualizationOptions
 A struct for defining how a cable element is to be visualized. More...
 
struct  SNetIntegratorOptions
 
struct  SNetSimOptions
 A struct for the simulation options concerning the trawl net. More...
 

Public Member Functions

 CTrawlNetAssembler (std::string outDir, std::string sNetName, bool usePlaceholders=false)
 Constructor.
 
 ~CTrawlNetAssembler (void)
 Destructor.
 
void ResetOutput (bool bResetError)
 Resets both input and output data of the object.
 
void ClearOutput ()
 Clears all output data.
 
void CreatePanelDefinitions ()
 Uses the net specifications to construct the sections usable for simulation.
 
bool SetRefineFactor (double dRefineFactor)
 Sets the refine factor of all sections of the net.
 
bool SetRefineFactor (TrawlSpec::EPanel_t EPanel, int iSecNo, double dRefineFactor)
 Sets a ratio to calculate the hydrodynamic forces on the net sections with.
 
double GetScale ()
 Gets the scale of the trawl net.
 
void SetScale (double dScale)
 Sets the scale of the trawl net.
 
void Scale (double dScaleMultiplier)
 Multiplies the scale of the trawl net by a factor.
 
void SetMaxNumPanels (int iMaxNumPanels)
 Sets the maximum number of panels for the simulation.
 
void SetMaxEdgeLengthFactor (double dEdgeLengthFactor)
 Sets the maximum edge length factor.
 
void SetAdaptation (double dMaxStepLength, double dAdaptationPeriod=0, double dMeanCableTension=0, double dStepSafetyFactor=50)
 Sets some options for increasing the possible step length in the system.
 
int GetNumOriginalNodes ()
 Retrieves the number of nodes before mesh refinement.
 
SNetSimOptions GetSimoptions ()
 Gets the simulation options.
 
virtual std::string ToFile (std::string filename="")
 Writes the trawl net model to a model file.
 
std::string NetText ()
 The text of the <Net> file ToFile writes.
 
std::string LibLine (const std::string &fileName)
 The <Lib> declaration ToFile returns, of a Net/NetStructure that reads the net file fileName.
 
std::vector< std::string > NodesInputForce ()
 The external nodes the net is connected by (NodesInputForce of LibLine).
 
std::vector< std::string > NodesOutputPosAndVel ()
 The connected and the output external nodes (NodesOutputPosAndVel of LibLine).
 
void SetWriteSideFiles (bool write)
 Writes the panel drawings (CreatePanelDefinitions) and the section table (SectionSpecToFile), or neither.
 
const std::vector< TrawlSpec::SPanelNodes > & PanelNodes () const
 
const std::vector< NetElementDef > & NetElements () const
 The net elements, as the net file lists them.
 
const std::vector< SCableSectionData > & SimulationLines () const
 The lines as the net file lists them: each line of the specification per side, or in its two halves.
 
const TrawlSpec::SNetExternalNodes & ExternalNodes () const
 The node numbers of the external nodes, port and starboard; set by NetText.
 
void SectionSpecToFile (std::string sSectionSpecFileName)
 Sends the specification of the net sections to a csv file for debugging purposes.
 
- Public Member Functions inherited from CTrawlNetSpec
 CTrawlNetSpec (void)
 Constructor.
 
 ~CTrawlNetSpec (void)
 Destructor.
 
void AddSectionToFront (TrawlSpec::EPanel_t EWhichPanel, double barD, double barRho, double barE, double barL, double N, double T1, double T2, double T3=-1, double cutN=0, double cutB=0, double cutT=0, double reinforcementRatio=0, double refineFactor=1)
 Adds a section to the front of the trawl net.
 
void AddSectionToFront (TrawlSpec::EPanel_t EWhichPanel, TrawlSpec::SNetSection NetSection)
 Adds a section to the front of the trawl net.
 
void AddSectionToFront (TrawlSpec::EPanel_t EWhichPanel, TrawlSpec::SMeshBar SBar, TrawlSpec::SPanelCut SCut, double reinforcementRatio=0, double refineFactor=1)
 Adds a section to the front of the trawl net.
 
void AddSectionToBack (TrawlSpec::EPanel_t EWhichPanel, double barD, double barRho, double barE, double barL, double N, double T1, double T2, double T3=-1, double cutN=0, double cutB=0, double cutT=0, double reinforcementRatio=0, double refineFactor=1)
 Adds a section to the back of the trawl net.
 
void AddSectionToBack (TrawlSpec::EPanel_t EWhichPanel, TrawlSpec::SNetSection NetSection)
 Adds a section to the back of the trawl net.
 
void AddSectionToBack (TrawlSpec::EPanel_t EWhichPanel, TrawlSpec::SMeshBar SBar, TrawlSpec::SPanelCut SCut, double reinforcementRatio=0, double refineFactor=1)
 Adds a section to the back of the trawl net.
 
TrawlSpec::SNetSection GetSection (TrawlSpec::EPanel_t EWhichPanel, int iSecNo, bool bFromBack=true)
 Gets the specification of a specified net section.
 
void DeleteSection (TrawlSpec::EPanel_t EWhichPanel, int iSecNo, bool bFromBack=true)
 Deletes the specified net section.
 
void DeletePanel (TrawlSpec::EPanel_t EWhichPanel)
 Deletes all net sections of the specified panel.
 
void UpdateSection (TrawlSpec::SNetSection NetSection, TrawlSpec::EPanel_t EWhichPanel, int iSecNo, bool bFromBack=true)
 Updates the specified net section.
 
int GetNumBellySections (TrawlSpec::EPanel_t EWhichPanel)
 Gets the number of belly sections in a panel, not counting splitter section.
 
int GetNumSplitterSections (TrawlSpec::EPanel_t EWhichPanel)
 Gets the number of splitter sections in a panel.
 
int GetNumSections (TrawlSpec::EPanel_t EWhichPanel, TrawlSpec::EPanelEdge_t EWhichEdge)
 Gets the number of sections in a panel.
 
int GetNumWingSections (TrawlSpec::EPanel_t EWhichPanel, TrawlSpec::EPanelEdge_t EWhichEdge)
 Gets the number of wing sections in a panel.
 
void AddLine (int sectionNum, TrawlSpec::EPanel_t EWhichPanel, TrawlSpec::ESectionSide_t side, double L, double D, double E, double rho)
 Adds a line or chain to the trawl net.
 
void AddLine (int sectionNum, TrawlSpec::EPanel_t EWhichPanel, TrawlSpec::ESectionSide_t side, SCableSectionData SCableSection)
 Adds a line, chain, gear or Headline to the trawl net.
 
void AddLine (SCableSectionData SCableSection)
 Adds a line, chain, gear or Headline to the trawl net.
 
SCableSectionData GetLine (TrawlSpec::EPanel_t EWhichPanel, int iLineIndex)
 Gets the specification of a line connected to the trawl net.
 
SCableSectionData * GetLinePtr (TrawlSpec::EPanel_t EWhichPanel, int iLineIndex)
 Gets a pointer to a line connected to the trawl net.
 
int GetNumLines (TrawlSpec::EPanel_t EWhichPanel)
 Gets the number of lines in a specified panel.
 
void SetExternalNodeIndices (std::set< TrawlSpec::ENetExternalNodes_t > ViExternalNodes)
 Sets the indices of the nodes to be used for external connections.
 
void AddExternalConnection (TrawlSpec::ENetExternalNodes_t ENode)
 Adds an external connection to the net.
 
void AddExternalNodeOutput (TrawlSpec::ENetExternalNodes_t ENode)
 Adds an external output node to the net.
 
void SetNumConnectedSections (TrawlSpec::EPanel_t EWhichPanel, int iNumSections)
 Defines how far forward the a panel is connected to other panels.
 
int GetNumConnectedSections (TrawlSpec::EPanel_t EWhichPanel)
 Gets how far forward the upper panel is connected to other panels.
 
void SetAftMostSectionNumber (TrawlSpec::EPanel_t EWhichPanel, int iAftSection)
 Defines the aft-forward placement of a panel in relation to a common baseline.
 
int GetAftMostSectionNumber (TrawlSpec::EPanel_t EWhichPanel)
 Gets the aft-forward placement of a panel in relation to a common baseline.
 
double GetMinNodeSeparation () const
 The mesh count under which an aft or front end edge of a panel is meshed as a point.
 
bool HasError ()
 Returns if an error has occured in this class.
 
std::string GetError ()
 Returns a string specifying the first error that occured in this class.
 
void ResetInput (bool bResetError)
 Resets both input and output data of the object.
 
int GetNumExternalConnections ()
 Gets the number of external connections on each side of the trawl net.
 
std::set< TrawlSpec::ENetExternalNodes_t > GetExternalConnections ()
 Gets the external connections on each side of the trawl net.
 
const std::set< TrawlSpec::ENetExternalNodes_t > & GetExternalOutputs () const
 Gets the external nodes that only output their positions and velocities (AddExternalNodeOutput).
 
bool SetMirrorWings (TrawlSpec::EPanel_t EWhichPanel, bool bMirror)
 Sets the wings of a specified panel to be mirrored or not.
 
bool GetMirrorWings (TrawlSpec::EPanel_t EWhichPanel)
 Gets if the wings of a specified panel are to be mirrored or not.
 
int MirrorWings ()
 Mirrors the wings for the appropriate panels.
 
double GetStretchedEdge (int sectionNum, TrawlSpec::EPanel_t EWhichPanel, TrawlSpec::ESectionSide_t side)
 Get stretched length of section side.
 
- Public Member Functions inherited from CModelWriter
 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
 

Protected Member Functions

void SetSimOptions ()
 Sets the simulation options for the trawl net.
 
void CreatePanelNodes ()
 Creates the structured panel node numbers.
 
void CreateUnconnectedPanelNodes ()
 Creates the unconnected structured panel node numbers.
 
void ConnectPanelNodes ()
 Creates the connected structured panel node numbers from the unconnected.
 
TrawlSpec::SPanelNodes CreateUnconnectedPanelNodes (TrawlSpec::EPanel_t EWhichPanel, int &iNextNode)
 Creates the unconnected structured panel node numbers of one panel.
 
void ConnectNodes (std::vector< TrawlSpec::SNodeSpec > VSConn)
 Collects nodes to be connected.
 
void ConnectNodes (TrawlSpec::SNodeSpec SConn1, TrawlSpec::SNodeSpec SConn2)
 Collects nodes to be connected.
 
void ConnectNodes (TrawlSpec::EPanel_t Panel1, TrawlSpec::EPanelNodes NodePlacement1, int Section1, TrawlSpec::EPanel_t Panel2, TrawlSpec::EPanelNodes NodePlacement2, int Section2)
 Collects nodes to be connected.
 
bool IsSectionConnected (TrawlSpec::EPanel_t EWhichPanel, TrawlSpec::EPanelEdge_t EWhichEdge, int iGlobalSection)
 Determines if a given panel is connected at the given side and the given global section number.
 
bool SetNodeNumber (TrawlSpec::SNodeSpec SNode, int iNodeNum)
 Sets the node number of the specified node.
 
int GetNodeNumber (TrawlSpec::SNodeSpec SNode)
 Gets the node number of the specified node.
 
std::vector< int > FindUnUsedNodes ()
 Finds all node numbers which are not in use.
 
void CondenseNodes (std::vector< int > ViUnUsedNodes)
 Sets the node numbers to fill in all node numbers not used.
 
void MakeAllNodesCW ()
 Makes the nodes of all sections so that they are CW as seen from the outside of the trawl.
 
void CreateCableElements ()
 Creates the cable elements associated with the net, including Headline and ground gear.
 
bool VerifyCableNodes ()
 Checks if the cable nodes are all right.
 
void CreateSimulationElements (TrawlSpec::EPanel_t EWhichPanel)
 Creates a vector of all sections with the data necessary for simulation.
 
void CreateNodePosXY (TrawlSpec::EPanel_t EWhichPanel)
 Creates a xy-position for every node on a panel.
 
void CreateNodeNumbers ()
 Creates structs containing the global node numbers for the various sections.
 
void AssignNodeNumbers (TrawlSpec::EPanel_t EWhichPanel, int iSecNo, int iElementNo, NetElementDef *pNetElement)
 Assigns node numbers to the given panel.
 
std::vector< int > FindEdgeNodes (int iSecNo, TrawlSpec::EPanel_t EWhichPanel, TrawlSpec::ESectionSide_t EWhichSide, bool *pbDivide)
 Finds the global nodes of the given edge of the given section.
 
std::vector< int > FindEdgeNodesHP (int iSecNo, TrawlSpec::ESectionSide_t EWhichSide, TrawlSpec::EPanel_t EWhichPanel, bool *pbDivide)
 Finds the global nodes of the given edge of the given section in the upper or lower panels.
 
std::vector< int > FindEdgeNodesSP (int iSecNo, TrawlSpec::ESectionSide_t EWhichSide, bool *pbDivide)
 Finds the global nodes of the given edge of the given section in the sidepanels.
 
sfh::linalg::Vec2 GetNodePosUV (TrawlSpec::EPanel_t EWhichPanel, TrawlSpec::ESectionNode_t EWhichNode, int iSec)
 Returns the mesh position of the specified node.
 
TrawlSpec::SPosXY GetNodePosXY (TrawlSpec::EPanel_t EWhichPanel, TrawlSpec::ESectionNode_t EWhichNode, int iSec)
 Returns the XY position of the specified node.
 
void SetExternalNodes ()
 Sets the external nodeNumbers.
 
int ReplaceNodes (int iOldNode, int iNewNode)
 
std::vector< std::string > CreateNodeStringsFromIndices (std::set< TrawlSpec::ENetExternalNodes_t > ViExternalConnections)
 Creates node strings for external connections based on the given indexes (based on the TrawlSpec::ESectionNode_t enum).
 
- Protected Member Functions inherited from CTrawlNetSpec
TrawlSpec::SNetPanel * GetPanelPtr (TrawlSpec::EPanel_t EWhichPanel)
 Gets a pointer to the panel defined by an enum.
 
bool IsSidepanel (TrawlSpec::EPanel_t EWhichPanel)
 Tests if a specified panel is a side panel;.
 
void SetError (std::string sErrorMsg)
 Sets the error state.
 
TrawlSpec::ESectionType_t DetermineSectionType (TrawlSpec::EPanel_t EWhichPanel, int iSecNo)
 Determines if the section is a wing, splitter or belly section, based on its placement.
 
std::string GetPanelString (TrawlSpec::EPanel_t EWhichPanel)
 Creates a string specifying the panel.
 
bool HasTriangularFront (TrawlSpec::EPanel_t EWhichPanel, TrawlSpec::EPanelEdge_t EWhichEdge)
 
bool HasTriangularAft (TrawlSpec::EPanel_t EWhichPanel)
 
int GetWingSectionIndex (TrawlSpec::EPanel_t EWhichPanel, TrawlSpec::EPanelEdge_t EWhichEdge, int iWingSecNum)
 Gets the index of a specified wing section.
 
void MirrorWings (TrawlSpec::EPanel_t EWhichPanel)
 Mirrors the wings for the specified panels.
 
- Protected Member Functions inherited from CModelWriter
bool AddIntegration ()
 Adds the integration options to the model string.
 

Protected Attributes

std::vector< NetElementDef > m_VSNetSections
 A vector of the net sections ready for simulation.
 
std::vector< TrawlSpec::SPanelNodes > m_VSNodes
 A vector of the structured node numbers of the panels.
 
bool m_bAllNodesCW
 Indicates if the nodes of all sections are set so that they are CW as seen from the outside of the trawl.
 
SNetSimOptions m_SimOptions
 The simulation options of the trawl net.
 
double m_Scale
 The scale of the trawl net in relation to the specifications.
 
SNetIntegratorOptions m_IntegratorOptions
 The integration options of the trawl net,.
 
SLineVisualizationOptions m_SCableVisOptions
 The visualization options of the cable elements.
 
std::vector< SCableSectionData > m_VSSimLines
 A vector of the lines as they are to be included in the simulation.
 
std::vector< std::vector< TrawlSpec::SNodeSpec > > m_VVSConnectedNodes
 
TrawlSpec::SNetExternalNodes m_SExternalNodes
 
bool m_writeSideFiles = true
 Whether the panel drawings and the section table are written.
 
- Protected Attributes inherited from CTrawlNetSpec
std::vector< TrawlSpec::SNetPanel > m_VSPanelInfo
 A vector of structures containing the sections comprising the various panels.
 
std::string m_sError
 A string describing the first error string.
 
int m_aiConnectedSections [3]
 The number of sections connected to each panel.
 
int m_aiAftSection [3]
 The relative section number of the aftmost section of each panel, counted from the aft.
 
std::set< TrawlSpec::ENetExternalNodes_t > m_ViExternalConnections
 The indices of the nodes to select for external connections. 0 - 5 designate the wings, starting from the top.
 
std::set< TrawlSpec::ENetExternalNodes_t > m_ViExternalNodesOutput
 The indices of the nodes to select for external connections. 0 - 5 designate the wings, starting from the top.
 
double m_dMinNodeSeparation
 The minimum separation between two nodes in front or aft of a section before it is handled as one node.
 
bool m_bHasSidePanel
 A bool telling if the trawl net has four panels.
 
bool m_bHasError
 Have there been any errors in this object?
 
bool m_bExternalNodesAreSet
 Indicates if the external nodes have been set by calling SetExternalNodeIndices.
 
bool m_bMirrorWings [3]
 Reflects for which panels the wings should be mirrored.
 
bool m_bMirrorWingsIsDone [3]
 Reflects for which panels the wings have been mirrored.
 
- Protected Attributes inherited from CModelWriter
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
 

Friends

class CTrawlNetPrinter
 Making the CTrawlNetPrinter class a friend class, to allow access to necessary information.
 

Additional Inherited Members

- Static Public Member Functions inherited from CModelWriter
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.
 
- Static Protected Attributes inherited from CModelWriter
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

Member Function Documentation

◆ PanelNodes()

const std::vector< TrawlSpec::SPanelNodes > & CTrawlNetAssembler::PanelNodes ( ) const
inline

The node numbers of each panel (upper, lower, port and starboard side) and the positions of its sections' corners, in metres, at square meshes: x forward from the aft end, y to starboard.

◆ SetRefineFactor()

bool CTrawlNetAssembler::SetRefineFactor ( TrawlSpec::EPanel_t  EPanel,
int  iSecNo,
double  dRefineFactor 
)

Sets the refine factor of the specified section of the net.


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