FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
NetStructureSpec.h
1
9
10#ifndef CNetStructureSpec_H
11#define CNetStructureSpec_H
12
13// Includes
14#include <memory>
15#include <string>
16#include <vector>
17#include "CommonTypes.h"
18#include "NetCableElementSpec.h"
19#include "NetElementDef.h"
20#include <fhsim/InputReader.h>
21#include <fhsim/ISimObjectLogger.h>
22
25{
26 double maxCableTension;
27 double maxStepLength;
28 double meanCableTension;
29 double minCableLength;
30 double stepSafetyFactor;
31 double adaptationPeriod;
32 double massFactor;
33 double maxVelocity;
34 double addedDragPerMPS;
35};
36
37
38//Class definition
40{
41public:
43 NetStructureSpec(ISimObjectLogger *logger);
47 NetStructureSpec& operator=(const NetStructureSpec&) = delete;
48
49 virtual void FromFile(std::string fileName, std::string filePath);
50 void FromBinaryFile(std::string fileName, std::string filePath);
56 bool FromNetSpec(const std::string& specPath);
61 std::vector<std::string> DefaultNodes(const std::string& parameter) const;
62
63 // The finished mesh, read only: each reader above refines the net before it returns.
64 int CreateExternalNodeMap(std::vector<std::string> VsInputNodes, VSPairStrInt& VsNodes) const;
65 int GetNumNodesCalc() const {return m_numNodesCalc;}
66 int GetNumNodesOriginal() const {return m_numNodesOriginal;}
68 std::vector<const NetElementDef*> GetNetPanels() const;
70 std::vector<const NetCableElementSpec*> GetCableElements() const;
71 SAdaptationSpec_t GetAdaptationSpec() const {return m_SAdaptationSpec;}
72
73 bool GetCatsRefinementMode() const;
74 void PrintInfo() const;
75
76protected:
78 virtual void ReadInput(InputReader& FileReader, ISimObjectLogger* logger);
81 virtual void ReadBinaryInputFile(std::string fileName, std::string filePath, ISimObjectLogger* logger);
82 void FindNodesToDivide(int nodesToDivide[2], double *length, double *lengthFactor);
83 void RefineMesh();
84 void RefineMesh2();
85
86 void CheckNodeNumber(int nodeNumber, ISimObjectLogger *const logger, std::string nodeDescription = "");
87 void CheckNodes(ISimObjectLogger *logger);
88 unsigned short AddCalcNode(int aiNodes[2]);
89 unsigned short DivideCableElement(int CableNum );
90
91 // Calculation variables
96
97 std::vector<std::unique_ptr<NetElementDef>> m_VSPanelData;
98 std::vector<std::unique_ptr<NetCableElementSpec>> m_VCableElements;
99
100 // Variables for controlling the calculation mesh refinement.
107 double m_scale;
108
109 std::string m_netName;
110 VSPairStrInt m_VsNodesAvailable;
111
113
114 std::vector<std::string> m_defaultNodesInputForce;
115 std::vector<std::string> m_defaultNodesOutputPosAndVel;
116
117 static int s_iID;
118 int m_iD;
119 ISimObjectLogger* m_logger;
120};
121
122
123#endif
124
Definition NetStructureSpec.h:40
int m_numNodesCalc
The number of nodes of the net after refinement.
Definition NetStructureSpec.h:95
NetStructureSpec(const NetStructureSpec &)=delete
Owns its panel and cable specifications.
double m_maxSideLengthFactor
The maximum element side length factor.
Definition NetStructureSpec.h:102
int m_numNodesOriginal
The number of original nodes of the net.
Definition NetStructureSpec.h:94
void CheckAndRefine()
Checks the node numbers and refines the mesh of the net just read.
int m_numCablesCalc
The number of elements the cable is divided into.
Definition NetStructureSpec.h:93
VSPairStrInt m_VsNodesAvailable
The tag names and indices of the available external nodes.
Definition NetStructureSpec.h:110
int m_maxNumPanels
The maximum number of net panels used for the calculations.
Definition NetStructureSpec.h:105
virtual void ReadInput(InputReader &FileReader, ISimObjectLogger *logger)
Reads a <Net> document, from a file or from text.
SAdaptationSpec_t m_SAdaptationSpec
A struct containing adaptations for faster integration of the net structure.
Definition NetStructureSpec.h:112
int m_foldingPointRefinement
refinement by folding points on each cable (Cats mode)
Definition NetStructureSpec.h:101
virtual ~NetStructureSpec()
The elements are owned through std::unique_ptr.
int m_maxNumCables
The maximum number of cable elements used for the calculations.
Definition NetStructureSpec.h:106
int m_numPanelsCalc
The number of elements the net is divided into.
Definition NetStructureSpec.h:92
double m_minSideLength
The side length limit for the elements to be further subdivided.
Definition NetStructureSpec.h:103
std::vector< std::string > m_defaultNodesOutputPosAndVel
DefaultNodes("NodesOutputPosAndVel").
Definition NetStructureSpec.h:115
std::vector< const NetCableElementSpec * > GetCableElements() const
The cable elements of the refined mesh, as GetNetPanels.
NetStructureSpec(ISimObjectLogger *logger)
The constructor sets the pointer to the output object and the parser object.
std::vector< std::unique_ptr< NetCableElementSpec > > m_VCableElements
The cable elements read from the input file, then refined.
Definition NetStructureSpec.h:98
std::vector< const NetElementDef * > GetNetPanels() const
The panels of the refined mesh: read-only pointers to the elements the spec owns, valid while it live...
std::vector< std::string > m_defaultNodesInputForce
DefaultNodes("NodesInputForce").
Definition NetStructureSpec.h:114
double m_scale
The scale of the trawl net in relation to the specifications.
Definition NetStructureSpec.h:107
std::vector< std::unique_ptr< NetElementDef > > m_VSPanelData
The panels read from the input file, then refined.
Definition NetStructureSpec.h:97
std::vector< std::string > DefaultNodes(const std::string &parameter) const
bool FromNetSpec(const std::string &specPath)
int m_maxNumNodes
The maximum number of nodes used for net calculations.
Definition NetStructureSpec.h:104
std::string m_netName
The identification name of the net.
Definition NetStructureSpec.h:109
Class containing the specification for a net object.
Definition NetStructureSpec.h:25