From 7509e098a60b56764fe042e6cfeeab456868eca0 Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Sat, 23 May 2026 12:26:09 +0200 Subject: [PATCH 01/12] [FEM] Refactor templates in latest FEM classes --- .../ElementCorotationalFEMForceField.cpp | 25 ++++++------------- .../ElementCorotationalFEMForceField.h | 15 ----------- .../ElementLinearSmallStrainFEMForceField.cpp | 25 ++++++------------- .../ElementLinearSmallStrainFEMForceField.h | 17 +------------ .../fem/elastic/FEMForceField.h | 2 +- .../fem/elastic/FEMForceField.inl | 1 + .../HexahedronCorotationalFEMForceField.scn | 5 ++-- .../HexahedronCorotationalFEMForceField.scn | 5 ++-- .../HexahedronCorotationalFEMForceField.scn | 5 ++-- .../HexahedronCorotationalFEMForceField.scn | 5 ++-- ...xahedronLinearSmallStrainFEMForceField.scn | 5 ++-- ...xahedronLinearSmallStrainFEMForceField.scn | 5 ++-- ...xahedronLinearSmallStrainFEMForceField.scn | 5 ++-- ...xahedronLinearSmallStrainFEMForceField.scn | 5 ++-- .../TetrahedronCorotationalFEMForceField.scn | 3 ++- .../TetrahedronCorotationalFEMForceField.scn | 5 ++-- .../TetrahedronCorotationalFEMForceField.scn | 5 ++-- .../TetrahedronCorotationalFEMForceField.scn | 5 ++-- ...rahedronLinearSmallStrainFEMForceField.scn | 5 ++-- ...rahedronLinearSmallStrainFEMForceField.scn | 5 ++-- ...rahedronLinearSmallStrainFEMForceField.scn | 5 ++-- ...rahedronLinearSmallStrainFEMForceField.scn | 5 ++-- 22 files changed, 66 insertions(+), 97 deletions(-) diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.cpp b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.cpp index fd38c9e67bb..52a14a6bf00 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.cpp +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.cpp @@ -31,27 +31,18 @@ namespace sofa::component::solidmechanics::fem::elastic void registerElementCorotationalFEMForceField(sofa::core::ObjectFactory* factory) { - factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law on linear beams using the corotational approach") + factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law using the corotational approach") // .add< ElementCorotationalFEMForceField >() .add< ElementCorotationalFEMForceField >() - .add< ElementCorotationalFEMForceField >(true)); - - factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law on linear triangles using the corotational approach") + .add< ElementCorotationalFEMForceField >() .add< ElementCorotationalFEMForceField >() - .add< ElementCorotationalFEMForceField >(true)); - - factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law on linear quads using the corotational approach") + .add< ElementCorotationalFEMForceField >() .add< ElementCorotationalFEMForceField >() - .add< ElementCorotationalFEMForceField >(true)); - - factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law on linear tetrahedra using the corotational approach") - .add< ElementCorotationalFEMForceField >(true)); - - factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law on linear hexahedra using the corotational approach") - .add< ElementCorotationalFEMForceField >(true)); - - factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law on linear prisms using the corotational approach") - .add< ElementCorotationalFEMForceField >(true)); + .add< ElementCorotationalFEMForceField >() + .add< ElementCorotationalFEMForceField >() + .add< ElementCorotationalFEMForceField >() + .add< ElementCorotationalFEMForceField >() + ); } // template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.h b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.h index 1425fdfa925..df07d0d87e8 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.h +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.h @@ -121,21 +121,6 @@ class ElementCorotationalFEMForceField : SOFA_TEMPLATE2(BaseElementLinearFEMForceField, DataTypes, ElementType), SOFA_TEMPLATE2(FEMForceField, DataTypes, ElementType)); - /** - * The purpose of this function is to register the name of this class according to the provided - * pattern. - * - * Example: ElementCorotationalFEMForceField will produce - * the class name "EdgeCorotationalFEMForceField". - */ - static const std::string GetCustomClassName() - { - return std::string(sofa::geometry::elementTypeToString(ElementType::Element_type)) + - "CorotationalFEMForceField"; - } - - static const std::string GetCustomTemplateName() { return DataTypes::Name(); } - private: using trait = sofa::component::solidmechanics::fem::elastic::trait; using ElementGradient = typename trait::ElementGradient; diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.cpp b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.cpp index cb17452bdb2..2d6cc35ecec 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.cpp +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.cpp @@ -31,27 +31,18 @@ namespace sofa::component::solidmechanics::fem::elastic void registerElementLinearSmallStrainFEMForceField(sofa::core::ObjectFactory* factory) { - factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law on linear beams assuming small strain") + factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law assuming small strain") .add< ElementLinearSmallStrainFEMForceField >() .add< ElementLinearSmallStrainFEMForceField >() - .add< ElementLinearSmallStrainFEMForceField >(true)); - - factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law on linear triangles assuming small strain") + .add< ElementLinearSmallStrainFEMForceField >() .add< ElementLinearSmallStrainFEMForceField >() - .add< ElementLinearSmallStrainFEMForceField >(true)); - - factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law on linear quads assuming small strain") + .add< ElementLinearSmallStrainFEMForceField >() .add< ElementLinearSmallStrainFEMForceField >() - .add< ElementLinearSmallStrainFEMForceField >(true)); - - factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law on linear tetrahedra assuming small strain") - .add< ElementLinearSmallStrainFEMForceField >(true)); - - factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law on linear hexahedra assuming small strain") - .add< ElementLinearSmallStrainFEMForceField >(true)); - - factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law on linear prisms assuming small strain") - .add< ElementLinearSmallStrainFEMForceField >(true)); + .add< ElementLinearSmallStrainFEMForceField >() + .add< ElementLinearSmallStrainFEMForceField >() + .add< ElementLinearSmallStrainFEMForceField >() + .add< ElementLinearSmallStrainFEMForceField >() + ); } template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.h b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.h index 853867ff38e..456142fe527 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.h +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.h @@ -45,23 +45,8 @@ class ElementLinearSmallStrainFEMForceField : SOFA_TEMPLATE2(BaseElementLinearFEMForceField, DataTypes, ElementType), SOFA_TEMPLATE2(FEMForceField, DataTypes, ElementType)); - /** - * The purpose of this function is to register the name of this class according to the provided - * pattern. - * - * Example: ElementLinearSmallStrainFEMForceField will produce - * the class name "EdgeLinearSmallStrainFEMForceField". - */ - static const std::string GetCustomClassName() - { - return std::string(sofa::geometry::elementTypeToString(ElementType::Element_type)) + - "LinearSmallStrainFEMForceField"; - } - - static const std::string GetCustomTemplateName() { return DataTypes::Name(); } - private: - using trait = sofa::component::solidmechanics::fem::elastic::trait; + using trait = typename FEMForceField::trait; using ElementHessian = typename trait::ElementHessian; using ElementDisplacement = typename trait::ElementDisplacement; using StrainDisplacement = typename trait::StrainDisplacement; diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/FEMForceField.h b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/FEMForceField.h index 1c2519ee348..a0a718527e3 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/FEMForceField.h +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/FEMForceField.h @@ -48,7 +48,7 @@ class FEMForceField : sofa::core::behavior::TopologyAccessor, sofa::simulation::TaskSchedulerUser); -private: +protected: using trait = sofa::component::solidmechanics::fem::elastic::trait; using ElementGradient = typename trait::ElementGradient; diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/FEMForceField.inl b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/FEMForceField.inl index a1e60d07744..44d6dc85e07 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/FEMForceField.inl +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/FEMForceField.inl @@ -163,6 +163,7 @@ void FEMForceField::computeElementsForcesDeriv( const sofa::VecDeriv_t& dx) { SCOPED_TIMER("ElementForcesDeriv"); + beforeElementForceDeriv(mparams); this->beforeElementForceDeriv(mparams); diff --git a/examples/Validation/cantilever_beam/hexahedron/corotational/parallel/assembled/HexahedronCorotationalFEMForceField.scn b/examples/Validation/cantilever_beam/hexahedron/corotational/parallel/assembled/HexahedronCorotationalFEMForceField.scn index ffc08f685ae..fe245080f86 100644 --- a/examples/Validation/cantilever_beam/hexahedron/corotational/parallel/assembled/HexahedronCorotationalFEMForceField.scn +++ b/examples/Validation/cantilever_beam/hexahedron/corotational/parallel/assembled/HexahedronCorotationalFEMForceField.scn @@ -6,7 +6,8 @@ - + diff --git a/examples/Validation/cantilever_beam/hexahedron/corotational/parallel/matrixfree/HexahedronCorotationalFEMForceField.scn b/examples/Validation/cantilever_beam/hexahedron/corotational/parallel/matrixfree/HexahedronCorotationalFEMForceField.scn index c48bc2ef0b2..5132bedec93 100644 --- a/examples/Validation/cantilever_beam/hexahedron/corotational/parallel/matrixfree/HexahedronCorotationalFEMForceField.scn +++ b/examples/Validation/cantilever_beam/hexahedron/corotational/parallel/matrixfree/HexahedronCorotationalFEMForceField.scn @@ -4,7 +4,8 @@ - + diff --git a/examples/Validation/cantilever_beam/hexahedron/corotational/sequential/assembled/HexahedronCorotationalFEMForceField.scn b/examples/Validation/cantilever_beam/hexahedron/corotational/sequential/assembled/HexahedronCorotationalFEMForceField.scn index c1e3f1439de..690ef79063d 100644 --- a/examples/Validation/cantilever_beam/hexahedron/corotational/sequential/assembled/HexahedronCorotationalFEMForceField.scn +++ b/examples/Validation/cantilever_beam/hexahedron/corotational/sequential/assembled/HexahedronCorotationalFEMForceField.scn @@ -6,7 +6,8 @@ - + diff --git a/examples/Validation/cantilever_beam/hexahedron/corotational/sequential/matrixfree/HexahedronCorotationalFEMForceField.scn b/examples/Validation/cantilever_beam/hexahedron/corotational/sequential/matrixfree/HexahedronCorotationalFEMForceField.scn index ecbac27b125..6e81a7a9359 100644 --- a/examples/Validation/cantilever_beam/hexahedron/corotational/sequential/matrixfree/HexahedronCorotationalFEMForceField.scn +++ b/examples/Validation/cantilever_beam/hexahedron/corotational/sequential/matrixfree/HexahedronCorotationalFEMForceField.scn @@ -4,7 +4,8 @@ - + diff --git a/examples/Validation/cantilever_beam/hexahedron/linear/parallel/assembled/HexahedronLinearSmallStrainFEMForceField.scn b/examples/Validation/cantilever_beam/hexahedron/linear/parallel/assembled/HexahedronLinearSmallStrainFEMForceField.scn index 3a4a4a8f0c4..5895dacbf91 100644 --- a/examples/Validation/cantilever_beam/hexahedron/linear/parallel/assembled/HexahedronLinearSmallStrainFEMForceField.scn +++ b/examples/Validation/cantilever_beam/hexahedron/linear/parallel/assembled/HexahedronLinearSmallStrainFEMForceField.scn @@ -6,7 +6,8 @@ - + diff --git a/examples/Validation/cantilever_beam/hexahedron/linear/parallel/matrixfree/HexahedronLinearSmallStrainFEMForceField.scn b/examples/Validation/cantilever_beam/hexahedron/linear/parallel/matrixfree/HexahedronLinearSmallStrainFEMForceField.scn index 3af7b73e10e..b170bcc1fad 100644 --- a/examples/Validation/cantilever_beam/hexahedron/linear/parallel/matrixfree/HexahedronLinearSmallStrainFEMForceField.scn +++ b/examples/Validation/cantilever_beam/hexahedron/linear/parallel/matrixfree/HexahedronLinearSmallStrainFEMForceField.scn @@ -4,7 +4,8 @@ - + diff --git a/examples/Validation/cantilever_beam/hexahedron/linear/sequential/assembled/HexahedronLinearSmallStrainFEMForceField.scn b/examples/Validation/cantilever_beam/hexahedron/linear/sequential/assembled/HexahedronLinearSmallStrainFEMForceField.scn index a53c81fb0c3..0eab370dfc8 100644 --- a/examples/Validation/cantilever_beam/hexahedron/linear/sequential/assembled/HexahedronLinearSmallStrainFEMForceField.scn +++ b/examples/Validation/cantilever_beam/hexahedron/linear/sequential/assembled/HexahedronLinearSmallStrainFEMForceField.scn @@ -6,7 +6,8 @@ - + diff --git a/examples/Validation/cantilever_beam/hexahedron/linear/sequential/matrixfree/HexahedronLinearSmallStrainFEMForceField.scn b/examples/Validation/cantilever_beam/hexahedron/linear/sequential/matrixfree/HexahedronLinearSmallStrainFEMForceField.scn index 599d7db5dfb..18a76a8c91b 100644 --- a/examples/Validation/cantilever_beam/hexahedron/linear/sequential/matrixfree/HexahedronLinearSmallStrainFEMForceField.scn +++ b/examples/Validation/cantilever_beam/hexahedron/linear/sequential/matrixfree/HexahedronLinearSmallStrainFEMForceField.scn @@ -4,7 +4,8 @@ - + diff --git a/examples/Validation/cantilever_beam/tetrahedron/corotational/parallel/assembled/TetrahedronCorotationalFEMForceField.scn b/examples/Validation/cantilever_beam/tetrahedron/corotational/parallel/assembled/TetrahedronCorotationalFEMForceField.scn index 98a1c55cc9a..603cb2252e8 100644 --- a/examples/Validation/cantilever_beam/tetrahedron/corotational/parallel/assembled/TetrahedronCorotationalFEMForceField.scn +++ b/examples/Validation/cantilever_beam/tetrahedron/corotational/parallel/assembled/TetrahedronCorotationalFEMForceField.scn @@ -12,7 +12,8 @@ - diff --git a/examples/Validation/cantilever_beam/tetrahedron/corotational/parallel/matrixfree/TetrahedronCorotationalFEMForceField.scn b/examples/Validation/cantilever_beam/tetrahedron/corotational/parallel/matrixfree/TetrahedronCorotationalFEMForceField.scn index a5c6983f2fc..3c089fe1530 100644 --- a/examples/Validation/cantilever_beam/tetrahedron/corotational/parallel/matrixfree/TetrahedronCorotationalFEMForceField.scn +++ b/examples/Validation/cantilever_beam/tetrahedron/corotational/parallel/matrixfree/TetrahedronCorotationalFEMForceField.scn @@ -10,8 +10,9 @@ - + diff --git a/examples/Validation/cantilever_beam/tetrahedron/corotational/sequential/assembled/TetrahedronCorotationalFEMForceField.scn b/examples/Validation/cantilever_beam/tetrahedron/corotational/sequential/assembled/TetrahedronCorotationalFEMForceField.scn index 49d2891903e..3d034353b0d 100644 --- a/examples/Validation/cantilever_beam/tetrahedron/corotational/sequential/assembled/TetrahedronCorotationalFEMForceField.scn +++ b/examples/Validation/cantilever_beam/tetrahedron/corotational/sequential/assembled/TetrahedronCorotationalFEMForceField.scn @@ -12,8 +12,9 @@ - + diff --git a/examples/Validation/cantilever_beam/tetrahedron/corotational/sequential/matrixfree/TetrahedronCorotationalFEMForceField.scn b/examples/Validation/cantilever_beam/tetrahedron/corotational/sequential/matrixfree/TetrahedronCorotationalFEMForceField.scn index dffc83cd146..0198ae6e6c1 100644 --- a/examples/Validation/cantilever_beam/tetrahedron/corotational/sequential/matrixfree/TetrahedronCorotationalFEMForceField.scn +++ b/examples/Validation/cantilever_beam/tetrahedron/corotational/sequential/matrixfree/TetrahedronCorotationalFEMForceField.scn @@ -10,8 +10,9 @@ - + diff --git a/examples/Validation/cantilever_beam/tetrahedron/linear/parallel/assembled/TetrahedronLinearSmallStrainFEMForceField.scn b/examples/Validation/cantilever_beam/tetrahedron/linear/parallel/assembled/TetrahedronLinearSmallStrainFEMForceField.scn index 385d58095e4..52c91d8c6f4 100644 --- a/examples/Validation/cantilever_beam/tetrahedron/linear/parallel/assembled/TetrahedronLinearSmallStrainFEMForceField.scn +++ b/examples/Validation/cantilever_beam/tetrahedron/linear/parallel/assembled/TetrahedronLinearSmallStrainFEMForceField.scn @@ -12,8 +12,9 @@ - + diff --git a/examples/Validation/cantilever_beam/tetrahedron/linear/parallel/matrixfree/TetrahedronLinearSmallStrainFEMForceField.scn b/examples/Validation/cantilever_beam/tetrahedron/linear/parallel/matrixfree/TetrahedronLinearSmallStrainFEMForceField.scn index 92eed6a9101..e4f0da75eba 100644 --- a/examples/Validation/cantilever_beam/tetrahedron/linear/parallel/matrixfree/TetrahedronLinearSmallStrainFEMForceField.scn +++ b/examples/Validation/cantilever_beam/tetrahedron/linear/parallel/matrixfree/TetrahedronLinearSmallStrainFEMForceField.scn @@ -10,8 +10,9 @@ - + diff --git a/examples/Validation/cantilever_beam/tetrahedron/linear/sequential/assembled/TetrahedronLinearSmallStrainFEMForceField.scn b/examples/Validation/cantilever_beam/tetrahedron/linear/sequential/assembled/TetrahedronLinearSmallStrainFEMForceField.scn index 2830d933059..eaaa5d32a54 100644 --- a/examples/Validation/cantilever_beam/tetrahedron/linear/sequential/assembled/TetrahedronLinearSmallStrainFEMForceField.scn +++ b/examples/Validation/cantilever_beam/tetrahedron/linear/sequential/assembled/TetrahedronLinearSmallStrainFEMForceField.scn @@ -12,8 +12,9 @@ - + diff --git a/examples/Validation/cantilever_beam/tetrahedron/linear/sequential/matrixfree/TetrahedronLinearSmallStrainFEMForceField.scn b/examples/Validation/cantilever_beam/tetrahedron/linear/sequential/matrixfree/TetrahedronLinearSmallStrainFEMForceField.scn index 1967c27ef34..40ba7eff557 100644 --- a/examples/Validation/cantilever_beam/tetrahedron/linear/sequential/matrixfree/TetrahedronLinearSmallStrainFEMForceField.scn +++ b/examples/Validation/cantilever_beam/tetrahedron/linear/sequential/matrixfree/TetrahedronLinearSmallStrainFEMForceField.scn @@ -10,8 +10,9 @@ - + From a0e99ccfe039ec78890baadccddc1a47704f808d Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Thu, 28 May 2026 09:16:05 +0200 Subject: [PATCH 02/12] Refactor also the mass --- .../sofa/component/mass/ElementFEMMass.cpp | 25 ++++++------------- .../src/sofa/component/mass/ElementFEMMass.h | 18 ------------- .../Mapping/Hexa2PrismTopologicalMapping.scn | 2 +- 3 files changed, 9 insertions(+), 36 deletions(-) diff --git a/Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.cpp b/Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.cpp index e2c0f520e30..947400539e6 100644 --- a/Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.cpp +++ b/Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.cpp @@ -41,27 +41,18 @@ template class SOFA_COMPONENT_MASS_API ElementFEMMassregisterObjects(sofa::core::ObjectRegistrationData("Finite-element mass (inertia and body force) defined on edges") + factory->registerObjects(sofa::core::ObjectRegistrationData("Finite-element mass (inertia and body force)") .add< ElementFEMMass >() .add< ElementFEMMass >() - .add< ElementFEMMass >(true)); - - factory->registerObjects(sofa::core::ObjectRegistrationData("Finite-element mass (inertia and body force) defined on triangles") + .add< ElementFEMMass >() .add< ElementFEMMass >() - .add< ElementFEMMass >(true)); - - factory->registerObjects(sofa::core::ObjectRegistrationData("Finite-element mass (inertia and body force) defined on quads") + .add< ElementFEMMass >() .add< ElementFEMMass >() - .add< ElementFEMMass >(true)); - - factory->registerObjects(sofa::core::ObjectRegistrationData("Finite-element mass (inertia and body force) defined on tetrahedra") - .add< ElementFEMMass >(true)); - - factory->registerObjects(sofa::core::ObjectRegistrationData("Finite-element mass (inertia and body force) defined on hexahedra") - .add< ElementFEMMass >(true)); - - factory->registerObjects(sofa::core::ObjectRegistrationData("Finite-element mass (inertia and body force) defined on prisms") - .add< ElementFEMMass >(true)); + .add< ElementFEMMass >() + .add< ElementFEMMass >() + .add< ElementFEMMass >() + .add< ElementFEMMass >() + ); } } diff --git a/Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.h b/Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.h index f390189c375..71ae68345d6 100644 --- a/Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.h +++ b/Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.h @@ -80,24 +80,6 @@ class ElementFEMMass : public: - /** - * @brief Gets the class name according to the provided template parameters. - * - * For example, `ElementFEMMass` will return "EdgeFEMMass". - * - * @return A string representing the class name. - */ - static const std::string GetCustomClassName() - { - return std::string(sofa::geometry::elementTypeToString(ElementType::Element_type)) + "FEMMass"; - } - - /** - * @brief Gets the template name based on the data types. - * @return A string representing the template name (e.g., "Vec3d"). - */ - static const std::string GetCustomTemplateName() { return DataTypes::Name(); } - /** * @brief Link to the nodal mass density component. * diff --git a/examples/Component/Topology/Mapping/Hexa2PrismTopologicalMapping.scn b/examples/Component/Topology/Mapping/Hexa2PrismTopologicalMapping.scn index c2867de54c2..f94d1b1185b 100644 --- a/examples/Component/Topology/Mapping/Hexa2PrismTopologicalMapping.scn +++ b/examples/Component/Topology/Mapping/Hexa2PrismTopologicalMapping.scn @@ -37,7 +37,7 @@ rotationMethod="polar" computeForceStrategy="sequenced" computeForceDerivStrategy="sequenced"/> - + From a10c01c150be6b7deebd99962331830995ebf19b Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Fri, 5 Jun 2026 08:29:35 +0200 Subject: [PATCH 03/12] rename ElementCorotationalFEMForceField to CorotationalFEMForceField --- .../SolidMechanics/FEM/Elastic/CMakeLists.txt | 6 +- .../fem/elastic/CorotationalFEMForceField.cpp | 59 +++++++++++++++++++ ...rceField.h => CorotationalFEMForceField.h} | 28 ++++----- ...ield.inl => CorotationalFEMForceField.inl} | 24 ++++---- .../ElementCorotationalFEMForceField.cpp | 59 ------------------- .../solidmechanics/fem/elastic/init.cpp | 4 +- .../HexahedronCorotationalFEMForceField.scn | 2 +- .../HexahedronCorotationalFEMForceField.scn | 2 +- .../HexahedronCorotationalFEMForceField.scn | 2 +- .../HexahedronCorotationalFEMForceField.scn | 2 +- .../TetrahedronCorotationalFEMForceField.scn | 2 +- .../TetrahedronCorotationalFEMForceField.scn | 2 +- .../TetrahedronCorotationalFEMForceField.scn | 2 +- .../TetrahedronCorotationalFEMForceField.scn | 2 +- 14 files changed, 98 insertions(+), 98 deletions(-) create mode 100644 Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/CorotationalFEMForceField.cpp rename Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/{ElementCorotationalFEMForceField.h => CorotationalFEMForceField.h} (88%) rename Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/{ElementCorotationalFEMForceField.inl => CorotationalFEMForceField.inl} (91%) delete mode 100644 Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.cpp diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/CMakeLists.txt b/Sofa/Component/SolidMechanics/FEM/Elastic/CMakeLists.txt index 2e090b63ebb..ff8e89af2be 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/CMakeLists.txt +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/CMakeLists.txt @@ -13,8 +13,8 @@ set(HEADER_FILES ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/BaseLinearElasticityFEMForceField.inl ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/BeamFEMForceField.h ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/BeamFEMForceField.inl - ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/ElementCorotationalFEMForceField.h - ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/ElementCorotationalFEMForceField.inl + ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/CorotationalFEMForceField.h + ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/CorotationalFEMForceField.inl ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/ElementLinearSmallStrainFEMForceField.h ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/ElementLinearSmallStrainFEMForceField.inl ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/FastTetrahedralCorotationalForceField.h @@ -68,7 +68,7 @@ set(SOURCE_FILES ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/BaseElementLinearFEMForceField.cpp ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/BaseLinearElasticityFEMForceField.cpp ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/BeamFEMForceField.cpp - ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/ElementCorotationalFEMForceField.cpp + ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/CorotationalFEMForceField.cpp ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/ElementLinearSmallStrainFEMForceField.cpp ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/FastTetrahedralCorotationalForceField.cpp ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/FEMForceField.cpp diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/CorotationalFEMForceField.cpp b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/CorotationalFEMForceField.cpp new file mode 100644 index 00000000000..efd7c5d6bca --- /dev/null +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/CorotationalFEMForceField.cpp @@ -0,0 +1,59 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture * +* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * +* * +* This program is free software; you can redistribute it and/or modify it * +* under the terms of the GNU Lesser General Public License as published by * +* the Free Software Foundation; either version 2.1 of the License, or (at * +* your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, but WITHOUT * +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * +* for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with this program. If not, see . * +******************************************************************************* +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#define SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_COROTATIONAL_FEM_FORCE_FIELD_CPP + +#include + +#include +#include + +namespace sofa::component::solidmechanics::fem::elastic +{ + +void registerCorotationalFEMForceField(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law using the corotational approach") + // .add< CorotationalFEMForceField >() + .add< CorotationalFEMForceField >() + .add< CorotationalFEMForceField >() + .add< CorotationalFEMForceField >() + .add< CorotationalFEMForceField >() + .add< CorotationalFEMForceField >() + .add< CorotationalFEMForceField >() + .add< CorotationalFEMForceField >() + .add< CorotationalFEMForceField >() + .add< CorotationalFEMForceField >() + ); +} + +// template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; + +} diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.h b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/CorotationalFEMForceField.h similarity index 88% rename from Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.h rename to Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/CorotationalFEMForceField.h index df07d0d87e8..720fc68bb02 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.h +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/CorotationalFEMForceField.h @@ -111,13 +111,13 @@ struct RotationMethods : RotationMethodsC template -class ElementCorotationalFEMForceField : +class CorotationalFEMForceField : public BaseElementLinearFEMForceField, public FEMForceField { public: SOFA_CLASS2( - SOFA_TEMPLATE2(ElementCorotationalFEMForceField, DataTypes, ElementType), + SOFA_TEMPLATE2(CorotationalFEMForceField, DataTypes, ElementType), SOFA_TEMPLATE2(BaseElementLinearFEMForceField, DataTypes, ElementType), SOFA_TEMPLATE2(FEMForceField, DataTypes, ElementType)); @@ -129,7 +129,7 @@ class ElementCorotationalFEMForceField : public: - ElementCorotationalFEMForceField(); + CorotationalFEMForceField(); void init() override; @@ -174,17 +174,17 @@ class ElementCorotationalFEMForceField : -#if !defined(ELASTICITY_COMPONENT_ELEMENT_COROTATIONAL_FEM_FORCE_FIELD_CPP) -// extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; +#if !defined(SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_COROTATIONAL_FEM_FORCE_FIELD_CPP) +// extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; #endif } // namespace sofa::component::solidmechanics::fem::elastic diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.inl b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/CorotationalFEMForceField.inl similarity index 91% rename from Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.inl rename to Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/CorotationalFEMForceField.inl index e32ca8daa01..2e9dbe20c50 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.inl +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/CorotationalFEMForceField.inl @@ -20,7 +20,7 @@ * Contact information: contact@sofa-framework.org * ******************************************************************************/ #pragma once -#include +#include #include #include @@ -31,7 +31,7 @@ namespace sofa::component::solidmechanics::fem::elastic { template -ElementCorotationalFEMForceField::ElementCorotationalFEMForceField() +CorotationalFEMForceField::CorotationalFEMForceField() : m_rotationMethods(this) { this->addUpdateCallback("selectRotationMethod", {&this->m_rotationMethods.d_rotationMethod}, @@ -47,7 +47,7 @@ ElementCorotationalFEMForceField::ElementCorotationalFEM } template -void ElementCorotationalFEMForceField::init() +void CorotationalFEMForceField::init() { BaseElementLinearFEMForceField::init(); FEMForceField::init(); @@ -70,7 +70,7 @@ void ElementCorotationalFEMForceField::init() } template -void ElementCorotationalFEMForceField::beforeElementForce( +void CorotationalFEMForceField::beforeElementForce( const sofa::core::MechanicalParams* mparams, sofa::type::vector& f, const sofa::VecCoord_t& x) { @@ -79,7 +79,7 @@ void ElementCorotationalFEMForceField::beforeElementForc } template -void ElementCorotationalFEMForceField::computeElementsForces( +void CorotationalFEMForceField::computeElementsForces( const sofa::simulation::Range& range, const sofa::core::MechanicalParams* mparams, sofa::type::vector& elementForces, const sofa::VecCoord_t& nodePositions) { @@ -128,7 +128,7 @@ void ElementCorotationalFEMForceField::computeElementsFo template -void ElementCorotationalFEMForceField::computeElementsForcesDeriv( +void CorotationalFEMForceField::computeElementsForcesDeriv( const sofa::simulation::Range& range, const sofa::core::MechanicalParams* mparams, sofa::type::vector& elementForcesDeriv, @@ -165,7 +165,7 @@ void ElementCorotationalFEMForceField::computeElementsFo } template -void ElementCorotationalFEMForceField::buildStiffnessMatrix( +void CorotationalFEMForceField::buildStiffnessMatrix( sofa::core::behavior::StiffnessMatrix* matrix) { auto dfdx = matrix->getForceDerivativeIn(this->sofa::core::behavior::ForceField::mstate) @@ -202,7 +202,7 @@ void ElementCorotationalFEMForceField::buildStiffnessMat } template -SReal ElementCorotationalFEMForceField::getPotentialEnergy( +SReal CorotationalFEMForceField::getPotentialEnergy( const sofa::core::MechanicalParams*, const sofa::DataVecCoord_t& x) const { @@ -210,7 +210,7 @@ SReal ElementCorotationalFEMForceField::getPotentialEner } template -auto ElementCorotationalFEMForceField::translation( +auto CorotationalFEMForceField::translation( const std::array, trait::NumberOfNodesInElement>& nodes) const -> sofa::Coord_t { // return nodes[0]; @@ -218,7 +218,7 @@ auto ElementCorotationalFEMForceField::translation( } template -auto ElementCorotationalFEMForceField::computeCentroid( +auto CorotationalFEMForceField::computeCentroid( const std::array, trait::NumberOfNodesInElement>& nodes) -> sofa::Coord_t { sofa::Coord_t centroid; @@ -231,7 +231,7 @@ auto ElementCorotationalFEMForceField::computeCentroid( } template -void ElementCorotationalFEMForceField::computeRotations( +void CorotationalFEMForceField::computeRotations( sofa::type::vector& rotations, const sofa::VecCoord_t& nodePositions, const sofa::VecCoord_t& nodeRestPositions) @@ -264,7 +264,7 @@ void ElementCorotationalFEMForceField::computeRotations( } template -void ElementCorotationalFEMForceField::computeInitialRotations() +void CorotationalFEMForceField::computeInitialRotations() { auto restPositionAccessor = this->sofa::core::behavior::ForceField::mstate->readRestPositions(); computeRotations(m_initialRotationsTransposed, restPositionAccessor.ref(), restPositionAccessor.ref()); diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.cpp b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.cpp deleted file mode 100644 index 52a14a6bf00..00000000000 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/****************************************************************************** -* SOFA, Simulation Open-Framework Architecture * -* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU Lesser General Public License as published by * -* the Free Software Foundation; either version 2.1 of the License, or (at * -* your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but WITHOUT * -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * -* for more details. * -* * -* You should have received a copy of the GNU Lesser General Public License * -* along with this program. If not, see . * -******************************************************************************* -* Authors: The SOFA Team and external contributors (see Authors.txt) * -* * -* Contact information: contact@sofa-framework.org * -******************************************************************************/ -#define ELASTICITY_COMPONENT_ELEMENT_COROTATIONAL_FEM_FORCE_FIELD_CPP - -#include - -#include -#include - -namespace sofa::component::solidmechanics::fem::elastic -{ - -void registerElementCorotationalFEMForceField(sofa::core::ObjectFactory* factory) -{ - factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law using the corotational approach") - // .add< ElementCorotationalFEMForceField >() - .add< ElementCorotationalFEMForceField >() - .add< ElementCorotationalFEMForceField >() - .add< ElementCorotationalFEMForceField >() - .add< ElementCorotationalFEMForceField >() - .add< ElementCorotationalFEMForceField >() - .add< ElementCorotationalFEMForceField >() - .add< ElementCorotationalFEMForceField >() - .add< ElementCorotationalFEMForceField >() - .add< ElementCorotationalFEMForceField >() - ); -} - -// template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; - -} diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/init.cpp b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/init.cpp index 343b296dbba..2cd823fc529 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/init.cpp +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/init.cpp @@ -27,7 +27,7 @@ namespace sofa::component::solidmechanics::fem::elastic { extern void registerBeamFEMForceField(sofa::core::ObjectFactory* factory); -extern void registerElementCorotationalFEMForceField(sofa::core::ObjectFactory* factory); +extern void registerCorotationalFEMForceField(sofa::core::ObjectFactory* factory); extern void registerElementLinearSmallStrainFEMForceField(sofa::core::ObjectFactory* factory); extern void registerFastTetrahedralCorotationalForceField(sofa::core::ObjectFactory* factory); extern void registerHexahedralFEMForceField(sofa::core::ObjectFactory* factory); @@ -67,7 +67,7 @@ const char* getModuleVersion() void registerObjects(sofa::core::ObjectFactory* factory) { registerBeamFEMForceField(factory); - registerElementCorotationalFEMForceField(factory); + registerCorotationalFEMForceField(factory); registerElementLinearSmallStrainFEMForceField(factory); registerFastTetrahedralCorotationalForceField(factory); registerHexahedralFEMForceField(factory); diff --git a/examples/Validation/cantilever_beam/hexahedron/corotational/parallel/assembled/HexahedronCorotationalFEMForceField.scn b/examples/Validation/cantilever_beam/hexahedron/corotational/parallel/assembled/HexahedronCorotationalFEMForceField.scn index fe245080f86..ab76ef3d14a 100644 --- a/examples/Validation/cantilever_beam/hexahedron/corotational/parallel/assembled/HexahedronCorotationalFEMForceField.scn +++ b/examples/Validation/cantilever_beam/hexahedron/corotational/parallel/assembled/HexahedronCorotationalFEMForceField.scn @@ -6,7 +6,7 @@ - diff --git a/examples/Validation/cantilever_beam/hexahedron/corotational/parallel/matrixfree/HexahedronCorotationalFEMForceField.scn b/examples/Validation/cantilever_beam/hexahedron/corotational/parallel/matrixfree/HexahedronCorotationalFEMForceField.scn index 5132bedec93..2fd8d92f467 100644 --- a/examples/Validation/cantilever_beam/hexahedron/corotational/parallel/matrixfree/HexahedronCorotationalFEMForceField.scn +++ b/examples/Validation/cantilever_beam/hexahedron/corotational/parallel/matrixfree/HexahedronCorotationalFEMForceField.scn @@ -4,7 +4,7 @@ - diff --git a/examples/Validation/cantilever_beam/hexahedron/corotational/sequential/assembled/HexahedronCorotationalFEMForceField.scn b/examples/Validation/cantilever_beam/hexahedron/corotational/sequential/assembled/HexahedronCorotationalFEMForceField.scn index 690ef79063d..15588cb4d05 100644 --- a/examples/Validation/cantilever_beam/hexahedron/corotational/sequential/assembled/HexahedronCorotationalFEMForceField.scn +++ b/examples/Validation/cantilever_beam/hexahedron/corotational/sequential/assembled/HexahedronCorotationalFEMForceField.scn @@ -6,7 +6,7 @@ - diff --git a/examples/Validation/cantilever_beam/hexahedron/corotational/sequential/matrixfree/HexahedronCorotationalFEMForceField.scn b/examples/Validation/cantilever_beam/hexahedron/corotational/sequential/matrixfree/HexahedronCorotationalFEMForceField.scn index 6e81a7a9359..c08a6908544 100644 --- a/examples/Validation/cantilever_beam/hexahedron/corotational/sequential/matrixfree/HexahedronCorotationalFEMForceField.scn +++ b/examples/Validation/cantilever_beam/hexahedron/corotational/sequential/matrixfree/HexahedronCorotationalFEMForceField.scn @@ -4,7 +4,7 @@ - diff --git a/examples/Validation/cantilever_beam/tetrahedron/corotational/parallel/assembled/TetrahedronCorotationalFEMForceField.scn b/examples/Validation/cantilever_beam/tetrahedron/corotational/parallel/assembled/TetrahedronCorotationalFEMForceField.scn index 603cb2252e8..800334cf4b8 100644 --- a/examples/Validation/cantilever_beam/tetrahedron/corotational/parallel/assembled/TetrahedronCorotationalFEMForceField.scn +++ b/examples/Validation/cantilever_beam/tetrahedron/corotational/parallel/assembled/TetrahedronCorotationalFEMForceField.scn @@ -12,7 +12,7 @@ - diff --git a/examples/Validation/cantilever_beam/tetrahedron/corotational/parallel/matrixfree/TetrahedronCorotationalFEMForceField.scn b/examples/Validation/cantilever_beam/tetrahedron/corotational/parallel/matrixfree/TetrahedronCorotationalFEMForceField.scn index 3c089fe1530..6c7473a988d 100644 --- a/examples/Validation/cantilever_beam/tetrahedron/corotational/parallel/matrixfree/TetrahedronCorotationalFEMForceField.scn +++ b/examples/Validation/cantilever_beam/tetrahedron/corotational/parallel/matrixfree/TetrahedronCorotationalFEMForceField.scn @@ -10,7 +10,7 @@ - diff --git a/examples/Validation/cantilever_beam/tetrahedron/corotational/sequential/assembled/TetrahedronCorotationalFEMForceField.scn b/examples/Validation/cantilever_beam/tetrahedron/corotational/sequential/assembled/TetrahedronCorotationalFEMForceField.scn index 3d034353b0d..9cacdee3bc1 100644 --- a/examples/Validation/cantilever_beam/tetrahedron/corotational/sequential/assembled/TetrahedronCorotationalFEMForceField.scn +++ b/examples/Validation/cantilever_beam/tetrahedron/corotational/sequential/assembled/TetrahedronCorotationalFEMForceField.scn @@ -12,7 +12,7 @@ - diff --git a/examples/Validation/cantilever_beam/tetrahedron/corotational/sequential/matrixfree/TetrahedronCorotationalFEMForceField.scn b/examples/Validation/cantilever_beam/tetrahedron/corotational/sequential/matrixfree/TetrahedronCorotationalFEMForceField.scn index 0198ae6e6c1..219ca285d73 100644 --- a/examples/Validation/cantilever_beam/tetrahedron/corotational/sequential/matrixfree/TetrahedronCorotationalFEMForceField.scn +++ b/examples/Validation/cantilever_beam/tetrahedron/corotational/sequential/matrixfree/TetrahedronCorotationalFEMForceField.scn @@ -10,7 +10,7 @@ - From 630c589a4a15fe67c3a1877874a32de20f30cc81 Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Fri, 5 Jun 2026 08:38:57 +0200 Subject: [PATCH 04/12] rename ElementLinearSmallStrainFEMForceField to LinearSmallStrainFEMForceField --- .../SolidMechanics/FEM/Elastic/CMakeLists.txt | 6 +- .../ElementLinearSmallStrainFEMForceField.cpp | 59 ------------------- .../LinearSmallStrainFEMForceField.cpp | 59 +++++++++++++++++++ ...eld.h => LinearSmallStrainFEMForceField.h} | 26 ++++---- ...inl => LinearSmallStrainFEMForceField.inl} | 14 ++--- .../solidmechanics/fem/elastic/init.cpp | 4 +- ...xahedronLinearSmallStrainFEMForceField.scn | 2 +- ...xahedronLinearSmallStrainFEMForceField.scn | 2 +- ...xahedronLinearSmallStrainFEMForceField.scn | 2 +- ...xahedronLinearSmallStrainFEMForceField.scn | 2 +- ...rahedronLinearSmallStrainFEMForceField.scn | 2 +- ...rahedronLinearSmallStrainFEMForceField.scn | 2 +- ...rahedronLinearSmallStrainFEMForceField.scn | 2 +- ...rahedronLinearSmallStrainFEMForceField.scn | 2 +- 14 files changed, 92 insertions(+), 92 deletions(-) delete mode 100644 Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.cpp create mode 100644 Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/LinearSmallStrainFEMForceField.cpp rename Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/{ElementLinearSmallStrainFEMForceField.h => LinearSmallStrainFEMForceField.h} (79%) rename Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/{ElementLinearSmallStrainFEMForceField.inl => LinearSmallStrainFEMForceField.inl} (92%) diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/CMakeLists.txt b/Sofa/Component/SolidMechanics/FEM/Elastic/CMakeLists.txt index ff8e89af2be..fddd6033a0d 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/CMakeLists.txt +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/CMakeLists.txt @@ -15,8 +15,8 @@ set(HEADER_FILES ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/BeamFEMForceField.inl ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/CorotationalFEMForceField.h ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/CorotationalFEMForceField.inl - ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/ElementLinearSmallStrainFEMForceField.h - ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/ElementLinearSmallStrainFEMForceField.inl + ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/LinearSmallStrainFEMForceField.h + ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/LinearSmallStrainFEMForceField.inl ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/FastTetrahedralCorotationalForceField.h ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/FastTetrahedralCorotationalForceField.inl ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/FEMForceField.h @@ -69,7 +69,7 @@ set(SOURCE_FILES ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/BaseLinearElasticityFEMForceField.cpp ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/BeamFEMForceField.cpp ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/CorotationalFEMForceField.cpp - ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/ElementLinearSmallStrainFEMForceField.cpp + ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/LinearSmallStrainFEMForceField.cpp ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/FastTetrahedralCorotationalForceField.cpp ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/FEMForceField.cpp ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/HexahedralFEMForceField.cpp diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.cpp b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.cpp deleted file mode 100644 index 2d6cc35ecec..00000000000 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/****************************************************************************** -* SOFA, Simulation Open-Framework Architecture * -* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU Lesser General Public License as published by * -* the Free Software Foundation; either version 2.1 of the License, or (at * -* your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but WITHOUT * -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * -* for more details. * -* * -* You should have received a copy of the GNU Lesser General Public License * -* along with this program. If not, see . * -******************************************************************************* -* Authors: The SOFA Team and external contributors (see Authors.txt) * -* * -* Contact information: contact@sofa-framework.org * -******************************************************************************/ -#define ELASTICITY_COMPONENT_ELEMENT_LINEAR_SMALL_STRAIN_FEM_FORCE_FIELD_CPP - -#include - -#include -#include - -namespace sofa::component::solidmechanics::fem::elastic -{ - -void registerElementLinearSmallStrainFEMForceField(sofa::core::ObjectFactory* factory) -{ - factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law assuming small strain") - .add< ElementLinearSmallStrainFEMForceField >() - .add< ElementLinearSmallStrainFEMForceField >() - .add< ElementLinearSmallStrainFEMForceField >() - .add< ElementLinearSmallStrainFEMForceField >() - .add< ElementLinearSmallStrainFEMForceField >() - .add< ElementLinearSmallStrainFEMForceField >() - .add< ElementLinearSmallStrainFEMForceField >() - .add< ElementLinearSmallStrainFEMForceField >() - .add< ElementLinearSmallStrainFEMForceField >() - .add< ElementLinearSmallStrainFEMForceField >() - ); -} - -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; - -} diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/LinearSmallStrainFEMForceField.cpp b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/LinearSmallStrainFEMForceField.cpp new file mode 100644 index 00000000000..52a1eb9a6e2 --- /dev/null +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/LinearSmallStrainFEMForceField.cpp @@ -0,0 +1,59 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture * +* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * +* * +* This program is free software; you can redistribute it and/or modify it * +* under the terms of the GNU Lesser General Public License as published by * +* the Free Software Foundation; either version 2.1 of the License, or (at * +* your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, but WITHOUT * +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * +* for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with this program. If not, see . * +******************************************************************************* +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#define SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_LINEAR_SMALL_STRAIN_FEM_FORCE_FIELD_CPP + +#include + +#include +#include + +namespace sofa::component::solidmechanics::fem::elastic +{ + +void registerLinearSmallStrainFEMForceField(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law assuming small strain") + .add< LinearSmallStrainFEMForceField >() + .add< LinearSmallStrainFEMForceField >() + .add< LinearSmallStrainFEMForceField >() + .add< LinearSmallStrainFEMForceField >() + .add< LinearSmallStrainFEMForceField >() + .add< LinearSmallStrainFEMForceField >() + .add< LinearSmallStrainFEMForceField >() + .add< LinearSmallStrainFEMForceField >() + .add< LinearSmallStrainFEMForceField >() + .add< LinearSmallStrainFEMForceField >() + ); +} + +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; + +} diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.h b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/LinearSmallStrainFEMForceField.h similarity index 79% rename from Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.h rename to Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/LinearSmallStrainFEMForceField.h index 456142fe527..cc48d5787e8 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.h +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/LinearSmallStrainFEMForceField.h @@ -35,13 +35,13 @@ namespace sofa::component::solidmechanics::fem::elastic { template -class ElementLinearSmallStrainFEMForceField : +class LinearSmallStrainFEMForceField : public BaseElementLinearFEMForceField, public FEMForceField { public: SOFA_CLASS2( - SOFA_TEMPLATE2(ElementLinearSmallStrainFEMForceField, DataTypes, ElementType), + SOFA_TEMPLATE2(LinearSmallStrainFEMForceField, DataTypes, ElementType), SOFA_TEMPLATE2(BaseElementLinearFEMForceField, DataTypes, ElementType), SOFA_TEMPLATE2(FEMForceField, DataTypes, ElementType)); @@ -81,17 +81,17 @@ class ElementLinearSmallStrainFEMForceField : }; -#if !defined(ELASTICITY_COMPONENT_ELEMENT_LINEAR_SMALL_STRAIN_FEM_FORCE_FIELD_CPP) -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; +#if !defined(SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_LINEAR_SMALL_STRAIN_FEM_FORCE_FIELD_CPP) +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; #endif } // namespace sofa::component::solidmechanics::fem::elastic diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.inl b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/LinearSmallStrainFEMForceField.inl similarity index 92% rename from Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.inl rename to Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/LinearSmallStrainFEMForceField.inl index 8967dc3d4a2..6fea5667a99 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.inl +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/LinearSmallStrainFEMForceField.inl @@ -20,7 +20,7 @@ * Contact information: contact@sofa-framework.org * ******************************************************************************/ #pragma once -#include +#include #include #include @@ -28,7 +28,7 @@ namespace sofa::component::solidmechanics::fem::elastic { template -void ElementLinearSmallStrainFEMForceField::init() +void LinearSmallStrainFEMForceField::init() { BaseElementLinearFEMForceField::init(); FEMForceField::init(); @@ -41,7 +41,7 @@ void ElementLinearSmallStrainFEMForceField::init() template -void ElementLinearSmallStrainFEMForceField::computeElementsForces( +void LinearSmallStrainFEMForceField::computeElementsForces( const sofa::simulation::Range& range, const sofa::core::MechanicalParams* mparams, sofa::type::vector& elementForces, @@ -72,7 +72,7 @@ void ElementLinearSmallStrainFEMForceField::computeEleme } template -void ElementLinearSmallStrainFEMForceField::computeElementsForcesDeriv( +void LinearSmallStrainFEMForceField::computeElementsForcesDeriv( const sofa::simulation::Range& range, const sofa::core::MechanicalParams* mparams, sofa::type::vector& elementForcesDeriv, @@ -104,7 +104,7 @@ void ElementLinearSmallStrainFEMForceField::computeEleme } template -void ElementLinearSmallStrainFEMForceField::buildStiffnessMatrix( +void LinearSmallStrainFEMForceField::buildStiffnessMatrix( sofa::core::behavior::StiffnessMatrix* matrix) { if (this->isComponentStateInvalid()) @@ -141,7 +141,7 @@ void ElementLinearSmallStrainFEMForceField::buildStiffne } template -SReal ElementLinearSmallStrainFEMForceField::getPotentialEnergy( +SReal LinearSmallStrainFEMForceField::getPotentialEnergy( const sofa::core::MechanicalParams*, const sofa::DataVecCoord_t& x) const { @@ -149,7 +149,7 @@ SReal ElementLinearSmallStrainFEMForceField::getPotentia } template -void ElementLinearSmallStrainFEMForceField::addKToMatrix( +void LinearSmallStrainFEMForceField::addKToMatrix( sofa::linearalgebra::BaseMatrix* matrix, SReal kFact, unsigned& offset) { if (this->isComponentStateInvalid()) diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/init.cpp b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/init.cpp index 2cd823fc529..2c37e45f155 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/init.cpp +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/init.cpp @@ -28,12 +28,12 @@ namespace sofa::component::solidmechanics::fem::elastic extern void registerBeamFEMForceField(sofa::core::ObjectFactory* factory); extern void registerCorotationalFEMForceField(sofa::core::ObjectFactory* factory); -extern void registerElementLinearSmallStrainFEMForceField(sofa::core::ObjectFactory* factory); extern void registerFastTetrahedralCorotationalForceField(sofa::core::ObjectFactory* factory); extern void registerHexahedralFEMForceField(sofa::core::ObjectFactory* factory); extern void registerHexahedralFEMForceFieldAndMass(sofa::core::ObjectFactory* factory); extern void registerHexahedronFEMForceField(sofa::core::ObjectFactory* factory); extern void registerHexahedronFEMForceFieldAndMass(sofa::core::ObjectFactory* factory); +extern void registerLinearSmallStrainFEMForceField(sofa::core::ObjectFactory* factory); extern void registerQuadBendingFEMForceField(sofa::core::ObjectFactory* factory); extern void registerTetrahedralCorotationalFEMForceField(sofa::core::ObjectFactory* factory); extern void registerTetrahedronFEMForceField(sofa::core::ObjectFactory* factory); @@ -68,12 +68,12 @@ void registerObjects(sofa::core::ObjectFactory* factory) { registerBeamFEMForceField(factory); registerCorotationalFEMForceField(factory); - registerElementLinearSmallStrainFEMForceField(factory); registerFastTetrahedralCorotationalForceField(factory); registerHexahedralFEMForceField(factory); registerHexahedralFEMForceFieldAndMass(factory); registerHexahedronFEMForceField(factory); registerHexahedronFEMForceFieldAndMass(factory); + registerLinearSmallStrainFEMForceField(factory); registerQuadBendingFEMForceField(factory); registerTetrahedralCorotationalFEMForceField(factory); registerTetrahedronFEMForceField(factory); diff --git a/examples/Validation/cantilever_beam/hexahedron/linear/parallel/assembled/HexahedronLinearSmallStrainFEMForceField.scn b/examples/Validation/cantilever_beam/hexahedron/linear/parallel/assembled/HexahedronLinearSmallStrainFEMForceField.scn index 5895dacbf91..f248d50ec51 100644 --- a/examples/Validation/cantilever_beam/hexahedron/linear/parallel/assembled/HexahedronLinearSmallStrainFEMForceField.scn +++ b/examples/Validation/cantilever_beam/hexahedron/linear/parallel/assembled/HexahedronLinearSmallStrainFEMForceField.scn @@ -6,7 +6,7 @@ - diff --git a/examples/Validation/cantilever_beam/hexahedron/linear/parallel/matrixfree/HexahedronLinearSmallStrainFEMForceField.scn b/examples/Validation/cantilever_beam/hexahedron/linear/parallel/matrixfree/HexahedronLinearSmallStrainFEMForceField.scn index b170bcc1fad..1d1906ff28e 100644 --- a/examples/Validation/cantilever_beam/hexahedron/linear/parallel/matrixfree/HexahedronLinearSmallStrainFEMForceField.scn +++ b/examples/Validation/cantilever_beam/hexahedron/linear/parallel/matrixfree/HexahedronLinearSmallStrainFEMForceField.scn @@ -4,7 +4,7 @@ - diff --git a/examples/Validation/cantilever_beam/hexahedron/linear/sequential/assembled/HexahedronLinearSmallStrainFEMForceField.scn b/examples/Validation/cantilever_beam/hexahedron/linear/sequential/assembled/HexahedronLinearSmallStrainFEMForceField.scn index 0eab370dfc8..661c3d7ccb9 100644 --- a/examples/Validation/cantilever_beam/hexahedron/linear/sequential/assembled/HexahedronLinearSmallStrainFEMForceField.scn +++ b/examples/Validation/cantilever_beam/hexahedron/linear/sequential/assembled/HexahedronLinearSmallStrainFEMForceField.scn @@ -6,7 +6,7 @@ - diff --git a/examples/Validation/cantilever_beam/hexahedron/linear/sequential/matrixfree/HexahedronLinearSmallStrainFEMForceField.scn b/examples/Validation/cantilever_beam/hexahedron/linear/sequential/matrixfree/HexahedronLinearSmallStrainFEMForceField.scn index 18a76a8c91b..2cfec24cb83 100644 --- a/examples/Validation/cantilever_beam/hexahedron/linear/sequential/matrixfree/HexahedronLinearSmallStrainFEMForceField.scn +++ b/examples/Validation/cantilever_beam/hexahedron/linear/sequential/matrixfree/HexahedronLinearSmallStrainFEMForceField.scn @@ -4,7 +4,7 @@ - diff --git a/examples/Validation/cantilever_beam/tetrahedron/linear/parallel/assembled/TetrahedronLinearSmallStrainFEMForceField.scn b/examples/Validation/cantilever_beam/tetrahedron/linear/parallel/assembled/TetrahedronLinearSmallStrainFEMForceField.scn index 52c91d8c6f4..daa01ccb236 100644 --- a/examples/Validation/cantilever_beam/tetrahedron/linear/parallel/assembled/TetrahedronLinearSmallStrainFEMForceField.scn +++ b/examples/Validation/cantilever_beam/tetrahedron/linear/parallel/assembled/TetrahedronLinearSmallStrainFEMForceField.scn @@ -12,7 +12,7 @@ - diff --git a/examples/Validation/cantilever_beam/tetrahedron/linear/parallel/matrixfree/TetrahedronLinearSmallStrainFEMForceField.scn b/examples/Validation/cantilever_beam/tetrahedron/linear/parallel/matrixfree/TetrahedronLinearSmallStrainFEMForceField.scn index e4f0da75eba..56e8afd6cf0 100644 --- a/examples/Validation/cantilever_beam/tetrahedron/linear/parallel/matrixfree/TetrahedronLinearSmallStrainFEMForceField.scn +++ b/examples/Validation/cantilever_beam/tetrahedron/linear/parallel/matrixfree/TetrahedronLinearSmallStrainFEMForceField.scn @@ -10,7 +10,7 @@ - diff --git a/examples/Validation/cantilever_beam/tetrahedron/linear/sequential/assembled/TetrahedronLinearSmallStrainFEMForceField.scn b/examples/Validation/cantilever_beam/tetrahedron/linear/sequential/assembled/TetrahedronLinearSmallStrainFEMForceField.scn index eaaa5d32a54..c7e260d7a23 100644 --- a/examples/Validation/cantilever_beam/tetrahedron/linear/sequential/assembled/TetrahedronLinearSmallStrainFEMForceField.scn +++ b/examples/Validation/cantilever_beam/tetrahedron/linear/sequential/assembled/TetrahedronLinearSmallStrainFEMForceField.scn @@ -12,7 +12,7 @@ - diff --git a/examples/Validation/cantilever_beam/tetrahedron/linear/sequential/matrixfree/TetrahedronLinearSmallStrainFEMForceField.scn b/examples/Validation/cantilever_beam/tetrahedron/linear/sequential/matrixfree/TetrahedronLinearSmallStrainFEMForceField.scn index 40ba7eff557..329bb440a61 100644 --- a/examples/Validation/cantilever_beam/tetrahedron/linear/sequential/matrixfree/TetrahedronLinearSmallStrainFEMForceField.scn +++ b/examples/Validation/cantilever_beam/tetrahedron/linear/sequential/matrixfree/TetrahedronLinearSmallStrainFEMForceField.scn @@ -10,7 +10,7 @@ - From c4e557f9cd9f2fde4e81ff02c85babaf3d5d4794 Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Fri, 5 Jun 2026 08:42:58 +0200 Subject: [PATCH 05/12] rename ElementFEMMass to FEMMass --- Sofa/Component/Mass/CMakeLists.txt | 10 ++-- .../sofa/component/mass/ElementFEMMass.cpp | 58 ------------------- .../Mass/src/sofa/component/mass/FEMMass.cpp | 58 +++++++++++++++++++ .../mass/{ElementFEMMass.h => FEMMass.h} | 32 +++++----- .../mass/{ElementFEMMass.inl => FEMMass.inl} | 26 ++++----- Sofa/Component/Mass/tests/CMakeLists.txt | 4 +- ...ass].cpp => MassTestCreation[FEMMass].cpp} | 6 +- .../Mapping/Hexa2PrismTopologicalMapping.scn | 2 +- 8 files changed, 98 insertions(+), 98 deletions(-) delete mode 100644 Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.cpp create mode 100644 Sofa/Component/Mass/src/sofa/component/mass/FEMMass.cpp rename Sofa/Component/Mass/src/sofa/component/mass/{ElementFEMMass.h => FEMMass.h} (89%) rename Sofa/Component/Mass/src/sofa/component/mass/{ElementFEMMass.inl => FEMMass.inl} (93%) rename Sofa/Component/Mass/tests/{MassTestCreation[ElementFEMMass].cpp => MassTestCreation[FEMMass].cpp} (95%) diff --git a/Sofa/Component/Mass/CMakeLists.txt b/Sofa/Component/Mass/CMakeLists.txt index d43240fb14d..9924a1916ac 100644 --- a/Sofa/Component/Mass/CMakeLists.txt +++ b/Sofa/Component/Mass/CMakeLists.txt @@ -4,13 +4,11 @@ project(Sofa.Component.Mass LANGUAGES CXX) set(SOFACOMPONENTMASS_SOURCE_DIR "src/sofa/component/mass") set(HEADER_FILES - ${SOFACOMPONENTMASS_SOURCE_DIR}/config.h.in - ${SOFACOMPONENTMASS_SOURCE_DIR}/init.h ${SOFACOMPONENTMASS_SOURCE_DIR}/AddMToMatrixFunctor.h ${SOFACOMPONENTMASS_SOURCE_DIR}/DiagonalMass.h ${SOFACOMPONENTMASS_SOURCE_DIR}/DiagonalMass.inl - ${SOFACOMPONENTMASS_SOURCE_DIR}/ElementFEMMass.h - ${SOFACOMPONENTMASS_SOURCE_DIR}/ElementFEMMass.inl + ${SOFACOMPONENTMASS_SOURCE_DIR}/FEMMass.h + ${SOFACOMPONENTMASS_SOURCE_DIR}/FEMMass.inl ${SOFACOMPONENTMASS_SOURCE_DIR}/MassType.h ${SOFACOMPONENTMASS_SOURCE_DIR}/MeshMatrixMass.h ${SOFACOMPONENTMASS_SOURCE_DIR}/MeshMatrixMass.inl @@ -19,12 +17,14 @@ set(HEADER_FILES ${SOFACOMPONENTMASS_SOURCE_DIR}/UniformMass.h ${SOFACOMPONENTMASS_SOURCE_DIR}/UniformMass.inl ${SOFACOMPONENTMASS_SOURCE_DIR}/VecMassType.h + ${SOFACOMPONENTMASS_SOURCE_DIR}/config.h.in + ${SOFACOMPONENTMASS_SOURCE_DIR}/init.h ) set(SOURCE_FILES ${SOFACOMPONENTMASS_SOURCE_DIR}/init.cpp ${SOFACOMPONENTMASS_SOURCE_DIR}/DiagonalMass.cpp - ${SOFACOMPONENTMASS_SOURCE_DIR}/ElementFEMMass.cpp + ${SOFACOMPONENTMASS_SOURCE_DIR}/FEMMass.cpp ${SOFACOMPONENTMASS_SOURCE_DIR}/MeshMatrixMass.cpp ${SOFACOMPONENTMASS_SOURCE_DIR}/NodalMassDensity.cpp ${SOFACOMPONENTMASS_SOURCE_DIR}/UniformMass.cpp diff --git a/Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.cpp b/Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.cpp deleted file mode 100644 index 947400539e6..00000000000 --- a/Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/****************************************************************************** -* SOFA, Simulation Open-Framework Architecture * -* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU Lesser General Public License as published by * -* the Free Software Foundation; either version 2.1 of the License, or (at * -* your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but WITHOUT * -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * -* for more details. * -* * -* You should have received a copy of the GNU Lesser General Public License * -* along with this program. If not, see . * -******************************************************************************* -* Authors: The SOFA Team and external contributors (see Authors.txt) * -* * -* Contact information: contact@sofa-framework.org * -******************************************************************************/ -#define SOFA_COMPONENT_MASS_ELEMENTFEMMASS_CPP -#include -#include -#include -#include - -namespace sofa::component::mass -{ - -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; - -void registerFEMMass(sofa::core::ObjectFactory* factory) -{ - factory->registerObjects(sofa::core::ObjectRegistrationData("Finite-element mass (inertia and body force)") - .add< ElementFEMMass >() - .add< ElementFEMMass >() - .add< ElementFEMMass >() - .add< ElementFEMMass >() - .add< ElementFEMMass >() - .add< ElementFEMMass >() - .add< ElementFEMMass >() - .add< ElementFEMMass >() - .add< ElementFEMMass >() - .add< ElementFEMMass >() - ); -} - -} diff --git a/Sofa/Component/Mass/src/sofa/component/mass/FEMMass.cpp b/Sofa/Component/Mass/src/sofa/component/mass/FEMMass.cpp new file mode 100644 index 00000000000..da683dd56b6 --- /dev/null +++ b/Sofa/Component/Mass/src/sofa/component/mass/FEMMass.cpp @@ -0,0 +1,58 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture * +* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * +* * +* This program is free software; you can redistribute it and/or modify it * +* under the terms of the GNU Lesser General Public License as published by * +* the Free Software Foundation; either version 2.1 of the License, or (at * +* your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, but WITHOUT * +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * +* for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with this program. If not, see . * +******************************************************************************* +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#define SOFA_COMPONENT_MASS_FEMMASS_CPP +#include +#include +#include +#include + +namespace sofa::component::mass +{ + +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; + +void registerFEMMass(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(sofa::core::ObjectRegistrationData("Finite-element mass (inertia and body force)") + .add< FEMMass >() + .add< FEMMass >() + .add< FEMMass >() + .add< FEMMass >() + .add< FEMMass >() + .add< FEMMass >() + .add< FEMMass >() + .add< FEMMass >() + .add< FEMMass >() + .add< FEMMass >() + ); +} + +} diff --git a/Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.h b/Sofa/Component/Mass/src/sofa/component/mass/FEMMass.h similarity index 89% rename from Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.h rename to Sofa/Component/Mass/src/sofa/component/mass/FEMMass.h index 71ae68345d6..28327421c52 100644 --- a/Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.h +++ b/Sofa/Component/Mass/src/sofa/component/mass/FEMMass.h @@ -36,7 +36,7 @@ namespace sofa::component::mass { /** - * @class ElementFEMMass + * @class FEMMass * @brief Computes and stores the mass matrix for a finite element model. * * This class calculates the mass matrix for a given set of finite elements based on a nodal mass density field. @@ -54,14 +54,14 @@ namespace sofa::component::mass * @tparam TElementType The type of finite element (e.g., sofa::geometry::Tetrahedron). */ template -class ElementFEMMass : +class FEMMass : public core::behavior::Mass, public virtual sofa::core::behavior::TopologyAccessor { public: using DataTypes = TDataTypes; using ElementType = TElementType; - SOFA_CLASS2(SOFA_TEMPLATE2(ElementFEMMass, DataTypes, ElementType), + SOFA_CLASS2(SOFA_TEMPLATE2(FEMMass, DataTypes, ElementType), core::behavior::Mass, sofa::core::behavior::TopologyAccessor); @@ -86,7 +86,7 @@ class ElementFEMMass : * This component provides the mass density at each node of the mesh. * It must be present in the context for the mass to be calculated correctly. */ - sofa::SingleLink l_nodalMassDensity; /** @@ -193,7 +193,7 @@ class ElementFEMMass : /** * @brief Default constructor. */ - ElementFEMMass(); + FEMMass(); /** * @brief Performs the internal calculation and assembly of the mass matrix. @@ -249,17 +249,17 @@ class ElementFEMMass : GlobalMassMatrixType m_globalMassMatrix; }; -#if !defined(SOFA_COMPONENT_MASS_ELEMENTFEMMASS_CPP) -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; +#if !defined(SOFA_COMPONENT_MASS_FEMMASS_CPP) +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; #endif } // namespace sofa::component::mass diff --git a/Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.inl b/Sofa/Component/Mass/src/sofa/component/mass/FEMMass.inl similarity index 93% rename from Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.inl rename to Sofa/Component/Mass/src/sofa/component/mass/FEMMass.inl index 4a2df9212de..36ce2d21249 100644 --- a/Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.inl +++ b/Sofa/Component/Mass/src/sofa/component/mass/FEMMass.inl @@ -20,7 +20,7 @@ * Contact information: contact@sofa-framework.org * ******************************************************************************/ #pragma once -#include +#include #include #include #include @@ -29,14 +29,14 @@ namespace sofa::component::mass { template -ElementFEMMass::ElementFEMMass() +FEMMass::FEMMass() : l_nodalMassDensity(initLink("nodalMassDensity", "Link to nodal mass density")) { } template -void ElementFEMMass::init() +void FEMMass::init() { TopologyAccessor::init(); @@ -57,7 +57,7 @@ void ElementFEMMass::init() } template -void ElementFEMMass::validateNodalMassDensity() +void FEMMass::validateNodalMassDensity() { if (l_nodalMassDensity.empty()) { @@ -76,7 +76,7 @@ void ElementFEMMass::validateNodalMassDensity() template -void ElementFEMMass::elementFEMMass_init() +void FEMMass::elementFEMMass_init() { const auto& elements = FiniteElement::getElementSequence(*this->l_topology); sofa::type::vector elementMassMatrices; @@ -89,7 +89,7 @@ void ElementFEMMass::elementFEMMass_init() } template -void ElementFEMMass::calculateElementMassMatrix( +void FEMMass::calculateElementMassMatrix( const auto& elements, sofa::type::vector &elementMassMatrices) { const auto nbElements = elements.size(); @@ -149,7 +149,7 @@ void ElementFEMMass::calculateElementMassMatrix( } template -void ElementFEMMass::initializeGlobalMassMatrix( +void FEMMass::initializeGlobalMassMatrix( const auto& elements, const sofa::type::vector& elementMassMatrices) { SCOPED_TIMER("elementMassMatrix"); @@ -183,7 +183,7 @@ void ElementFEMMass::initializeGlobalMassMatrix( } template -void ElementFEMMass::addForce(const core::MechanicalParams* mparams, +void FEMMass::addForce(const core::MechanicalParams* mparams, sofa::DataVecDeriv_t& f, const sofa::DataVecCoord_t& x, const sofa::DataVecDeriv_t& v) @@ -213,7 +213,7 @@ void ElementFEMMass::addForce(const core::MechanicalPa } template -void ElementFEMMass::buildMassMatrix( +void FEMMass::buildMassMatrix( sofa::core::behavior::MassMatrixAccumulator* matrices) { for (std::size_t xi = 0; xi < m_globalMassMatrix.rowIndex.size(); ++xi) @@ -234,7 +234,7 @@ void ElementFEMMass::buildMassMatrix( } template -void ElementFEMMass::addMDx(const core::MechanicalParams* mparams, +void FEMMass::addMDx(const core::MechanicalParams* mparams, DataVecDeriv_t& f, const DataVecDeriv_t& dx, SReal factor) @@ -259,7 +259,7 @@ void ElementFEMMass::addMDx(const core::MechanicalPara } template -void ElementFEMMass::accFromF(const core::MechanicalParams* mparams, +void FEMMass::accFromF(const core::MechanicalParams* mparams, DataVecDeriv_t& a, const DataVecDeriv_t& f) { @@ -271,7 +271,7 @@ void ElementFEMMass::accFromF(const core::MechanicalPa } template -SReal ElementFEMMass::getKineticEnergy( +SReal FEMMass::getKineticEnergy( const core::MechanicalParams* mparams, const DataVecDeriv_t& v) const { @@ -297,7 +297,7 @@ SReal ElementFEMMass::getKineticEnergy( } template -SReal ElementFEMMass::getPotentialEnergy( +SReal FEMMass::getPotentialEnergy( const core::MechanicalParams* mparams, const DataVecCoord_t& x) const { diff --git a/Sofa/Component/Mass/tests/CMakeLists.txt b/Sofa/Component/Mass/tests/CMakeLists.txt index d80b20f5111..0d5e6228c26 100644 --- a/Sofa/Component/Mass/tests/CMakeLists.txt +++ b/Sofa/Component/Mass/tests/CMakeLists.txt @@ -4,10 +4,10 @@ project(Sofa.Component.Mass_test) set(SOURCE_FILES DiagonalMass_test.cpp - UniformMass_test.cpp - MassTestCreation[ElementFEMMass].cpp + MassTestCreation[FEMMass].cpp MassTestCreation[MeshMatrixMass].cpp MassTestCreation[UniformMass].cpp + UniformMass_test.cpp ) add_executable(${PROJECT_NAME} ${SOURCE_FILES}) diff --git a/Sofa/Component/Mass/tests/MassTestCreation[ElementFEMMass].cpp b/Sofa/Component/Mass/tests/MassTestCreation[FEMMass].cpp similarity index 95% rename from Sofa/Component/Mass/tests/MassTestCreation[ElementFEMMass].cpp rename to Sofa/Component/Mass/tests/MassTestCreation[FEMMass].cpp index 9a7c75487dc..a4dadaaa65c 100644 --- a/Sofa/Component/Mass/tests/MassTestCreation[ElementFEMMass].cpp +++ b/Sofa/Component/Mass/tests/MassTestCreation[FEMMass].cpp @@ -19,7 +19,7 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ -#include +#include #include #include #include @@ -32,11 +32,11 @@ using MeshTopology = sofa::component::topology::container::constant::MeshTopolog /*************************************************************************************************** - * ElementFEMMass + * FEMMass **************************************************************************************************/ template -struct ElementMass_template_test : public Mass_test> +struct ElementMass_template_test : public Mass_test> { using DataTypes = typename MassParam::DataTypes; diff --git a/examples/Component/Topology/Mapping/Hexa2PrismTopologicalMapping.scn b/examples/Component/Topology/Mapping/Hexa2PrismTopologicalMapping.scn index f94d1b1185b..6b76fd5232f 100644 --- a/examples/Component/Topology/Mapping/Hexa2PrismTopologicalMapping.scn +++ b/examples/Component/Topology/Mapping/Hexa2PrismTopologicalMapping.scn @@ -37,7 +37,7 @@ rotationMethod="polar" computeForceStrategy="sequenced" computeForceDerivStrategy="sequenced"/> - + From e3c31fa458fce6bf0ddf19dac47132815abcf3e8 Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Sat, 23 May 2026 12:26:09 +0200 Subject: [PATCH 06/12] [FEM] Refactor templates in latest FEM classes --- .../ElementCorotationalFEMForceField.cpp | 25 ++++++------------- .../ElementCorotationalFEMForceField.h | 15 ----------- .../ElementLinearSmallStrainFEMForceField.cpp | 25 ++++++------------- .../ElementLinearSmallStrainFEMForceField.h | 17 +------------ .../fem/elastic/FEMForceField.h | 2 +- .../fem/elastic/FEMForceField.inl | 1 + .../HexahedronCorotationalFEMForceField.scn | 5 ++-- .../HexahedronCorotationalFEMForceField.scn | 5 ++-- .../HexahedronCorotationalFEMForceField.scn | 5 ++-- .../HexahedronCorotationalFEMForceField.scn | 5 ++-- ...xahedronLinearSmallStrainFEMForceField.scn | 5 ++-- ...xahedronLinearSmallStrainFEMForceField.scn | 5 ++-- ...xahedronLinearSmallStrainFEMForceField.scn | 5 ++-- ...xahedronLinearSmallStrainFEMForceField.scn | 5 ++-- .../TetrahedronCorotationalFEMForceField.scn | 3 ++- .../TetrahedronCorotationalFEMForceField.scn | 5 ++-- .../TetrahedronCorotationalFEMForceField.scn | 5 ++-- .../TetrahedronCorotationalFEMForceField.scn | 5 ++-- ...rahedronLinearSmallStrainFEMForceField.scn | 5 ++-- ...rahedronLinearSmallStrainFEMForceField.scn | 5 ++-- ...rahedronLinearSmallStrainFEMForceField.scn | 5 ++-- ...rahedronLinearSmallStrainFEMForceField.scn | 5 ++-- 22 files changed, 66 insertions(+), 97 deletions(-) diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.cpp b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.cpp index fd38c9e67bb..52a14a6bf00 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.cpp +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.cpp @@ -31,27 +31,18 @@ namespace sofa::component::solidmechanics::fem::elastic void registerElementCorotationalFEMForceField(sofa::core::ObjectFactory* factory) { - factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law on linear beams using the corotational approach") + factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law using the corotational approach") // .add< ElementCorotationalFEMForceField >() .add< ElementCorotationalFEMForceField >() - .add< ElementCorotationalFEMForceField >(true)); - - factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law on linear triangles using the corotational approach") + .add< ElementCorotationalFEMForceField >() .add< ElementCorotationalFEMForceField >() - .add< ElementCorotationalFEMForceField >(true)); - - factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law on linear quads using the corotational approach") + .add< ElementCorotationalFEMForceField >() .add< ElementCorotationalFEMForceField >() - .add< ElementCorotationalFEMForceField >(true)); - - factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law on linear tetrahedra using the corotational approach") - .add< ElementCorotationalFEMForceField >(true)); - - factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law on linear hexahedra using the corotational approach") - .add< ElementCorotationalFEMForceField >(true)); - - factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law on linear prisms using the corotational approach") - .add< ElementCorotationalFEMForceField >(true)); + .add< ElementCorotationalFEMForceField >() + .add< ElementCorotationalFEMForceField >() + .add< ElementCorotationalFEMForceField >() + .add< ElementCorotationalFEMForceField >() + ); } // template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.h b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.h index 1425fdfa925..df07d0d87e8 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.h +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.h @@ -121,21 +121,6 @@ class ElementCorotationalFEMForceField : SOFA_TEMPLATE2(BaseElementLinearFEMForceField, DataTypes, ElementType), SOFA_TEMPLATE2(FEMForceField, DataTypes, ElementType)); - /** - * The purpose of this function is to register the name of this class according to the provided - * pattern. - * - * Example: ElementCorotationalFEMForceField will produce - * the class name "EdgeCorotationalFEMForceField". - */ - static const std::string GetCustomClassName() - { - return std::string(sofa::geometry::elementTypeToString(ElementType::Element_type)) + - "CorotationalFEMForceField"; - } - - static const std::string GetCustomTemplateName() { return DataTypes::Name(); } - private: using trait = sofa::component::solidmechanics::fem::elastic::trait; using ElementGradient = typename trait::ElementGradient; diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.cpp b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.cpp index cb17452bdb2..2d6cc35ecec 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.cpp +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.cpp @@ -31,27 +31,18 @@ namespace sofa::component::solidmechanics::fem::elastic void registerElementLinearSmallStrainFEMForceField(sofa::core::ObjectFactory* factory) { - factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law on linear beams assuming small strain") + factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law assuming small strain") .add< ElementLinearSmallStrainFEMForceField >() .add< ElementLinearSmallStrainFEMForceField >() - .add< ElementLinearSmallStrainFEMForceField >(true)); - - factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law on linear triangles assuming small strain") + .add< ElementLinearSmallStrainFEMForceField >() .add< ElementLinearSmallStrainFEMForceField >() - .add< ElementLinearSmallStrainFEMForceField >(true)); - - factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law on linear quads assuming small strain") + .add< ElementLinearSmallStrainFEMForceField >() .add< ElementLinearSmallStrainFEMForceField >() - .add< ElementLinearSmallStrainFEMForceField >(true)); - - factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law on linear tetrahedra assuming small strain") - .add< ElementLinearSmallStrainFEMForceField >(true)); - - factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law on linear hexahedra assuming small strain") - .add< ElementLinearSmallStrainFEMForceField >(true)); - - factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law on linear prisms assuming small strain") - .add< ElementLinearSmallStrainFEMForceField >(true)); + .add< ElementLinearSmallStrainFEMForceField >() + .add< ElementLinearSmallStrainFEMForceField >() + .add< ElementLinearSmallStrainFEMForceField >() + .add< ElementLinearSmallStrainFEMForceField >() + ); } template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.h b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.h index 853867ff38e..456142fe527 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.h +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.h @@ -45,23 +45,8 @@ class ElementLinearSmallStrainFEMForceField : SOFA_TEMPLATE2(BaseElementLinearFEMForceField, DataTypes, ElementType), SOFA_TEMPLATE2(FEMForceField, DataTypes, ElementType)); - /** - * The purpose of this function is to register the name of this class according to the provided - * pattern. - * - * Example: ElementLinearSmallStrainFEMForceField will produce - * the class name "EdgeLinearSmallStrainFEMForceField". - */ - static const std::string GetCustomClassName() - { - return std::string(sofa::geometry::elementTypeToString(ElementType::Element_type)) + - "LinearSmallStrainFEMForceField"; - } - - static const std::string GetCustomTemplateName() { return DataTypes::Name(); } - private: - using trait = sofa::component::solidmechanics::fem::elastic::trait; + using trait = typename FEMForceField::trait; using ElementHessian = typename trait::ElementHessian; using ElementDisplacement = typename trait::ElementDisplacement; using StrainDisplacement = typename trait::StrainDisplacement; diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/FEMForceField.h b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/FEMForceField.h index 1c2519ee348..a0a718527e3 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/FEMForceField.h +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/FEMForceField.h @@ -48,7 +48,7 @@ class FEMForceField : sofa::core::behavior::TopologyAccessor, sofa::simulation::TaskSchedulerUser); -private: +protected: using trait = sofa::component::solidmechanics::fem::elastic::trait; using ElementGradient = typename trait::ElementGradient; diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/FEMForceField.inl b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/FEMForceField.inl index a1e60d07744..44d6dc85e07 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/FEMForceField.inl +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/FEMForceField.inl @@ -163,6 +163,7 @@ void FEMForceField::computeElementsForcesDeriv( const sofa::VecDeriv_t& dx) { SCOPED_TIMER("ElementForcesDeriv"); + beforeElementForceDeriv(mparams); this->beforeElementForceDeriv(mparams); diff --git a/examples/Validation/cantilever_beam/hexahedron/corotational/parallel/assembled/HexahedronCorotationalFEMForceField.scn b/examples/Validation/cantilever_beam/hexahedron/corotational/parallel/assembled/HexahedronCorotationalFEMForceField.scn index ffc08f685ae..fe245080f86 100644 --- a/examples/Validation/cantilever_beam/hexahedron/corotational/parallel/assembled/HexahedronCorotationalFEMForceField.scn +++ b/examples/Validation/cantilever_beam/hexahedron/corotational/parallel/assembled/HexahedronCorotationalFEMForceField.scn @@ -6,7 +6,8 @@ - + diff --git a/examples/Validation/cantilever_beam/hexahedron/corotational/parallel/matrixfree/HexahedronCorotationalFEMForceField.scn b/examples/Validation/cantilever_beam/hexahedron/corotational/parallel/matrixfree/HexahedronCorotationalFEMForceField.scn index c48bc2ef0b2..5132bedec93 100644 --- a/examples/Validation/cantilever_beam/hexahedron/corotational/parallel/matrixfree/HexahedronCorotationalFEMForceField.scn +++ b/examples/Validation/cantilever_beam/hexahedron/corotational/parallel/matrixfree/HexahedronCorotationalFEMForceField.scn @@ -4,7 +4,8 @@ - + diff --git a/examples/Validation/cantilever_beam/hexahedron/corotational/sequential/assembled/HexahedronCorotationalFEMForceField.scn b/examples/Validation/cantilever_beam/hexahedron/corotational/sequential/assembled/HexahedronCorotationalFEMForceField.scn index c1e3f1439de..690ef79063d 100644 --- a/examples/Validation/cantilever_beam/hexahedron/corotational/sequential/assembled/HexahedronCorotationalFEMForceField.scn +++ b/examples/Validation/cantilever_beam/hexahedron/corotational/sequential/assembled/HexahedronCorotationalFEMForceField.scn @@ -6,7 +6,8 @@ - + diff --git a/examples/Validation/cantilever_beam/hexahedron/corotational/sequential/matrixfree/HexahedronCorotationalFEMForceField.scn b/examples/Validation/cantilever_beam/hexahedron/corotational/sequential/matrixfree/HexahedronCorotationalFEMForceField.scn index ecbac27b125..6e81a7a9359 100644 --- a/examples/Validation/cantilever_beam/hexahedron/corotational/sequential/matrixfree/HexahedronCorotationalFEMForceField.scn +++ b/examples/Validation/cantilever_beam/hexahedron/corotational/sequential/matrixfree/HexahedronCorotationalFEMForceField.scn @@ -4,7 +4,8 @@ - + diff --git a/examples/Validation/cantilever_beam/hexahedron/linear/parallel/assembled/HexahedronLinearSmallStrainFEMForceField.scn b/examples/Validation/cantilever_beam/hexahedron/linear/parallel/assembled/HexahedronLinearSmallStrainFEMForceField.scn index 3a4a4a8f0c4..5895dacbf91 100644 --- a/examples/Validation/cantilever_beam/hexahedron/linear/parallel/assembled/HexahedronLinearSmallStrainFEMForceField.scn +++ b/examples/Validation/cantilever_beam/hexahedron/linear/parallel/assembled/HexahedronLinearSmallStrainFEMForceField.scn @@ -6,7 +6,8 @@ - + diff --git a/examples/Validation/cantilever_beam/hexahedron/linear/parallel/matrixfree/HexahedronLinearSmallStrainFEMForceField.scn b/examples/Validation/cantilever_beam/hexahedron/linear/parallel/matrixfree/HexahedronLinearSmallStrainFEMForceField.scn index 3af7b73e10e..b170bcc1fad 100644 --- a/examples/Validation/cantilever_beam/hexahedron/linear/parallel/matrixfree/HexahedronLinearSmallStrainFEMForceField.scn +++ b/examples/Validation/cantilever_beam/hexahedron/linear/parallel/matrixfree/HexahedronLinearSmallStrainFEMForceField.scn @@ -4,7 +4,8 @@ - + diff --git a/examples/Validation/cantilever_beam/hexahedron/linear/sequential/assembled/HexahedronLinearSmallStrainFEMForceField.scn b/examples/Validation/cantilever_beam/hexahedron/linear/sequential/assembled/HexahedronLinearSmallStrainFEMForceField.scn index a53c81fb0c3..0eab370dfc8 100644 --- a/examples/Validation/cantilever_beam/hexahedron/linear/sequential/assembled/HexahedronLinearSmallStrainFEMForceField.scn +++ b/examples/Validation/cantilever_beam/hexahedron/linear/sequential/assembled/HexahedronLinearSmallStrainFEMForceField.scn @@ -6,7 +6,8 @@ - + diff --git a/examples/Validation/cantilever_beam/hexahedron/linear/sequential/matrixfree/HexahedronLinearSmallStrainFEMForceField.scn b/examples/Validation/cantilever_beam/hexahedron/linear/sequential/matrixfree/HexahedronLinearSmallStrainFEMForceField.scn index 599d7db5dfb..18a76a8c91b 100644 --- a/examples/Validation/cantilever_beam/hexahedron/linear/sequential/matrixfree/HexahedronLinearSmallStrainFEMForceField.scn +++ b/examples/Validation/cantilever_beam/hexahedron/linear/sequential/matrixfree/HexahedronLinearSmallStrainFEMForceField.scn @@ -4,7 +4,8 @@ - + diff --git a/examples/Validation/cantilever_beam/tetrahedron/corotational/parallel/assembled/TetrahedronCorotationalFEMForceField.scn b/examples/Validation/cantilever_beam/tetrahedron/corotational/parallel/assembled/TetrahedronCorotationalFEMForceField.scn index 98a1c55cc9a..603cb2252e8 100644 --- a/examples/Validation/cantilever_beam/tetrahedron/corotational/parallel/assembled/TetrahedronCorotationalFEMForceField.scn +++ b/examples/Validation/cantilever_beam/tetrahedron/corotational/parallel/assembled/TetrahedronCorotationalFEMForceField.scn @@ -12,7 +12,8 @@ - diff --git a/examples/Validation/cantilever_beam/tetrahedron/corotational/parallel/matrixfree/TetrahedronCorotationalFEMForceField.scn b/examples/Validation/cantilever_beam/tetrahedron/corotational/parallel/matrixfree/TetrahedronCorotationalFEMForceField.scn index a5c6983f2fc..3c089fe1530 100644 --- a/examples/Validation/cantilever_beam/tetrahedron/corotational/parallel/matrixfree/TetrahedronCorotationalFEMForceField.scn +++ b/examples/Validation/cantilever_beam/tetrahedron/corotational/parallel/matrixfree/TetrahedronCorotationalFEMForceField.scn @@ -10,8 +10,9 @@ - + diff --git a/examples/Validation/cantilever_beam/tetrahedron/corotational/sequential/assembled/TetrahedronCorotationalFEMForceField.scn b/examples/Validation/cantilever_beam/tetrahedron/corotational/sequential/assembled/TetrahedronCorotationalFEMForceField.scn index 49d2891903e..3d034353b0d 100644 --- a/examples/Validation/cantilever_beam/tetrahedron/corotational/sequential/assembled/TetrahedronCorotationalFEMForceField.scn +++ b/examples/Validation/cantilever_beam/tetrahedron/corotational/sequential/assembled/TetrahedronCorotationalFEMForceField.scn @@ -12,8 +12,9 @@ - + diff --git a/examples/Validation/cantilever_beam/tetrahedron/corotational/sequential/matrixfree/TetrahedronCorotationalFEMForceField.scn b/examples/Validation/cantilever_beam/tetrahedron/corotational/sequential/matrixfree/TetrahedronCorotationalFEMForceField.scn index dffc83cd146..0198ae6e6c1 100644 --- a/examples/Validation/cantilever_beam/tetrahedron/corotational/sequential/matrixfree/TetrahedronCorotationalFEMForceField.scn +++ b/examples/Validation/cantilever_beam/tetrahedron/corotational/sequential/matrixfree/TetrahedronCorotationalFEMForceField.scn @@ -10,8 +10,9 @@ - + diff --git a/examples/Validation/cantilever_beam/tetrahedron/linear/parallel/assembled/TetrahedronLinearSmallStrainFEMForceField.scn b/examples/Validation/cantilever_beam/tetrahedron/linear/parallel/assembled/TetrahedronLinearSmallStrainFEMForceField.scn index 385d58095e4..52c91d8c6f4 100644 --- a/examples/Validation/cantilever_beam/tetrahedron/linear/parallel/assembled/TetrahedronLinearSmallStrainFEMForceField.scn +++ b/examples/Validation/cantilever_beam/tetrahedron/linear/parallel/assembled/TetrahedronLinearSmallStrainFEMForceField.scn @@ -12,8 +12,9 @@ - + diff --git a/examples/Validation/cantilever_beam/tetrahedron/linear/parallel/matrixfree/TetrahedronLinearSmallStrainFEMForceField.scn b/examples/Validation/cantilever_beam/tetrahedron/linear/parallel/matrixfree/TetrahedronLinearSmallStrainFEMForceField.scn index 92eed6a9101..e4f0da75eba 100644 --- a/examples/Validation/cantilever_beam/tetrahedron/linear/parallel/matrixfree/TetrahedronLinearSmallStrainFEMForceField.scn +++ b/examples/Validation/cantilever_beam/tetrahedron/linear/parallel/matrixfree/TetrahedronLinearSmallStrainFEMForceField.scn @@ -10,8 +10,9 @@ - + diff --git a/examples/Validation/cantilever_beam/tetrahedron/linear/sequential/assembled/TetrahedronLinearSmallStrainFEMForceField.scn b/examples/Validation/cantilever_beam/tetrahedron/linear/sequential/assembled/TetrahedronLinearSmallStrainFEMForceField.scn index 2830d933059..eaaa5d32a54 100644 --- a/examples/Validation/cantilever_beam/tetrahedron/linear/sequential/assembled/TetrahedronLinearSmallStrainFEMForceField.scn +++ b/examples/Validation/cantilever_beam/tetrahedron/linear/sequential/assembled/TetrahedronLinearSmallStrainFEMForceField.scn @@ -12,8 +12,9 @@ - + diff --git a/examples/Validation/cantilever_beam/tetrahedron/linear/sequential/matrixfree/TetrahedronLinearSmallStrainFEMForceField.scn b/examples/Validation/cantilever_beam/tetrahedron/linear/sequential/matrixfree/TetrahedronLinearSmallStrainFEMForceField.scn index 1967c27ef34..40ba7eff557 100644 --- a/examples/Validation/cantilever_beam/tetrahedron/linear/sequential/matrixfree/TetrahedronLinearSmallStrainFEMForceField.scn +++ b/examples/Validation/cantilever_beam/tetrahedron/linear/sequential/matrixfree/TetrahedronLinearSmallStrainFEMForceField.scn @@ -10,8 +10,9 @@ - + From 858ea96ad5c8f93d19352cbb8260c92f5b1e7829 Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Thu, 28 May 2026 09:16:05 +0200 Subject: [PATCH 07/12] Refactor also the mass --- .../sofa/component/mass/ElementFEMMass.cpp | 25 ++++++------------- .../src/sofa/component/mass/ElementFEMMass.h | 18 ------------- .../Mapping/Hexa2PrismTopologicalMapping.scn | 2 +- 3 files changed, 9 insertions(+), 36 deletions(-) diff --git a/Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.cpp b/Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.cpp index e2c0f520e30..947400539e6 100644 --- a/Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.cpp +++ b/Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.cpp @@ -41,27 +41,18 @@ template class SOFA_COMPONENT_MASS_API ElementFEMMassregisterObjects(sofa::core::ObjectRegistrationData("Finite-element mass (inertia and body force) defined on edges") + factory->registerObjects(sofa::core::ObjectRegistrationData("Finite-element mass (inertia and body force)") .add< ElementFEMMass >() .add< ElementFEMMass >() - .add< ElementFEMMass >(true)); - - factory->registerObjects(sofa::core::ObjectRegistrationData("Finite-element mass (inertia and body force) defined on triangles") + .add< ElementFEMMass >() .add< ElementFEMMass >() - .add< ElementFEMMass >(true)); - - factory->registerObjects(sofa::core::ObjectRegistrationData("Finite-element mass (inertia and body force) defined on quads") + .add< ElementFEMMass >() .add< ElementFEMMass >() - .add< ElementFEMMass >(true)); - - factory->registerObjects(sofa::core::ObjectRegistrationData("Finite-element mass (inertia and body force) defined on tetrahedra") - .add< ElementFEMMass >(true)); - - factory->registerObjects(sofa::core::ObjectRegistrationData("Finite-element mass (inertia and body force) defined on hexahedra") - .add< ElementFEMMass >(true)); - - factory->registerObjects(sofa::core::ObjectRegistrationData("Finite-element mass (inertia and body force) defined on prisms") - .add< ElementFEMMass >(true)); + .add< ElementFEMMass >() + .add< ElementFEMMass >() + .add< ElementFEMMass >() + .add< ElementFEMMass >() + ); } } diff --git a/Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.h b/Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.h index f390189c375..71ae68345d6 100644 --- a/Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.h +++ b/Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.h @@ -80,24 +80,6 @@ class ElementFEMMass : public: - /** - * @brief Gets the class name according to the provided template parameters. - * - * For example, `ElementFEMMass` will return "EdgeFEMMass". - * - * @return A string representing the class name. - */ - static const std::string GetCustomClassName() - { - return std::string(sofa::geometry::elementTypeToString(ElementType::Element_type)) + "FEMMass"; - } - - /** - * @brief Gets the template name based on the data types. - * @return A string representing the template name (e.g., "Vec3d"). - */ - static const std::string GetCustomTemplateName() { return DataTypes::Name(); } - /** * @brief Link to the nodal mass density component. * diff --git a/examples/Component/Topology/Mapping/Hexa2PrismTopologicalMapping.scn b/examples/Component/Topology/Mapping/Hexa2PrismTopologicalMapping.scn index c2867de54c2..f94d1b1185b 100644 --- a/examples/Component/Topology/Mapping/Hexa2PrismTopologicalMapping.scn +++ b/examples/Component/Topology/Mapping/Hexa2PrismTopologicalMapping.scn @@ -37,7 +37,7 @@ rotationMethod="polar" computeForceStrategy="sequenced" computeForceDerivStrategy="sequenced"/> - + From 93efd76023de4fbc76d9cd624e735b5844b3aeb3 Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Fri, 5 Jun 2026 08:29:35 +0200 Subject: [PATCH 08/12] rename ElementCorotationalFEMForceField to CorotationalFEMForceField --- .../SolidMechanics/FEM/Elastic/CMakeLists.txt | 6 +- .../fem/elastic/CorotationalFEMForceField.cpp | 59 +++++++++++++++++++ ...rceField.h => CorotationalFEMForceField.h} | 28 ++++----- ...ield.inl => CorotationalFEMForceField.inl} | 24 ++++---- .../ElementCorotationalFEMForceField.cpp | 59 ------------------- .../solidmechanics/fem/elastic/init.cpp | 4 +- .../HexahedronCorotationalFEMForceField.scn | 2 +- .../HexahedronCorotationalFEMForceField.scn | 2 +- .../HexahedronCorotationalFEMForceField.scn | 2 +- .../HexahedronCorotationalFEMForceField.scn | 2 +- .../TetrahedronCorotationalFEMForceField.scn | 2 +- .../TetrahedronCorotationalFEMForceField.scn | 2 +- .../TetrahedronCorotationalFEMForceField.scn | 2 +- .../TetrahedronCorotationalFEMForceField.scn | 2 +- 14 files changed, 98 insertions(+), 98 deletions(-) create mode 100644 Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/CorotationalFEMForceField.cpp rename Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/{ElementCorotationalFEMForceField.h => CorotationalFEMForceField.h} (88%) rename Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/{ElementCorotationalFEMForceField.inl => CorotationalFEMForceField.inl} (91%) delete mode 100644 Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.cpp diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/CMakeLists.txt b/Sofa/Component/SolidMechanics/FEM/Elastic/CMakeLists.txt index 2e090b63ebb..ff8e89af2be 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/CMakeLists.txt +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/CMakeLists.txt @@ -13,8 +13,8 @@ set(HEADER_FILES ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/BaseLinearElasticityFEMForceField.inl ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/BeamFEMForceField.h ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/BeamFEMForceField.inl - ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/ElementCorotationalFEMForceField.h - ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/ElementCorotationalFEMForceField.inl + ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/CorotationalFEMForceField.h + ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/CorotationalFEMForceField.inl ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/ElementLinearSmallStrainFEMForceField.h ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/ElementLinearSmallStrainFEMForceField.inl ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/FastTetrahedralCorotationalForceField.h @@ -68,7 +68,7 @@ set(SOURCE_FILES ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/BaseElementLinearFEMForceField.cpp ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/BaseLinearElasticityFEMForceField.cpp ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/BeamFEMForceField.cpp - ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/ElementCorotationalFEMForceField.cpp + ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/CorotationalFEMForceField.cpp ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/ElementLinearSmallStrainFEMForceField.cpp ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/FastTetrahedralCorotationalForceField.cpp ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/FEMForceField.cpp diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/CorotationalFEMForceField.cpp b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/CorotationalFEMForceField.cpp new file mode 100644 index 00000000000..efd7c5d6bca --- /dev/null +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/CorotationalFEMForceField.cpp @@ -0,0 +1,59 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture * +* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * +* * +* This program is free software; you can redistribute it and/or modify it * +* under the terms of the GNU Lesser General Public License as published by * +* the Free Software Foundation; either version 2.1 of the License, or (at * +* your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, but WITHOUT * +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * +* for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with this program. If not, see . * +******************************************************************************* +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#define SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_COROTATIONAL_FEM_FORCE_FIELD_CPP + +#include + +#include +#include + +namespace sofa::component::solidmechanics::fem::elastic +{ + +void registerCorotationalFEMForceField(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law using the corotational approach") + // .add< CorotationalFEMForceField >() + .add< CorotationalFEMForceField >() + .add< CorotationalFEMForceField >() + .add< CorotationalFEMForceField >() + .add< CorotationalFEMForceField >() + .add< CorotationalFEMForceField >() + .add< CorotationalFEMForceField >() + .add< CorotationalFEMForceField >() + .add< CorotationalFEMForceField >() + .add< CorotationalFEMForceField >() + ); +} + +// template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; + +} diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.h b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/CorotationalFEMForceField.h similarity index 88% rename from Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.h rename to Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/CorotationalFEMForceField.h index df07d0d87e8..720fc68bb02 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.h +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/CorotationalFEMForceField.h @@ -111,13 +111,13 @@ struct RotationMethods : RotationMethodsC template -class ElementCorotationalFEMForceField : +class CorotationalFEMForceField : public BaseElementLinearFEMForceField, public FEMForceField { public: SOFA_CLASS2( - SOFA_TEMPLATE2(ElementCorotationalFEMForceField, DataTypes, ElementType), + SOFA_TEMPLATE2(CorotationalFEMForceField, DataTypes, ElementType), SOFA_TEMPLATE2(BaseElementLinearFEMForceField, DataTypes, ElementType), SOFA_TEMPLATE2(FEMForceField, DataTypes, ElementType)); @@ -129,7 +129,7 @@ class ElementCorotationalFEMForceField : public: - ElementCorotationalFEMForceField(); + CorotationalFEMForceField(); void init() override; @@ -174,17 +174,17 @@ class ElementCorotationalFEMForceField : -#if !defined(ELASTICITY_COMPONENT_ELEMENT_COROTATIONAL_FEM_FORCE_FIELD_CPP) -// extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; +#if !defined(SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_COROTATIONAL_FEM_FORCE_FIELD_CPP) +// extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField; #endif } // namespace sofa::component::solidmechanics::fem::elastic diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.inl b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/CorotationalFEMForceField.inl similarity index 91% rename from Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.inl rename to Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/CorotationalFEMForceField.inl index e32ca8daa01..2e9dbe20c50 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.inl +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/CorotationalFEMForceField.inl @@ -20,7 +20,7 @@ * Contact information: contact@sofa-framework.org * ******************************************************************************/ #pragma once -#include +#include #include #include @@ -31,7 +31,7 @@ namespace sofa::component::solidmechanics::fem::elastic { template -ElementCorotationalFEMForceField::ElementCorotationalFEMForceField() +CorotationalFEMForceField::CorotationalFEMForceField() : m_rotationMethods(this) { this->addUpdateCallback("selectRotationMethod", {&this->m_rotationMethods.d_rotationMethod}, @@ -47,7 +47,7 @@ ElementCorotationalFEMForceField::ElementCorotationalFEM } template -void ElementCorotationalFEMForceField::init() +void CorotationalFEMForceField::init() { BaseElementLinearFEMForceField::init(); FEMForceField::init(); @@ -70,7 +70,7 @@ void ElementCorotationalFEMForceField::init() } template -void ElementCorotationalFEMForceField::beforeElementForce( +void CorotationalFEMForceField::beforeElementForce( const sofa::core::MechanicalParams* mparams, sofa::type::vector& f, const sofa::VecCoord_t& x) { @@ -79,7 +79,7 @@ void ElementCorotationalFEMForceField::beforeElementForc } template -void ElementCorotationalFEMForceField::computeElementsForces( +void CorotationalFEMForceField::computeElementsForces( const sofa::simulation::Range& range, const sofa::core::MechanicalParams* mparams, sofa::type::vector& elementForces, const sofa::VecCoord_t& nodePositions) { @@ -128,7 +128,7 @@ void ElementCorotationalFEMForceField::computeElementsFo template -void ElementCorotationalFEMForceField::computeElementsForcesDeriv( +void CorotationalFEMForceField::computeElementsForcesDeriv( const sofa::simulation::Range& range, const sofa::core::MechanicalParams* mparams, sofa::type::vector& elementForcesDeriv, @@ -165,7 +165,7 @@ void ElementCorotationalFEMForceField::computeElementsFo } template -void ElementCorotationalFEMForceField::buildStiffnessMatrix( +void CorotationalFEMForceField::buildStiffnessMatrix( sofa::core::behavior::StiffnessMatrix* matrix) { auto dfdx = matrix->getForceDerivativeIn(this->sofa::core::behavior::ForceField::mstate) @@ -202,7 +202,7 @@ void ElementCorotationalFEMForceField::buildStiffnessMat } template -SReal ElementCorotationalFEMForceField::getPotentialEnergy( +SReal CorotationalFEMForceField::getPotentialEnergy( const sofa::core::MechanicalParams*, const sofa::DataVecCoord_t& x) const { @@ -210,7 +210,7 @@ SReal ElementCorotationalFEMForceField::getPotentialEner } template -auto ElementCorotationalFEMForceField::translation( +auto CorotationalFEMForceField::translation( const std::array, trait::NumberOfNodesInElement>& nodes) const -> sofa::Coord_t { // return nodes[0]; @@ -218,7 +218,7 @@ auto ElementCorotationalFEMForceField::translation( } template -auto ElementCorotationalFEMForceField::computeCentroid( +auto CorotationalFEMForceField::computeCentroid( const std::array, trait::NumberOfNodesInElement>& nodes) -> sofa::Coord_t { sofa::Coord_t centroid; @@ -231,7 +231,7 @@ auto ElementCorotationalFEMForceField::computeCentroid( } template -void ElementCorotationalFEMForceField::computeRotations( +void CorotationalFEMForceField::computeRotations( sofa::type::vector& rotations, const sofa::VecCoord_t& nodePositions, const sofa::VecCoord_t& nodeRestPositions) @@ -264,7 +264,7 @@ void ElementCorotationalFEMForceField::computeRotations( } template -void ElementCorotationalFEMForceField::computeInitialRotations() +void CorotationalFEMForceField::computeInitialRotations() { auto restPositionAccessor = this->sofa::core::behavior::ForceField::mstate->readRestPositions(); computeRotations(m_initialRotationsTransposed, restPositionAccessor.ref(), restPositionAccessor.ref()); diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.cpp b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.cpp deleted file mode 100644 index 52a14a6bf00..00000000000 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/****************************************************************************** -* SOFA, Simulation Open-Framework Architecture * -* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU Lesser General Public License as published by * -* the Free Software Foundation; either version 2.1 of the License, or (at * -* your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but WITHOUT * -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * -* for more details. * -* * -* You should have received a copy of the GNU Lesser General Public License * -* along with this program. If not, see . * -******************************************************************************* -* Authors: The SOFA Team and external contributors (see Authors.txt) * -* * -* Contact information: contact@sofa-framework.org * -******************************************************************************/ -#define ELASTICITY_COMPONENT_ELEMENT_COROTATIONAL_FEM_FORCE_FIELD_CPP - -#include - -#include -#include - -namespace sofa::component::solidmechanics::fem::elastic -{ - -void registerElementCorotationalFEMForceField(sofa::core::ObjectFactory* factory) -{ - factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law using the corotational approach") - // .add< ElementCorotationalFEMForceField >() - .add< ElementCorotationalFEMForceField >() - .add< ElementCorotationalFEMForceField >() - .add< ElementCorotationalFEMForceField >() - .add< ElementCorotationalFEMForceField >() - .add< ElementCorotationalFEMForceField >() - .add< ElementCorotationalFEMForceField >() - .add< ElementCorotationalFEMForceField >() - .add< ElementCorotationalFEMForceField >() - .add< ElementCorotationalFEMForceField >() - ); -} - -// template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementCorotationalFEMForceField; - -} diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/init.cpp b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/init.cpp index 343b296dbba..2cd823fc529 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/init.cpp +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/init.cpp @@ -27,7 +27,7 @@ namespace sofa::component::solidmechanics::fem::elastic { extern void registerBeamFEMForceField(sofa::core::ObjectFactory* factory); -extern void registerElementCorotationalFEMForceField(sofa::core::ObjectFactory* factory); +extern void registerCorotationalFEMForceField(sofa::core::ObjectFactory* factory); extern void registerElementLinearSmallStrainFEMForceField(sofa::core::ObjectFactory* factory); extern void registerFastTetrahedralCorotationalForceField(sofa::core::ObjectFactory* factory); extern void registerHexahedralFEMForceField(sofa::core::ObjectFactory* factory); @@ -67,7 +67,7 @@ const char* getModuleVersion() void registerObjects(sofa::core::ObjectFactory* factory) { registerBeamFEMForceField(factory); - registerElementCorotationalFEMForceField(factory); + registerCorotationalFEMForceField(factory); registerElementLinearSmallStrainFEMForceField(factory); registerFastTetrahedralCorotationalForceField(factory); registerHexahedralFEMForceField(factory); diff --git a/examples/Validation/cantilever_beam/hexahedron/corotational/parallel/assembled/HexahedronCorotationalFEMForceField.scn b/examples/Validation/cantilever_beam/hexahedron/corotational/parallel/assembled/HexahedronCorotationalFEMForceField.scn index fe245080f86..ab76ef3d14a 100644 --- a/examples/Validation/cantilever_beam/hexahedron/corotational/parallel/assembled/HexahedronCorotationalFEMForceField.scn +++ b/examples/Validation/cantilever_beam/hexahedron/corotational/parallel/assembled/HexahedronCorotationalFEMForceField.scn @@ -6,7 +6,7 @@ - diff --git a/examples/Validation/cantilever_beam/hexahedron/corotational/parallel/matrixfree/HexahedronCorotationalFEMForceField.scn b/examples/Validation/cantilever_beam/hexahedron/corotational/parallel/matrixfree/HexahedronCorotationalFEMForceField.scn index 5132bedec93..2fd8d92f467 100644 --- a/examples/Validation/cantilever_beam/hexahedron/corotational/parallel/matrixfree/HexahedronCorotationalFEMForceField.scn +++ b/examples/Validation/cantilever_beam/hexahedron/corotational/parallel/matrixfree/HexahedronCorotationalFEMForceField.scn @@ -4,7 +4,7 @@ - diff --git a/examples/Validation/cantilever_beam/hexahedron/corotational/sequential/assembled/HexahedronCorotationalFEMForceField.scn b/examples/Validation/cantilever_beam/hexahedron/corotational/sequential/assembled/HexahedronCorotationalFEMForceField.scn index 690ef79063d..15588cb4d05 100644 --- a/examples/Validation/cantilever_beam/hexahedron/corotational/sequential/assembled/HexahedronCorotationalFEMForceField.scn +++ b/examples/Validation/cantilever_beam/hexahedron/corotational/sequential/assembled/HexahedronCorotationalFEMForceField.scn @@ -6,7 +6,7 @@ - diff --git a/examples/Validation/cantilever_beam/hexahedron/corotational/sequential/matrixfree/HexahedronCorotationalFEMForceField.scn b/examples/Validation/cantilever_beam/hexahedron/corotational/sequential/matrixfree/HexahedronCorotationalFEMForceField.scn index 6e81a7a9359..c08a6908544 100644 --- a/examples/Validation/cantilever_beam/hexahedron/corotational/sequential/matrixfree/HexahedronCorotationalFEMForceField.scn +++ b/examples/Validation/cantilever_beam/hexahedron/corotational/sequential/matrixfree/HexahedronCorotationalFEMForceField.scn @@ -4,7 +4,7 @@ - diff --git a/examples/Validation/cantilever_beam/tetrahedron/corotational/parallel/assembled/TetrahedronCorotationalFEMForceField.scn b/examples/Validation/cantilever_beam/tetrahedron/corotational/parallel/assembled/TetrahedronCorotationalFEMForceField.scn index 603cb2252e8..800334cf4b8 100644 --- a/examples/Validation/cantilever_beam/tetrahedron/corotational/parallel/assembled/TetrahedronCorotationalFEMForceField.scn +++ b/examples/Validation/cantilever_beam/tetrahedron/corotational/parallel/assembled/TetrahedronCorotationalFEMForceField.scn @@ -12,7 +12,7 @@ - diff --git a/examples/Validation/cantilever_beam/tetrahedron/corotational/parallel/matrixfree/TetrahedronCorotationalFEMForceField.scn b/examples/Validation/cantilever_beam/tetrahedron/corotational/parallel/matrixfree/TetrahedronCorotationalFEMForceField.scn index 3c089fe1530..6c7473a988d 100644 --- a/examples/Validation/cantilever_beam/tetrahedron/corotational/parallel/matrixfree/TetrahedronCorotationalFEMForceField.scn +++ b/examples/Validation/cantilever_beam/tetrahedron/corotational/parallel/matrixfree/TetrahedronCorotationalFEMForceField.scn @@ -10,7 +10,7 @@ - diff --git a/examples/Validation/cantilever_beam/tetrahedron/corotational/sequential/assembled/TetrahedronCorotationalFEMForceField.scn b/examples/Validation/cantilever_beam/tetrahedron/corotational/sequential/assembled/TetrahedronCorotationalFEMForceField.scn index 3d034353b0d..9cacdee3bc1 100644 --- a/examples/Validation/cantilever_beam/tetrahedron/corotational/sequential/assembled/TetrahedronCorotationalFEMForceField.scn +++ b/examples/Validation/cantilever_beam/tetrahedron/corotational/sequential/assembled/TetrahedronCorotationalFEMForceField.scn @@ -12,7 +12,7 @@ - diff --git a/examples/Validation/cantilever_beam/tetrahedron/corotational/sequential/matrixfree/TetrahedronCorotationalFEMForceField.scn b/examples/Validation/cantilever_beam/tetrahedron/corotational/sequential/matrixfree/TetrahedronCorotationalFEMForceField.scn index 0198ae6e6c1..219ca285d73 100644 --- a/examples/Validation/cantilever_beam/tetrahedron/corotational/sequential/matrixfree/TetrahedronCorotationalFEMForceField.scn +++ b/examples/Validation/cantilever_beam/tetrahedron/corotational/sequential/matrixfree/TetrahedronCorotationalFEMForceField.scn @@ -10,7 +10,7 @@ - From 5265afc47a4faf6d3f3042edc1bf449cbfbc3d76 Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Fri, 5 Jun 2026 08:38:57 +0200 Subject: [PATCH 09/12] rename ElementLinearSmallStrainFEMForceField to LinearSmallStrainFEMForceField --- .../SolidMechanics/FEM/Elastic/CMakeLists.txt | 6 +- .../ElementLinearSmallStrainFEMForceField.cpp | 59 ------------------- .../LinearSmallStrainFEMForceField.cpp | 59 +++++++++++++++++++ ...eld.h => LinearSmallStrainFEMForceField.h} | 26 ++++---- ...inl => LinearSmallStrainFEMForceField.inl} | 14 ++--- .../solidmechanics/fem/elastic/init.cpp | 4 +- ...xahedronLinearSmallStrainFEMForceField.scn | 2 +- ...xahedronLinearSmallStrainFEMForceField.scn | 2 +- ...xahedronLinearSmallStrainFEMForceField.scn | 2 +- ...xahedronLinearSmallStrainFEMForceField.scn | 2 +- ...rahedronLinearSmallStrainFEMForceField.scn | 2 +- ...rahedronLinearSmallStrainFEMForceField.scn | 2 +- ...rahedronLinearSmallStrainFEMForceField.scn | 2 +- ...rahedronLinearSmallStrainFEMForceField.scn | 2 +- 14 files changed, 92 insertions(+), 92 deletions(-) delete mode 100644 Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.cpp create mode 100644 Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/LinearSmallStrainFEMForceField.cpp rename Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/{ElementLinearSmallStrainFEMForceField.h => LinearSmallStrainFEMForceField.h} (79%) rename Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/{ElementLinearSmallStrainFEMForceField.inl => LinearSmallStrainFEMForceField.inl} (92%) diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/CMakeLists.txt b/Sofa/Component/SolidMechanics/FEM/Elastic/CMakeLists.txt index ff8e89af2be..fddd6033a0d 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/CMakeLists.txt +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/CMakeLists.txt @@ -15,8 +15,8 @@ set(HEADER_FILES ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/BeamFEMForceField.inl ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/CorotationalFEMForceField.h ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/CorotationalFEMForceField.inl - ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/ElementLinearSmallStrainFEMForceField.h - ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/ElementLinearSmallStrainFEMForceField.inl + ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/LinearSmallStrainFEMForceField.h + ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/LinearSmallStrainFEMForceField.inl ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/FastTetrahedralCorotationalForceField.h ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/FastTetrahedralCorotationalForceField.inl ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/FEMForceField.h @@ -69,7 +69,7 @@ set(SOURCE_FILES ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/BaseLinearElasticityFEMForceField.cpp ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/BeamFEMForceField.cpp ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/CorotationalFEMForceField.cpp - ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/ElementLinearSmallStrainFEMForceField.cpp + ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/LinearSmallStrainFEMForceField.cpp ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/FastTetrahedralCorotationalForceField.cpp ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/FEMForceField.cpp ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/HexahedralFEMForceField.cpp diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.cpp b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.cpp deleted file mode 100644 index 2d6cc35ecec..00000000000 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/****************************************************************************** -* SOFA, Simulation Open-Framework Architecture * -* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU Lesser General Public License as published by * -* the Free Software Foundation; either version 2.1 of the License, or (at * -* your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but WITHOUT * -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * -* for more details. * -* * -* You should have received a copy of the GNU Lesser General Public License * -* along with this program. If not, see . * -******************************************************************************* -* Authors: The SOFA Team and external contributors (see Authors.txt) * -* * -* Contact information: contact@sofa-framework.org * -******************************************************************************/ -#define ELASTICITY_COMPONENT_ELEMENT_LINEAR_SMALL_STRAIN_FEM_FORCE_FIELD_CPP - -#include - -#include -#include - -namespace sofa::component::solidmechanics::fem::elastic -{ - -void registerElementLinearSmallStrainFEMForceField(sofa::core::ObjectFactory* factory) -{ - factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law assuming small strain") - .add< ElementLinearSmallStrainFEMForceField >() - .add< ElementLinearSmallStrainFEMForceField >() - .add< ElementLinearSmallStrainFEMForceField >() - .add< ElementLinearSmallStrainFEMForceField >() - .add< ElementLinearSmallStrainFEMForceField >() - .add< ElementLinearSmallStrainFEMForceField >() - .add< ElementLinearSmallStrainFEMForceField >() - .add< ElementLinearSmallStrainFEMForceField >() - .add< ElementLinearSmallStrainFEMForceField >() - .add< ElementLinearSmallStrainFEMForceField >() - ); -} - -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; - -} diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/LinearSmallStrainFEMForceField.cpp b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/LinearSmallStrainFEMForceField.cpp new file mode 100644 index 00000000000..52a1eb9a6e2 --- /dev/null +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/LinearSmallStrainFEMForceField.cpp @@ -0,0 +1,59 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture * +* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * +* * +* This program is free software; you can redistribute it and/or modify it * +* under the terms of the GNU Lesser General Public License as published by * +* the Free Software Foundation; either version 2.1 of the License, or (at * +* your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, but WITHOUT * +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * +* for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with this program. If not, see . * +******************************************************************************* +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#define SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_LINEAR_SMALL_STRAIN_FEM_FORCE_FIELD_CPP + +#include + +#include +#include + +namespace sofa::component::solidmechanics::fem::elastic +{ + +void registerLinearSmallStrainFEMForceField(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law assuming small strain") + .add< LinearSmallStrainFEMForceField >() + .add< LinearSmallStrainFEMForceField >() + .add< LinearSmallStrainFEMForceField >() + .add< LinearSmallStrainFEMForceField >() + .add< LinearSmallStrainFEMForceField >() + .add< LinearSmallStrainFEMForceField >() + .add< LinearSmallStrainFEMForceField >() + .add< LinearSmallStrainFEMForceField >() + .add< LinearSmallStrainFEMForceField >() + .add< LinearSmallStrainFEMForceField >() + ); +} + +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; + +} diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.h b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/LinearSmallStrainFEMForceField.h similarity index 79% rename from Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.h rename to Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/LinearSmallStrainFEMForceField.h index 456142fe527..cc48d5787e8 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.h +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/LinearSmallStrainFEMForceField.h @@ -35,13 +35,13 @@ namespace sofa::component::solidmechanics::fem::elastic { template -class ElementLinearSmallStrainFEMForceField : +class LinearSmallStrainFEMForceField : public BaseElementLinearFEMForceField, public FEMForceField { public: SOFA_CLASS2( - SOFA_TEMPLATE2(ElementLinearSmallStrainFEMForceField, DataTypes, ElementType), + SOFA_TEMPLATE2(LinearSmallStrainFEMForceField, DataTypes, ElementType), SOFA_TEMPLATE2(BaseElementLinearFEMForceField, DataTypes, ElementType), SOFA_TEMPLATE2(FEMForceField, DataTypes, ElementType)); @@ -81,17 +81,17 @@ class ElementLinearSmallStrainFEMForceField : }; -#if !defined(ELASTICITY_COMPONENT_ELEMENT_LINEAR_SMALL_STRAIN_FEM_FORCE_FIELD_CPP) -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; +#if !defined(SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_LINEAR_SMALL_STRAIN_FEM_FORCE_FIELD_CPP) +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; #endif } // namespace sofa::component::solidmechanics::fem::elastic diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.inl b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/LinearSmallStrainFEMForceField.inl similarity index 92% rename from Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.inl rename to Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/LinearSmallStrainFEMForceField.inl index 8967dc3d4a2..6fea5667a99 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.inl +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/LinearSmallStrainFEMForceField.inl @@ -20,7 +20,7 @@ * Contact information: contact@sofa-framework.org * ******************************************************************************/ #pragma once -#include +#include #include #include @@ -28,7 +28,7 @@ namespace sofa::component::solidmechanics::fem::elastic { template -void ElementLinearSmallStrainFEMForceField::init() +void LinearSmallStrainFEMForceField::init() { BaseElementLinearFEMForceField::init(); FEMForceField::init(); @@ -41,7 +41,7 @@ void ElementLinearSmallStrainFEMForceField::init() template -void ElementLinearSmallStrainFEMForceField::computeElementsForces( +void LinearSmallStrainFEMForceField::computeElementsForces( const sofa::simulation::Range& range, const sofa::core::MechanicalParams* mparams, sofa::type::vector& elementForces, @@ -72,7 +72,7 @@ void ElementLinearSmallStrainFEMForceField::computeEleme } template -void ElementLinearSmallStrainFEMForceField::computeElementsForcesDeriv( +void LinearSmallStrainFEMForceField::computeElementsForcesDeriv( const sofa::simulation::Range& range, const sofa::core::MechanicalParams* mparams, sofa::type::vector& elementForcesDeriv, @@ -104,7 +104,7 @@ void ElementLinearSmallStrainFEMForceField::computeEleme } template -void ElementLinearSmallStrainFEMForceField::buildStiffnessMatrix( +void LinearSmallStrainFEMForceField::buildStiffnessMatrix( sofa::core::behavior::StiffnessMatrix* matrix) { if (this->isComponentStateInvalid()) @@ -141,7 +141,7 @@ void ElementLinearSmallStrainFEMForceField::buildStiffne } template -SReal ElementLinearSmallStrainFEMForceField::getPotentialEnergy( +SReal LinearSmallStrainFEMForceField::getPotentialEnergy( const sofa::core::MechanicalParams*, const sofa::DataVecCoord_t& x) const { @@ -149,7 +149,7 @@ SReal ElementLinearSmallStrainFEMForceField::getPotentia } template -void ElementLinearSmallStrainFEMForceField::addKToMatrix( +void LinearSmallStrainFEMForceField::addKToMatrix( sofa::linearalgebra::BaseMatrix* matrix, SReal kFact, unsigned& offset) { if (this->isComponentStateInvalid()) diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/init.cpp b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/init.cpp index 2cd823fc529..2c37e45f155 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/init.cpp +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/init.cpp @@ -28,12 +28,12 @@ namespace sofa::component::solidmechanics::fem::elastic extern void registerBeamFEMForceField(sofa::core::ObjectFactory* factory); extern void registerCorotationalFEMForceField(sofa::core::ObjectFactory* factory); -extern void registerElementLinearSmallStrainFEMForceField(sofa::core::ObjectFactory* factory); extern void registerFastTetrahedralCorotationalForceField(sofa::core::ObjectFactory* factory); extern void registerHexahedralFEMForceField(sofa::core::ObjectFactory* factory); extern void registerHexahedralFEMForceFieldAndMass(sofa::core::ObjectFactory* factory); extern void registerHexahedronFEMForceField(sofa::core::ObjectFactory* factory); extern void registerHexahedronFEMForceFieldAndMass(sofa::core::ObjectFactory* factory); +extern void registerLinearSmallStrainFEMForceField(sofa::core::ObjectFactory* factory); extern void registerQuadBendingFEMForceField(sofa::core::ObjectFactory* factory); extern void registerTetrahedralCorotationalFEMForceField(sofa::core::ObjectFactory* factory); extern void registerTetrahedronFEMForceField(sofa::core::ObjectFactory* factory); @@ -68,12 +68,12 @@ void registerObjects(sofa::core::ObjectFactory* factory) { registerBeamFEMForceField(factory); registerCorotationalFEMForceField(factory); - registerElementLinearSmallStrainFEMForceField(factory); registerFastTetrahedralCorotationalForceField(factory); registerHexahedralFEMForceField(factory); registerHexahedralFEMForceFieldAndMass(factory); registerHexahedronFEMForceField(factory); registerHexahedronFEMForceFieldAndMass(factory); + registerLinearSmallStrainFEMForceField(factory); registerQuadBendingFEMForceField(factory); registerTetrahedralCorotationalFEMForceField(factory); registerTetrahedronFEMForceField(factory); diff --git a/examples/Validation/cantilever_beam/hexahedron/linear/parallel/assembled/HexahedronLinearSmallStrainFEMForceField.scn b/examples/Validation/cantilever_beam/hexahedron/linear/parallel/assembled/HexahedronLinearSmallStrainFEMForceField.scn index 5895dacbf91..f248d50ec51 100644 --- a/examples/Validation/cantilever_beam/hexahedron/linear/parallel/assembled/HexahedronLinearSmallStrainFEMForceField.scn +++ b/examples/Validation/cantilever_beam/hexahedron/linear/parallel/assembled/HexahedronLinearSmallStrainFEMForceField.scn @@ -6,7 +6,7 @@ - diff --git a/examples/Validation/cantilever_beam/hexahedron/linear/parallel/matrixfree/HexahedronLinearSmallStrainFEMForceField.scn b/examples/Validation/cantilever_beam/hexahedron/linear/parallel/matrixfree/HexahedronLinearSmallStrainFEMForceField.scn index b170bcc1fad..1d1906ff28e 100644 --- a/examples/Validation/cantilever_beam/hexahedron/linear/parallel/matrixfree/HexahedronLinearSmallStrainFEMForceField.scn +++ b/examples/Validation/cantilever_beam/hexahedron/linear/parallel/matrixfree/HexahedronLinearSmallStrainFEMForceField.scn @@ -4,7 +4,7 @@ - diff --git a/examples/Validation/cantilever_beam/hexahedron/linear/sequential/assembled/HexahedronLinearSmallStrainFEMForceField.scn b/examples/Validation/cantilever_beam/hexahedron/linear/sequential/assembled/HexahedronLinearSmallStrainFEMForceField.scn index 0eab370dfc8..661c3d7ccb9 100644 --- a/examples/Validation/cantilever_beam/hexahedron/linear/sequential/assembled/HexahedronLinearSmallStrainFEMForceField.scn +++ b/examples/Validation/cantilever_beam/hexahedron/linear/sequential/assembled/HexahedronLinearSmallStrainFEMForceField.scn @@ -6,7 +6,7 @@ - diff --git a/examples/Validation/cantilever_beam/hexahedron/linear/sequential/matrixfree/HexahedronLinearSmallStrainFEMForceField.scn b/examples/Validation/cantilever_beam/hexahedron/linear/sequential/matrixfree/HexahedronLinearSmallStrainFEMForceField.scn index 18a76a8c91b..2cfec24cb83 100644 --- a/examples/Validation/cantilever_beam/hexahedron/linear/sequential/matrixfree/HexahedronLinearSmallStrainFEMForceField.scn +++ b/examples/Validation/cantilever_beam/hexahedron/linear/sequential/matrixfree/HexahedronLinearSmallStrainFEMForceField.scn @@ -4,7 +4,7 @@ - diff --git a/examples/Validation/cantilever_beam/tetrahedron/linear/parallel/assembled/TetrahedronLinearSmallStrainFEMForceField.scn b/examples/Validation/cantilever_beam/tetrahedron/linear/parallel/assembled/TetrahedronLinearSmallStrainFEMForceField.scn index 52c91d8c6f4..daa01ccb236 100644 --- a/examples/Validation/cantilever_beam/tetrahedron/linear/parallel/assembled/TetrahedronLinearSmallStrainFEMForceField.scn +++ b/examples/Validation/cantilever_beam/tetrahedron/linear/parallel/assembled/TetrahedronLinearSmallStrainFEMForceField.scn @@ -12,7 +12,7 @@ - diff --git a/examples/Validation/cantilever_beam/tetrahedron/linear/parallel/matrixfree/TetrahedronLinearSmallStrainFEMForceField.scn b/examples/Validation/cantilever_beam/tetrahedron/linear/parallel/matrixfree/TetrahedronLinearSmallStrainFEMForceField.scn index e4f0da75eba..56e8afd6cf0 100644 --- a/examples/Validation/cantilever_beam/tetrahedron/linear/parallel/matrixfree/TetrahedronLinearSmallStrainFEMForceField.scn +++ b/examples/Validation/cantilever_beam/tetrahedron/linear/parallel/matrixfree/TetrahedronLinearSmallStrainFEMForceField.scn @@ -10,7 +10,7 @@ - diff --git a/examples/Validation/cantilever_beam/tetrahedron/linear/sequential/assembled/TetrahedronLinearSmallStrainFEMForceField.scn b/examples/Validation/cantilever_beam/tetrahedron/linear/sequential/assembled/TetrahedronLinearSmallStrainFEMForceField.scn index eaaa5d32a54..c7e260d7a23 100644 --- a/examples/Validation/cantilever_beam/tetrahedron/linear/sequential/assembled/TetrahedronLinearSmallStrainFEMForceField.scn +++ b/examples/Validation/cantilever_beam/tetrahedron/linear/sequential/assembled/TetrahedronLinearSmallStrainFEMForceField.scn @@ -12,7 +12,7 @@ - diff --git a/examples/Validation/cantilever_beam/tetrahedron/linear/sequential/matrixfree/TetrahedronLinearSmallStrainFEMForceField.scn b/examples/Validation/cantilever_beam/tetrahedron/linear/sequential/matrixfree/TetrahedronLinearSmallStrainFEMForceField.scn index 40ba7eff557..329bb440a61 100644 --- a/examples/Validation/cantilever_beam/tetrahedron/linear/sequential/matrixfree/TetrahedronLinearSmallStrainFEMForceField.scn +++ b/examples/Validation/cantilever_beam/tetrahedron/linear/sequential/matrixfree/TetrahedronLinearSmallStrainFEMForceField.scn @@ -10,7 +10,7 @@ - From fcb33652280b2f8f987f93bec65fe60a429806b9 Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Fri, 5 Jun 2026 08:42:58 +0200 Subject: [PATCH 10/12] rename ElementFEMMass to FEMMass --- Sofa/Component/Mass/CMakeLists.txt | 10 ++-- .../sofa/component/mass/ElementFEMMass.cpp | 58 ------------------- .../Mass/src/sofa/component/mass/FEMMass.cpp | 58 +++++++++++++++++++ .../mass/{ElementFEMMass.h => FEMMass.h} | 32 +++++----- .../mass/{ElementFEMMass.inl => FEMMass.inl} | 26 ++++----- Sofa/Component/Mass/tests/CMakeLists.txt | 4 +- ...ass].cpp => MassTestCreation[FEMMass].cpp} | 6 +- .../Mapping/Hexa2PrismTopologicalMapping.scn | 2 +- 8 files changed, 98 insertions(+), 98 deletions(-) delete mode 100644 Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.cpp create mode 100644 Sofa/Component/Mass/src/sofa/component/mass/FEMMass.cpp rename Sofa/Component/Mass/src/sofa/component/mass/{ElementFEMMass.h => FEMMass.h} (89%) rename Sofa/Component/Mass/src/sofa/component/mass/{ElementFEMMass.inl => FEMMass.inl} (93%) rename Sofa/Component/Mass/tests/{MassTestCreation[ElementFEMMass].cpp => MassTestCreation[FEMMass].cpp} (95%) diff --git a/Sofa/Component/Mass/CMakeLists.txt b/Sofa/Component/Mass/CMakeLists.txt index d43240fb14d..9924a1916ac 100644 --- a/Sofa/Component/Mass/CMakeLists.txt +++ b/Sofa/Component/Mass/CMakeLists.txt @@ -4,13 +4,11 @@ project(Sofa.Component.Mass LANGUAGES CXX) set(SOFACOMPONENTMASS_SOURCE_DIR "src/sofa/component/mass") set(HEADER_FILES - ${SOFACOMPONENTMASS_SOURCE_DIR}/config.h.in - ${SOFACOMPONENTMASS_SOURCE_DIR}/init.h ${SOFACOMPONENTMASS_SOURCE_DIR}/AddMToMatrixFunctor.h ${SOFACOMPONENTMASS_SOURCE_DIR}/DiagonalMass.h ${SOFACOMPONENTMASS_SOURCE_DIR}/DiagonalMass.inl - ${SOFACOMPONENTMASS_SOURCE_DIR}/ElementFEMMass.h - ${SOFACOMPONENTMASS_SOURCE_DIR}/ElementFEMMass.inl + ${SOFACOMPONENTMASS_SOURCE_DIR}/FEMMass.h + ${SOFACOMPONENTMASS_SOURCE_DIR}/FEMMass.inl ${SOFACOMPONENTMASS_SOURCE_DIR}/MassType.h ${SOFACOMPONENTMASS_SOURCE_DIR}/MeshMatrixMass.h ${SOFACOMPONENTMASS_SOURCE_DIR}/MeshMatrixMass.inl @@ -19,12 +17,14 @@ set(HEADER_FILES ${SOFACOMPONENTMASS_SOURCE_DIR}/UniformMass.h ${SOFACOMPONENTMASS_SOURCE_DIR}/UniformMass.inl ${SOFACOMPONENTMASS_SOURCE_DIR}/VecMassType.h + ${SOFACOMPONENTMASS_SOURCE_DIR}/config.h.in + ${SOFACOMPONENTMASS_SOURCE_DIR}/init.h ) set(SOURCE_FILES ${SOFACOMPONENTMASS_SOURCE_DIR}/init.cpp ${SOFACOMPONENTMASS_SOURCE_DIR}/DiagonalMass.cpp - ${SOFACOMPONENTMASS_SOURCE_DIR}/ElementFEMMass.cpp + ${SOFACOMPONENTMASS_SOURCE_DIR}/FEMMass.cpp ${SOFACOMPONENTMASS_SOURCE_DIR}/MeshMatrixMass.cpp ${SOFACOMPONENTMASS_SOURCE_DIR}/NodalMassDensity.cpp ${SOFACOMPONENTMASS_SOURCE_DIR}/UniformMass.cpp diff --git a/Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.cpp b/Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.cpp deleted file mode 100644 index 947400539e6..00000000000 --- a/Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/****************************************************************************** -* SOFA, Simulation Open-Framework Architecture * -* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU Lesser General Public License as published by * -* the Free Software Foundation; either version 2.1 of the License, or (at * -* your option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but WITHOUT * -* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * -* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * -* for more details. * -* * -* You should have received a copy of the GNU Lesser General Public License * -* along with this program. If not, see . * -******************************************************************************* -* Authors: The SOFA Team and external contributors (see Authors.txt) * -* * -* Contact information: contact@sofa-framework.org * -******************************************************************************/ -#define SOFA_COMPONENT_MASS_ELEMENTFEMMASS_CPP -#include -#include -#include -#include - -namespace sofa::component::mass -{ - -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; - -void registerFEMMass(sofa::core::ObjectFactory* factory) -{ - factory->registerObjects(sofa::core::ObjectRegistrationData("Finite-element mass (inertia and body force)") - .add< ElementFEMMass >() - .add< ElementFEMMass >() - .add< ElementFEMMass >() - .add< ElementFEMMass >() - .add< ElementFEMMass >() - .add< ElementFEMMass >() - .add< ElementFEMMass >() - .add< ElementFEMMass >() - .add< ElementFEMMass >() - .add< ElementFEMMass >() - ); -} - -} diff --git a/Sofa/Component/Mass/src/sofa/component/mass/FEMMass.cpp b/Sofa/Component/Mass/src/sofa/component/mass/FEMMass.cpp new file mode 100644 index 00000000000..da683dd56b6 --- /dev/null +++ b/Sofa/Component/Mass/src/sofa/component/mass/FEMMass.cpp @@ -0,0 +1,58 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture * +* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * +* * +* This program is free software; you can redistribute it and/or modify it * +* under the terms of the GNU Lesser General Public License as published by * +* the Free Software Foundation; either version 2.1 of the License, or (at * +* your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, but WITHOUT * +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * +* for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with this program. If not, see . * +******************************************************************************* +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#define SOFA_COMPONENT_MASS_FEMMASS_CPP +#include +#include +#include +#include + +namespace sofa::component::mass +{ + +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; + +void registerFEMMass(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(sofa::core::ObjectRegistrationData("Finite-element mass (inertia and body force)") + .add< FEMMass >() + .add< FEMMass >() + .add< FEMMass >() + .add< FEMMass >() + .add< FEMMass >() + .add< FEMMass >() + .add< FEMMass >() + .add< FEMMass >() + .add< FEMMass >() + .add< FEMMass >() + ); +} + +} diff --git a/Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.h b/Sofa/Component/Mass/src/sofa/component/mass/FEMMass.h similarity index 89% rename from Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.h rename to Sofa/Component/Mass/src/sofa/component/mass/FEMMass.h index 71ae68345d6..28327421c52 100644 --- a/Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.h +++ b/Sofa/Component/Mass/src/sofa/component/mass/FEMMass.h @@ -36,7 +36,7 @@ namespace sofa::component::mass { /** - * @class ElementFEMMass + * @class FEMMass * @brief Computes and stores the mass matrix for a finite element model. * * This class calculates the mass matrix for a given set of finite elements based on a nodal mass density field. @@ -54,14 +54,14 @@ namespace sofa::component::mass * @tparam TElementType The type of finite element (e.g., sofa::geometry::Tetrahedron). */ template -class ElementFEMMass : +class FEMMass : public core::behavior::Mass, public virtual sofa::core::behavior::TopologyAccessor { public: using DataTypes = TDataTypes; using ElementType = TElementType; - SOFA_CLASS2(SOFA_TEMPLATE2(ElementFEMMass, DataTypes, ElementType), + SOFA_CLASS2(SOFA_TEMPLATE2(FEMMass, DataTypes, ElementType), core::behavior::Mass, sofa::core::behavior::TopologyAccessor); @@ -86,7 +86,7 @@ class ElementFEMMass : * This component provides the mass density at each node of the mesh. * It must be present in the context for the mass to be calculated correctly. */ - sofa::SingleLink l_nodalMassDensity; /** @@ -193,7 +193,7 @@ class ElementFEMMass : /** * @brief Default constructor. */ - ElementFEMMass(); + FEMMass(); /** * @brief Performs the internal calculation and assembly of the mass matrix. @@ -249,17 +249,17 @@ class ElementFEMMass : GlobalMassMatrixType m_globalMassMatrix; }; -#if !defined(SOFA_COMPONENT_MASS_ELEMENTFEMMASS_CPP) -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; -template class SOFA_COMPONENT_MASS_API ElementFEMMass; +#if !defined(SOFA_COMPONENT_MASS_FEMMASS_CPP) +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; +template class SOFA_COMPONENT_MASS_API FEMMass; #endif } // namespace sofa::component::mass diff --git a/Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.inl b/Sofa/Component/Mass/src/sofa/component/mass/FEMMass.inl similarity index 93% rename from Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.inl rename to Sofa/Component/Mass/src/sofa/component/mass/FEMMass.inl index 4a2df9212de..36ce2d21249 100644 --- a/Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.inl +++ b/Sofa/Component/Mass/src/sofa/component/mass/FEMMass.inl @@ -20,7 +20,7 @@ * Contact information: contact@sofa-framework.org * ******************************************************************************/ #pragma once -#include +#include #include #include #include @@ -29,14 +29,14 @@ namespace sofa::component::mass { template -ElementFEMMass::ElementFEMMass() +FEMMass::FEMMass() : l_nodalMassDensity(initLink("nodalMassDensity", "Link to nodal mass density")) { } template -void ElementFEMMass::init() +void FEMMass::init() { TopologyAccessor::init(); @@ -57,7 +57,7 @@ void ElementFEMMass::init() } template -void ElementFEMMass::validateNodalMassDensity() +void FEMMass::validateNodalMassDensity() { if (l_nodalMassDensity.empty()) { @@ -76,7 +76,7 @@ void ElementFEMMass::validateNodalMassDensity() template -void ElementFEMMass::elementFEMMass_init() +void FEMMass::elementFEMMass_init() { const auto& elements = FiniteElement::getElementSequence(*this->l_topology); sofa::type::vector elementMassMatrices; @@ -89,7 +89,7 @@ void ElementFEMMass::elementFEMMass_init() } template -void ElementFEMMass::calculateElementMassMatrix( +void FEMMass::calculateElementMassMatrix( const auto& elements, sofa::type::vector &elementMassMatrices) { const auto nbElements = elements.size(); @@ -149,7 +149,7 @@ void ElementFEMMass::calculateElementMassMatrix( } template -void ElementFEMMass::initializeGlobalMassMatrix( +void FEMMass::initializeGlobalMassMatrix( const auto& elements, const sofa::type::vector& elementMassMatrices) { SCOPED_TIMER("elementMassMatrix"); @@ -183,7 +183,7 @@ void ElementFEMMass::initializeGlobalMassMatrix( } template -void ElementFEMMass::addForce(const core::MechanicalParams* mparams, +void FEMMass::addForce(const core::MechanicalParams* mparams, sofa::DataVecDeriv_t& f, const sofa::DataVecCoord_t& x, const sofa::DataVecDeriv_t& v) @@ -213,7 +213,7 @@ void ElementFEMMass::addForce(const core::MechanicalPa } template -void ElementFEMMass::buildMassMatrix( +void FEMMass::buildMassMatrix( sofa::core::behavior::MassMatrixAccumulator* matrices) { for (std::size_t xi = 0; xi < m_globalMassMatrix.rowIndex.size(); ++xi) @@ -234,7 +234,7 @@ void ElementFEMMass::buildMassMatrix( } template -void ElementFEMMass::addMDx(const core::MechanicalParams* mparams, +void FEMMass::addMDx(const core::MechanicalParams* mparams, DataVecDeriv_t& f, const DataVecDeriv_t& dx, SReal factor) @@ -259,7 +259,7 @@ void ElementFEMMass::addMDx(const core::MechanicalPara } template -void ElementFEMMass::accFromF(const core::MechanicalParams* mparams, +void FEMMass::accFromF(const core::MechanicalParams* mparams, DataVecDeriv_t& a, const DataVecDeriv_t& f) { @@ -271,7 +271,7 @@ void ElementFEMMass::accFromF(const core::MechanicalPa } template -SReal ElementFEMMass::getKineticEnergy( +SReal FEMMass::getKineticEnergy( const core::MechanicalParams* mparams, const DataVecDeriv_t& v) const { @@ -297,7 +297,7 @@ SReal ElementFEMMass::getKineticEnergy( } template -SReal ElementFEMMass::getPotentialEnergy( +SReal FEMMass::getPotentialEnergy( const core::MechanicalParams* mparams, const DataVecCoord_t& x) const { diff --git a/Sofa/Component/Mass/tests/CMakeLists.txt b/Sofa/Component/Mass/tests/CMakeLists.txt index d80b20f5111..0d5e6228c26 100644 --- a/Sofa/Component/Mass/tests/CMakeLists.txt +++ b/Sofa/Component/Mass/tests/CMakeLists.txt @@ -4,10 +4,10 @@ project(Sofa.Component.Mass_test) set(SOURCE_FILES DiagonalMass_test.cpp - UniformMass_test.cpp - MassTestCreation[ElementFEMMass].cpp + MassTestCreation[FEMMass].cpp MassTestCreation[MeshMatrixMass].cpp MassTestCreation[UniformMass].cpp + UniformMass_test.cpp ) add_executable(${PROJECT_NAME} ${SOURCE_FILES}) diff --git a/Sofa/Component/Mass/tests/MassTestCreation[ElementFEMMass].cpp b/Sofa/Component/Mass/tests/MassTestCreation[FEMMass].cpp similarity index 95% rename from Sofa/Component/Mass/tests/MassTestCreation[ElementFEMMass].cpp rename to Sofa/Component/Mass/tests/MassTestCreation[FEMMass].cpp index 9a7c75487dc..a4dadaaa65c 100644 --- a/Sofa/Component/Mass/tests/MassTestCreation[ElementFEMMass].cpp +++ b/Sofa/Component/Mass/tests/MassTestCreation[FEMMass].cpp @@ -19,7 +19,7 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ -#include +#include #include #include #include @@ -32,11 +32,11 @@ using MeshTopology = sofa::component::topology::container::constant::MeshTopolog /*************************************************************************************************** - * ElementFEMMass + * FEMMass **************************************************************************************************/ template -struct ElementMass_template_test : public Mass_test> +struct ElementMass_template_test : public Mass_test> { using DataTypes = typename MassParam::DataTypes; diff --git a/examples/Component/Topology/Mapping/Hexa2PrismTopologicalMapping.scn b/examples/Component/Topology/Mapping/Hexa2PrismTopologicalMapping.scn index f94d1b1185b..6b76fd5232f 100644 --- a/examples/Component/Topology/Mapping/Hexa2PrismTopologicalMapping.scn +++ b/examples/Component/Topology/Mapping/Hexa2PrismTopologicalMapping.scn @@ -37,7 +37,7 @@ rotationMethod="polar" computeForceStrategy="sequenced" computeForceDerivStrategy="sequenced"/> - + From 7e9cde6bceb2b85ca209d7bfa51fe517f8fd91fa Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Fri, 19 Jun 2026 13:21:49 +0200 Subject: [PATCH 11/12] adapt to CUDA --- .../plugins/SofaCUDA/Component/CMakeLists.txt | 18 ++++---- .../Component/src/SofaCUDA/component/init.cpp | 8 ++-- ....cpp => CudaCorotationalFEMForceField.cpp} | 44 +++++++++---------- ...ld.cu => CudaCorotationalFEMForceField.cu} | 32 +++++++------- ...ield.h => CudaCorotationalFEMForceField.h} | 30 +++++-------- ....inl => CudaCorotationalFEMForceField.inl} | 34 +++++++------- ...KernelUtils.cuh => CudaFEMKernelUtils.cuh} | 0 ...=> CudaLinearSmallStrainFEMForceField.cpp} | 44 +++++++++---------- ... => CudaLinearSmallStrainFEMForceField.cu} | 22 +++++----- ...h => CudaLinearSmallStrainFEMForceField.h} | 28 ++++-------- ...=> CudaLinearSmallStrainFEMForceField.inl} | 22 +++++----- .../plugins/SofaCUDA/examples/.scene-tests | 22 +++++----- ...=> CudaCorotationalFEMForceField_hexa.scn} | 4 +- ...=> CudaCorotationalFEMForceField_quad.scn} | 2 +- ...> CudaCorotationalFEMForceField_tetra.scn} | 4 +- ...udaCorotationalFEMForceField_triangle.scn} | 2 +- ...daLinearSmallStrainFEMForceField_hexa.scn} | 2 +- ...daLinearSmallStrainFEMForceField_quad.scn} | 2 +- ...aLinearSmallStrainFEMForceField_tetra.scn} | 4 +- ...nearSmallStrainFEMForceField_triangle.scn} | 2 +- .../benchmarks/Hexahedron_corotational.py | 2 +- .../benchmarks/Tetrahedron_corotational.py | 2 +- ...rotationalFEMForceField_tetra_cpu_gpu.scn} | 0 ...ionalFEMForceField_tetra_cpu_gpu.scn.view} | 0 24 files changed, 155 insertions(+), 175 deletions(-) rename applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/{CudaElementCorotationalFEMForceField.cpp => CudaCorotationalFEMForceField.cpp} (62%) rename applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/{CudaElementCorotationalFEMForceField.cu => CudaCorotationalFEMForceField.cu} (90%) rename applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/{CudaElementCorotationalFEMForceField.h => CudaCorotationalFEMForceField.h} (85%) rename applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/{CudaElementCorotationalFEMForceField.inl => CudaCorotationalFEMForceField.inl} (89%) rename applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/{CudaElementFEMKernelUtils.cuh => CudaFEMKernelUtils.cuh} (100%) rename applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/{CudaElementLinearSmallStrainFEMForceField.cpp => CudaLinearSmallStrainFEMForceField.cpp} (61%) rename applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/{CudaElementLinearSmallStrainFEMForceField.cu => CudaLinearSmallStrainFEMForceField.cu} (88%) rename applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/{CudaElementLinearSmallStrainFEMForceField.h => CudaLinearSmallStrainFEMForceField.h} (82%) rename applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/{CudaElementLinearSmallStrainFEMForceField.inl => CudaLinearSmallStrainFEMForceField.inl} (89%) rename applications/plugins/SofaCUDA/examples/ElementFEMForcefield/{CudaElementCorotationalFEMForceField_hexa.scn => CudaCorotationalFEMForceField_hexa.scn} (90%) rename applications/plugins/SofaCUDA/examples/ElementFEMForcefield/{CudaElementCorotationalFEMForceField_quad.scn => CudaCorotationalFEMForceField_quad.scn} (92%) rename applications/plugins/SofaCUDA/examples/ElementFEMForcefield/{CudaElementCorotationalFEMForceField_tetra.scn => CudaCorotationalFEMForceField_tetra.scn} (92%) rename applications/plugins/SofaCUDA/examples/ElementFEMForcefield/{CudaElementCorotationalFEMForceField_triangle.scn => CudaCorotationalFEMForceField_triangle.scn} (92%) rename applications/plugins/SofaCUDA/examples/ElementFEMForcefield/{CudaElementLinearSmallStrainFEMForceField_hexa.scn => CudaLinearSmallStrainFEMForceField_hexa.scn} (94%) rename applications/plugins/SofaCUDA/examples/ElementFEMForcefield/{CudaElementLinearSmallStrainFEMForceField_quad.scn => CudaLinearSmallStrainFEMForceField_quad.scn} (92%) rename applications/plugins/SofaCUDA/examples/ElementFEMForcefield/{CudaElementLinearSmallStrainFEMForceField_tetra.scn => CudaLinearSmallStrainFEMForceField_tetra.scn} (91%) rename applications/plugins/SofaCUDA/examples/ElementFEMForcefield/{CudaElementLinearSmallStrainFEMForceField_triangle.scn => CudaLinearSmallStrainFEMForceField_triangle.scn} (92%) rename applications/plugins/SofaCUDA/examples/ElementFEMForcefield/cpu-gpu_validation/{ElementCorotationalFEMForceField_tetra_cpu_gpu.scn => CorotationalFEMForceField_tetra_cpu_gpu.scn} (100%) rename applications/plugins/SofaCUDA/examples/ElementFEMForcefield/cpu-gpu_validation/{ElementCorotationalFEMForceField_tetra_cpu_gpu.scn.view => CorotationalFEMForceField_tetra_cpu_gpu.scn.view} (100%) diff --git a/applications/plugins/SofaCUDA/Component/CMakeLists.txt b/applications/plugins/SofaCUDA/Component/CMakeLists.txt index ce4d885c90b..effab0275a9 100644 --- a/applications/plugins/SofaCUDA/Component/CMakeLists.txt +++ b/applications/plugins/SofaCUDA/Component/CMakeLists.txt @@ -39,11 +39,11 @@ set(HEADER_FILES ### solidmechanics - ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementFEMKernelUtils.cuh - ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.h - ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.inl - ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.h - ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.inl + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaFEMKernelUtils.cuh + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.inl + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.inl ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.h ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.inl ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.h @@ -116,8 +116,8 @@ set(SOURCE_FILES ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mass/CudaUniformMass.cpp ### Solidmechanics - ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.cpp - ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.cpp ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.cpp ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.cpp ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/tensormass/CudaTetrahedralTensorMassForceField.cpp @@ -188,8 +188,8 @@ set(CUDA_SOURCES ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mass/CudaUniformMass.cu ### solidmechanics - ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.cu - ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.cu + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.cu + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.cu ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.cu ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.cu ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/tensormass/CudaTetrahedralTensorMassForceField.cu diff --git a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/init.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/init.cpp index c6b0ee6b438..968cd603fb6 100644 --- a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/init.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/init.cpp @@ -90,8 +90,8 @@ extern void registerPlaneForceField(sofa::core::ObjectFactory* factory); extern void registerSphereForceField(sofa::core::ObjectFactory* factory); // component::solidmechanics::fem::elastic -extern void registerElementCorotationalFEMForceField(sofa::core::ObjectFactory* factory); -extern void registerElementLinearSmallStrainFEMForceField(sofa::core::ObjectFactory* factory); +extern void registerCorotationalFEMForceField(sofa::core::ObjectFactory* factory); +extern void registerLinearSmallStrainFEMForceField(sofa::core::ObjectFactory* factory); extern void registerHexahedronFEMForceField(sofa::core::ObjectFactory* factory); extern void registerTetrahedronFEMForceField(sofa::core::ObjectFactory* factory); extern void registerTriangularFEMForceFieldOptim(sofa::core::ObjectFactory* factory); @@ -226,8 +226,8 @@ void registerObjects(sofa::core::ObjectFactory* factory) registerLinearForceField(factory); registerPlaneForceField(factory); registerSphereForceField(factory); - registerElementCorotationalFEMForceField(factory); - registerElementLinearSmallStrainFEMForceField(factory); + registerCorotationalFEMForceField(factory); + registerLinearSmallStrainFEMForceField(factory); registerHexahedronFEMForceField(factory); registerTetrahedronFEMForceField(factory); registerTriangularFEMForceFieldOptim(factory); diff --git a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.cpp similarity index 62% rename from applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.cpp index 5cd43daa6d2..ca58990357d 100644 --- a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include namespace sofa::component::solidmechanics::fem::elastic @@ -30,18 +30,18 @@ namespace sofa::component::solidmechanics::fem::elastic using namespace sofa::gpu::cuda; -template class SOFACUDA_COMPONENT_API CudaElementCorotationalFEMForceField; -template class SOFACUDA_COMPONENT_API CudaElementCorotationalFEMForceField; -template class SOFACUDA_COMPONENT_API CudaElementCorotationalFEMForceField; -template class SOFACUDA_COMPONENT_API CudaElementCorotationalFEMForceField; -template class SOFACUDA_COMPONENT_API CudaElementCorotationalFEMForceField; +template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField; +template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField; +template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField; +template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField; +template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFACUDA_COMPONENT_API CudaElementCorotationalFEMForceField; -template class SOFACUDA_COMPONENT_API CudaElementCorotationalFEMForceField; -template class SOFACUDA_COMPONENT_API CudaElementCorotationalFEMForceField; -template class SOFACUDA_COMPONENT_API CudaElementCorotationalFEMForceField; -template class SOFACUDA_COMPONENT_API CudaElementCorotationalFEMForceField; +template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField; +template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField; +template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField; +template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField; +template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField; #endif } // namespace sofa::component::solidmechanics::fem::elastic @@ -49,51 +49,51 @@ template class SOFACUDA_COMPONENT_API CudaElementCorotationalFEMForceFieldregisterObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA for EdgeCorotationalFEMForceField") - .add< CudaElementCorotationalFEMForceField >() + .add< CudaCorotationalFEMForceField >() ); factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA for TriangleCorotationalFEMForceField") - .add< CudaElementCorotationalFEMForceField >() + .add< CudaCorotationalFEMForceField >() ); factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA for QuadCorotationalFEMForceField") - .add< CudaElementCorotationalFEMForceField >() + .add< CudaCorotationalFEMForceField >() ); factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA for TetrahedronCorotationalFEMForceField") - .add< CudaElementCorotationalFEMForceField >() + .add< CudaCorotationalFEMForceField >() ); factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA for HexahedronCorotationalFEMForceField") - .add< CudaElementCorotationalFEMForceField >() + .add< CudaCorotationalFEMForceField >() ); #ifdef SOFA_GPU_CUDA_DOUBLE factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA (double) for EdgeCorotationalFEMForceField") - .add< CudaElementCorotationalFEMForceField >() + .add< CudaCorotationalFEMForceField >() ); factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA (double) for TriangleCorotationalFEMForceField") - .add< CudaElementCorotationalFEMForceField >() + .add< CudaCorotationalFEMForceField >() ); factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA (double) for QuadCorotationalFEMForceField") - .add< CudaElementCorotationalFEMForceField >() + .add< CudaCorotationalFEMForceField >() ); factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA (double) for TetrahedronCorotationalFEMForceField") - .add< CudaElementCorotationalFEMForceField >() + .add< CudaCorotationalFEMForceField >() ); factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA (double) for HexahedronCorotationalFEMForceField") - .add< CudaElementCorotationalFEMForceField >() + .add< CudaCorotationalFEMForceField >() ); #endif } diff --git a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.cu b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.cu similarity index 90% rename from applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.cu rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.cu index 6616637dc55..a34a75c7646 100644 --- a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.cu +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.cu @@ -21,7 +21,7 @@ ******************************************************************************/ #include #include -#include "CudaElementFEMKernelUtils.cuh" +#include "CudaFEMKernelUtils.cuh" namespace sofa::gpu::cuda { @@ -30,7 +30,7 @@ namespace sofa::gpu::cuda * Combined kernel: compute rotations AND per-element forces in one pass. */ template -__global__ void ElementCorotationalFEMForceField_computeRotationsAndForce_kernel( +__global__ void CorotationalFEMForceField_computeRotationsAndForce_kernel( int nbElem, const int* __restrict__ elements, const T* __restrict__ initRotTransposed, @@ -92,7 +92,7 @@ __global__ void ElementCorotationalFEMForceField_computeRotationsAndForce_kernel * Kernel for addForce with pre-computed rotations. */ template -__global__ void ElementCorotationalFEMForceField_computeForce_kernel( +__global__ void CorotationalFEMForceField_computeForce_kernel( int nbElem, const int* __restrict__ elements, const T* __restrict__ rotations, @@ -141,7 +141,7 @@ __global__ void ElementCorotationalFEMForceField_computeForce_kernel( * Kernel for addDForce. */ template -__global__ void ElementCorotationalFEMForceField_computeDForce_kernel( +__global__ void CorotationalFEMForceField_computeDForce_kernel( int nbElem, const int* __restrict__ elements, const T* __restrict__ rotations, @@ -179,7 +179,7 @@ __global__ void ElementCorotationalFEMForceField_computeDForce_kernel( // ===================== Launch functions ===================== template -void ElementCorotationalFEMForceFieldCuda_addForceWithRotations( +void CorotationalFEMForceFieldCuda_addForceWithRotations( unsigned int nbElem, unsigned int nbVertex, unsigned int maxElemPerVertex, @@ -195,7 +195,7 @@ void ElementCorotationalFEMForceFieldCuda_addForceWithRotations( { const int computeThreads = 64; int numBlocks = (nbElem + computeThreads - 1) / computeThreads; - ElementCorotationalFEMForceField_computeRotationsAndForce_kernel + CorotationalFEMForceField_computeRotationsAndForce_kernel <<>>( nbElem, (const int*)elements, @@ -205,7 +205,7 @@ void ElementCorotationalFEMForceFieldCuda_addForceWithRotations( (const T*)x0, (T*)rotationsOut, (T*)eforce); - mycudaDebugError("ElementCorotationalFEMForceField_computeRotationsAndForce_kernel"); + mycudaDebugError("CorotationalFEMForceField_computeRotationsAndForce_kernel"); const int gatherThreads = 256; numBlocks = (nbVertex + gatherThreads - 1) / gatherThreads; @@ -220,7 +220,7 @@ void ElementCorotationalFEMForceFieldCuda_addForceWithRotations( } template -void ElementCorotationalFEMForceFieldCuda_addForce( +void CorotationalFEMForceFieldCuda_addForce( unsigned int nbElem, unsigned int nbVertex, unsigned int maxElemPerVertex, @@ -235,7 +235,7 @@ void ElementCorotationalFEMForceFieldCuda_addForce( { const int computeThreads = 64; int numBlocks = (nbElem + computeThreads - 1) / computeThreads; - ElementCorotationalFEMForceField_computeForce_kernel + CorotationalFEMForceField_computeForce_kernel <<>>( nbElem, (const int*)elements, @@ -244,7 +244,7 @@ void ElementCorotationalFEMForceFieldCuda_addForce( (const T*)x, (const T*)x0, (T*)eforce); - mycudaDebugError("ElementCorotationalFEMForceField_computeForce_kernel"); + mycudaDebugError("CorotationalFEMForceField_computeForce_kernel"); const int gatherThreads = 256; numBlocks = (nbVertex + gatherThreads - 1) / gatherThreads; @@ -259,7 +259,7 @@ void ElementCorotationalFEMForceFieldCuda_addForce( } template -void ElementCorotationalFEMForceFieldCuda_addDForce( +void CorotationalFEMForceFieldCuda_addDForce( unsigned int nbElem, unsigned int nbVertex, unsigned int maxElemPerVertex, @@ -274,7 +274,7 @@ void ElementCorotationalFEMForceFieldCuda_addDForce( { const int computeThreads = 64; int numBlocks = (nbElem + computeThreads - 1) / computeThreads; - ElementCorotationalFEMForceField_computeDForce_kernel + CorotationalFEMForceField_computeDForce_kernel <<>>( nbElem, (const int*)elements, @@ -283,7 +283,7 @@ void ElementCorotationalFEMForceFieldCuda_addDForce( (const T*)dx, (T*)eforce, kFactor); - mycudaDebugError("ElementCorotationalFEMForceField_computeDForce_kernel"); + mycudaDebugError("CorotationalFEMForceField_computeDForce_kernel"); const int gatherThreads = 256; numBlocks = (nbVertex + gatherThreads - 1) / gatherThreads; @@ -300,15 +300,15 @@ void ElementCorotationalFEMForceFieldCuda_addDForce( // ===================== Explicit template instantiations ===================== #define INSTANTIATE_COROTATIONAL(T, NNodes) \ - template void ElementCorotationalFEMForceFieldCuda_addForce( \ + template void CorotationalFEMForceFieldCuda_addForce( \ unsigned int, unsigned int, unsigned int, const void*, const void*, \ const void*, const void*, const void*, void*, void*, const void*); \ - template void ElementCorotationalFEMForceFieldCuda_addDForce( \ + template void CorotationalFEMForceFieldCuda_addDForce( \ unsigned int, unsigned int, unsigned int, const void*, const void*, \ const void*, const void*, void*, void*, const void*, T); #define INSTANTIATE_COROTATIONAL_WITH_ROTATIONS(T, NNodes) \ - template void ElementCorotationalFEMForceFieldCuda_addForceWithRotations( \ + template void CorotationalFEMForceFieldCuda_addForceWithRotations( \ unsigned int, unsigned int, unsigned int, const void*, const void*, \ const void*, const void*, const void*, void*, void*, void*, const void*); diff --git a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.h similarity index 85% rename from applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.h index 820b4c915a1..2d1d5e2f643 100644 --- a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.h +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.h @@ -22,13 +22,13 @@ #pragma once #include -#include +#include namespace sofa::gpu::cuda { template -void ElementCorotationalFEMForceFieldCuda_addForceWithRotations( +void CorotationalFEMForceFieldCuda_addForceWithRotations( unsigned int nbElem, unsigned int nbVertex, unsigned int maxElemPerVertex, @@ -43,7 +43,7 @@ void ElementCorotationalFEMForceFieldCuda_addForceWithRotations( const void* velems); template -void ElementCorotationalFEMForceFieldCuda_addForce( +void CorotationalFEMForceFieldCuda_addForce( unsigned int nbElem, unsigned int nbVertex, unsigned int maxElemPerVertex, @@ -57,7 +57,7 @@ void ElementCorotationalFEMForceFieldCuda_addForce( const void* velems); template -void ElementCorotationalFEMForceFieldCuda_addDForce( +void CorotationalFEMForceFieldCuda_addDForce( unsigned int nbElem, unsigned int nbVertex, unsigned int maxElemPerVertex, @@ -76,7 +76,7 @@ namespace sofa::component::solidmechanics::fem::elastic { /** - * CUDA-accelerated version of ElementCorotationalFEMForceField. + * CUDA-accelerated version of CorotationalFEMForceField. * * Works with any element type (Edge, Triangle, Quad, Tetrahedron, Hexahedron). * The addDForce method (the CG hot path, called ~250 times per timestep) runs entirely on GPU. @@ -87,13 +87,13 @@ namespace sofa::component::solidmechanics::fem::elastic * Kernel 2: gather per-vertex (1 thread/vertex, no atomics) */ template -class CudaElementCorotationalFEMForceField - : public ElementCorotationalFEMForceField +class CudaCorotationalFEMForceField + : public CorotationalFEMForceField { public: SOFA_CLASS( - SOFA_TEMPLATE2(CudaElementCorotationalFEMForceField, DataTypes, ElementType), - SOFA_TEMPLATE2(ElementCorotationalFEMForceField, DataTypes, ElementType)); + SOFA_TEMPLATE2(CudaCorotationalFEMForceField, DataTypes, ElementType), + SOFA_TEMPLATE2(CorotationalFEMForceField, DataTypes, ElementType)); using Real = sofa::Real_t; using Coord = sofa::Coord_t; @@ -101,16 +101,6 @@ class CudaElementCorotationalFEMForceField using VecCoord = sofa::VecCoord_t; using VecDeriv = sofa::VecDeriv_t; - static const std::string GetCustomClassName() - { - return ElementCorotationalFEMForceField::GetCustomClassName(); - } - - static const std::string GetCustomTemplateName() - { - return DataTypes::Name(); - } - void init() override; void addForce( @@ -128,7 +118,7 @@ class CudaElementCorotationalFEMForceField protected: - CudaElementCorotationalFEMForceField() = default; + CudaCorotationalFEMForceField() = default; void uploadStiffnessAndConnectivity(); void uploadRotations(); diff --git a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.inl b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.inl similarity index 89% rename from applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.inl rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.inl index 3cc1e29eea5..982ad644a51 100644 --- a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.inl +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.inl @@ -20,8 +20,8 @@ * Contact information: contact@sofa-framework.org * ******************************************************************************/ #pragma once -#include -#include +#include +#include #include #include @@ -29,9 +29,9 @@ namespace sofa::component::solidmechanics::fem::elastic { template -void CudaElementCorotationalFEMForceField::init() +void CudaCorotationalFEMForceField::init() { - ElementCorotationalFEMForceField::init(); + CorotationalFEMForceField::init(); if (!this->isComponentStateInvalid()) { @@ -41,7 +41,7 @@ void CudaElementCorotationalFEMForceField::init() } template -void CudaElementCorotationalFEMForceField::uploadStiffnessAndConnectivity() +void CudaCorotationalFEMForceField::uploadStiffnessAndConnectivity() { using trait = sofa::component::solidmechanics::fem::elastic::trait; @@ -150,7 +150,7 @@ void CudaElementCorotationalFEMForceField::uploadStiffne } template -void CudaElementCorotationalFEMForceField::uploadRotations() +void CudaCorotationalFEMForceField::uploadRotations() { using trait = sofa::component::solidmechanics::fem::elastic::trait; constexpr auto dim = trait::spatial_dimensions; @@ -174,7 +174,7 @@ void CudaElementCorotationalFEMForceField::uploadRotatio } template -void CudaElementCorotationalFEMForceField::uploadInitialRotationsTransposed() +void CudaCorotationalFEMForceField::uploadInitialRotationsTransposed() { using trait = sofa::component::solidmechanics::fem::elastic::trait; constexpr auto dim = trait::spatial_dimensions; @@ -204,7 +204,7 @@ void CudaElementCorotationalFEMForceField::uploadInitial } template -void CudaElementCorotationalFEMForceField::downloadRotations() +void CudaCorotationalFEMForceField::downloadRotations() { using trait = sofa::component::solidmechanics::fem::elastic::trait; constexpr auto dim = trait::spatial_dimensions; @@ -225,17 +225,17 @@ void CudaElementCorotationalFEMForceField::downloadRotat } template -void CudaElementCorotationalFEMForceField::buildStiffnessMatrix( +void CudaCorotationalFEMForceField::buildStiffnessMatrix( sofa::core::behavior::StiffnessMatrix* matrix) { if (m_gpuRotationMethodSupported && m_gpuRotationsUploaded) downloadRotations(); - ElementCorotationalFEMForceField::buildStiffnessMatrix(matrix); + CorotationalFEMForceField::buildStiffnessMatrix(matrix); } template -void CudaElementCorotationalFEMForceField::addForce( +void CudaCorotationalFEMForceField::addForce( const sofa::core::MechanicalParams* mparams, sofa::DataVecDeriv_t& d_f, const sofa::DataVecCoord_t& d_x, @@ -246,7 +246,7 @@ void CudaElementCorotationalFEMForceField::addForce( if (!m_gpuDataUploaded) { - ElementCorotationalFEMForceField::addForce(mparams, d_f, d_x, d_v); + CorotationalFEMForceField::addForce(mparams, d_f, d_x, d_v); uploadRotations(); return; } @@ -271,7 +271,7 @@ void CudaElementCorotationalFEMForceField::addForce( { if (m_gpuRotationMethodSupported) { - gpu::cuda::ElementCorotationalFEMForceFieldCuda_addForceWithRotations( + gpu::cuda::CorotationalFEMForceFieldCuda_addForceWithRotations( nbElem, nbVertex, m_maxElemPerVertex, m_gpuElements.deviceRead(), m_gpuInitialRotationsTransposed.deviceRead(), m_gpuStiffness.deviceRead(), x.deviceRead(), x0.deviceRead(), @@ -288,7 +288,7 @@ void CudaElementCorotationalFEMForceField::addForce( this->computeRotations(this->m_rotations, x, x0); uploadRotations(); - gpu::cuda::ElementCorotationalFEMForceFieldCuda_addForce( + gpu::cuda::CorotationalFEMForceFieldCuda_addForce( nbElem, nbVertex, m_maxElemPerVertex, m_gpuElements.deviceRead(), m_gpuRotations.deviceRead(), m_gpuStiffness.deviceRead(), x.deviceRead(), x0.deviceRead(), @@ -299,7 +299,7 @@ void CudaElementCorotationalFEMForceField::addForce( } template -void CudaElementCorotationalFEMForceField::addDForce( +void CudaCorotationalFEMForceField::addDForce( const sofa::core::MechanicalParams* mparams, sofa::DataVecDeriv_t& d_df, const sofa::DataVecDeriv_t& d_dx) @@ -310,7 +310,7 @@ void CudaElementCorotationalFEMForceField::addDForce( if (!m_gpuDataUploaded || !m_gpuRotationsUploaded) { // Fallback to CPU if GPU data not ready - ElementCorotationalFEMForceField::addDForce(mparams, d_df, d_dx); + CorotationalFEMForceField::addDForce(mparams, d_df, d_dx); return; } @@ -332,7 +332,7 @@ void CudaElementCorotationalFEMForceField::addDForce( const auto nbElem = static_cast(elements.size()); const auto nbVertex = static_cast(dx.size()); - gpu::cuda::ElementCorotationalFEMForceFieldCuda_addDForce( + gpu::cuda::CorotationalFEMForceFieldCuda_addDForce( nbElem, nbVertex, m_maxElemPerVertex, m_gpuElements.deviceRead(), m_gpuRotations.deviceRead(), m_gpuStiffness.deviceRead(), dx.deviceRead(), diff --git a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementFEMKernelUtils.cuh b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaFEMKernelUtils.cuh similarity index 100% rename from applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementFEMKernelUtils.cuh rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaFEMKernelUtils.cuh diff --git a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.cpp similarity index 61% rename from applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.cpp index d8d3b9ef1c3..0c624c5b03e 100644 --- a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include namespace sofa::component::solidmechanics::fem::elastic @@ -30,18 +30,18 @@ namespace sofa::component::solidmechanics::fem::elastic using namespace sofa::gpu::cuda; -template class SOFACUDA_COMPONENT_API CudaElementLinearSmallStrainFEMForceField; -template class SOFACUDA_COMPONENT_API CudaElementLinearSmallStrainFEMForceField; -template class SOFACUDA_COMPONENT_API CudaElementLinearSmallStrainFEMForceField; -template class SOFACUDA_COMPONENT_API CudaElementLinearSmallStrainFEMForceField; -template class SOFACUDA_COMPONENT_API CudaElementLinearSmallStrainFEMForceField; +template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField; +template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField; +template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField; +template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField; +template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFACUDA_COMPONENT_API CudaElementLinearSmallStrainFEMForceField; -template class SOFACUDA_COMPONENT_API CudaElementLinearSmallStrainFEMForceField; -template class SOFACUDA_COMPONENT_API CudaElementLinearSmallStrainFEMForceField; -template class SOFACUDA_COMPONENT_API CudaElementLinearSmallStrainFEMForceField; -template class SOFACUDA_COMPONENT_API CudaElementLinearSmallStrainFEMForceField; +template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField; +template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField; +template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField; +template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField; +template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField; #endif } // namespace sofa::component::solidmechanics::fem::elastic @@ -49,51 +49,51 @@ template class SOFACUDA_COMPONENT_API CudaElementLinearSmallStrainFEMForceField< namespace sofa::gpu::cuda { -void registerElementLinearSmallStrainFEMForceField(sofa::core::ObjectFactory* factory) +void registerLinearSmallStrainFEMForceField(sofa::core::ObjectFactory* factory) { using namespace sofa::component::solidmechanics::fem::elastic; factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA for EdgeLinearSmallStrainFEMForceField") - .add< CudaElementLinearSmallStrainFEMForceField >() + .add< CudaLinearSmallStrainFEMForceField >() ); factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA for TriangleLinearSmallStrainFEMForceField") - .add< CudaElementLinearSmallStrainFEMForceField >() + .add< CudaLinearSmallStrainFEMForceField >() ); factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA for QuadLinearSmallStrainFEMForceField") - .add< CudaElementLinearSmallStrainFEMForceField >() + .add< CudaLinearSmallStrainFEMForceField >() ); factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA for TetrahedronLinearSmallStrainFEMForceField") - .add< CudaElementLinearSmallStrainFEMForceField >() + .add< CudaLinearSmallStrainFEMForceField >() ); factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA for HexahedronLinearSmallStrainFEMForceField") - .add< CudaElementLinearSmallStrainFEMForceField >() + .add< CudaLinearSmallStrainFEMForceField >() ); #ifdef SOFA_GPU_CUDA_DOUBLE factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA (double) for EdgeLinearSmallStrainFEMForceField") - .add< CudaElementLinearSmallStrainFEMForceField >() + .add< CudaLinearSmallStrainFEMForceField >() ); factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA (double) for TriangleLinearSmallStrainFEMForceField") - .add< CudaElementLinearSmallStrainFEMForceField >() + .add< CudaLinearSmallStrainFEMForceField >() ); factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA (double) for QuadLinearSmallStrainFEMForceField") - .add< CudaElementLinearSmallStrainFEMForceField >() + .add< CudaLinearSmallStrainFEMForceField >() ); factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA (double) for TetrahedronLinearSmallStrainFEMForceField") - .add< CudaElementLinearSmallStrainFEMForceField >() + .add< CudaLinearSmallStrainFEMForceField >() ); factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA (double) for HexahedronLinearSmallStrainFEMForceField") - .add< CudaElementLinearSmallStrainFEMForceField >() + .add< CudaLinearSmallStrainFEMForceField >() ); #endif } diff --git a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.cu b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.cu similarity index 88% rename from applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.cu rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.cu index 9d0195ab580..e625c701d49 100644 --- a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.cu +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.cu @@ -21,7 +21,7 @@ ******************************************************************************/ #include #include -#include "CudaElementFEMKernelUtils.cuh" +#include "CudaFEMKernelUtils.cuh" namespace sofa::gpu::cuda { @@ -30,7 +30,7 @@ namespace sofa::gpu::cuda * Kernel for addForce: f = -K * (x - x0) */ template -__global__ void ElementLinearSmallStrainFEMForceField_computeForce_kernel( +__global__ void LinearSmallStrainFEMForceField_computeForce_kernel( int nbElem, const int* __restrict__ elements, const T* __restrict__ stiffness, @@ -61,7 +61,7 @@ __global__ void ElementLinearSmallStrainFEMForceField_computeForce_kernel( * Kernel for addDForce: df = -kFactor * K * dx */ template -__global__ void ElementLinearSmallStrainFEMForceField_computeDForce_kernel( +__global__ void LinearSmallStrainFEMForceField_computeDForce_kernel( int nbElem, const int* __restrict__ elements, const T* __restrict__ stiffness, @@ -91,7 +91,7 @@ __global__ void ElementLinearSmallStrainFEMForceField_computeDForce_kernel( // ===================== Launch functions ===================== template -void ElementLinearSmallStrainFEMForceFieldCuda_addForce( +void LinearSmallStrainFEMForceFieldCuda_addForce( unsigned int nbElem, unsigned int nbVertex, unsigned int maxElemPerVertex, @@ -105,7 +105,7 @@ void ElementLinearSmallStrainFEMForceFieldCuda_addForce( { const int computeThreads = 64; int numBlocks = (nbElem + computeThreads - 1) / computeThreads; - ElementLinearSmallStrainFEMForceField_computeForce_kernel + LinearSmallStrainFEMForceField_computeForce_kernel <<>>( nbElem, (const int*)elements, @@ -113,7 +113,7 @@ void ElementLinearSmallStrainFEMForceFieldCuda_addForce( (const T*)x, (const T*)x0, (T*)eforce); - mycudaDebugError("ElementLinearSmallStrainFEMForceField_computeForce_kernel"); + mycudaDebugError("LinearSmallStrainFEMForceField_computeForce_kernel"); const int gatherThreads = 256; numBlocks = (nbVertex + gatherThreads - 1) / gatherThreads; @@ -128,7 +128,7 @@ void ElementLinearSmallStrainFEMForceFieldCuda_addForce( } template -void ElementLinearSmallStrainFEMForceFieldCuda_addDForce( +void LinearSmallStrainFEMForceFieldCuda_addDForce( unsigned int nbElem, unsigned int nbVertex, unsigned int maxElemPerVertex, @@ -142,7 +142,7 @@ void ElementLinearSmallStrainFEMForceFieldCuda_addDForce( { const int computeThreads = 64; int numBlocks = (nbElem + computeThreads - 1) / computeThreads; - ElementLinearSmallStrainFEMForceField_computeDForce_kernel + LinearSmallStrainFEMForceField_computeDForce_kernel <<>>( nbElem, (const int*)elements, @@ -150,7 +150,7 @@ void ElementLinearSmallStrainFEMForceFieldCuda_addDForce( (const T*)dx, (T*)eforce, kFactor); - mycudaDebugError("ElementLinearSmallStrainFEMForceField_computeDForce_kernel"); + mycudaDebugError("LinearSmallStrainFEMForceField_computeDForce_kernel"); const int gatherThreads = 256; numBlocks = (nbVertex + gatherThreads - 1) / gatherThreads; @@ -167,10 +167,10 @@ void ElementLinearSmallStrainFEMForceFieldCuda_addDForce( // ===================== Explicit template instantiations ===================== #define INSTANTIATE_LINEAR(T, NNodes) \ - template void ElementLinearSmallStrainFEMForceFieldCuda_addForce( \ + template void LinearSmallStrainFEMForceFieldCuda_addForce( \ unsigned int, unsigned int, unsigned int, const void*, const void*, \ const void*, const void*, void*, void*, const void*); \ - template void ElementLinearSmallStrainFEMForceFieldCuda_addDForce( \ + template void LinearSmallStrainFEMForceFieldCuda_addDForce( \ unsigned int, unsigned int, unsigned int, const void*, const void*, \ const void*, void*, void*, const void*, T); diff --git a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.h similarity index 82% rename from applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.h index 45d119846e8..41490465d72 100644 --- a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.h +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.h @@ -22,13 +22,13 @@ #pragma once #include -#include +#include namespace sofa::gpu::cuda { template -void ElementLinearSmallStrainFEMForceFieldCuda_addForce( +void LinearSmallStrainFEMForceFieldCuda_addForce( unsigned int nbElem, unsigned int nbVertex, unsigned int maxElemPerVertex, @@ -41,7 +41,7 @@ void ElementLinearSmallStrainFEMForceFieldCuda_addForce( const void* velems); template -void ElementLinearSmallStrainFEMForceFieldCuda_addDForce( +void LinearSmallStrainFEMForceFieldCuda_addDForce( unsigned int nbElem, unsigned int nbVertex, unsigned int maxElemPerVertex, @@ -59,7 +59,7 @@ namespace sofa::component::solidmechanics::fem::elastic { /** - * CUDA-accelerated version of ElementLinearSmallStrainFEMForceField. + * CUDA-accelerated version of LinearSmallStrainFEMForceField. * * Works with any element type (Edge, Triangle, Quad, Tetrahedron, Hexahedron). * Both addForce and addDForce run entirely on GPU. @@ -71,13 +71,13 @@ namespace sofa::component::solidmechanics::fem::elastic * Compared to the corotational version, no rotation matrices are needed. */ template -class CudaElementLinearSmallStrainFEMForceField - : public ElementLinearSmallStrainFEMForceField +class CudaLinearSmallStrainFEMForceField + : public LinearSmallStrainFEMForceField { public: SOFA_CLASS( - SOFA_TEMPLATE2(CudaElementLinearSmallStrainFEMForceField, DataTypes, ElementType), - SOFA_TEMPLATE2(ElementLinearSmallStrainFEMForceField, DataTypes, ElementType)); + SOFA_TEMPLATE2(CudaLinearSmallStrainFEMForceField, DataTypes, ElementType), + SOFA_TEMPLATE2(LinearSmallStrainFEMForceField, DataTypes, ElementType)); using Real = sofa::Real_t; using Coord = sofa::Coord_t; @@ -85,16 +85,6 @@ class CudaElementLinearSmallStrainFEMForceField using VecCoord = sofa::VecCoord_t; using VecDeriv = sofa::VecDeriv_t; - static const std::string GetCustomClassName() - { - return ElementLinearSmallStrainFEMForceField::GetCustomClassName(); - } - - static const std::string GetCustomTemplateName() - { - return DataTypes::Name(); - } - void init() override; void addForce( @@ -110,7 +100,7 @@ class CudaElementLinearSmallStrainFEMForceField protected: - CudaElementLinearSmallStrainFEMForceField() = default; + CudaLinearSmallStrainFEMForceField() = default; void uploadStiffnessAndConnectivity(); diff --git a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.inl b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.inl similarity index 89% rename from applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.inl rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.inl index f590bc86b66..967bb65ccf5 100644 --- a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.inl +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.inl @@ -20,8 +20,8 @@ * Contact information: contact@sofa-framework.org * ******************************************************************************/ #pragma once -#include -#include +#include +#include #include #include @@ -29,9 +29,9 @@ namespace sofa::component::solidmechanics::fem::elastic { template -void CudaElementLinearSmallStrainFEMForceField::init() +void CudaLinearSmallStrainFEMForceField::init() { - ElementLinearSmallStrainFEMForceField::init(); + LinearSmallStrainFEMForceField::init(); if (!this->isComponentStateInvalid()) { @@ -40,7 +40,7 @@ void CudaElementLinearSmallStrainFEMForceField::init() } template -void CudaElementLinearSmallStrainFEMForceField::uploadStiffnessAndConnectivity() +void CudaLinearSmallStrainFEMForceField::uploadStiffnessAndConnectivity() { using trait = sofa::component::solidmechanics::fem::elastic::trait; @@ -145,7 +145,7 @@ void CudaElementLinearSmallStrainFEMForceField::uploadSt } template -void CudaElementLinearSmallStrainFEMForceField::addForce( +void CudaLinearSmallStrainFEMForceField::addForce( const sofa::core::MechanicalParams* mparams, sofa::DataVecDeriv_t& d_f, const sofa::DataVecCoord_t& d_x, @@ -156,7 +156,7 @@ void CudaElementLinearSmallStrainFEMForceField::addForce if (!m_gpuDataUploaded) { - ElementLinearSmallStrainFEMForceField::addForce(mparams, d_f, d_x, d_v); + LinearSmallStrainFEMForceField::addForce(mparams, d_f, d_x, d_v); return; } @@ -177,7 +177,7 @@ void CudaElementLinearSmallStrainFEMForceField::addForce const auto nbElem = static_cast(elements.size()); const auto nbVertex = static_cast(x.size()); - gpu::cuda::ElementLinearSmallStrainFEMForceFieldCuda_addForce( + gpu::cuda::LinearSmallStrainFEMForceFieldCuda_addForce( nbElem, nbVertex, m_maxElemPerVertex, m_gpuElements.deviceRead(), m_gpuStiffness.deviceRead(), x.deviceRead(), x0.deviceRead(), @@ -188,7 +188,7 @@ void CudaElementLinearSmallStrainFEMForceField::addForce } template -void CudaElementLinearSmallStrainFEMForceField::addDForce( +void CudaLinearSmallStrainFEMForceField::addDForce( const sofa::core::MechanicalParams* mparams, sofa::DataVecDeriv_t& d_df, const sofa::DataVecDeriv_t& d_dx) @@ -199,7 +199,7 @@ void CudaElementLinearSmallStrainFEMForceField::addDForc if (!m_gpuDataUploaded) { // Fallback to CPU if GPU data not ready - ElementLinearSmallStrainFEMForceField::addDForce(mparams, d_df, d_dx); + LinearSmallStrainFEMForceField::addDForce(mparams, d_df, d_dx); return; } @@ -221,7 +221,7 @@ void CudaElementLinearSmallStrainFEMForceField::addDForc const auto nbElem = static_cast(elements.size()); const auto nbVertex = static_cast(dx.size()); - gpu::cuda::ElementLinearSmallStrainFEMForceFieldCuda_addDForce( + gpu::cuda::LinearSmallStrainFEMForceFieldCuda_addDForce( nbElem, nbVertex, m_maxElemPerVertex, m_gpuElements.deviceRead(), m_gpuStiffness.deviceRead(), dx.deviceRead(), df.deviceWrite(), diff --git a/applications/plugins/SofaCUDA/examples/.scene-tests b/applications/plugins/SofaCUDA/examples/.scene-tests index 033705ee8c7..0f0ae272277 100644 --- a/applications/plugins/SofaCUDA/examples/.scene-tests +++ b/applications/plugins/SofaCUDA/examples/.scene-tests @@ -33,16 +33,16 @@ timeout "TetrahedralTensorMassForceFieldCPU.scn" "60" ignore "TetrahedralTensorMassForceFieldCUDA.scn" ignore "TetrahedronFEM_with_SpringForceField.scn" -ignore "CudaElementCorotationalFEMForceField.scn" -ignore "CudaElementLinearSmallStrainFEMForceField.scn" -ignore "CudaElementCorotationalFEMForceField_hexa.scn" -ignore "CudaElementCorotationalFEMForceField_quad.scn" -ignore "CudaElementCorotationalFEMForceField_tetra.scn" -ignore "CudaElementCorotationalFEMForceField_triangle.scn" -ignore "CudaElementLinearSmallStrainFEMForceField_hexa.scn" -ignore "CudaElementLinearSmallStrainFEMForceField_quad.scn" -ignore "CudaElementLinearSmallStrainFEMForceField_tetra.scn" -ignore "CudaElementLinearSmallStrainFEMForceField_triangle.scn" -ignore "ElementCorotationalFEMForceField_tetra_cpu_gpu.scn" +ignore "CudaCorotationalFEMForceField.scn" +ignore "CudaLinearSmallStrainFEMForceField.scn" +ignore "CudaCorotationalFEMForceField_hexa.scn" +ignore "CudaCorotationalFEMForceField_quad.scn" +ignore "CudaCorotationalFEMForceField_tetra.scn" +ignore "CudaCorotationalFEMForceField_triangle.scn" +ignore "CudaLinearSmallStrainFEMForceField_hexa.scn" +ignore "CudaLinearSmallStrainFEMForceField_quad.scn" +ignore "CudaLinearSmallStrainFEMForceField_tetra.scn" +ignore "CudaLinearSmallStrainFEMForceField_triangle.scn" +ignore "CorotationalFEMForceField_tetra_cpu_gpu.scn" ignore "Tetrahedron_corotational.py" ignore "Hexahedron_corotational.py" diff --git a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementCorotationalFEMForceField_hexa.scn b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaCorotationalFEMForceField_hexa.scn similarity index 90% rename from applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementCorotationalFEMForceField_hexa.scn rename to applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaCorotationalFEMForceField_hexa.scn index a08c65e0024..4087b4d35f6 100644 --- a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementCorotationalFEMForceField_hexa.scn +++ b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaCorotationalFEMForceField_hexa.scn @@ -30,8 +30,8 @@ - + diff --git a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementCorotationalFEMForceField_quad.scn b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaCorotationalFEMForceField_quad.scn similarity index 92% rename from applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementCorotationalFEMForceField_quad.scn rename to applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaCorotationalFEMForceField_quad.scn index 047a96624f9..391720de4cd 100644 --- a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementCorotationalFEMForceField_quad.scn +++ b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaCorotationalFEMForceField_quad.scn @@ -30,7 +30,7 @@ - + diff --git a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementCorotationalFEMForceField_tetra.scn b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaCorotationalFEMForceField_tetra.scn similarity index 92% rename from applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementCorotationalFEMForceField_tetra.scn rename to applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaCorotationalFEMForceField_tetra.scn index 57a39e63286..99db3eb91d8 100644 --- a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementCorotationalFEMForceField_tetra.scn +++ b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaCorotationalFEMForceField_tetra.scn @@ -39,8 +39,8 @@ - + diff --git a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementCorotationalFEMForceField_triangle.scn b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaCorotationalFEMForceField_triangle.scn similarity index 92% rename from applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementCorotationalFEMForceField_triangle.scn rename to applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaCorotationalFEMForceField_triangle.scn index 0a47b7e393d..b0cf2b2f857 100644 --- a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementCorotationalFEMForceField_triangle.scn +++ b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaCorotationalFEMForceField_triangle.scn @@ -30,6 +30,6 @@ - + diff --git a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementLinearSmallStrainFEMForceField_hexa.scn b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaLinearSmallStrainFEMForceField_hexa.scn similarity index 94% rename from applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementLinearSmallStrainFEMForceField_hexa.scn rename to applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaLinearSmallStrainFEMForceField_hexa.scn index 228e4a08943..d97ce9cf27a 100644 --- a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementLinearSmallStrainFEMForceField_hexa.scn +++ b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaLinearSmallStrainFEMForceField_hexa.scn @@ -29,7 +29,7 @@ - diff --git a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementLinearSmallStrainFEMForceField_quad.scn b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaLinearSmallStrainFEMForceField_quad.scn similarity index 92% rename from applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementLinearSmallStrainFEMForceField_quad.scn rename to applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaLinearSmallStrainFEMForceField_quad.scn index 14babc5d207..2542b7b7e41 100644 --- a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementLinearSmallStrainFEMForceField_quad.scn +++ b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaLinearSmallStrainFEMForceField_quad.scn @@ -29,7 +29,7 @@ - + diff --git a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementLinearSmallStrainFEMForceField_tetra.scn b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaLinearSmallStrainFEMForceField_tetra.scn similarity index 91% rename from applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementLinearSmallStrainFEMForceField_tetra.scn rename to applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaLinearSmallStrainFEMForceField_tetra.scn index eac98ff93ac..8864c7a68d3 100644 --- a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementLinearSmallStrainFEMForceField_tetra.scn +++ b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaLinearSmallStrainFEMForceField_tetra.scn @@ -38,8 +38,8 @@ - + diff --git a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementLinearSmallStrainFEMForceField_triangle.scn b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaLinearSmallStrainFEMForceField_triangle.scn similarity index 92% rename from applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementLinearSmallStrainFEMForceField_triangle.scn rename to applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaLinearSmallStrainFEMForceField_triangle.scn index 03c6955697c..d383bf5db04 100644 --- a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementLinearSmallStrainFEMForceField_triangle.scn +++ b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaLinearSmallStrainFEMForceField_triangle.scn @@ -29,7 +29,7 @@ - + diff --git a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/benchmarks/Hexahedron_corotational.py b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/benchmarks/Hexahedron_corotational.py index aec2063fbe6..295a7ac4e1a 100644 --- a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/benchmarks/Hexahedron_corotational.py +++ b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/benchmarks/Hexahedron_corotational.py @@ -52,7 +52,7 @@ def createScene(root_node): if g_fem_version == "legacy": hexahedron_node.addObject('HexahedronFEMForceField', name="LegacyFEM", template=g_fem_template, youngModulus="4000", poissonRatio="0.3", method="large") if g_fem_version == "new": - hexahedron_node.addObject('HexahedronCorotationalFEMForceField', name="NewFEM", template=g_fem_template, youngModulus="4000", poissonRatio="0.3") + hexahedron_node.addObject('CudaCorotationalFEMForceField', name="NewFEM", template=f"${g_fem_template},Hexahedron", youngModulus="4000", poissonRatio="0.3") def main(): diff --git a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/benchmarks/Tetrahedron_corotational.py b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/benchmarks/Tetrahedron_corotational.py index d9480c34dfa..734eb29e9cd 100644 --- a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/benchmarks/Tetrahedron_corotational.py +++ b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/benchmarks/Tetrahedron_corotational.py @@ -53,7 +53,7 @@ def createScene(root_node): if g_fem_version == "legacy": tetrahedron_node.addObject('TetrahedronFEMForceField', name="LegacyFEM", template=g_fem_template, youngModulus="4000", poissonRatio="0.3", method="large") if g_fem_version == "new": - tetrahedron_node.addObject('TetrahedronCorotationalFEMForceField', name="NewFEM", template=g_fem_template, youngModulus="4000", poissonRatio="0.3") + tetrahedron_node.addObject('CudaCorotationalFEMForceField', name="NewFEM", template=f"${g_fem_template},Tetrahedron", youngModulus="4000", poissonRatio="0.3") def main(): diff --git a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/cpu-gpu_validation/ElementCorotationalFEMForceField_tetra_cpu_gpu.scn b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/cpu-gpu_validation/CorotationalFEMForceField_tetra_cpu_gpu.scn similarity index 100% rename from applications/plugins/SofaCUDA/examples/ElementFEMForcefield/cpu-gpu_validation/ElementCorotationalFEMForceField_tetra_cpu_gpu.scn rename to applications/plugins/SofaCUDA/examples/ElementFEMForcefield/cpu-gpu_validation/CorotationalFEMForceField_tetra_cpu_gpu.scn diff --git a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/cpu-gpu_validation/ElementCorotationalFEMForceField_tetra_cpu_gpu.scn.view b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/cpu-gpu_validation/CorotationalFEMForceField_tetra_cpu_gpu.scn.view similarity index 100% rename from applications/plugins/SofaCUDA/examples/ElementFEMForcefield/cpu-gpu_validation/ElementCorotationalFEMForceField_tetra_cpu_gpu.scn.view rename to applications/plugins/SofaCUDA/examples/ElementFEMForcefield/cpu-gpu_validation/CorotationalFEMForceField_tetra_cpu_gpu.scn.view From fb237d02f12fe3bcf40b8cdfb6ee0ba937bfc7e3 Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Fri, 19 Jun 2026 14:08:46 +0200 Subject: [PATCH 12/12] forgot some scenes --- ...ceField.scn => CudaCorotationalFEMForceField.scn} | 12 ++++++------ ...ld.scn => CudaLinearSmallStrainFEMForceField.scn} | 12 ++++++------ .../CantileverBeam_ElementFEMForceField.xml | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) rename applications/plugins/SofaCUDA/examples/{CudaElementCorotationalFEMForceField.scn => CudaCorotationalFEMForceField.scn} (88%) rename applications/plugins/SofaCUDA/examples/{CudaElementLinearSmallStrainFEMForceField.scn => CudaLinearSmallStrainFEMForceField.scn} (87%) diff --git a/applications/plugins/SofaCUDA/examples/CudaElementCorotationalFEMForceField.scn b/applications/plugins/SofaCUDA/examples/CudaCorotationalFEMForceField.scn similarity index 88% rename from applications/plugins/SofaCUDA/examples/CudaElementCorotationalFEMForceField.scn rename to applications/plugins/SofaCUDA/examples/CudaCorotationalFEMForceField.scn index 7ecf5da0d41..3f65d050936 100644 --- a/applications/plugins/SofaCUDA/examples/CudaElementCorotationalFEMForceField.scn +++ b/applications/plugins/SofaCUDA/examples/CudaCorotationalFEMForceField.scn @@ -30,8 +30,8 @@ - + --> @@ -58,8 +58,8 @@ - + @@ -78,7 +78,7 @@ - + --> diff --git a/applications/plugins/SofaCUDA/examples/CudaElementLinearSmallStrainFEMForceField.scn b/applications/plugins/SofaCUDA/examples/CudaLinearSmallStrainFEMForceField.scn similarity index 87% rename from applications/plugins/SofaCUDA/examples/CudaElementLinearSmallStrainFEMForceField.scn rename to applications/plugins/SofaCUDA/examples/CudaLinearSmallStrainFEMForceField.scn index 39a5017048d..5b88ab29745 100644 --- a/applications/plugins/SofaCUDA/examples/CudaElementLinearSmallStrainFEMForceField.scn +++ b/applications/plugins/SofaCUDA/examples/CudaLinearSmallStrainFEMForceField.scn @@ -29,8 +29,8 @@ - + --> @@ -57,8 +57,8 @@ - + @@ -77,7 +77,7 @@ - + --> diff --git a/examples/Validation/cantilever_beam/CantileverBeam_ElementFEMForceField.xml b/examples/Validation/cantilever_beam/CantileverBeam_ElementFEMForceField.xml index 5953130431f..157de731557 100644 --- a/examples/Validation/cantilever_beam/CantileverBeam_ElementFEMForceField.xml +++ b/examples/Validation/cantilever_beam/CantileverBeam_ElementFEMForceField.xml @@ -31,7 +31,7 @@ - +