Skip to content

Commit c221011

Browse files
committed
[algorithm] Place geometry checks in InsertionAlgorithm when they make sense
1 parent 7e138a6 commit c221011

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
@@ -130,23 +130,21 @@ class InsertionAlgorithm : public BaseAlgorithm
130130

131131
void doDetection()
132132
{
133-
if (!l_tipGeom || !l_surfGeom || !l_shaftGeom || !l_volGeom) return;
134-
135133
auto& collisionOutput = *d_collisionOutput.beginEdit();
136134
auto& insertionOutput = *d_insertionOutput.beginEdit();
137135

138136
insertionOutput.clear();
139137
collisionOutput.clear();
140138

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

148146
// Puncture sequence
149-
if (d_enablePuncture.getValue())
147+
if (d_enablePuncture.getValue() && l_tipGeom)
150148
{
151149
auto createTipProximity =
152150
Operations::CreateCenterProximity::Operation::get(l_tipGeom->getTypeInfo());
@@ -189,7 +187,7 @@ class InsertionAlgorithm : public BaseAlgorithm
189187
}
190188

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

231229
ElementIterator::SPtr itTip = l_tipGeom->begin();
232230
auto createTipProximity =
@@ -326,7 +324,7 @@ class InsertionAlgorithm : public BaseAlgorithm
326324
}
327325
}
328326

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

0 commit comments

Comments
 (0)