GCC Code Coverage Report


Directory: ./
File: FiniteElement/curvilinearFiniteElement.hpp
Date: 2024-04-14 07:32:34
Exec Total Coverage
Lines: 29 29 100.0%
Branches: 0 0 -%

Line Branch Exec Source
1 // ______ ______ _ _ _____ ______
2 // | ____| ____| | (_)/ ____| | ____|
3 // | |__ | |__ | | _| (___ ___| |__
4 // | __| | __| | | | |\___ \ / __| __|
5 // | | | |____| |____| |____) | (__| |____
6 // |_| |______|______|_|_____/ \___|______|
7 // Finite Elements for Life Sciences and Engineering
8 //
9 // License: LGL2.1 License
10 // FELiScE default license: LICENSE in root folder
11 //
12 // Main authors: J-F. Gerbeau
13 //
14
15 // System includes
16 #include <vector>
17
18 // External includes
19
20 // Project includes
21 #include "Core/felisce.hpp"
22 #include "FiniteElement/curBaseFiniteElement.hpp"
23
24 #ifndef _CURVILINEAR_FINITE_ELEMENT_H
25 #define _CURVILINEAR_FINITE_ELEMENT_H
26
27 namespace felisce
28 {
29 ///@name felisce Globals
30 ///@{
31
32 ///@}
33 ///@name Type Definitions
34 ///@{
35
36 ///@}
37 ///@name Enum's
38 ///@{
39
40 ///@}
41 ///@name Functions
42 ///@{
43
44 ///@}
45 ///@name felisce Classes
46 ///@{
47 /*!
48 \class CurvilinearFiniteElement
49 \authors J-F. Gerbeau
50 \brief Class implementing a curvilinear finite element
51 */
52 class CurvilinearFiniteElement:
53 public CurBaseFiniteElement
54 {
55 public:
56 ///@name Type Definitions
57 ///@{
58
59 /// Pointer definition of CurvilinearFiniteElement
60 FELISCE_CLASS_POINTER_DEFINITION(CurvilinearFiniteElement);
61
62 ///@}
63 ///@name Life Cycle
64 ///@{
65
66 /// constructors
67 CurvilinearFiniteElement(
68 const RefElement& refEle,
69 const GeoElement& geoEle,
70 const DegreeOfExactness& degOfExactness
71 );
72
73 /// constructors (vector of DegreeOfExactness)
74 8 CurvilinearFiniteElement(
75 const RefElement& refEle,
76 const GeoElement& geoEle,
77 const std::vector<DegreeOfExactness>& degOfExactness
78 8 ) : CurvilinearFiniteElement(refEle, geoEle, degOfExactness[0])
79 {
80 8 }
81
82 /// destructor
83 ~CurvilinearFiniteElement() override;
84
85 ///@}
86 ///@name Operators
87 ///@{
88
89 ///@}
90 ///@name Operations
91 ///@{
92
93 //-----------
94 // updates:
95 //-----------
96 /// minimal update: we just identify the id of the current element
97 void update(const int id, const std::vector<Point*>& point) override;
98 void update(const int id, const UBlasMatrix& point, const std::vector<int>& ipt);
99
100 /// compute the arrays meas, weightDet, jacobian on the current element
101 void updateMeas(const int id, const std::vector<Point*>& point) override;
102 void updateMeas(const int id, const UBlasMatrix& point, const std::vector<int>& ipt);
103
104 /// compute the arrays meas, weightDet, jacobian and quadrature point on the current element
105 void updateMeasQuadPt(const int id, const std::vector<Point*>& point);
106
107 /// compute the arrays normal, meas, weightDet and jacobian on the current element
108 /// note: comment is incomplete! vm 08/2011
109 void updateMeasNormal(const int id, const std::vector<Point*>& point);
110 void updateMeasNormal(const int id, const UBlasMatrix& point, const std::vector<int>& ipt);
111
112 void updateMeasNormalQuadPt(const int id, const std::vector<Point*>& point);
113
114 void updateMeasNormalContra(const int id, const std::vector<Point*>& point);
115 void updateMeasNormalContra(const int id, const UBlasMatrix& point, const std::vector<int>& ipt);
116
117 void updateMeasNormalTangent(const int id, const std::vector<Point*>& point);
118 void updateMeasNormalTangent(const int id, const UBlasMatrix& point, const std::vector<int>& ipt);
119
120 void updateBasisAndNormalContra(const int id, const std::vector<Point*>& point);
121 void updateSubElementMeasNormal(const int id, const std::vector<Point*>& ptElem, const std::vector<Point*> ptSubElem);
122
123 //----------------------------------------------------------------------
124 //----------------------------------------------------------------------
125 //****************** Curved Beam Elasticity Linear *********************
126 //----------------------------------------------------------------------
127 //----------------------------------------------------------------------
128
129 // recuperation from the mesh of normals and tangents on the current FE
130 void updateNormalTangentMesh (const std::vector<Point*>& normalFE, const std::vector <std::vector<Point*> >& tangentFE);
131
132 void compute_weightMeas();
133
134 // F = F0 + z F1 covariante basis - linear part
135 void compute_F0_F1_beam(const double thickness);
136
137 void compute_F0_F1_thinShell(const double thickness);
138
139 // component Grr of the Covariant metric tensor
140 // grr = Grr0 + z.Grr1 + z².Grr
141 void compute_Grr0_Grr1_Grr2(const UBlasMatrix& rF0, const UBlasMatrix& rF1);
142
143 //compute the component grr tensor metric covariant
144 // grs = Grs0 + z.Grs1 + z².Grs
145 void compute_Grs0_Grs1_Grs2(const UBlasMatrix& rF0, const UBlasMatrix& rF1);
146
147 //compute the component grr tensor metric covariant
148 // gss = Gss0 + z.Gss1 + z².Gss
149 void compute_Gss0_Gss1_Gss2(const UBlasMatrix& rF0, const UBlasMatrix& rF1);
150
151 void updateBeam (const int id, const std::vector<Point*>& point, const std::vector<Point*>& normalFE, const std::vector< std::vector<Point*> >& tangentFE, const double thickness);
152
153 void updateThinShell (const int id, const std::vector<Point*>& point, const std::vector<Point*>& normalFE, const std::vector< std::vector<Point*> >& tangentFE, const double thickness);
154
155 //Alexandre THIS
156 //29 04 2016
157 //Method written to tell if the element is inside a ball centered in c = [x,y,z] with radius R=r
158 bool isInBallRange(double*, double); // TODO D.C. this is a fully geometric check, why the hell is in finite element???
159
160 void computeNormalThinShell();
161
162 void computeNormal();
163
164 void computeTangent();
165
166 void computeTangentNormal();
167
168
169 // Evaluate each basis function on the point.
170 // The function is written in the case of R^3. So triangles and quadrangles.
171 // The point is assumed to be inside the element.
172 void evaluateBasisFunctionsInPoint(const Point* p, std::vector<double>& values) const;
173
174 ///@}
175 ///@name Member Variables
176 ///@{
177
178 /* // is Protected in curBaseFE
179 /// dPhiRef[ig](icoor,jpoint) = derivative with respect to x_icoor of the jpoint-th reference basis function at integration point ig
180 UBlasMatrix* dPhiRef;
181 */
182 std::vector<UBlasMatrix> tangent;
183 std::vector<UBlasVector> normal;
184 /// The covariant metric tensor
185 std::vector<UBlasMatrix> covMetric;
186 std::vector<UBlasMatrix> m_covBasis;
187 std::vector<UBlasMatrix> contravariantMetric;
188 /// The contravariant basis
189 std::vector<UBlasMatrix> contravariantCompleteBasis;
190
191 double m_sign = 1.0;
192
193 ///@}
194 ///@name Access
195 ///@{
196
197 795508 inline UBlasMatrix F0(int ir) const {
198 795508 return m_F0[ir];
199 }
200 795508 inline UBlasMatrix F1(int ir) const {
201 795508 return m_F1[ir];
202 }
203
204 //access to the decomposition component G^rr of the contravariant metric tensor
205 795508 inline double Grr0() const {
206 795508 return m_Grr0;
207 }
208 795508 inline double Grr1() const {
209 795508 return m_Grr1;
210 }
211 795508 inline double Grr2() const {
212 795508 return m_Grr2;
213 }
214
215 //access to the decomposition component G^rs of the contravariant metric tensor
216 739948 inline double Grs0() const {
217 739948 return m_Grs0;
218 }
219 739948 inline double Grs1() const {
220 739948 return m_Grs1;
221 }
222 739948 inline double Grs2() const {
223 739948 return m_Grs2;
224 }
225
226 //access to the decomposition component G^ss of the contravariant metric tensor
227 739948 inline double Gss0() const {
228 739948 return m_Gss0;
229 }
230 739948 inline double Gss1() const {
231 739948 return m_Gss1;
232 }
233 739948 inline double Gss2() const {
234 739948 return m_Gss2;
235 }
236
237 /// return true if the tangent has been updated
238 inline bool hasTangent() const {
239 return m_hasTangent;
240 }
241 /// return true if the normal has been updated
242 4916888 inline bool hasNormal() const {
243 4916888 return m_hasNormal;
244 }
245
246 /// access to dPhiRef is necessary
247 13800 const UBlasMatrix& dPhiRef(int ig) const {
248 13800 return m_dPhiRef[ig];
249 }
250
251 ///@}
252 ///@name Inquiry
253 ///@{
254
255 ///@}
256 ///@name Input and output
257 ///@{
258
259 void print(int verbose,std::ostream& c=std::cout) const;
260
261 ///@}
262 ///@name Friends
263 ///@{
264
265 ///@}
266 protected:
267 ///@name Protected static Member Variables
268 ///@{
269
270 ///@}
271 ///@name Protected member Variables
272 ///@{
273
274 bool m_hasTangent = false;
275 bool m_hasNormal = false;
276 bool m_hasIteratNormal = false;
277 bool m_hasIteratTangent = false;
278
279 /// The covariant basis: the rows are the basis vectors. m_covBasis[ig](icoor,jcoor)=derivative with respect to x_icoor of the component jcoor (icoor is the index of the std::vector in the basis, jcoor its component)
280 //UBlasMatrix* m_covBasis;
281
282 /// The covariant basis: the rows are the basis vectors. m_covBasis[ig](icoor,jcoor)=derivative with respect to x_icoor of the component jcoor (icoor is the index of the std::vector in the basis, jcoor its component) with the normal
283 std::vector<UBlasMatrix> m_covCompleteBasis;
284
285 ///@}
286 ///@name Protected Operators
287 ///@{
288
289 ///@}
290 ///@name Protected Operations
291 ///@{
292
293 /// compute the covariant basis
294 void computeCovariantBasis();
295
296 /// compute the contravariant basis
297 void computeContravariantBasis();
298
299 /// compute the determinant of the Jacobian (call first computeJacobian)
300 void computeContravariantMetric();
301
302 /// compute the determinant of the Jacobian
303 void computeMeas() override;
304
305 ///@}
306 ///@name Protected Access
307 ///@{
308
309 ///@}
310 ///@name Protected Inquiry
311 ///@{
312
313 ///@}
314 ///@name Protected LifeCycle
315 ///@{
316
317 ///@}
318 private:
319 ///@name Private static Member Variables
320 ///@{
321
322 ///@}
323 ///@name Private member Variables
324 ///@{
325
326 //Polynomial decomposition in z of covariant basis - linear part
327 std::vector <UBlasMatrix> m_F0, m_F1;
328
329 //Normals and Tangents calcule at each vertice
330 std::vector <UBlasMatrix> m_tangentVertice;
331 UBlasMatrix m_normalVertice;
332
333 // Grr = Grr0 + z Grr1 + z^2 Grr2
334 double m_Grr0 = 0.0;
335 double m_Grr1 = 0.0;
336 double m_Grr2 = 0.0;
337
338 // Grs = Grs0 + z Grs1 + z^2 Grs2
339 double m_Grs0 = 0.0;
340 double m_Grs1 = 0.0;
341 double m_Grs2 = 0.0;
342
343 // Gss = Gss0 + z Gss1 + z^2 Gss2
344 double m_Gss0 = 0.0;
345 double m_Gss1 = 0.0;
346 double m_Gss2 = 0.0;
347
348 ///@}
349 ///@name Private Operators
350 ///@{
351
352 ///@}
353 ///@name Private Operations
354 ///@{
355
356 ///@}
357 ///@name Private Access
358 ///@{
359
360 ///@}
361 ///@name Private Inquiry
362 ///@{
363
364 ///@}
365 ///@name Private LifeCycle
366 ///@{
367
368 ///@}
369 };
370 ///@}
371 ///@name Type Definitions
372 ///@{
373
374 ///@}
375 } /* namespace felisce.*/
376 #endif
377