Marine systems simulation
CMembraneCage.h
1
9
10#pragma once
11
12#include <stdio.h>
13#include <string>
14#include <fstream>
15
16#include <ISimObjectCreator.h>
17#include "CMembraneStructure.h"
18//#include "CMembraneElement.h"
19
20#ifdef FH_VISUALIZATION
21//#include "CFhVis.h"
22#endif
23
24//const double g_PI = 3.1415926;
25
26namespace Netcage {
27
29{
30public:
32 CMembraneCage(const string& simobjectname, ISimObjectCreator* const creator);
33
36
38 //virtual void OdeFcn(const double T, const double *const X, double *const XDot, const bool bIsMajorTimeStep);
39
41 const double* outSumHydDynForce(const double T, const double* const X);
42 const double* outNodeSumForce(const double T, const double* const X);
43 const double* outNodeSumDragForceAbs(const double T, const double* const X);
44 const double* outNodeSumDragForceDirection(const double T, const double* const X);
45 const double* outNodeSumLiftForce(const double T, const double* const X);
46 const double* outBottomPosition(const double T, const double* const X);
47
48 const virtual double * NodeForce(const double dT, const double *const adX, int iExtNode); // NEW: added to test new approach where pos and vel for selected nodes are set by external objects
49 virtual void FinalSetup(const double dT, const double *const adX, ISimObjectCreator *const pCreator); // NEW: overridden to test new approach where pos and vel for selected nodes are set by external objects
50 //const double *const outExternalNodeForce(const double dT, const double *const adX, int iExtNode);
51 //const double* const outCurrentVel(const double T, const double* const X);
52
53 // Overloads the function in CNetStructure
54 //void AddNetForces(const double dT, const double* const adX);
55 virtual void OdeFcn(const double dT, const double* const adX, double* const adXDot, const bool bIsMajorTimeStep);
56
57 void GetNodePositionIndices( std::vector<int> &NodePositions);
58 void GetNodeVelocityIndices( std::vector<int> &NodeVelocities);
59
60#ifdef FH_VISUALIZATION
61
63 virtual void RenderUpdate(const double T, const double* const X); // NEW: overridden to test new approach where pos and vel for selected nodes are set by external objects
64
65#endif
66
67protected:
68 double g_PI;
69 void DecomposeDragForcesInCurrentDirection(double* const DragForcesProjected, const double T, const double* const X);
70
71 void SetExternalPos(const double dT, const double *const adX); // NEW: added to test new approach where pos and vel for selected nodes are set by external objects
72 void SetExternalVel(const double dT, const double *const adX); // NEW: added to test new approach where pos and vel for selected nodes are set by external objects
73
74 virtual void CreateDataStructures(); // NEW: overridden to test new approach where pos and vel for selected nodes are set by external objects
75 virtual void AddInputPorts(ISimObjectCreator *pCreator); // NEW: overridden to test new approach where pos and vel for selected nodes are set by external objects
76 virtual void CreateOutputPorts(ISimObjectCreator *pCreator); // NEW: overridden to test new approach where pos and vel for selected nodes are set by external objects
77 virtual void CalcStateDerivatives(const double *const adX, double *const adXDot); // NEW: overridden to test new approach where pos and vel for selected nodes are set by external objects
78 virtual double AddNodeBottomForce(const double *const adX, int iNode, double dDiam, double adForceInOut[3]);// NEW: overridden to test new approach where pos and vel for selected nodes are set by external objects
79 virtual void AddNetForces(const double dT, const double *const adX); // NEW: overridden to test new approach where pos and vel for selected nodes are set by external objects
80 virtual void AddCableForces(const double dT, const double *const adX); // NEW: overridden to test new approach where pos and vel for selected nodes are set by external objects
81
82 void GetUniformCurrentDragData(); // NEW: Reads pressure coefficients from text file.
83
84 //ISignalPort* m_CurrentVel; // Current velocity input
85 ISignalPort **m_InExternalPos; // NEW: added to test new approach where pos and vel for selected nodes are set by external objects
86 ISignalPort **m_InExternalVel; // NEW: added to test new approach where pos and vel for selected nodes are set by external objects
87
88 double* m_NodeExternalPos; // NEW: added to test new approach where pos and vel for selected nodes are set by external objects
89 double* m_NodeExternalVel; // NEW: added to test new approach where pos and vel for selected nodes are set by external objects
90
91 double m_adNodeSumForce[3];
92 double m_adSumHydDynForce[3];
93 double m_dNodeSumDragForceAbs;
94 double m_dNodeSumDragDirection;
95 double m_dNodeSumLiftForce;
96
97 double* m_pressCoeffAngle; // New: Global angle used for finding appropriate pressure coefficient
98 double* m_pressCoeff; // New: Pressure coefficients corresponding to m_pressCoeffAngle
99
100 double* m_adNodeHydDynForce;
101
102 double* m_NodeInternalForces; // NEW: added to test new approach where pos and vel for selected nodes are set by external objects
103
104 int(* m_hasPosAndVelStates)[2]; // NEW: added to test new approach where pos and vel for selected nodes are set by external objects
105
106 int m_NumNodesInputPosAndVel; // NEW: added to test new approach where pos and vel for selected nodes are set by external objects
107 int m_NumNodesOutputForce; // NEW: added to test new approach where pos and vel for selected nodes are set by external objects
108
109 VSPairStrInt m_VsNodesInputPosAndVel; // NEW: added to test new approach where pos and vel for selected nodes are set by external objects
110 VSPairStrInt m_VsNodesOutputForce; // NEW: added to test new approach where pos and vel for selected nodes are set by external objects
111
112#ifdef FH_VISUALIZATION
113/*
114 double m_Scale; ///< Scale factor for the visualization.
115 const Ogre::Root* m_OgreRoot;
116 Ogre::SceneNode* m_renderNode;
117*/
118#endif
119};
120
121} // namespace
Definition: CMembraneCage.h:29
CMembraneCage(const string &simobjectname, ISimObjectCreator *const creator)
The constructor sets the pointer to the output object and the parser object.
~CMembraneCage()
The destructor cleans up.
const double * outSumHydDynForce(const double T, const double *const X)
Calculates the state derivatives.
Definition: CMembraneStructure.h:42
Class modelling a Net cage.
Definition: CBottomRing.h:35