Marine systems simulation
CNetStructureOCL.h
1
9
10#ifndef CNetStructureOCL_H
11#define CNetStructureOCL_H
12
13//#define CNetStructureOCL_DO_PROFILE
14// Includes
15#include <string>
16#include "SimObject.h"
17#include "CNetElement3N.h"
18#include "CNetCableElementSpec.h"
19#include "CNetCableElement.h"
20#include "CNetElementDef.h"
21#include "environment/IBasicBottom.h"
22#include "CNetBottomContactFilter.h"
23#include "environment/ICurrentVel.h"
24#include "sfh/timers/ProfilerWallclock.h"
25#include "CNetStructureSpec.h"
26#include "cl.hpp" // Fix?
27#include "CNetPanelForcesOcl.h"
28
29#ifdef FH_VISUALIZATION
30# include "NMeshGenerators.h"
31#endif
32
33//Class definition
34class CNetStructureOCL : public SimObject
35{
36public:
38 CNetStructureOCL(std::string sSimObjectName, ISimObjectCreator *pCreator);
41 virtual void OdeFcn(const double dT, const double *const adX, double *const adXDot, const bool bIsMajorTimeStep);
42 virtual void InitialConditionSetup(const double dT, const double *const adCurrentIC, double *const adUpdatedIC, ISimObjectCreator *const pCreator);
43 virtual void FinalSetup(const double dT, const double *const adX, ISimObjectCreator *const pCreator);
44#ifdef FH_VISUALIZATION
46 virtual void RenderInit(Ogre::Root *const pOgreRoot, ISimObjectCreator *const pCreator);
48 virtual void RenderUpdate(const double dT, const double *const adX);
49#endif
50 const virtual double *const NodePos(const double dT, const double *const adX, int iExtNode);
51 const virtual double *const NodeVel(const double dT, const double *const adX, int iExtNode);
52 const virtual double *const BottomContact(const double dT, const double *const adX);
53 void SetAddedDragPerMPS(double AddedDragPerMPS);
54protected:
55 virtual void CalcStateDerivatives(const double *const adX, double *const adXDot);
56 virtual void AddExternalForces(const double dT, const double *const adX);
57 virtual void AddNetForces(const double dT, const double *const adX);
58 virtual void AddCableForces(const double dT, const double *const adX);
59 virtual double AddNodeBottomForce(const double *const adX, int iNode, double dDiam, double adForceInOut[3]);
60 virtual void AddBottomForces(const double *const adX);
61 virtual void AddInputPorts(ISimObjectCreator *pCreator);
62 virtual void CreateNetPanels(std::vector<const CNetElementDef*> VNetElementDefs, ISimObjectCreator *pCreator);
63 virtual void CreateNetCables(std::vector<const CNetCableElementSpec*> VCableElements, ISimObjectCreator *pCreator);
64 virtual void CreateDataStructures();
65 virtual void CreateOutputPorts(ISimObjectCreator *pCreator);
66 VSPairStrInt CreateExternalNodeMap( std::string sTag, int* piUsed, CNetStructureSpec & NetSpec, ISimObjectCreator *pCreator);
67 void PRINTALLNODEFORCES(std::string spec, double dT);
68
70
71 ISignalPort **m_apInExternalForces;
72 int *m_aIStatePos;
73 int *m_aIStateVel;
75
77
79 int m_iNumNodesOutputPosAndVel;
80 int m_iNumPanelsCalc;
81 int m_iNumCablesCalc;
82 int m_iNumNodesOriginal;
83 int m_iNumNodesCalc;
84 int m_iNumNodeOutputs;
86
88
90 double m_adBottomContact[6];
91 IBasicBottom** m_ppBottom;
92 ICurrentVel** m_ppCurrentVel;
93 float* m_afElementWaterVel;
95
97
98 std::vector<CNetCableElement*> m_VpCableElements;
99 std::vector<CNetElement3N*> m_VpNetElements;
100 float* m_afInertia;
101 int* m_aiNetConn;
102 int** m_aaiCableConn;
103 SAdaptationSpec_t m_SAdaptations;
105
106
108
110 VSPairStrInt m_VsNodesInputForce;
111 bool m_bUseTagForExternalNodes;
113
114 double* m_adNodeForce;
115 sfh::timers::StopWatch m_OdeTimer;
116#ifdef CNetStructureOCL_DO_PROFILE
117 sfh::timers::ProfilerWallclock m_Profiler;
118#endif
119 // OpenCL
120 CNetPanelForcesOcl* pNetPanelForcesOcl;
121#ifdef FH_VISUALIZATION
122 Ogre::Entity* thisEntity;
123 Ogre::SceneNode* thisSceneNode;
124 Ogre::MeshPtr msh;
125 Ogre::HardwareVertexBufferSharedPtr m_VertexBuffer;
126 Ogre::HardwareVertexBufferSharedPtr m_NormalsBuffer;
127 Ogre::SceneManager* m_pSceneMgr;
128 Ogre::Entity** m_apRenderSphere;
129 Ogre::SceneNode** m_apRenderNodeSphere;
130
131
132#endif
133};
134
135
136#endif
Definition: CNetBottomContactFilter.h:7
Definition: CNetPanelForcesOcl.h:10
Class containing a net object.
Definition: CNetStructureOCL.h:35
CNetStructureOCL(std::string sSimObjectName, ISimObjectCreator *pCreator)
The constructor sets the pointer to the output object and the parser object.
VSPairStrInt m_VsNodesOutputPosAndVel
Nodes reachable directly through input or output ports.
Definition: CNetStructureOCL.h:109
ISignalPort ** m_apInExternalForces
Interface member variables.
Definition: CNetStructureOCL.h:71
int m_iNumNodesInputForce
Node counts.
Definition: CNetStructureOCL.h:78
virtual ~CNetStructureOCL()
The destructor deletes dynamically allocated memory.
CNetBottomContactFilter m_BottomContactFilter
Environment.
Definition: CNetStructureOCL.h:89
std::vector< CNetCableElement * > m_VpCableElements
Element properties.
Definition: CNetStructureOCL.h:98
Definition: CNetStructureSpec.h:38
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