Skip to content

Commit dd81a05

Browse files
committed
[src] Overload add function with DetectionOutput signature to shorten code
1 parent a438b01 commit dd81a05

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/CollisionAlgorithm/DataDetectionOutput.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ class DetectionOutput {
5858
m_output.push_back(PairDetection(p1,p2));
5959
}
6060

61+
inline void add(const DetectionOutput& addition) {
62+
for (auto& it : addition)
63+
this->add(it.first, it.second);
64+
}
65+
6166
inline const PairDetection & operator[](int i) const {
6267
return m_output[i];
6368
}

src/CollisionAlgorithm/algorithm/InsertionAlgorithm.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,7 @@ void InsertionAlgorithm::doDetection()
119119
// Shaft collision sequence - Disable if coupling points have been added
120120
sofa::helper::AdvancedTimer::stepBegin("Shaft collision - " + this->getName());
121121
if (d_enableShaftCollision.getValue() && m_couplingPts.empty())
122-
{
123-
AlgorithmOutput shaftCollisions = shaftCollisionPhase();
124-
for (auto& it : shaftCollisions) collisionOutput.add(it.first, it.second);
125-
}
122+
collisionOutput.add(shaftCollisionPhase());
126123
sofa::helper::AdvancedTimer::stepEnd("Shaft collision - " + this->getName());
127124
}
128125
else

0 commit comments

Comments
 (0)