-
Notifications
You must be signed in to change notification settings - Fork 311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SofaBaseMechanics] Fix UniformMass topology changes handling mode. #2377
Conversation
…on callback method was missing during add/remove process
…directly from the topologyData
… engine in variable names and comments
…ng the queue of events to the handlers
…r Data indices and remove handleTopologyChange method.
…t of indices and also display the points involved
…re removed. At the end of the events, recompute the current mass.
[ci-build][with-all-tests] |
SofaKernel/modules/SofaBaseMechanics/src/SofaBaseMechanics/UniformMass.inl
Outdated
Show resolved
Hide resolved
SofaKernel/modules/SofaBaseMechanics/src/SofaBaseMechanics/UniformMass.inl
Outdated
Show resolved
Hide resolved
@@ -65,8 +69,7 @@ class UniformMass : public core::behavior::Mass<DataTypes> | |||
/// indices outside of this range are discarded (useful for parallelization | |||
/// using mesh partitionning) | |||
Data< type::Vec<2,int> > d_localRange; | |||
Data< type::vector<int> > d_indices; ///< optional local DOF indices. Any computation involving only indices outside of this list are discarded | |||
|
|||
SetIndex d_indices; ///< optional local DOF indices. Any computation involving only indices outside of this list are discarded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same SetIndex
is actually quite confusing, it's hiding that it corresponds to a data..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok what name do you want?
This is the same typedef as in all constraints component. Like FixedConstraint
…formMass.inl Co-authored-by: Hugo <hugo.talbot@sofa-framework.org>
@@ -65,8 +69,7 @@ class UniformMass : public core::behavior::Mass<DataTypes> | |||
/// indices outside of this range are discarded (useful for parallelization | |||
/// using mesh partitionning) | |||
Data< type::Vec<2,int> > d_localRange; | |||
Data< type::vector<int> > d_indices; ///< optional local DOF indices. Any computation involving only indices outside of this list are discarded | |||
|
|||
SetIndex d_indices; ///< optional local DOF indices. Any computation involving only indices outside of this list are discarded | |||
Data<bool> d_handleTopologicalChanges; ///< The mass and totalMass are recomputed on particles add/remove. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could add the info specifying why this option exists (UniformMass works also only with DOFs - without TopologyContainer in the scene)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New proposal: remove the data, and keep it as a private variable of the UniformMass class.
This boolean variable should be true if a Container is found, false else.
…formMass.inl Co-authored-by: Hugo <hugo.talbot@sofa-framework.org>
…otalMass, massDensity to send warnings only if values are strictly negatives
…default if the topology is dynamic register callback on DataSetIndex
[ci-build][with-all-tests] |
{ | ||
msg_info() << "link to Topology container should be set to ensure right behavior. First Topology found in current context will be used."; | ||
l_topology.set(this->getContext()->getMeshTopologyLink()); | ||
Real newVertexMass = d_totalMass.getValue() / Real(newSize); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check if newSize == 0
Just tested it @epernod it works as a charm 👍 👍 👍 👍 |
…ofa-framework#2377) This PR depends on sofa-framework#2374 sofa-framework#2375 and sofa-framework#2376 and should be rebased before review. - Remove old method `handleTopologyChange` - Turn d_indices into TopologySubsetIndices, this automatically fix the topological changes update. - Fix the use of subset indices combined with topology changes. - Add callback on endingEvent to update the totalMass/vertexMass - Fix the center of gravity display when using subset of indices ______________________________________________________ Co-authored-by: Hugo <hugo.talbot@sofa-framework.org> Co-authored-by: Frederick Roy <fredroy@users.noreply.github.com>
This PR depends on #2374 #2375 and #2376 and should be rebased before review.
handleTopologyChange
Here is an example of scenes RemovingTrianglesProcess.scn using a subset of indices (yellow points)
<UniformMass template="Vec3d,double" name="mass" totalMass="1.0" handleTopologicalChanges="1" indices="0 1 2 3 4 5 6 7 8 9"/>
By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).
Reviewers will merge this pull-request only if