Skip to content

Commit 13974a5

Browse files
committed
[timer] Add advanced timers in the InsertionAlgorithm
1 parent 1df37d7 commit 13974a5

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
@@ -141,6 +141,8 @@ class InsertionAlgorithm : public BaseAlgorithm
141141
if (m_couplingPts.empty() && l_surfGeom)
142142
{
143143
// Operations on surface geometry
144+
sofa::helper::AdvancedTimer::stepBegin("Puncture detection - "+this->getName());
145+
144146
auto findClosestProxOnSurf =
145147
Operations::FindClosestProximity::Operation::get(l_surfGeom);
146148
auto projectOnSurf = Operations::Project::Operation::get(l_surfGeom);
@@ -187,8 +189,10 @@ class InsertionAlgorithm : public BaseAlgorithm
187189
}
188190
}
189191
}
192+
sofa::helper::AdvancedTimer::stepEnd("Puncture detection - "+this->getName());
190193

191194
// Shaft collision sequence - Disable if coupling points have been added
195+
sofa::helper::AdvancedTimer::stepBegin("Shaft collision - "+this->getName());
192196
if (d_enableShaftCollision.getValue() && m_couplingPts.empty() && l_shaftGeom)
193197
{
194198
auto createShaftProximity =
@@ -222,10 +226,12 @@ class InsertionAlgorithm : public BaseAlgorithm
222226
}
223227
}
224228
}
229+
sofa::helper::AdvancedTimer::stepEnd("Shaft collision - "+this->getName());
225230
}
226231
else
227232
{
228233
// Insertion sequence
234+
sofa::helper::AdvancedTimer::stepBegin("Needle insertion - " + this->getName());
229235
if (!d_enableInsertion.getValue() || !l_tipGeom || !l_volGeom || !l_shaftGeom) return;
230236

231237
ElementIterator::SPtr itTip = l_tipGeom->begin();
@@ -324,8 +330,10 @@ class InsertionAlgorithm : public BaseAlgorithm
324330
Operations::Needle::PrunePointsAheadOfTip::get(itShaft->getTypeInfo());
325331
prunePointsAheadOfTip(m_couplingPts, itShaft->element());
326332
}
333+
sofa::helper::AdvancedTimer::stepEnd("Needle insertion - " + this->getName());
327334
}
328335

336+
sofa::helper::AdvancedTimer::stepBegin("Reproject coupling points - "+this->getName());
329337
if (d_enableInsertion.getValue() && !m_couplingPts.empty() && l_shaftGeom)
330338
{
331339
// Reprojection on shaft geometry sequence
@@ -345,6 +353,7 @@ class InsertionAlgorithm : public BaseAlgorithm
345353
// because the needle has exited abruptly. Thus, we clear the coupling points.
346354
if (insertionOutput.size() == 0) m_couplingPts.clear();
347355
}
356+
sofa::helper::AdvancedTimer::stepEnd("Reproject coupling points - "+this->getName());
348357

349358
d_collisionOutput.endEdit();
350359
d_insertionOutput.endEdit();

0 commit comments

Comments
 (0)