]> https://gitweb.dealii.org/ - code-gallery.git/commitdiff
Forgot to use ternary conditional statement at some places in H_plus()
authorWasim Niyaz Munshi <munshiw0@gmail.com>
Sun, 8 Dec 2024 22:19:32 +0000 (15:19 -0700)
committerWasim Niyaz Munshi <munshiw0@gmail.com>
Sun, 8 Dec 2024 22:19:32 +0000 (15:19 -0700)
Phase_field_fracture_model_in_3D/phase_field.cc

index f55dd98f74cf16fdb61c7280574d0e7001e862cc..9e3d372ccce38199b9ca908395e3d222c716f73f 100644 (file)
@@ -364,22 +364,9 @@ namespace PF
 
     Mac_tr_strain = tr_strain >0 ? tr_strain : 0;
     const std::array<double, 3> Principal_strains = eigenvalues (strain);
-    if (Principal_strains[0] > 0)
-      {
-        Mac_first_principal_strain = Principal_strains[0];
-      }
-    else
-      {
-        Mac_first_principal_strain = 0;
-      }
-    if (Principal_strains[1] > 0)
-      {
-        Mac_second_principal_strain = Principal_strains[1];
-      }
-    else
-      {
-        Mac_second_principal_strain = 0;
-      }
+
+    Mac_first_principal_strain = (Principal_strains[0] > 0) ? Principal_strains[0] : 0;
+    Mac_second_principal_strain = (Principal_strains[1] > 0) ? Principal_strains[1] : 0;
     Mac_third_principal_strain = (Principal_strains[2] > 0) ? Principal_strains[2] : 0;
 
     tr_sqr_Mac_Principal_strain = pow (Mac_first_principal_strain, 2)

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.