From e855aceb3f18b996fcaa4bbd655d8a736594f471 Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Sat, 23 May 2026 12:26:09 +0200 Subject: [PATCH 1/5] [FEM] Refactor templates in latest FEM classes --- .../ElementCorotationalFEMForceField.cpp | 25 ++++++------------- .../ElementCorotationalFEMForceField.h | 15 ----------- .../ElementLinearSmallStrainFEMForceField.cpp | 25 ++++++------------- .../ElementLinearSmallStrainFEMForceField.h | 17 +------------ .../fem/elastic/FEMForceField.h | 4 ++- .../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, 68 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 484a5c89697..f4e1fba588a 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 ElementForce = typename trait::ElementForce; 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 db8436d83fc..cc737513032 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 ElementStiffness = typename trait::ElementStiffness; 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 c5eb9f4a3ee..241c647cb84 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 ElementForce = typename trait::ElementForce; @@ -106,6 +106,8 @@ class FEMForceField : sofa::type::vector& df, const sofa::VecDeriv_t& dx); + virtual void beforeElementForceDeriv(const sofa::core::MechanicalParams* mparams) {} + virtual void computeElementsForcesDeriv( const sofa::simulation::Range& range, const sofa::core::MechanicalParams* mparams, 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 bdae03ead2b..46a22a772a4 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); const auto& elements = trait::FiniteElement::getElementSequence(*this->l_topology); 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 b5016d0c9a96b0c125d8e6007969524f9f6860e9 Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Thu, 28 May 2026 09:16:05 +0200 Subject: [PATCH 2/5] 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 11178a22c5eece0666f31b1dc158dfc598ec0400 Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Fri, 5 Jun 2026 08:29:35 +0200 Subject: [PATCH 3/5] 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} (92%) 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 f4e1fba588a..71a076a3ef9 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 92% 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 a3a74a36a81..c9141076e71 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 #include @@ -32,7 +32,7 @@ namespace sofa::component::solidmechanics::fem::elastic { template -ElementCorotationalFEMForceField::ElementCorotationalFEMForceField() +CorotationalFEMForceField::CorotationalFEMForceField() : m_rotationMethods(this) { this->addUpdateCallback("selectRotationMethod", {&this->m_rotationMethods.d_rotationMethod}, @@ -48,7 +48,7 @@ ElementCorotationalFEMForceField::ElementCorotationalFEM } template -void ElementCorotationalFEMForceField::init() +void CorotationalFEMForceField::init() { BaseElementLinearFEMForceField::init(); FEMForceField::init(); @@ -71,7 +71,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) { @@ -80,7 +80,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) { @@ -127,7 +127,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, @@ -164,7 +164,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) @@ -201,7 +201,7 @@ void ElementCorotationalFEMForceField::buildStiffnessMat } template -SReal ElementCorotationalFEMForceField::getPotentialEnergy( +SReal CorotationalFEMForceField::getPotentialEnergy( const sofa::core::MechanicalParams*, const sofa::DataVecCoord_t& x) const { @@ -209,7 +209,7 @@ SReal ElementCorotationalFEMForceField::getPotentialEner } template -auto ElementCorotationalFEMForceField::translation( +auto CorotationalFEMForceField::translation( const std::array, trait::NumberOfNodesInElement>& nodes) const -> sofa::Coord_t { // return nodes[0]; @@ -217,7 +217,7 @@ auto ElementCorotationalFEMForceField::translation( } template -auto ElementCorotationalFEMForceField::computeCentroid( +auto CorotationalFEMForceField::computeCentroid( const std::array, trait::NumberOfNodesInElement>& nodes) -> sofa::Coord_t { sofa::Coord_t centroid; @@ -230,7 +230,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) @@ -263,7 +263,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 890e985d8d761e004297afe2ef43fd54df0f3f53 Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Fri, 5 Jun 2026 08:38:57 +0200 Subject: [PATCH 4/5] 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 cc737513032..63c5d4af7f9 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 fc58db7abe4..e90fb6bce02 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 c6dd38db066ab28b23f5101cd751747d4f0e5a64 Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Fri, 5 Jun 2026 08:42:58 +0200 Subject: [PATCH 5/5] 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"/> - +