Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1121,14 +1121,20 @@ void InterventionalRadiologyController<DataTypes>::fillInstrumentCurvAbsTable(co
template <class DataTypes>
void InterventionalRadiologyController<DataTypes>::fixFirstNodesWithUntil(unsigned int firstSimulatedNode)
{
l_fixedConstraint->clearConstraints();

if (firstSimulatedNode == 0)
{
d_indexFirstNode = 0;
return;
}
Comment on lines +1126 to +1130
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (firstSimulatedNode == 0)
{
d_indexFirstNode = 0;
return;
}
if (firstSimulatedNode == 0)
{
msg_warning() << "An invalid value of firstSimulatedNode equal to 0 has been given to fixFirstNodesWithUntil() method.";
d_indexFirstNode = 0;
return;
}


WriteAccessor<Data<VecCoord> > xMstate = *getMechanicalState()->write(sofa::core::vec_id::write_access::position);
WriteAccessor<Data<VecCoord> > xrestMstate = *getMechanicalState()->write(sofa::core::vec_id::write_access::restPosition);
WriteAccessor<Data<VecDeriv> > vMstate = *getMechanicalState()->write(sofa::core::vec_id::write_access::velocity);

// set the position to startingPos for all the nodes that are not simulated
const auto& startPos = d_startingPos.getValue();
// and add a fixedConstraint
l_fixedConstraint->clearConstraints();
for(unsigned int i=0; i<firstSimulatedNode-1 ; i++)
{
xMstate[i] = startPos;
Expand Down
Loading