Skip to content

Commit

Permalink
WireRestShape: getBeamSection() must return a const ref in any case (#…
Browse files Browse the repository at this point in the history
…151)

* return (empty) beam section even if x_curv is not in the key points

* make sure that the default ctor of BeamSection initializes its fields to 0
  • Loading branch information
fredroy authored Jul 15, 2024
1 parent 5cbc193 commit 1ccadbb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/BeamAdapter/component/engine/WireRestShape.inl
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ const BeamSection& WireRestShape<DataTypes>::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;
}


Expand Down
16 changes: 8 additions & 8 deletions src/BeamAdapter/utils/BeamSection.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 1ccadbb

Please sign in to comment.