Marine systems simulation
CNetStructure.h
1#pragma once
2
173//#define CNetStructure_DO_PROFILE
174
175// Includes
176#include <string>
177
178
179#include "SimObject.h"
180#include "CEnvironment.h"
181#include "IBasicBottom.h"
182#include "ICurrentVel.h"
183#include "sfh/timers/ProfilerWallclock.h"
184#include "sfh/math/math.h"
185
186#include "CNetBottomContactFilter.h"
187#include "CNetStructureSpec.h"
188#include "CNetElement3N.h"
189#include "CNetCableElementSpec.h"
190#include "CNetCableElement.h"
191#include "CNetElementDef.h"
192
193
194#ifdef FH_VISUALIZATION
195 #include "sfh/ogre/NMeshGenerators.h"
196 #include "sfh/ogre/C3DLine.h"
197 #include "CTextRenderer.h"
198#endif
199
200
201//Class definition
202class CNetStructure : public SimObject
203{
204public:
206 CNetStructure(std::string sSimObjectName, ISimObjectCreator *pCreator);
208 virtual ~CNetStructure();
209 virtual void OdeFcn(const double dT, const double *const adX, double *const adXDot, const bool bIsMajorTimeStep);
210 virtual void InitialConditionSetup(const double dT, const double *const adCurrentIC, double *const adUpdatedIC, ISimObjectCreator *const pCreator);
211 virtual void FinalSetup(const double dT, const double *const adX, ISimObjectCreator *const pCreator);
212 const double * outExternalNodeForce(const double dT, const double *const adX, int iExtNode);
213
214#ifdef FH_VISUALIZATION
216 virtual void RenderInit(Ogre::Root *const pOgreRoot, ISimObjectCreator *const pCreator);
218 virtual void RenderUpdate(const double dT, const double *const adX);
219#endif
220 const virtual double * NodePos(const double dT, const double *const adX, int iExtNode);
221 const virtual double * NodeVel(const double dT, const double *const adX, int iExtNode);
222 const virtual double * BottomContact(const double dT, const double *const adX);
223
224 const virtual double * StrainEnergy(const double dT, const double *const adX);
225 const virtual double * VelNorm(const double dT, const double *const adX);
226 double m_velNorm;
227
228 void SetAddedDragPerMPS(double AddedDragPerMPS);
229protected:
230 virtual void CalcStateDerivatives(const double *const adX, double *const adXDot);
231 virtual void AddExternalForces(const double dT, const double *const adX);
232 virtual void AddNetForces(const double dT, const double *const adX);
233 virtual void AddCableForces(const double dT, const double *const adX);
234 virtual double AddNodeBottomForce(const double *const adX, int iNode, double dDiam, double adForceInOut[3]);
235 virtual void AddBottomForces(const double *const adX);
236 virtual void AddInputPorts(ISimObjectCreator *pCreator);
237 virtual void CreateNetPanels(std::vector<const CNetElementDef*> VNetElementDefs, ISimObjectCreator *pCreator);
238 virtual void CreateNetCables(std::vector<const CNetCableElementSpec*> VCableElements, ISimObjectCreator *pCreator);
239 virtual void CreateDataStructures();
240 virtual void CreateOutputPorts(ISimObjectCreator *pCreator);
241 VSPairStrInt CreateExternalNodeMap( std::string sTag, int* piUsed, CNetStructureSpec & NetSpec, ISimObjectCreator *pCreator);
242 void PRINTALLNODEFORCES(std::string spec, double dT);
243
244 double m_StrainEnergy;
245
247
248 ISignalPort **m_apInExternalForces;
249 int *m_aIStatePos;
250 int *m_aIStateVel;
252 //double* m_NodeExternalForces;
254
256 int m_iNumNodesOutputPosAndVel;
257 int m_iNumPanelsCalc;
258 int m_iNumCablesCalc;
259 int m_iNumNodesOriginal;
260 int m_iNumNodesCalc;
261 int m_iNumNodeOutputs;
263
265
267 double m_adBottomContact[6];
268
269 IBasicBottom** m_ppBottom;
270 ICurrentVel** m_ppCurrentVel;
271 CEnvironment* m_pEnvironment;
273
275
276 std::vector<CNetCableElement*> m_VpCableElements;
277 std::vector<CNetElement3N*> m_VpNetElements;
278 float* m_afInertia;
279 int* m_aiNetConn;
280 int** m_aaiCableConn;
281 SAdaptationSpec_t m_SAdaptations;
282 bool m_bFoldingPointRefinementUsed;
284
285
287
289 VSPairStrInt m_VsNodesInputForce;
290 bool m_bUseTagForExternalNodes;
292
293 double* m_adNodeForce;
294 sfh::timers::StopWatch m_OdeTimer;
295 double* m_adAccelerationNorms;
296
297#ifdef CNetStructure_DO_PROFILE
298 sfh::timers::ProfilerWallclock m_Profiler;
299#endif
300
301#ifdef FH_VISUALIZATION
302 bool m_bLineVisualization;
303 C3DLine *m_LineVisualizationPressure;
304 C3DLine *m_LineVisualizationStrain;
305#endif
306
307};
Definition: CEnvironment.h:10
Definition: CNetBottomContactFilter.h:7
Definition: CNetStructureSpec.h:38
Definition: CNetStructure.h:203
VSPairStrInt m_VsNodesOutputPosAndVel
Nodes reachable directly through input or output ports.
Definition: CNetStructure.h:288
CNetStructure(std::string sSimObjectName, ISimObjectCreator *pCreator)
The constructor sets the pointer to the output object and the parser object.
std::vector< CNetCableElement * > m_VpCableElements
Element properties.
Definition: CNetStructure.h:276
CNetBottomContactFilter m_BottomContactFilter
Environment.
Definition: CNetStructure.h:266
int m_iNumNodesInputForce
Node counts.
Definition: CNetStructure.h:255
ISignalPort ** m_apInExternalForces
Interface member variables.
Definition: CNetStructure.h:248
virtual ~CNetStructure()
The destructor deletes dynamically allocated memory.
Interface for calculating the bottom force on various objects.
Definition: IBasicBottom.h:23
Definition: ICurrentVel.h:12
Class containing the specification for a net object.
Definition: CNetStructureSpec.h:22