Skip to content

[ForceField] Fix stream functions for some ForceField - #6304

Open
Lucas-TJ wants to merge 11 commits into
sofa-framework:masterfrom
Lucas-TJ:fix_streamfunctions
Open

[ForceField] Fix stream functions for some ForceField#6304
Lucas-TJ wants to merge 11 commits into
sofa-framework:masterfrom
Lucas-TJ:fix_streamfunctions

Conversation

@Lucas-TJ

@Lucas-TJ Lucas-TJ commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Hello !

For my project, I want to save and load data from components. Same as PR #6128 for TetrahedralCorotationalFEMForceField, I want to save/load data from internal class like "EdgeInformation" or "VertexInformation" etc. These classes have Output and Input stream functions, but they are not correctly implemented.

So, in this PR, I fix the Output stream and Input stream functions for:

  • EdgePressureForceField.h
  • FastTetrahedralCorotationalForceField.h
  • FastTriangularBendingSprings.h
  • HexahedralFEMForceField.h
  • QuadBendingFEMForceField.h
  • QuadPressureForceField.h
  • QuadularBendingSprings.h
  • StandardTetrahedralFEMForceField.h
  • TetrahedralTensorMassForceField.h
  • TetrahedronHyperelasticityFEMForceField.h
  • TrianglePressureForceField.h
  • TriangularBendingSprings.h
  • TriangularBiquadraticSpringsForceField.h
  • TriangularFEMForceField.h
  • TriangularQuadraticSpringsForceField.h
  • TriangularTensorMassForceField.h
  • VectorSpringForceField.h

(Each function has its own unit test !)

Some additional information :

  • For some tests, I had to create the test file and therefore modify the corresponding CMake file. This is especially the case for TensorMass, which did not have any tests until now
  • For QuadBendingFEMForceField, there was no information/data in the VertexInformation class. Since it was still being used, I added the necessary information myself, taking inspiration from another component

Thank you !

[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

  • 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).

This commit groups together all fixes related to stream's functions from certain forcefields:
- EdgePressureForceField.h
- FastTetrahedralCorotationalForceField.h
- FastTriangularBendingSprings.h
- HexahedralFEMForceField.h
- QuadBendingFEMForceField.h
- QuadPressureForceField.h
- QuadularBendingSprings.h
- StandardTetrahedralFEMForceField.h
- TetrahedralTensorMassForceField.h
- TetrahedronHyperelasticityFEMForceField.h
- TrianglePressureForceField.h
- TriangularBendingSprings.h
- TriangularBiquadraticSpringsForceField.h
- TriangularFEMForceField.h
- TriangularQuadraticSpringsForceField.h
- TriangularTensorMassForceField.h
- VectorSpringForceField.h
@Lucas-TJ Lucas-TJ added pr: fix Fix a bug pr: status to review To notify reviewers to review this pull-request labels Sep 9, 2026
Comment thread Sofa/Component/MechanicalLoad/tests/TrianglePressureForceField_test.cpp Outdated
{
public:
EdgeInformation(){}
Mat DfDx; ///< the edge stiffness matrix

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think that EdgeInformation and VertexInformation and its instances must be removed. The only usage is a resize, without any further usage.

Comment thread Sofa/Component/SolidMechanics/Spring/tests/QuadularBendingSprings_test.cpp Outdated
Comment thread Sofa/Component/SolidMechanics/Spring/tests/FastTriangularBendingSprings_test.cpp Outdated
Comment thread Sofa/Component/SolidMechanics/TensorMass/tests/CMakeLists.txt Outdated
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 to review To notify reviewers to review this pull-request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants