2828
2929using namespace Arcane ;
3030using namespace Arcane ::FemUtils;
31- Real REL_PREC{1.0e-15 };
3231/* ---------------------------------------------------------------------------*/
3332/* *
3433 * @brief Contains various functions & operations related to FEM calculations.
@@ -1752,6 +1751,7 @@ class ArcaneFemFunctions
17521751#ifdef _DEBUG
17531752 ARCANE_ASSERT (inod >= 0 && inod < 8 );
17541753#endif
1754+ Real tol{1.0e-15 };
17551755
17561756 auto r{ ref_coord[0 ] }, s{ ref_coord[1 ] };
17571757 auto ri{ 1 . }, si{ 1 . };
@@ -1793,16 +1793,17 @@ class ArcaneFemFunctions
17931793 Phi = (1 + r0) * (1 + s0) * t0 / 4 .;
17941794
17951795 else { // Middle nodes
1796- if (fabs (ri) < REL_PREC )
1796+ if (fabs (ri) < tol )
17971797 Phi = (1 - r * r) * (1 + s0) / 2 .;
1798- else if (fabs (si) < REL_PREC )
1798+ else if (fabs (si) < tol )
17991799 Phi = (1 - s * s) * (1 + r0) / 2 .;
18001800 }
18011801 return Phi;
18021802 }
18031803
18041804 static inline Real3 quad8ShapeFuncDeriv (Integer inod, Real3 ref_coord)
18051805 {
1806+ Real tol{1.0e-15 };
18061807
18071808 auto r{ ref_coord[0 ] }, s{ ref_coord[1 ] };
18081809 auto ri{ 1 . }, si{ 1 . };
@@ -1845,11 +1846,11 @@ class ArcaneFemFunctions
18451846 dPhi.y = si * (1 + r0) * (t0 + 1 . + s0) / 4 .;
18461847 }
18471848 else { // Middle nodes
1848- if (fabs (ri) < REL_PREC ) {
1849+ if (fabs (ri) < tol ) {
18491850 dPhi.x = -r * (1 + s0);
18501851 dPhi.y = si * (1 - r * r) / 2 .;
18511852 }
1852- else if (fabs (si) < REL_PREC ) {
1853+ else if (fabs (si) < tol ) {
18531854 dPhi.x = -s * (1 + r0);
18541855 dPhi.y = ri * (1 - s * s) / 2 .;
18551856 }
@@ -1980,6 +1981,8 @@ class ArcaneFemFunctions
19801981#ifdef _DEBUG
19811982 ARCANE_ASSERT (inod >= 0 && inod < 20 );
19821983#endif
1984+ Real tol{1.0e-15 };
1985+
19831986 auto x{ ref_coord[0 ] }, y{ ref_coord[1 ] }, z{ ref_coord[2 ] };
19841987 auto ri{ 1 . }, si{ 1 . }, ti{ 1 . }; // Normalized coordinates (=+-1) =>node index 0 = (1,1,1)
19851988
@@ -2059,18 +2062,19 @@ class ArcaneFemFunctions
20592062 Phi = (1 + r0) * (1 + s0) * (1 + t0) * t / 8 .;
20602063
20612064 else { // Middle nodes
2062- if (math::abs (ri) < REL_PREC )
2065+ if (math::abs (ri) < tol )
20632066 Phi = (1 - x * x) * (1 + s0) * (1 + t0) / 4 .;
2064- else if (math::abs (si) < REL_PREC )
2067+ else if (math::abs (si) < tol )
20652068 Phi = (1 - y * y) * (1 + r0) * (1 + t0) / 4 .;
2066- else if (math::abs (ti) < REL_PREC )
2069+ else if (math::abs (ti) < tol )
20672070 Phi = (1 - z * z) * (1 + r0) * (1 + s0) / 4 .;
20682071 }
20692072 return Phi;
20702073 }
20712074
20722075 static inline Real3 hexa20ShapeFuncDeriv (Integer inod, Real3 ref_coord)
20732076 {
2077+ Real tol{1.0e-15 };
20742078
20752079 auto x{ ref_coord[0 ] }, y{ ref_coord[1 ] }, z{ ref_coord[2 ] };
20762080 auto ri{ 1 . }, si{ 1 . }, ti{ 1 . }; // Normalized coordinates (=+-1) =>node index 0 = (1,1,1)
@@ -2147,17 +2151,17 @@ class ArcaneFemFunctions
21472151 }
21482152 else { // Middle nodes
21492153 auto x2{ x * x }, y2{ y * y }, z2{ z * z };
2150- if (math::abs (ri) < REL_PREC ) {
2154+ if (math::abs (ri) < tol ) {
21512155 dPhi.x = -x * (1 + s0) * (1 + t0) / 2 .;
21522156 dPhi.y = si * (1 - x2) * (1 + t0) / 4 .;
21532157 dPhi.z = ti * (1 - x2) * (1 + s0) / 4 .;
21542158 }
2155- else if (math::abs (si) < REL_PREC ) {
2159+ else if (math::abs (si) < tol ) {
21562160 dPhi.x = ri * (1 - y2) * (1 + t0) / 4 .;
21572161 dPhi.y = -y * (1 + r0) * (1 + t0) / 2 .;
21582162 dPhi.z = ti * (1 - y2) * (1 + r0) / 4 .;
21592163 }
2160- else if (math::abs (ti) < REL_PREC ) {
2164+ else if (math::abs (ti) < tol ) {
21612165 dPhi.x = ri * (1 - z2) * (1 + s0) / 4 .;
21622166 dPhi.y = si * (1 - z2) * (1 + r0) / 4 .;
21632167 dPhi.z = -z * (1 + r0) * (1 + s0) / 2 .;
@@ -2468,6 +2472,8 @@ class ArcaneFemFunctions
24682472#ifdef _DEBUG
24692473 ARCANE_ASSERT (inod >= 0 && inod < 5 );
24702474#endif
2475+ Real tol{1.0e-15 };
2476+
24712477 auto r{ ref_coord[0 ] }, s{ ref_coord[1 ] }, t{ ref_coord[2 ] };
24722478 auto r1{ -1 . }, s1{ 1 . }, r2{ -1 . }, s2{ -1 . };
24732479
@@ -2476,7 +2482,7 @@ class ArcaneFemFunctions
24762482 auto ti{ t - 1 . };
24772483 auto t0{ 0 . };
24782484
2479- if (math::abs (ti) < REL_PREC )
2485+ if (math::abs (ti) < tol )
24802486 ti = 0 .;
24812487 else
24822488 t0 = -1 . / ti / 4 .;
@@ -2507,13 +2513,15 @@ class ArcaneFemFunctions
25072513#ifdef _DEBUG
25082514 ARCANE_ASSERT (inod >= 0 && inod < 5 );
25092515#endif
2516+ Real tol{1.0e-15 };
2517+
25102518 auto r{ ref_coord[0 ] }, s{ ref_coord[1 ] }, t{ ref_coord[2 ] };
25112519 auto r1{ -1 . }, s1{ 1 . }, r2{ -1 . }, s2{ -1 . };
25122520
25132521 auto ti{ t - 1 . };
25142522 auto t0{ 0 . };
25152523
2516- if (math::abs (ti) < REL_PREC )
2524+ if (math::abs (ti) < tol )
25172525 ti = 0 .;
25182526 else
25192527 t0 = -1 . / ti / 4 .;
@@ -2544,7 +2552,7 @@ class ArcaneFemFunctions
25442552 dPhi.x = t0 * (rr * r + rs * s + r12 * ti);
25452553 dPhi.y = t0 * (rs * r + ss * s + s12 * ti);
25462554
2547- if (math::abs (ti) < REL_PREC )
2555+ if (math::abs (ti) < tol )
25482556 dPhi.z = 0 .;
25492557 else
25502558 dPhi.z = t0 * (r12 * r + s12 * s + 2 . * ti) + t02 * (r1 * r + s1 * s + ti) * (r2 * r + s2 * s + ti);
0 commit comments