Skip to content

Commit 6d29c52

Browse files
committed
[timer] Add advanced timers in the InsertionAlgorithm
1 parent 1b44d7f commit 6d29c52

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/CollisionAlgorithm/algorithm/InsertionAlgorithm.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ class InsertionAlgorithm : public BaseAlgorithm
135135
if (m_couplingPts.empty())
136136
{
137137
// Operations on surface geometry
138+
sofa::helper::AdvancedTimer::stepBegin("Puncture detection - "+this->getName());
139+
138140
auto findClosestProxOnSurf =
139141
Operations::FindClosestProximity::Operation::get(l_surfGeom);
140142
auto projectOnSurf = Operations::Project::Operation::get(l_surfGeom);
@@ -181,8 +183,11 @@ class InsertionAlgorithm : public BaseAlgorithm
181183
}
182184
}
183185
}
186+
sofa::helper::AdvancedTimer::stepEnd("Puncture detection - "+this->getName());
184187

185188
// Shaft collision sequence - Disable if coupling points have been added
189+
sofa::helper::AdvancedTimer::stepBegin("Shaft collision - "+this->getName());
190+
186191
if (d_enableShaftCollision.getValue() && m_couplingPts.empty())
187192
{
188193
auto createShaftProximity =
@@ -216,10 +221,12 @@ class InsertionAlgorithm : public BaseAlgorithm
216221
}
217222
}
218223
}
224+
sofa::helper::AdvancedTimer::stepEnd("Shaft collision - "+this->getName());
219225
}
220226
else
221227
{
222228
// Insertion sequence
229+
sofa::helper::AdvancedTimer::stepBegin("Needle insertion - " + this->getName());
223230
if (!d_enableInsertion.getValue()) return;
224231

225232
ElementIterator::SPtr itTip = l_tipGeom->begin();
@@ -318,9 +325,11 @@ class InsertionAlgorithm : public BaseAlgorithm
318325
Operations::Needle::PrunePointsAheadOfTip::get(itShaft->getTypeInfo());
319326
prunePointsAheadOfTip(m_couplingPts, itShaft->element());
320327
}
328+
sofa::helper::AdvancedTimer::stepEnd("Needle insertion - " + this->getName());
321329
}
322330

323-
if (d_enableInsertion.getValue() && !m_couplingPts.empty())
331+
sofa::helper::AdvancedTimer::stepBegin("Reproject coupling points - "+this->getName());
332+
if (!m_couplingPts.empty())
324333
{
325334
// Reprojection on shaft geometry sequence
326335
auto findClosestProxOnShaft =
@@ -339,6 +348,7 @@ class InsertionAlgorithm : public BaseAlgorithm
339348
// because the needle has exited abruptly. Thus, we clear the coupling points.
340349
if (insertionOutput.size() == 0) m_couplingPts.clear();
341350
}
351+
sofa::helper::AdvancedTimer::stepEnd("Reproject coupling points - "+this->getName());
342352

343353
d_collisionOutput.endEdit();
344354
d_insertionOutput.endEdit();

0 commit comments

Comments
 (0)