From 455742dea9f249a531af222e2c1de46a6021a564 Mon Sep 17 00:00:00 2001 From: Frederick Roy Date: Wed, 26 Jun 2024 14:22:03 +0900 Subject: [PATCH 1/2] return (empty) beam section even if x_curv is not in the key points --- src/BeamAdapter/component/engine/WireRestShape.inl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/BeamAdapter/component/engine/WireRestShape.inl b/src/BeamAdapter/component/engine/WireRestShape.inl index 36567280..667e3668 100644 --- a/src/BeamAdapter/component/engine/WireRestShape.inl +++ b/src/BeamAdapter/component/engine/WireRestShape.inl @@ -312,6 +312,8 @@ const BeamSection& WireRestShape::getBeamSection(const Real& x_curv) } msg_error() << " problem in getBeamSection : x_curv " << x_curv << " is not between keyPoints" << keyPts; + static const BeamSection emptySection{}; + return emptySection; } From 983c8494b713d0426e10c262e2495f91ec37766b Mon Sep 17 00:00:00 2001 From: Frederick Roy Date: Wed, 26 Jun 2024 16:50:15 +0900 Subject: [PATCH 2/2] make sure that the default ctor of BeamSection initializes its fields to 0 --- src/BeamAdapter/utils/BeamSection.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/BeamAdapter/utils/BeamSection.h b/src/BeamAdapter/utils/BeamSection.h index 1abbcba9..6edabf49 100644 --- a/src/BeamAdapter/utils/BeamSection.h +++ b/src/BeamAdapter/utils/BeamSection.h @@ -25,14 +25,14 @@ namespace sofa::beamadapter { struct BeamSection { - double _r; ///< Radius of the beam section - double _rInner; ///< Inner radius of the section if beam is hollow - double _Iy; ///< Iy is the cross-section moment of inertia (assuming mass ratio = 1) about the y axis, see https ://en.wikipedia.org/wiki/Second_moment_of_area - double _Iz; ///< Iz is the cross-section moment of inertia (assuming mass ratio = 1) about the z axis, see https ://en.wikipedia.org/wiki/Second_moment_of_area - double _J; ///< Polar moment of inertia (J = Iy + Iz) - double _A; ///< A is the cross-sectional area - double _Asy; ///< _Asy is the y-direction effective shear area = 10/9 (for solid circular section) or 0 for a non-Timoshenko beam - double _Asz; ///< _Asz is the z-direction effective shear area + double _r{}; ///< Radius of the beam section + double _rInner{}; ///< Inner radius of the section if beam is hollow + double _Iy{}; ///< Iy is the cross-section moment of inertia (assuming mass ratio = 1) about the y axis, see https ://en.wikipedia.org/wiki/Second_moment_of_area + double _Iz{}; ///< Iz is the cross-section moment of inertia (assuming mass ratio = 1) about the z axis, see https ://en.wikipedia.org/wiki/Second_moment_of_area + double _J{}; ///< Polar moment of inertia (J = Iy + Iz) + double _A{}; ///< A is the cross-sectional area + double _Asy{}; ///< _Asy is the y-direction effective shear area = 10/9 (for solid circular section) or 0 for a non-Timoshenko beam + double _Asz{}; ///< _Asz is the z-direction effective shear area }; } // namespace sofa::beamAdapter