diff --git a/src/CollisionAlgorithm/BaseAABBBroadPhase.h b/src/CollisionAlgorithm/BaseAABBBroadPhase.h index 3a65ba4..f6ac3d1 100644 --- a/src/CollisionAlgorithm/BaseAABBBroadPhase.h +++ b/src/CollisionAlgorithm/BaseAABBBroadPhase.h @@ -61,12 +61,12 @@ class SOFA_COLLISIONALGORITHM_API BaseAABBBroadPhase : public BaseGeometry::Broa } inline void doUpdate() { - sofa::helper::AdvancedTimer::stepBegin("========================= AABBBroadPhase do update ========================="); + sofa::helper::AdvancedTimer::stepBegin("AABBBroadPhase::doUpdate - "+this->getName()); m_Bmin = l_geometry->getPosition(0); m_Bmax = m_Bmin; //updates bounding box area -// sofa::helper::AdvancedTimer::stepBegin("========================= BBox area update in AABBBroadPhase do update ========================="); + sofa::helper::AdvancedTimer::stepBegin("AABBBroadPhase BBox area update - "+this->getName()); for (unsigned j=1;jgetSize();j++) { type::Vec3 pos = l_geometry->getPosition(j); @@ -78,7 +78,7 @@ class SOFA_COLLISIONALGORITHM_API BaseAABBBroadPhase : public BaseGeometry::Broa } } -// sofa::helper::AdvancedTimer::stepEnd("========================= BBox area update in AABBBroadPhase do update ========================="); + sofa::helper::AdvancedTimer::stepEnd("AABBBroadPhase BBox area update - "+this->getName()); //fixes cell size for (int i = 0 ; i < 3 ; i++) { @@ -98,9 +98,9 @@ class SOFA_COLLISIONALGORITHM_API BaseAABBBroadPhase : public BaseGeometry::Broa } } -// sofa::helper::AdvancedTimer::stepBegin("========================= CLEAR MAP ========================="); + sofa::helper::AdvancedTimer::stepBegin("AABBBroadPhase clear map - "+this->getName()); newContainer(); -// sofa::helper::AdvancedTimer::stepEnd("========================= CLEAR MAP ========================="); + sofa::helper::AdvancedTimer::stepEnd("AABBBroadPhase clear map - "+this->getName()); // center in -0.5 cellwidth m_Bmin -= m_cellSize * 0.5; @@ -112,11 +112,11 @@ class SOFA_COLLISIONALGORITHM_API BaseAABBBroadPhase : public BaseGeometry::Broa return; } -// sofa::helper::AdvancedTimer::stepBegin("========================= Elements rangés dans boites in AABB doUpdate ========================="); + sofa::helper::AdvancedTimer::stepBegin("AABBBroadPhase updateElemInBoxes - " + this->getName()); updateElemInBoxes(); + sofa::helper::AdvancedTimer::stepEnd("AABBBroadPhase updateElemInBoxes - " + this->getName()); -// sofa::helper::AdvancedTimer::stepEnd("========================= Elements rangés dans boites in AABB doUpdate ========================="); - sofa::helper::AdvancedTimer::stepEnd("========================= AABBBroadPhase do update ========================="); + sofa::helper::AdvancedTimer::stepEnd("AABBBroadPhase::doUpdate - "+this->getName()); } diff --git a/src/CollisionAlgorithm/CollisionPipeline.h b/src/CollisionAlgorithm/CollisionPipeline.h index 75b3f65..7dc7eb4 100644 --- a/src/CollisionAlgorithm/CollisionPipeline.h +++ b/src/CollisionAlgorithm/CollisionPipeline.h @@ -66,11 +66,9 @@ class SOFA_COLLISIONALGORITHM_API CollisionLoop : public core::objectmodel::Base void processObject(simulation::Node*, core::objectmodel::BaseObject* obj) { if (CollisionAlgorithm * component = dynamic_cast(obj)) { -// std::string timerName = std::string("-- Do detection : ") + obj->getName(); - -// sofa::helper::AdvancedTimer::stepBegin(timerName.c_str()); + sofa::helper::AdvancedTimer::stepBegin("doDetection - "+obj->getName()); component->doDetection(); -// sofa::helper::AdvancedTimer::stepEnd(timerName.c_str()); + sofa::helper::AdvancedTimer::stepEnd("doDetection - "+obj->getName()); } } diff --git a/src/CollisionAlgorithm/algorithm/InsertionAlgorithm.h b/src/CollisionAlgorithm/algorithm/InsertionAlgorithm.h index 29ed4b3..08caa1d 100644 --- a/src/CollisionAlgorithm/algorithm/InsertionAlgorithm.h +++ b/src/CollisionAlgorithm/algorithm/InsertionAlgorithm.h @@ -139,6 +139,8 @@ class SOFA_COLLISIONALGORITHM_API InsertionAlgorithm : public BaseAlgorithm if (m_couplingPts.empty() && l_surfGeom) { // Operations on surface geometry + sofa::helper::AdvancedTimer::stepBegin("Puncture detection - "+this->getName()); + auto findClosestProxOnSurf = Operations::FindClosestProximity::Operation::get(l_surfGeom); auto projectOnSurf = Operations::Project::Operation::get(l_surfGeom); @@ -185,8 +187,11 @@ class SOFA_COLLISIONALGORITHM_API InsertionAlgorithm : public BaseAlgorithm } } } + sofa::helper::AdvancedTimer::stepEnd("Puncture detection - "+this->getName()); // Shaft collision sequence - Disable if coupling points have been added + sofa::helper::AdvancedTimer::stepBegin("Shaft collision - "+this->getName()); + if (d_enableShaftCollision.getValue() && m_couplingPts.empty() && l_shaftGeom) { auto createShaftProximity = @@ -220,10 +225,13 @@ class SOFA_COLLISIONALGORITHM_API InsertionAlgorithm : public BaseAlgorithm } } } + sofa::helper::AdvancedTimer::stepEnd("Shaft collision - "+this->getName()); } else { // Insertion sequence + sofa::helper::AdvancedTimer::stepBegin("Needle insertion - " + this->getName()); + if (!d_enableInsertion.getValue() || !l_tipGeom || !l_volGeom || !l_shaftGeom) return; ElementIterator::SPtr itTip = l_tipGeom->begin(); @@ -322,8 +330,11 @@ class SOFA_COLLISIONALGORITHM_API InsertionAlgorithm : public BaseAlgorithm Operations::Needle::PrunePointsAheadOfTip::get(itShaft->getTypeInfo()); prunePointsAheadOfTip(m_couplingPts, itShaft->element()); } + sofa::helper::AdvancedTimer::stepEnd("Needle insertion - " + this->getName()); } + sofa::helper::AdvancedTimer::stepBegin("Reproject coupling points - "+this->getName()); + if (d_enableInsertion.getValue() && !m_couplingPts.empty() && l_shaftGeom) { // Reprojection on shaft geometry sequence @@ -343,6 +354,7 @@ class SOFA_COLLISIONALGORITHM_API InsertionAlgorithm : public BaseAlgorithm // because the needle has exited abruptly. Thus, we clear the coupling points. if (insertionOutput.size() == 0) m_couplingPts.clear(); } + sofa::helper::AdvancedTimer::stepEnd("Reproject coupling points - "+this->getName()); d_collisionOutput.endEdit(); d_insertionOutput.endEdit();