Repository navigation
Conversation
…edgeMass - initFromVertexAndEdgeMass: each edge mass is applied twice (M(i,j) and M(j,i)), so totalMass = sum(vertexMass) + 2 * sum(edgeMass). When lumped, totalMass = coeff * sum(vertexMass), which is what addMDx applies. - initFromVertexMass (lumping): the given vertexMass are the lumped masses (behavior before sofa-framework#2305, and what totalMass and massDensity already assume). Store vertexMass / massLumpingCoeff, since the lumping coefficient is applied wherever the lumped mass is used. - Re-enable MeshMatrixMass_test.cpp and add tests checking that totalMass is the sum of the mass matrix entries (assembled and applied through addMDx) for both init paths, on tetra and hexa meshes. Behavior changes: - lumping=true with vertexMass only: the applied mass is now exactly the given vertexMass, instead of massLumpingCoeff (2 for triangles/quads, 2.5 for tetrahedra/hexahedra) times it. Free fall under gravity is unchanged, but objects are lighter relative to stiffness, constraints and contacts. d_vertexMass now holds vertexMass / massLumpingCoeff after init. totalMass and massDensity are unchanged. - vertexMass + edgeMass: the dynamics are unchanged, only the reported totalMass and massDensity change. The corrected massDensity also gives the right mass to elements added by topological changes. - No scene in the repository sets vertexMass or edgeMass on a MeshMatrixMass, so no regression reference is affected.
bakpaul
approved these changes
Oct 16, 2026
bakpaul
left a comment
Contributor
There was a problem hiding this comment.
Not an expert but seems OK for me
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
from #6410 , AI detected that there was a probleme with initialization from vertexmass/edgemass. 🥸
So this makes totalMass consistent with the applied mass matrix when initialized from vertexMass/edgeMass.
It adds unit tests as well.
Same as before, mass' experts opinions are welcome 😶🌫️
Behavior changes:
[with-all-tests]
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