Skip to content

Commit 62b077a

Browse files
committed
[algorithm] Add a bool to enable/disable insertion sequence
1 parent adf8d79 commit 62b077a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/CollisionAlgorithm/algorithm/InsertionAlgorithm.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class InsertionAlgorithm : public BaseAlgorithm
2929

3030
GeomLink l_tipGeom, l_surfGeom, l_shaftGeom, l_volGeom;
3131
Data<AlgorithmOutput> d_collisionOutput, d_insertionOutput;
32-
Data<bool> d_projective, d_enablePuncture;
32+
Data<bool> d_projective, d_enablePuncture, d_enableInsertion;
3333
Data<SReal> d_punctureForceThreshold, d_tipDistThreshold;
3434
ConstraintSolver::SPtr m_constraintSolver;
3535
std::vector<BaseProximity::SPtr> m_couplingPts;
@@ -52,6 +52,8 @@ class InsertionAlgorithm : public BaseAlgorithm
5252
"Projection of closest detected proximity back onto the needle tip element.")),
5353
d_enablePuncture(
5454
initData(&d_enablePuncture, true, "enablePuncture", "Enable puncture algorithm.")),
55+
d_enableInsertion(
56+
initData(&d_enableInsertion, true, "enableInsertion", "Enable insertion algorithm.")),
5557
d_punctureForceThreshold(initData(&d_punctureForceThreshold, -1_sreal,
5658
"punctureForceThreshold",
5759
"Threshold for the force applied to the needle tip. "
@@ -209,6 +211,8 @@ class InsertionAlgorithm : public BaseAlgorithm
209211
else
210212
{
211213
// Insertion sequence
214+
if (!d_enableInsertion.getValue()) return;
215+
212216
ElementIterator::SPtr itTip = l_tipGeom->begin();
213217
auto createTipProximity =
214218
Operations::CreateCenterProximity::Operation::get(itTip->getTypeInfo());
@@ -307,7 +311,7 @@ class InsertionAlgorithm : public BaseAlgorithm
307311
}
308312
}
309313

310-
if (!m_couplingPts.empty())
314+
if (d_enableInsertion.getValue() && !m_couplingPts.empty())
311315
{
312316
// Reprojection on shaft geometry sequence
313317
auto findClosestProxOnShaft =

0 commit comments

Comments
 (0)