Marine systems simulation
CNetCableElementTest.h
1
10
11#ifndef CNetCableElementTest_H
12#define CNetCableElementTest_H
13
14
15#include "sfh/math.h"
16#include "sfh/linalg.h"
17
18#include "CNetCableElementTestSpec.h"
19#ifdef FH_VISUALIZATION
20#pragma warning(push)
21#pragma warning( disable : 4251)
22#include <Ogre.h>
23#pragma warning(pop)
24#include "sfh/ogre/CDynamicLines.h"
25//#include "MeshGenerators.h"
26#endif
27
28//Class definition
30{
31public:
32 static float m_dRhoWater;
33 static float m_dDragCoeffSphere;
36 static float m_dTangentialDragCoeffDisk;
37 static float m_dTangentialFrictionCoeff;
38
41
42 static void * operator new ( size_t size)
43 {
44#ifdef WIN32
45 return _aligned_malloc(size,16);
46#elif __APPLE__
47 return malloc(size);
48#else
49 return aligned_alloc(16, size);
50#endif
51 }
52
53 static void operator delete( void *p )
54 {
55#ifdef WIN32
56 _aligned_free(p);
57#else
58 free(p);
59#endif
60 }
61
65
68
70 void AddEndForces(const double dRhoWater,const sfh::linalg::sse_vec3f &posa,const sfh::linalg::sse_vec3f &posb,const sfh::linalg::sse_vec3f &vela,const sfh::linalg::sse_vec3f &velb,const sfh::linalg::sse_vec3f &velf, sfh::linalg::sse_vec3f &forceA,sfh::linalg::sse_vec3f &forceB, double angle );
71
74
77
79 bool Divide(int aiNodes[2], int iNewNode, int iNewElementID, CNetCableElementTest** pSNewCable);
80
83
84 void DeleteSpheresAndDisks();
85
86 void AddSpheres(float* adD, float* adMass, float* adPos, std::vector<std::string> VsSphereMaterial, int iNum);
87 void AddDisks(float* adD, float* adThickness, float* adMass, float* adPos, std::vector<std::string> VsDiskMaterial, int iNum);
88
89#ifdef FH_VISUALIZATION
91 void RenderInit(Ogre::Root* pOgreRoot);
92
94 void RenderUpdate( const double adPosA[3], const double adPosB[3]);
95#endif
96 int m_conn[2];
98 float* m_adSphereD;
102 float* m_adDiskD;
105 float* m_adDiskPos;
106 //float m_dAddedWeightInWater; ///< The weight in water added to the element.
107 std::vector<std::string> m_VsDiskMeshName;
108 std::vector<std::string> m_VsSphereMeshName;
109
110public:
111
113 void AddHydroForcesAppendices(double adForceA[3], double adForceB[3]);
114
115 // Constants
116
117#ifdef FH_VISUALIZATION
118 Ogre::Entity** m_aRenderSpheres;
119 Ogre::SceneNode** m_aRenderNodeSpheres;
120 Ogre::Entity** m_aRenderDisks;
121 Ogre::SceneNode** m_aRenderNodeDisks;
122 std::string m_sMaterialName;
123 int m_iCableFaces;
124 float m_dDrawScale;
125
126#endif
127 std::string m_sCableName;
128
129 sfh::linalg::sse_vec3f n;
130 sfh::linalg::sse_vec3f n2[2];
131
132 sfh::linalg::sse_vec3f vel;
133 sfh::linalg::sse_vec3f vel_t;
134 sfh::linalg::sse_vec3f vel_n;
135 sfh::linalg::sse_vec3f vel_n_a;
136 sfh::linalg::sse_vec3f vel_n_b;
137
138 sfh::linalg::sse_vec3f f_struct;
139 sfh::linalg::sse_vec3f f_drag_a, f_drag_b;
140
141 sfh::linalg::sse_vec3f force_sphere_a;
142 sfh::linalg::sse_vec3f force_sphere_b;
143 sfh::linalg::sse_vec3f force_disk_a,force_disk_b;
144
145 int m_iID;
146 float m_dL0;
147 float m_dD;
148 float m_dDhyd;
149 float m_dE;
150 float m_dRho;
151 float m_dNormalDragCoeff;
152
153 float m_dDampingRatio;
154// float ma_dVelAmp;
155// float ma_adVel[3];
156// float ma_adVt[3];
157// float ma_adVn[3];
158 float m_adMassInWater[2];
159 float m_adWeightInWater[2];
160 //float m_adMassInWaterPerMeter[2];
161 //float m_adWeightInWaterPerMeter[2];
162 //float ma_adDirection[3];
163 float m_dL0Inv;
164 //float ma_dVtAmp;
165 //float ma_dVnAmp;
166 float lengthArray[3];
167 float compressionvelArray[3];
168 float m_length;
169 float m_compressionSpeed;
170// float minLength;
171// float minCompressionVel;
172// float maxLength;
173// float maxCompressionVel;
174 float velArray[3];
175 float structForceArray[3];
176 float ma_dDampingCoeff;
177 float m_dEA;
178 float ma_dNormalDragFactor;
179 float ma_dTangentialDragFactor;
180 float m_dA;
181
182 float m_dragReduction;
183 float m_projectedArea;
184 float m_normalVelocity;
185};
186
187
188#endif
Class containing a cable element object, allowing for disks and spheres to be connected.
Definition: CNetCableElementTestSpec.h:18
Class containing a cable element object, allowing for disks and spheres to be connected.
Definition: CNetCableElementTest.h:30
float * m_adSphereMass
The mass of the connected spheres.
Definition: CNetCableElementTest.h:99
static float m_dTangentialFrictionCoeffDisk
The normal friction coefficient of a disk.
Definition: CNetCableElementTest.h:35
void AddHydroForcesAppendices(double adForceA[3], double adForceB[3])
Calculates the hydrodynamic forces on spheres and disks attached to the cable.
int m_iNumSpheres
The number of spheres connected.
Definition: CNetCableElementTest.h:97
void CalcMassAndWeight()
Calculates the mass and weight of the element in water.
static float m_dDragCoeffSphere
The drag coefficient of a sphere.
Definition: CNetCableElementTest.h:33
float * m_adSphereD
The diameter of the connected spheres.
Definition: CNetCableElementTest.h:98
float * m_adSpherePos
The position of the connected spheres.
Definition: CNetCableElementTest.h:100
void AddEndForces(const double dRhoWater, const sfh::linalg::sse_vec3f &posa, const sfh::linalg::sse_vec3f &posb, const sfh::linalg::sse_vec3f &vela, const sfh::linalg::sse_vec3f &velb, const sfh::linalg::sse_vec3f &velf, sfh::linalg::sse_vec3f &forceA, sfh::linalg::sse_vec3f &forceB, double angle)
Calculates the end forces on the cable element.
void SetConstants()
Calculates parameters and sets physical constants.
bool CheckAndInitialize()
Does the initialization and checking to make sure that the element is ready for simulation.
float * m_adDiskD
The diameter of the connected disks.
Definition: CNetCableElementTest.h:102
float * m_adDiskPos
The position of the connected disks.
Definition: CNetCableElementTest.h:105
CNetCableElementTest()
The constructor.
bool Divide(int aiNodes[2], int iNewNode, int iNewElementID, CNetCableElementTest **pSNewCable)
Divides the element in two.
float * m_adDiskMass
The mass of the connected disks.
Definition: CNetCableElementTest.h:104
int m_iNumDisks
The number of disks connected.
Definition: CNetCableElementTest.h:101
CNetCableElementTest(const CNetCableElementTest *pOld)
The copy constructor.
int m_conn[2]
The node numbers that the element is connected to.
Definition: CNetCableElementTest.h:96
std::vector< std::string > m_VsSphereMeshName
The names of the materials of the attached spheres.
Definition: CNetCableElementTest.h:108
~CNetCableElementTest()
The destructor.
float * m_adDiskThickness
The thickness of the connected disks.
Definition: CNetCableElementTest.h:103
std::vector< std::string > m_VsDiskMeshName
The names of the materials of the attached disks.
Definition: CNetCableElementTest.h:107
static float m_dNormalDragCoeffDisk
The normal drag coefficient of a disk.
Definition: CNetCableElementTest.h:34