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 <string>
16#include <vector>
17
18#include "sfh/math.h"
19#include "sfh/linalg.h"
20#include "NetVec3f.h"
21
22#include "NetCableElementTestSpec.h"
23#ifdef FH_VISUALIZATION
24#pragma warning(push)
25#pragma warning( disable : 4251)
26#include <Ogre.h>
27#pragma warning(pop)
28#include "sfh/ogre/CDynamicLines.h"
29//#include "MeshGenerators.h"
30#endif
31
32//Class definition
34{
35public:
36 static float m_rhoWater;
37 static float m_dragCoeffSphere;
38 static float m_normalDragCoeffDisk;
40 static float m_tangentialDragCoeffDisk;
41 static float m_tangentialFrictionCoeff;
42
45
49
52
54 void AddEndForces(const double rhoWater,const NetVec3f &posa,const NetVec3f &posb,const NetVec3f &vela,const NetVec3f &velb,const NetVec3f &velf, NetVec3f &forceA,NetVec3f &forceB, double angle );
55
58
61
63 bool Divide(int aiNodes[2], int newNode, int newElementID, NetCableElementTest** sNewCable);
64
67
68 void DeleteSpheresAndDisks();
69
70 void AddSpheres(float* adD, float* adMass, float* adPos, std::vector<std::string> VsSphereMaterial, int num);
71 void AddDisks(float* adD, float* adThickness, float* adMass, float* adPos, std::vector<std::string> VsDiskMaterial, int num);
72
73#ifdef FH_VISUALIZATION
75 void RenderInit(Ogre::Root* ogreRoot);
76
78 void RenderUpdate( const double adPosA[3], const double adPosB[3]);
79#endif
80 int m_conn[2];
82 float* m_sphereD;
83 float* m_sphereMass;
84 float* m_spherePos;
86 float* m_diskD;
88 float* m_diskMass;
89 float* m_diskPos;
90 //float m_addedWeightInWater; ///< The weight in water added to the element.
91 std::vector<std::string> m_VsDiskMeshName;
92 std::vector<std::string> m_VsSphereMeshName;
93
94public:
95
97 void AddHydroForcesAppendices(double adForceA[3], double adForceB[3]);
98
99 // Constants
100
101#ifdef FH_VISUALIZATION
102 Ogre::Entity** m_renderSpheres;
103 Ogre::SceneNode** m_renderNodeSpheres;
104 Ogre::Entity** m_renderDisks;
105 Ogre::SceneNode** m_renderNodeDisks;
106 std::string m_materialName;
107 int m_cableFaces;
108 float m_drawScale;
109
110#endif
111 std::string m_cableName;
112
113 NetVec3f n;
114 NetVec3f n2[2];
115
116 NetVec3f vel;
117 NetVec3f vel_t;
118 NetVec3f vel_n;
119 NetVec3f vel_n_a;
120 NetVec3f vel_n_b;
121
122 NetVec3f f_struct;
123 NetVec3f f_drag_a, f_drag_b;
124
125 NetVec3f force_sphere_a;
126 NetVec3f force_sphere_b;
127 NetVec3f force_disk_a,force_disk_b;
128
129 int m_iD;
130 float m_dL0;
131 float m_dD;
132 float m_dhyd;
133 float m_dE;
134 float m_rho;
135 float m_normalDragCoeff;
136
137 float m_dampingRatio;
138// float ma_dVelAmp;
139// float ma_adVel[3];
140// float ma_adVt[3];
141// float ma_adVn[3];
142 float m_massInWater[2];
143 float m_weightInWater[2];
144 //float m_massInWaterPerMeter[2];
145 //float m_weightInWaterPerMeter[2];
146 //float ma_adDirection[3];
147 float m_dL0Inv;
148 //float ma_dVtAmp;
149 //float ma_dVnAmp;
150 float lengthArray[3];
151 float compressionvelArray[3];
152 float m_length;
153 float m_compressionSpeed;
154// float minLength;
155// float minCompressionVel;
156// float maxLength;
157// float maxCompressionVel;
158 float velArray[3];
159 float structForceArray[3];
160 float ma_dDampingCoeff;
161 float m_eA;
162 float ma_dNormalDragFactor;
163 float ma_dTangentialDragFactor;
164 float m_dA;
165
166 float m_dragReduction;
167 float m_projectedArea;
168 float m_normalVelocity;
169};
170
171// The vector members need 16 byte alignment; C++17 operator new keeps it, no custom allocator is needed.
172static_assert(alignof(NetCableElementTest) >= 16);
173
174
175
176#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:34
int m_numSpheres
The number of spheres connected.
Definition NetCableElementTest.h:81
float * m_diskD
The diameter of the connected disks.
Definition NetCableElementTest.h:86
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:83
static float m_normalDragCoeffDisk
The normal drag coefficient of a disk.
Definition NetCableElementTest.h:38
void SetConstants()
Calculates parameters and sets physical constants.
float * m_diskMass
The mass of the connected disks.
Definition NetCableElementTest.h:88
static float m_dragCoeffSphere
The drag coefficient of a sphere.
Definition NetCableElementTest.h:37
float * m_sphereD
The diameter of the connected spheres.
Definition NetCableElementTest.h:82
int m_conn[2]
The node numbers that the element is connected to.
Definition NetCableElementTest.h:80
~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:89
bool Divide(int aiNodes[2], int newNode, int newElementID, NetCableElementTest **sNewCable)
Divides the element in two.
void AddEndForces(const double rhoWater, const NetVec3f &posa, const NetVec3f &posb, const NetVec3f &vela, const NetVec3f &velb, const NetVec3f &velf, NetVec3f &forceA, NetVec3f &forceB, double angle)
Calculates the end forces on the cable element.
int m_numDisks
The number of disks connected.
Definition NetCableElementTest.h:85
std::vector< std::string > m_VsDiskMeshName
The names of the materials of the attached disks.
Definition NetCableElementTest.h:91
NetCableElementTest(const NetCableElementTest *old)
The copy constructor.
float * m_diskThickness
The thickness of the connected disks.
Definition NetCableElementTest.h:87
static float m_tangentialFrictionCoeffDisk
The normal friction coefficient of a disk.
Definition NetCableElementTest.h:39
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:84
std::vector< std::string > m_VsSphereMeshName
The names of the materials of the attached spheres.
Definition NetCableElementTest.h:92