Skip to content
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

[SofaSimpleFem] Fix row/col indices in hexa fem for bloc-based matrices #2277

Merged
merged 1 commit into from
Aug 4, 2021

Conversation

alxbilger
Copy link
Contributor

@alxbilger alxbilger commented Jul 28, 2021

Indices were wrong in case of multiple objects under the same linear solver which uses an assembled 3x3 bloc-based matrix.
Bug introduced in #2240


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

  • it builds with SUCCESS for all platforms on the CI.
  • it does not generate new warnings.
  • it does not generate new unit test failures.
  • it does not generate new scene test failures.
  • it does not break API compatibility.
  • it is more than 1 week old (or has fast-merge label).

@alxbilger alxbilger added pr: backport todo This PR will be backported into the release preceeding its milestone. pr: fix Fix a bug pr: status to review To notify reviewers to review this pull-request and removed pr: backport todo This PR will be backported into the release preceeding its milestone. labels Jul 28, 2021
@fredroy
Copy link
Contributor

fredroy commented Aug 3, 2021

[ci-build][force-full-build][with-all-tests]

@@ -1197,7 +1197,7 @@ void HexahedronFEMForceField<DataTypes>::addKToBlocMatrix(
Coord(Ke[3*n1+0][3*n2+0],Ke[3*n1+0][3*n2+1],Ke[3*n1+0][3*n2+2]),
Coord(Ke[3*n1+1][3*n2+0],Ke[3*n1+1][3*n2+1],Ke[3*n1+1][3*n2+2]),
Coord(Ke[3*n1+2][3*n2+0],Ke[3*n1+2][3*n2+1],Ke[3*n1+2][3*n2+2])) ) * Rot;
*crsmat->wbloc(offset + node1, offset + node2, true) += tmp * (-k);
*crsmat->wbloc(offset / 3 + node1, offset / 3 + node2, true) += tmp * (-k);
Copy link
Contributor

Choose a reason for hiding this comment

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

In the other cases of addKToMatrix, it appears that the same offset is used but it is never divided by 3:

r.matrix->add(r.offset + 3 * node1, r.offset + 3 * node2, tmp * (-kFactor));

I guess it comes from the difference between the wbloc and add functions, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, they both accept indices, but they don't represent the same thing

@fredroy fredroy added pr: status ready Approved a pull-request, ready to be squashed and removed pr: status to review To notify reviewers to review this pull-request labels Aug 4, 2021
@hugtalbot hugtalbot added pr: status ready Approved a pull-request, ready to be squashed and removed pr: status ready Approved a pull-request, ready to be squashed labels Aug 4, 2021
@fredroy fredroy merged commit 98c952f into sofa-framework:master Aug 4, 2021
@guparan guparan added this to the v21.12 milestone Oct 1, 2021
@alxbilger alxbilger deleted the fix_hexa branch June 28, 2022 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: fix Fix a bug pr: status ready Approved a pull-request, ready to be squashed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants