Skip to content

Commit

Permalink
[Spring] Add warning when user tries to override MeshSpringForcefield…
Browse files Browse the repository at this point in the history
… indices (sofa-framework#5136)

* Add warning when disabled mechanism is used

* remove unnecessary new lines

* Update Sofa/Component/SolidMechanics/Spring/src/sofa/component/solidmechanics/spring/MeshSpringForceField.inl

Co-authored-by: Hugo <[email protected]>

---------

Co-authored-by: Hugo <[email protected]>
  • Loading branch information
bakpaul and hugtalbot authored Dec 8, 2024
1 parent bece924 commit 539b6be
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,13 @@ void MeshSpringForceField<DataTypes>::addSpring(std::set<std::pair<sofa::Index,
template<class DataTypes>
void MeshSpringForceField<DataTypes>::init()
{
if(this->d_springsIndices[0].getValue().size() || this->d_springsIndices[1].getValue().size())
{
msg_warning(this) << "Setting springs of MeshSpringForcefield through datas \'indices1\' and \'indices2\' has been disabled since v24.12. The input indices will be overridden by the mesh.";
}

SpringForceField<DataTypes>::clear();

if(!(mstate1) || !(mstate2))
mstate2 = mstate1 = dynamic_cast<sofa::core::behavior::MechanicalState<DataTypes> *>(this->getContext()->getMechanicalState());

Expand Down

0 comments on commit 539b6be

Please sign in to comment.