Skip to content

Commit 193b847

Browse files
committed
[timer] Add advanced timers in the InsertionAlgorithm
1 parent 9442d61 commit 193b847

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/CollisionAlgorithm/algorithm/InsertionAlgorithm.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ class SOFA_COLLISIONALGORITHM_API InsertionAlgorithm : public BaseAlgorithm
139139
if (m_couplingPts.empty() && l_surfGeom)
140140
{
141141
// Operations on surface geometry
142+
sofa::helper::AdvancedTimer::stepBegin("Puncture detection - "+this->getName());
143+
142144
auto findClosestProxOnSurf =
143145
Operations::FindClosestProximity::Operation::get(l_surfGeom);
144146
auto projectOnSurf = Operations::Project::Operation::get(l_surfGeom);
@@ -185,8 +187,10 @@ class SOFA_COLLISIONALGORITHM_API InsertionAlgorithm : public BaseAlgorithm
185187
}
186188
}
187189
}
190+
sofa::helper::AdvancedTimer::stepEnd("Puncture detection - "+this->getName());
188191

189192
// Shaft collision sequence - Disable if coupling points have been added
193+
sofa::helper::AdvancedTimer::stepBegin("Shaft collision - "+this->getName());
190194
if (d_enableShaftCollision.getValue() && m_couplingPts.empty() && l_shaftGeom)
191195
{
192196
auto createShaftProximity =
@@ -220,10 +224,12 @@ class SOFA_COLLISIONALGORITHM_API InsertionAlgorithm : public BaseAlgorithm
220224
}
221225
}
222226
}
227+
sofa::helper::AdvancedTimer::stepEnd("Shaft collision - "+this->getName());
223228
}
224229
else
225230
{
226231
// Insertion sequence
232+
sofa::helper::AdvancedTimer::stepBegin("Needle insertion - " + this->getName());
227233
if (!d_enableInsertion.getValue() || !l_tipGeom || !l_volGeom || !l_shaftGeom) return;
228234

229235
ElementIterator::SPtr itTip = l_tipGeom->begin();
@@ -322,8 +328,10 @@ class SOFA_COLLISIONALGORITHM_API InsertionAlgorithm : public BaseAlgorithm
322328
Operations::Needle::PrunePointsAheadOfTip::get(itShaft->getTypeInfo());
323329
prunePointsAheadOfTip(m_couplingPts, itShaft->element());
324330
}
331+
sofa::helper::AdvancedTimer::stepEnd("Needle insertion - " + this->getName());
325332
}
326333

334+
sofa::helper::AdvancedTimer::stepBegin("Reproject coupling points - "+this->getName());
327335
if (d_enableInsertion.getValue() && !m_couplingPts.empty() && l_shaftGeom)
328336
{
329337
// Reprojection on shaft geometry sequence
@@ -343,6 +351,7 @@ class SOFA_COLLISIONALGORITHM_API InsertionAlgorithm : public BaseAlgorithm
343351
// because the needle has exited abruptly. Thus, we clear the coupling points.
344352
if (insertionOutput.size() == 0) m_couplingPts.clear();
345353
}
354+
sofa::helper::AdvancedTimer::stepEnd("Reproject coupling points - "+this->getName());
346355

347356
d_collisionOutput.endEdit();
348357
d_insertionOutput.endEdit();

0 commit comments

Comments
 (0)