FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
NetCableElementTest.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 "NetCableElementTestSpec.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_rhoWater;
33 static float m_dragCoeffSphere;
34 static float m_normalDragCoeffDisk;
36 static float m_tangentialDragCoeffDisk;
37 static float m_tangentialFrictionCoeff;
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 rhoWater,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 newNode, int newElementID, NetCableElementTest** sNewCable);
80
83
84 void DeleteSpheresAndDisks();
85
86 void AddSpheres(float* adD, float* adMass, float* adPos, std::vector<std::string> VsSphereMaterial, int num);
87 void AddDisks(float* adD, float* adThickness, float* adMass, float* adPos, std::vector<std::string> VsDiskMaterial, int num);
88
89#ifdef FH_VISUALIZATION
91 void RenderInit(Ogre::Root* ogreRoot);
92
94 void RenderUpdate( const double adPosA[3], const double adPosB[3]);
95#endif
96 int m_conn[2];
98 float* m_sphereD;
99 float* m_sphereMass;
100 float* m_spherePos;
102 float* m_diskD;
104 float* m_diskMass;
105 float* m_diskPos;
106 //float m_addedWeightInWater; ///< 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_renderSpheres;
119 Ogre::SceneNode** m_renderNodeSpheres;
120 Ogre::Entity** m_renderDisks;
121 Ogre::SceneNode** m_renderNodeDisks;
122 std::string m_materialName;
123 int m_cableFaces;
124 float m_drawScale;
125
126#endif
127 std::string m_cableName;
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_iD;
146 float m_dL0;
147 float m_dD;
148 float m_dhyd;
149 float m_dE;
150 float m_rho;
151 float m_normalDragCoeff;
152
153 float m_dampingRatio;
154// float ma_dVelAmp;
155// float ma_adVel[3];
156// float ma_adVt[3];
157// float ma_adVn[3];
158 float m_massInWater[2];
159 float m_weightInWater[2];
160 //float m_massInWaterPerMeter[2];
161 //float m_weightInWaterPerMeter[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_eA;
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 NetCableElementTestSpec.h:18
Class containing a cable element object, allowing for disks and spheres to be connected.
Definition NetCableElementTest.h:30
void AddEndForces(const double rhoWater, 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.
int m_numSpheres
The number of spheres connected.
Definition NetCableElementTest.h:97
float * m_diskD
The diameter of the connected disks.
Definition NetCableElementTest.h:102
NetCableElementTest()
The constructor.
bool CheckAndInitialize()
Does the initialization and checking to make sure that the element is ready for simulation.
float * m_sphereMass
The mass of the connected spheres.
Definition NetCableElementTest.h:99
static float m_normalDragCoeffDisk
The normal drag coefficient of a disk.
Definition NetCableElementTest.h:34
void SetConstants()
Calculates parameters and sets physical constants.
float * m_diskMass
The mass of the connected disks.
Definition NetCableElementTest.h:104
static float m_dragCoeffSphere
The drag coefficient of a sphere.
Definition NetCableElementTest.h:33
float * m_sphereD
The diameter of the connected spheres.
Definition NetCableElementTest.h:98
int m_conn[2]
The node numbers that the element is connected to.
Definition NetCableElementTest.h:96
~NetCableElementTest()
The destructor.
void CalcMassAndWeight()
Calculates the mass and weight of the element in water.
float * m_diskPos
The position of the connected disks.
Definition NetCableElementTest.h:105
bool Divide(int aiNodes[2], int newNode, int newElementID, NetCableElementTest **sNewCable)
Divides the element in two.
int m_numDisks
The number of disks connected.
Definition NetCableElementTest.h:101
std::vector< std::string > m_VsDiskMeshName
The names of the materials of the attached disks.
Definition NetCableElementTest.h:107
NetCableElementTest(const NetCableElementTest *old)
The copy constructor.
float * m_diskThickness
The thickness of the connected disks.
Definition NetCableElementTest.h:103
static float m_tangentialFrictionCoeffDisk
The normal friction coefficient of a disk.
Definition NetCableElementTest.h:35
void AddHydroForcesAppendices(double adForceA[3], double adForceB[3])
Calculates the hydrodynamic forces on spheres and disks attached to the cable.
float * m_spherePos
The position of the connected spheres.
Definition NetCableElementTest.h:100
std::vector< std::string > m_VsSphereMeshName
The names of the materials of the attached spheres.
Definition NetCableElementTest.h:108