From 27bc6738c6828127a00f4fa624ce49ed7a5ff144 Mon Sep 17 00:00:00 2001 From: AlejandroCornejo Date: Mon, 2 Dec 2024 16:49:41 +0100 Subject: [PATCH] avoid more rep --- .../truss_elements/linear_truss_element.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/applications/StructuralMechanicsApplication/custom_elements/truss_elements/linear_truss_element.cpp b/applications/StructuralMechanicsApplication/custom_elements/truss_elements/linear_truss_element.cpp index 4a485070ef1..ad1d60cd525 100644 --- a/applications/StructuralMechanicsApplication/custom_elements/truss_elements/linear_truss_element.cpp +++ b/applications/StructuralMechanicsApplication/custom_elements/truss_elements/linear_truss_element.cpp @@ -267,21 +267,15 @@ void LinearTrussElement::GetFirstDerivativesShapeFunctionsV GetGeometry().ShapeFunctionsLocalGradients(dN_de, coord); if constexpr (Dimension == 2) { - if constexpr (NNodes == 2) { - rdN_dX[0] = dN_de(0, 0); - rdN_dX[2] = dN_de(1, 0); - } else { // 3N - rdN_dX[0] = dN_de(0, 0); - rdN_dX[2] = dN_de(1, 0); + rdN_dX[0] = dN_de(0, 0); + rdN_dX[2] = dN_de(1, 0); + if constexpr (NNodes == 3) { rdN_dX[4] = dN_de(2, 0); } } else { - if constexpr (NNodes == 2) { - rdN_dX[0] = dN_de(0, 0); - rdN_dX[3] = dN_de(1, 0); - } else { // 3N - rdN_dX[0] = dN_de(0, 0); - rdN_dX[3] = dN_de(1, 0); + rdN_dX[0] = dN_de(0, 0); + rdN_dX[3] = dN_de(1, 0); + if constexpr (NNodes == 3) { rdN_dX[6] = dN_de(2, 0); } }