GCC Code Coverage Report


Directory: ./
File: Geometry/curvatures.hpp
Date: 2024-04-14 07:32:34
Exec Total Coverage
Lines: 48 48 100.0%
Branches: 5 10 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: Matteo
13 //
14
15 #ifndef _Curvatures_HPP
16 #define _Curvatures_HPP
17
18 // System includes
19
20 // External includes
21
22 // Project includes
23 #include "Core/felisce.hpp"
24 #include "FiniteElement/elementField.hpp"
25
26 namespace felisce {
27 class Curvatures
28 {
29 public:
30 Curvatures();
31 16 ~Curvatures() = default;
32 void update(const ElementField& normal, const UBlasMatrix& firstFundForm, const UBlasMatrix& covBasis);
33
34 403542 double gaussCurv() const {
35 403542 return m_gaussCurv;
36 }
37 403542 double meanCurv() const {
38 403542 return m_meanCurv;
39 }
40 4642488 double maxCurv() const {
41 4642488 return m_maxCurv;
42 }
43 4642488 double minCurv() const {
44 4642488 return m_minCurv;
45 }
46
47 1210626 double maxEigVCartComp( std::size_t i) {
48 1210626 return m_eigMax(i);
49 }
50 1210626 double minEigVCartComp( std::size_t i) {
51 1210626 return m_eigMin(i);
52 }
53 403542 double coeffKoiterLinear(const double& poisson) const {
54 403542 return 4*std::pow(m_meanCurv,2)-2*(1-poisson)*m_gaussCurv;
55 }
56 403542 double coeffKoiterQuadratic(const double& poisson) const {
57 403542 return 8*std::pow(m_meanCurv,3)-2*(3-poisson)*m_meanCurv*m_gaussCurv;
58 }
59 403542 double coeffKoiterCubic(const double& poisson) const {
60 403542 return 4*(std::pow(m_meanCurv,4)-std::pow(m_meanCurv,2)*m_gaussCurv)+
61 403542 0.5*(1+poisson)*std::pow(m_gaussCurv,2);
62 }
63 403542 double coeffKoiterMeanOfSquaredCurvatures() const {
64 403542 return 2*std::pow(m_meanCurv,2)-m_gaussCurv;
65 }
66
67 1740933 double coeffFibersLinearMax() const {
68 1740933 return m_maxProp*std::pow(m_maxCurv,2);
69 }
70
71 double coeffFibersQuadraticMax() const {
72 return m_maxProp*std::pow(m_maxCurv,3);
73 }
74
75 1160622 double coeffFibersCubicMax() const {
76 1160622 return m_maxProp*std::pow(m_maxCurv,4);
77 }
78
79 1740933 double coeffFibersLinearMin() const {
80 1740933 return m_minProp*std::pow(m_minCurv,2);
81 }
82
83 1160622 double coeffFibersQuadraticMin() const {
84 1160622 return m_minProp*std::pow(m_minCurv,3);
85 }
86
87 double coeffFibersCubicMin() const {
88 return m_minProp*std::pow(m_minCurv,4);
89 }
90
91 3481866 double coeffFiberProportionMin() const {
92 3481866 return m_minProp;
93 }
94
95 3481866 double coeffFiberProportionMax() const {
96 3481866 return m_maxProp;
97 }
98
99 943553 UBlasMatrix invMetricTensor() const {
100 943553 return m_invFFT;
101 }
102
103 386874 UBlasMatrix minFiberTensor() const {
104 386874 return m_projOnMinEigVec;
105 }
106
107 386874 UBlasMatrix maxFiberTensor() const {
108 386874 return m_projOnMaxEigVec;
109 }
110
111 193437 UBlasMatrix minProjTensor() const {
112
1/2
✓ Branch 2 taken 193437 times.
✗ Branch 3 not taken.
386874 return m_projOnMinEigVec/m_minProp;
113 }
114
115 193437 UBlasMatrix maxProjTensor() const {
116
1/2
✓ Branch 2 taken 193437 times.
✗ Branch 3 not taken.
386874 return m_projOnMaxEigVec/m_maxProp;
117 }
118
119 UBlasMatrix shapeOperator() const {
120 return m_shapeOperator;
121 }
122
123 1113358 UBlasMatrix cMatrix() const {
124
1/2
✓ Branch 2 taken 1113358 times.
✗ Branch 3 not taken.
2226716 return prod(m_shapeOperator,m_invFFT);
125 }
126
127 556679 UBlasMatrix cSquaredMatrix() const {
128
2/4
✓ Branch 2 taken 556679 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 556679 times.
✗ Branch 6 not taken.
1113358 return prod(m_shapeOperator, cMatrix() );
129 }
130
131 static UBlasVector testFuncGradient( int idLocDof );
132
133 static UBlasVector elemFieldGradient(const ElementField& f);
134
135 static double mNormOfGradient( const ElementField& f , const UBlasMatrix& M);
136
137 void print() const;
138
139 private:
140
141 void computeSecondFundamentalForm( const UBlasMatrix& covBasis, const ElementField& normal);
142 void computeShapeOperator();
143 void computeCurvatures();
144 void computePrincipalDirections();
145 void computeArcLengths();
146 void computeProportions();
147 void computeProjectors();
148 void computeEigInCartCoordinate( const UBlasMatrix& covBasis, const ElementField& normal);
149
150 double m_gaussCurv;
151 double m_meanCurv;
152
153 double m_maxCurv;
154 double m_minCurv;
155
156 double m_rayleighMaxEigVec;
157 double m_rayleighMinEigVec;
158
159 UBlasMatrix m_firstFundForm;
160 UBlasMatrix m_invFFT;
161 UBlasMatrix m_secondFundForm;
162 UBlasMatrix m_shapeOperator;
163
164 UBlasMatrix m_projOnMaxEigVec;
165 UBlasMatrix m_projOnMinEigVec;
166
167 UBlasVector m_maxEigVec;
168 UBlasVector m_minEigVec;
169
170 double m_maxProp;
171 double m_minProp;
172 double m_minProportion;
173
174 UBlasVector m_eigMax;
175 UBlasVector m_eigMin;
176 };
177 }
178 #endif
179