From 574f5626141e6be4c7293f826bfc31820d016428 Mon Sep 17 00:00:00 2001 From: Wasim Niyaz Munshi Date: Sun, 8 Dec 2024 15:19:32 -0700 Subject: [PATCH] Forgot to use ternary conditional statement at some places in H_plus() --- .../phase_field.cc | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) 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) -- 2.39.5