From: Wasim Niyaz Munshi Date: Sun, 8 Dec 2024 22:19:32 +0000 (-0700) Subject: Forgot to use ternary conditional statement at some places in H_plus() X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=574f5626141e6be4c7293f826bfc31820d016428;p=code-gallery.git Forgot to use ternary conditional statement at some places in H_plus() --- diff --git a/Phase_field_fracture_model_in_3D/phase_field.cc b/Phase_field_fracture_model_in_3D/phase_field.cc index f55dd98..9e3d372 100644 --- a/Phase_field_fracture_model_in_3D/phase_field.cc +++ b/Phase_field_fracture_model_in_3D/phase_field.cc @@ -364,22 +364,9 @@ namespace PF Mac_tr_strain = tr_strain >0 ? tr_strain : 0; const std::array 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)