Skip to content

Commit 61bea50

Browse files
committed
[src] Add option to get the tip dof id of a beam/wire
1 parent 1f5a6d8 commit 61bea50

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

src/BeamAdapter/component/BaseBeamInterpolation.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,9 @@ class BaseBeamInterpolation : public sofa::core::behavior::SingleStateAccessor<D
231231
Data< sofa::type::vector<EdgeID> > d_beamCollision;
232232

233233
Data<bool> d_dofsAndBeamsAligned;
234+
235+
/// index of the beam extremity that is considered as the tip of the wire
236+
Data <sofa::Index> d_wireTipIndex;
234237

235238
/// link to the (edge) topology
236239
SingleLink<BaseBeamInterpolation<DataTypes>, BaseMeshTopology, BaseLink::FLAG_STOREPATH|BaseLink::FLAG_STRONGLINK> l_topology;

src/BeamAdapter/component/BaseBeamInterpolation.inl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ BaseBeamInterpolation<DataTypes>::BaseBeamInterpolation()
107107
, d_beamCollision(initData(&d_beamCollision, "beamCollision", "list of beam (in edgeList) that needs to be considered for collision"))
108108
, d_dofsAndBeamsAligned(initData(&d_dofsAndBeamsAligned, true, "dofsAndBeamsAligned",
109109
"if false, a transformation for each beam is computed between the DOF and the beam nodes"))
110+
, d_wireTipIndex(initData(&d_wireTipIndex, (sofa::Index)0, "wireTipIndex", "index of the beam extremity that is considered as the tip of the wire"))
110111
, l_topology(initLink("topology", "link to the topology (must contain edges)"))
111112
{
112113

@@ -186,6 +187,9 @@ void BaseBeamInterpolation<DataTypes>::addBeam(const EdgeID eID, const Real leng
186187
d_dofsAndBeamsAligned.setValue(false);
187188
DOF0TransformNode0.push_back(Transform(Vec3(0, 0, 0), QuatX));
188189
DOF1TransformNode1.push_back(Transform(Vec3(0, 0, 0), QuatX));
190+
191+
const BaseMeshTopology::Edge& edge = l_topology->getEdge(eID);
192+
d_wireTipIndex.setValue(edge[1]);
189193
}
190194

191195

@@ -392,6 +396,7 @@ void BaseBeamInterpolation<DataTypes>::getTangent(Vec3& t, const Real baryCoord,
392396
}
393397

394398

399+
// TODO check why this method is called in continue
395400
template<class DataTypes>
396401
int BaseBeamInterpolation<DataTypes>::getNodeIndices(const EdgeID edgeInList,
397402
unsigned int& node0Idx,

0 commit comments

Comments
 (0)