Marine systems simulation
CRBCEngine.h
1
4//
12
13#ifndef CRBCENGINE_H
14#define CRBCENGINE_H
15
16
17
18//Class definition
20{
21public:
23 CRBCEngine(int nofBarElements,
24 double dBarMass,
25 double dLength,
26 double dOmegaNL,
27 double dOmegaN,
28 double dZetaNL,
29 double dZetaN,
30 bool fixedFixed,
31 double kei,
32 double ked,
33 double kep
34 );
37
38 // Member functions
39 // GetInitialStates is to be called before calling StateUpdate,
40 // GetAccelerations, GetEndForces, GetNodePositions, or
41 // GetNodeVelocities
42 bool GetInitialStates(const double * const posA,
43 const double * const posB,
44 const double * const velA,
45 const double * const velB,
46 double * vecB,
47 double * vecR,
48 double * vecBdot,
49 double * vecRdot,
50 double * endNodeSum
51 );
54 bool StateUpdate(const double * const posA,
55 const double * const posB,
56 const double * const velA,
57 const double * const velB,
58 const double * const vecB,
59 const double * const vecR,
60 const double * const vecBdot,
61 const double * const vecRdot,
62 const double * const endNodeSum,
63 double *addedMass,
64 double *nodeForces,
65 const double dT
66 );
68 bool GetAccelerations(double *bDotDot, double *rDotDot);
69 bool GetEndForces(double *forceA, double *forceB);
70 bool GetNodePositions(double *nodePosition);
71 bool GetNodeVelocities(double *nodeVelocities);
72 bool GetEndNodeSum(double *endNodeSum);
73 private:
74 // parameters gained from the constructor
75 int m_NofBarElements;
76 double m_dBarMass;
77 double m_dLength;
78
79 double m_dOmegaNL;
80 double m_dOmegaN;
81 double m_dZetaNL;
82 double m_dZetaN;
83 double m_dKei;
84 double m_dKed;
85 double m_dKep;
86
87 bool m_fixedFixed;
88
89 //
90 const double m_g;
91
92 // internally needed storage needed for Get functions
93 double *m_bDotDot;
94 double *m_rDotDot;
95 double *m_forceA;
96 double *m_forceB;
97 double *m_nodePositions;
98 double *m_nodeVelocities;
99 double *m_endNodeSum;
100
101 // internally needed storage needed for various book-keeping
102 bool m_dataUptoDate;
103 bool m_initialised;
104
105 double m_tau1ep[3]; //acceleration from the last element in fix-fix case
106
107 double *m_f_a;
108 double *m_f_b;
109
110 double *m_tau1_x;
111 double *m_tau1_y;
112 double *m_tau1_z;
113 double *m_tau2_x;
114 double *m_tau2_y;
115 double *m_tau2_z;
116
117 double *m_lambda_x;
118 double *m_lambda_y;
119 double *m_lambda_z;
120
121 double *m_Wn1c;
122 double *m_Wn1cT;
123 double *m_Pn1c;
124 double *m_Wn1caT;
125 double *m_Wn1cbT;
126 double *m_invertN1c;
127
128 double m_totalSumD[3];
129
130 // private member functions
131 bool CalcBarForces(double *nodeForces);
132 bool CalcTau(const double * const vecB,
133 const double * const vecBdot);
134 bool CalcLambda(const double * const posA,
135 const double * const velA,
136 const double * const vecB,
137 const double * const vecBdot,
138 const double * const vecR,
139 const double * const vecRdot);
140
141 bool CalcAcc(const double * const posB,
142 const double * const velB,
143 const double * const vecB,
144 const double * const vecBdot,
145 const double * const vecR,
146 const double * const vecRdot,
147 const double * const endNodeSum,
148 const double dT);
149 bool CalcEndForces();
150 bool CalcNodePositions(const double * const vecB,
151 const double * const vecR);
152 bool CalcNodeVelocities(const double * const vecBdot,
153 const double * const vecRdot);
154
155 void MatrixCalcAcc(const double *tau1, const double *tau2,
156 const double *lambda, double **accR,
157 double **accB);
158 void MatrixCalcLambda(const double *tau1, const double *tau2,
159 const double * barConstraint,
160 const double *ndotdot,
161 const double *invert,
162 double **lambda);
163 void CreateMatrises(void);
164};
165
166
167#endif
Class containing a Rigid Bar Cable (RBC) calculation engine.
Definition: CRBCEngine.h:20
bool GetNodePositions(double *nodePosition)
(dim: 3(N+1))
bool GetEndForces(double *forceA, double *forceB)
(dim: 3)
bool GetAccelerations(double *bDotDot, double *rDotDot)
Get functions are based on the last StateUpdate call.
bool GetInitialStates(const double *const posA, const double *const posB, const double *const velA, const double *const velB, double *vecB, double *vecR, double *vecBdot, double *vecRdot, double *endNodeSum)
bool GetNodeVelocities(double *nodeVelocities)
(dim: 3(N+1))
CRBCEngine(int nofBarElements, double dBarMass, double dLength, double dOmegaNL, double dOmegaN, double dZetaNL, double dZetaN, bool fixedFixed, double kei, double ked, double kep)
The constructor.
bool GetEndNodeSum(double *endNodeSum)
(dim: 3)
bool StateUpdate(const double *const posA, const double *const posB, const double *const velA, const double *const velB, const double *const vecB, const double *const vecR, const double *const vecBdot, const double *const vecRdot, const double *const endNodeSum, double *addedMass, double *nodeForces, const double dT)
~CRBCEngine()
The destructor cleans up dynamically allocated memory.