From 61bea50a959c6b4faf2ab2c70baad6323de541b8 Mon Sep 17 00:00:00 2001 From: epernod Date: Thu, 28 May 2026 11:56:25 +0200 Subject: [PATCH] [src] Add option to get the tip dof id of a beam/wire --- src/BeamAdapter/component/BaseBeamInterpolation.h | 3 +++ src/BeamAdapter/component/BaseBeamInterpolation.inl | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/BeamAdapter/component/BaseBeamInterpolation.h b/src/BeamAdapter/component/BaseBeamInterpolation.h index 7bd71e861..27624f02c 100644 --- a/src/BeamAdapter/component/BaseBeamInterpolation.h +++ b/src/BeamAdapter/component/BaseBeamInterpolation.h @@ -231,6 +231,9 @@ class BaseBeamInterpolation : public sofa::core::behavior::SingleStateAccessor > d_beamCollision; Data d_dofsAndBeamsAligned; + + /// index of the beam extremity that is considered as the tip of the wire + Data d_wireTipIndex; /// link to the (edge) topology SingleLink, BaseMeshTopology, BaseLink::FLAG_STOREPATH|BaseLink::FLAG_STRONGLINK> l_topology; diff --git a/src/BeamAdapter/component/BaseBeamInterpolation.inl b/src/BeamAdapter/component/BaseBeamInterpolation.inl index d87ae05d8..d2264b3bd 100644 --- a/src/BeamAdapter/component/BaseBeamInterpolation.inl +++ b/src/BeamAdapter/component/BaseBeamInterpolation.inl @@ -107,6 +107,7 @@ BaseBeamInterpolation::BaseBeamInterpolation() , d_beamCollision(initData(&d_beamCollision, "beamCollision", "list of beam (in edgeList) that needs to be considered for collision")) , d_dofsAndBeamsAligned(initData(&d_dofsAndBeamsAligned, true, "dofsAndBeamsAligned", "if false, a transformation for each beam is computed between the DOF and the beam nodes")) + , d_wireTipIndex(initData(&d_wireTipIndex, (sofa::Index)0, "wireTipIndex", "index of the beam extremity that is considered as the tip of the wire")) , l_topology(initLink("topology", "link to the topology (must contain edges)")) { @@ -186,6 +187,9 @@ void BaseBeamInterpolation::addBeam(const EdgeID eID, const Real leng d_dofsAndBeamsAligned.setValue(false); DOF0TransformNode0.push_back(Transform(Vec3(0, 0, 0), QuatX)); DOF1TransformNode1.push_back(Transform(Vec3(0, 0, 0), QuatX)); + + const BaseMeshTopology::Edge& edge = l_topology->getEdge(eID); + d_wireTipIndex.setValue(edge[1]); } @@ -392,6 +396,7 @@ void BaseBeamInterpolation::getTangent(Vec3& t, const Real baryCoord, } +// TODO check why this method is called in continue template int BaseBeamInterpolation::getNodeIndices(const EdgeID edgeInList, unsigned int& node0Idx,