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 cef754dd87d..ddd4889e609 100644 --- a/applications/StructuralMechanicsApplication/custom_elements/truss_elements/linear_truss_element.cpp +++ b/applications/StructuralMechanicsApplication/custom_elements/truss_elements/linear_truss_element.cpp @@ -232,7 +232,7 @@ void LinearTrussElement::GetShapeFunctionsValuesZ( rN.resize(SystemSize, false); rN.clear(); - + if constexpr (Dimension == 3) { array_1d base_N; noalias(base_N) = GetBaseShapeFunctions(xi); @@ -862,18 +862,12 @@ void LinearTrussElement::load(Serializer& rSerializer) /***********************************************************************************/ template -array_1d LinearTrussElement::GetBaseShapeFunctions(const double xi) const +Vector LinearTrussElement::GetBaseShapeFunctions(const double xi) const { - array_1d N; - - if constexpr (NNodes == 2) { - N[0] = 0.5 * (1.0 - xi); - N[1] = 0.5 * (1.0 + xi); - } else { - N[0] = 0.5 * xi * (xi - 1.0); - N[1] = 0.5 * xi * (xi + 1.0); - N[2] = (1.0 - std::pow(xi, 2)); - } + Vector coord(3), N(NNodes); + coord.clear(); + coord[0] = xi; + N = GetGeometry().ShapeFunctionsValues(N, coord); return N; } diff --git a/applications/StructuralMechanicsApplication/custom_elements/truss_elements/linear_truss_element.h b/applications/StructuralMechanicsApplication/custom_elements/truss_elements/linear_truss_element.h index 9b5d8ec66d5..a64549ee2ad 100644 --- a/applications/StructuralMechanicsApplication/custom_elements/truss_elements/linear_truss_element.h +++ b/applications/StructuralMechanicsApplication/custom_elements/truss_elements/linear_truss_element.h @@ -156,7 +156,7 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) LinearTrussElement /** * @brief This method returns the base shape functions in a reduced size vector (2 or 3 entries) */ - array_1d GetBaseShapeFunctions(const double xi) const; + Vector GetBaseShapeFunctions(const double xi) const; /** * @brief Returns a n component vector including the values of the DoFs diff --git a/applications/StructuralMechanicsApplication/structural_mechanics_application.cpp b/applications/StructuralMechanicsApplication/structural_mechanics_application.cpp index 19030d6cce1..ea5e0292d16 100644 --- a/applications/StructuralMechanicsApplication/structural_mechanics_application.cpp +++ b/applications/StructuralMechanicsApplication/structural_mechanics_application.cpp @@ -67,8 +67,8 @@ KratosStructuralMechanicsApplication::KratosStructuralMechanicsApplication() mCableElement3D2N(0, Element::GeometryType::Pointer(new Line3D2(Element::GeometryType::PointsArrayType(2)))), mLinearTrussElement2D2N(0, Element::GeometryType::Pointer(new Line2D2(Element::GeometryType::PointsArrayType(2)))), mLinearTrussElement2D3N(0, Element::GeometryType::Pointer(new Line2D3(Element::GeometryType::PointsArrayType(3)))), - mLinearTrussElement3D2N(0, Element::GeometryType::Pointer(new Line2D2(Element::GeometryType::PointsArrayType(2)))), - mLinearTrussElement3D3N(0, Element::GeometryType::Pointer(new Line2D3(Element::GeometryType::PointsArrayType(3)))), + mLinearTrussElement3D2N(0, Element::GeometryType::Pointer(new Line3D2(Element::GeometryType::PointsArrayType(2)))), + mLinearTrussElement3D3N(0, Element::GeometryType::Pointer(new Line3D3(Element::GeometryType::PointsArrayType(3)))), // Adding the beam elements mCrBeamElement3D2N(0, Element::GeometryType::Pointer(new Line3D2(Element::GeometryType::PointsArrayType(2)))), mCrLinearBeamElement3D2N(0, Element::GeometryType::Pointer(new Line3D2(Element::GeometryType::PointsArrayType(2)))),