Skip to content

Commit 7e138a6

Browse files
committed
[algorithm] Make sanity checks happen only when appropriate for some data
1 parent 6a25270 commit 7e138a6

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

src/CollisionAlgorithm/algorithm/InsertionAlgorithm.h

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,24 +76,30 @@ class InsertionAlgorithm : public BaseAlgorithm
7676
void init() override
7777
{
7878
BaseAlgorithm::init();
79-
this->getContext()->get<ConstraintSolver>(m_constraintSolver);
80-
msg_warning_when(!m_constraintSolver)
81-
<< "No constraint solver found in context. Insertion algorithm is disabled.";
8279

83-
if (d_punctureForceThreshold.getValue() < 0)
80+
if (d_enablePuncture.getValue())
8481
{
85-
msg_warning() << d_punctureForceThreshold.getName() +
86-
" parameter not defined or set to negative value." msgendl
87-
<< "Puncture will not function properly; provide a positive value";
88-
d_punctureForceThreshold.setValue(std::numeric_limits<double>::max());
82+
this->getContext()->get<ConstraintSolver>(m_constraintSolver);
83+
msg_warning_when(!m_constraintSolver)
84+
<< "No constraint solver found in context. Insertion algorithm is disabled.";
85+
if (d_punctureForceThreshold.getValue() < 0)
86+
{
87+
msg_warning() << d_punctureForceThreshold.getName() +
88+
" parameter not defined or set to negative value." msgendl
89+
<< "Puncture will not function properly; provide a positive value";
90+
d_punctureForceThreshold.setValue(std::numeric_limits<double>::max());
91+
}
8992
}
9093

91-
if (d_tipDistThreshold.getValue() < 0)
94+
if (d_enableInsertion.getValue())
9295
{
93-
msg_warning() << d_tipDistThreshold.getName() +
94-
" parameter not defined or set to negative value." msgendl
95-
<< "Needle-volume coupling is disabled; provide a positive value";
96-
d_tipDistThreshold.setValue(std::numeric_limits<double>::max());
96+
if (d_tipDistThreshold.getValue() < 0)
97+
{
98+
msg_warning() << d_tipDistThreshold.getName() +
99+
" parameter not defined or set to negative value." msgendl
100+
<< "Needle-volume coupling is disabled; provide a positive value";
101+
d_tipDistThreshold.setValue(std::numeric_limits<double>::max());
102+
}
97103
}
98104
}
99105

0 commit comments

Comments
 (0)