Skip to content

Commit c7542c0

Browse files
committed
[algorithm] Place geometry checks in InsertionAlgorithm when they make sense
1 parent 8df24e3 commit c7542c0

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/CollisionAlgorithm/algorithm/InsertionAlgorithm.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,23 +132,21 @@ class InsertionAlgorithm : public BaseAlgorithm
132132

133133
void doDetection()
134134
{
135-
if (!l_tipGeom || !l_surfGeom || !l_shaftGeom || !l_volGeom) return;
136-
137135
auto& collisionOutput = *d_collisionOutput.beginEdit();
138136
auto& insertionOutput = *d_insertionOutput.beginEdit();
139137

140138
insertionOutput.clear();
141139
collisionOutput.clear();
142140

143-
if (m_couplingPts.empty())
141+
if (m_couplingPts.empty() && l_surfGeom)
144142
{
145143
// Operations on surface geometry
146144
auto findClosestProxOnSurf =
147145
Operations::FindClosestProximity::Operation::get(l_surfGeom);
148146
auto projectOnSurf = Operations::Project::Operation::get(l_surfGeom);
149147

150148
// Puncture sequence
151-
if (d_enablePuncture.getValue())
149+
if (d_enablePuncture.getValue() && l_tipGeom)
152150
{
153151
auto createTipProximity =
154152
Operations::CreateCenterProximity::Operation::get(l_tipGeom->getTypeInfo());
@@ -191,7 +189,7 @@ class InsertionAlgorithm : public BaseAlgorithm
191189
}
192190

193191
// Shaft collision sequence - Disable if coupling points have been added
194-
if (d_enableShaftCollision.getValue() && m_couplingPts.empty())
192+
if (d_enableShaftCollision.getValue() && m_couplingPts.empty() && l_shaftGeom)
195193
{
196194
auto createShaftProximity =
197195
Operations::CreateCenterProximity::Operation::get(l_shaftGeom->getTypeInfo());
@@ -228,7 +226,7 @@ class InsertionAlgorithm : public BaseAlgorithm
228226
else
229227
{
230228
// Insertion sequence
231-
if (!d_enableInsertion.getValue()) return;
229+
if (!d_enableInsertion.getValue() || !l_tipGeom || !l_volGeom || !l_shaftGeom) return;
232230

233231
ElementIterator::SPtr itTip = l_tipGeom->begin();
234232
auto createTipProximity =
@@ -328,7 +326,7 @@ class InsertionAlgorithm : public BaseAlgorithm
328326
}
329327
}
330328

331-
if (d_enableInsertion.getValue() && !m_couplingPts.empty())
329+
if (d_enableInsertion.getValue() && !m_couplingPts.empty() && l_shaftGeom)
332330
{
333331
// Reprojection on shaft geometry sequence
334332
auto findClosestProxOnShaft =

0 commit comments

Comments
 (0)