GCC Code Coverage Report


Directory: ./
File: FiniteElement/currentFiniteElement.hpp
Date: 2024-04-14 07:32:34
Exec Total Coverage
Lines: 5 5 100.0%
Branches: 9 18 50.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 #ifndef _CURRENT_FINITE_ELEMENT_H
16 #define _CURRENT_FINITE_ELEMENT_H
17
18 // System includes
19 #include <vector>
20
21 // External includes
22
23 // Project includes
24 #include "Core/felisce.hpp"
25 #include "FiniteElement/curBaseFiniteElement.hpp"
26 #include "FiniteElement/curvilinearFiniteElement.hpp"
27
28 namespace felisce
29 {
30 ///@name felisce Globals
31 ///@{
32
33 ///@}
34 ///@name Type Definitions
35 ///@{
36
37 ///@}
38 ///@name Enum's
39 ///@{
40
41 ///@}
42 ///@name Functions
43 ///@{
44
45 ///@}
46 ///@name felisce Classes
47 ///@{
48 /**
49 * \class CurrentFiniteElement
50 * \authors J-F. Gerbeau
51 * \brief Class implementing a current finite element
52 */
53 class CurrentFiniteElement:
54 public CurBaseFiniteElement
55 {
56 public:
57 ///@name Type Definitions
58 ///@{
59
60 /// Pointer definition of CurrentFiniteElement
61 FELISCE_CLASS_POINTER_DEFINITION(CurrentFiniteElement);
62
63 ///@}
64 ///@name Life Cycle
65 ///@{
66
67 /// constructors (vector of DegreeOfExactness)
68 CurrentFiniteElement(
69 const RefElement& refEle,
70 const GeoElement& geoEle,
71 const std::vector<DegreeOfExactness>& degOfExactness
72 );
73
74 /// constructors
75 CurrentFiniteElement(const RefElement& refEle,const GeoElement& geoEle,const DegreeOfExactness& degOfExactness);
76
77 // Destructor
78 ~CurrentFiniteElement() override;
79
80 /// Copy constructor, to avoid warning due to user-declared destructor.
81
9/18
✓ Branch 2 taken 16384 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 16384 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 16384 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 16384 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 16384 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 16384 times.
✗ Branch 18 not taken.
✓ Branch 20 taken 16384 times.
✗ Branch 21 not taken.
✓ Branch 23 taken 16384 times.
✗ Branch 24 not taken.
✓ Branch 26 taken 16384 times.
✗ Branch 27 not taken.
16384 CurrentFiniteElement(const CurrentFiniteElement&) = default;
82
83 ///@}
84 ///@name Operators
85 ///@{
86
87 ///@}
88 ///@name Operations
89 ///@{
90
91 //-----------
92 // updates:
93 //-----------
94 /// minimal update: we just identify the id of the current element
95 void update(const int id,const std::vector<Point*>& point) override;
96
97 /// compute the arrays meas, weightDet, jacobian on the current element
98 void updateMeas(const int id,const std::vector<Point*>& point) override;
99
100 /*!
101 compute the arrays meas, weightDet, jacobian and quadPt
102 on the current element
103 */
104 void updateMeasQuadPt(const int id,const std::vector<Point*>& point);
105 /*!
106 compute the arrays meas, weightDet, jacobian,
107 tInvJac, phiDer on the current element
108 */
109 void updateFirstDeriv(const int id,const std::vector<Point*>& point);
110 /*!
111 to compute the basis function on some new quadrature point
112 */
113 void updateBasisAndFirstDeriv(const int id, const std::vector<Point*>& point);
114
115 /*!
116 to integrate on a sub element only
117 */
118 void updateSubElementFirstDeriv(const int id, const std::vector<Point*>& ptElem, const std::vector<Point*>& ptSubElem, CurBaseFiniteElement *feSurf = nullptr);
119
120 /*!
121 it calls the standard updateFirstDeriv, but it evaluates the basis functions and their derivatives also
122 on the dofs, not only in the quad points
123 */
124 void updateFirstDerivOnDofs(const int id,const std::vector<Point*>& point);
125
126 void allocateOnDofsDataStructures();
127
128 void identifyLocBDDof(const CurvilinearFiniteElement& curvFe, std::vector<int>& map) const;
129
130 ///@}
131 ///@name Access
132 ///@{
133
134 13317082 inline int indexQuadPoint(const int iBlockBd) const {
135 13317082 return m_indexQuadPoint[iBlockBd];
136 }
137
138 /// return true if the first derivatives have been updated
139 4916888 inline bool hasFirstDeriv() const {
140 4916888 return m_hasFirstDeriv;
141 }
142 /// return true if the second derivatives have been updated
143 inline bool hasSecondDeriv() const {
144 return m_hasSecondDeriv;
145 }
146
147 ///@}
148 ///@name Member Variables
149 ///@{
150
151 /// dPhi[ig](icoor,jdof) (computed as m_jacobian^{-1}*m_dPhiRef) (in the current FE)
152 std::vector<UBlasMatrix> dPhi;
153
154 std::vector<UBlasMatrix> dPhiOnDofs;
155
156 std::vector<UBlasVector> phiOnDofs;
157
158 ///@}
159 ///@name Inquiry
160 ///@{
161
162 ///@}
163 ///@name Input and output
164 ///@{
165
166 void print(int verbose,std::ostream& c=std::cout) const;
167
168 ///@}
169 ///@name Friends
170 ///@{
171
172 ///@}
173 protected:
174 ///@name Protected static Member Variables
175 ///@{
176
177 ///@}
178 ///@name Protected member Variables
179 ///@{
180
181 bool m_hasFirstDeriv = false;
182 bool m_hasSecondDeriv = false;
183
184 /// The transpose of the Jacobian of the geometrical mapping: m_jacobian[ig](icoor,jcoor) derivative with respect to x_icoor of the component jcoor (in the current FE)
185 std::vector<UBlasMatrix> m_jacobian;
186
187 /// index of beginning/end of the quad points (0->m_numQuadraturePoint-1 : internal quad points)
188 std::vector<int> m_indexQuadPoint;
189
190 bool m_phiDPhiOnDofs = false;
191 std::vector<UBlasMatrix> m_dPhiRefOnDofs;
192 std::vector<UBlasVector> m_phiGeoOnDofs;
193 std::vector<UBlasMatrix> m_dPhiGeoOnDofs;
194 std::vector<UBlasMatrix> m_jacobianOnDofs;
195
196 ///@}
197 ///@name Protected Operators
198 ///@{
199
200 ///@}
201 ///@name Protected Operations
202 ///@{
203
204 /// In the sequel: "iBlockBd": internal quad points are in the 0 block
205 /// (CurrFEWithBd: boundary quad points in the >0 blocks (face f in block f+1))
206 /// by default: compute only for the internal quad points.
207 //
208 /// update the points and compute the Jacobian matrix
209 void computeJacobian(const int iBlockBd=0,const std::size_t numBlockBd=1);
210
211 /// compute the determinant of the Jacobian (call first computeJacobian)
212 void computeMeas() override;
213
214 /// compute the determinant of the Jacobian and the derivatives of the basis functions (call first computeJacobian)
215 void computeMeasDer(const int iBlockBd=0,const std::size_t numBlockBd=1);
216
217 /// compute the norm of the inverse of the transpose of the jacobian times the normal to the element. Compute also the derivatives.
218 void computePiolaMeasDer(const int iBlockBd,const std::size_t numBlockBd, const std::vector<double>& normal);
219
220 void computeJacobianOnDofs();
221
222 void computeDerOnDofs();
223
224 ///@}
225 ///@name Protected Access
226 ///@{
227
228 ///@}
229 ///@name Protected Inquiry
230 ///@{
231
232 ///@}
233 ///@name Protected LifeCycle
234 ///@{
235
236 ///@}
237 private:
238 ///@name Private static Member Variables
239 ///@{
240
241 ///@}
242 ///@name Private member Variables
243 ///@{
244
245 ///@}
246 ///@name Private Operators
247 ///@{
248
249 ///@}
250 ///@name Private Operations
251 ///@{
252
253 ///@}
254 ///@name Private Access
255 ///@{
256
257 ///@}
258 ///@name Private Inquiry
259 ///@{
260
261 ///@}
262 ///@name Private LifeCycle
263 ///@{
264
265 ///@}
266 };
267 ///@}
268 ///@name Type Definitions
269 ///@{
270
271 ///@}
272 } /* namespace felisce.*/
273 #endif
274