Skip to content

Commit bf1395f

Browse files
committed
[timer] Add advanced timers in the InsertionAlgorithm
1 parent bc5101c commit bf1395f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/sofa/collisionAlgorithm/algorithm/InsertionAlgorithm.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ class InsertionAlgorithm : public BaseAlgorithm
129129

130130
if (m_couplingPts.empty())
131131
{
132+
sofa::helper::AdvancedTimer::stepBegin("Puncture detection - "+this->getName());
132133
// 1. Puncture algorithm
133134
auto createTipProximity =
134135
Operations::CreateCenterProximity::Operation::get(l_tipGeom->getTypeInfo());
@@ -178,8 +179,10 @@ class InsertionAlgorithm : public BaseAlgorithm
178179
collisionOutput.add(tipProx, surfProx);
179180
}
180181
}
182+
sofa::helper::AdvancedTimer::stepEnd("Puncture detection - "+this->getName());
181183

182184
// 1.3 Collision with the shaft geometry
185+
sofa::helper::AdvancedTimer::stepBegin("Shaft collision - "+this->getName());
183186
if (m_couplingPts.empty())
184187
{
185188
auto createShaftProximity =
@@ -207,9 +210,11 @@ class InsertionAlgorithm : public BaseAlgorithm
207210
}
208211
}
209212
}
213+
sofa::helper::AdvancedTimer::stepEnd("Shaft collision - "+this->getName());
210214
}
211215
else
212216
{
217+
sofa::helper::AdvancedTimer::stepBegin("Needle insertion - " + this->getName());
213218
// 2. Needle insertion algorithm
214219
ElementIterator::SPtr itTip = l_tipGeom->begin();
215220
auto createTipProximity =
@@ -299,8 +304,10 @@ class InsertionAlgorithm : public BaseAlgorithm
299304
Operations::Needle::PrunePointsAheadOfTip::get(itShaft->getTypeInfo());
300305
prunePointsAheadOfTip(m_couplingPts, itShaft->element());
301306
}
307+
sofa::helper::AdvancedTimer::stepEnd("Needle insertion - " + this->getName());
302308
}
303309

310+
sofa::helper::AdvancedTimer::stepBegin("Reproject coupling points - "+this->getName());
304311
if (!m_couplingPts.empty())
305312
{
306313
// 3. Re-project proximities on the shaft geometry
@@ -320,6 +327,7 @@ class InsertionAlgorithm : public BaseAlgorithm
320327
// because the needle has exited abruptly. Thus, we clear the coupling points.
321328
if (insertionOutput.size() == 0) m_couplingPts.clear();
322329
}
330+
sofa::helper::AdvancedTimer::stepEnd("Reproject coupling points - "+this->getName());
323331

324332
d_collisionOutput.endEdit();
325333
d_insertionOutput.endEdit();

0 commit comments

Comments
 (0)