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 e2c0f520e30..00000000000
--- a/Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.cpp
+++ /dev/null
@@ -1,67 +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) defined on edges")
- .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 >(true));
-
- factory->registerObjects(sofa::core::ObjectRegistrationData("Finite-element mass (inertia and body force) defined on quads")
- .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));
-}
-
-}
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 85%
rename from Sofa/Component/Mass/src/sofa/component/mass/ElementFEMMass.h
rename to Sofa/Component/Mass/src/sofa/component/mass/FEMMass.h
index f390189c375..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);
@@ -80,31 +80,13 @@ 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.
*
* 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;
/**
@@ -211,7 +193,7 @@ class ElementFEMMass :
/**
* @brief Default constructor.
*/
- ElementFEMMass();
+ FEMMass();
/**
* @brief Performs the internal calculation and assembly of the mass matrix.
@@ -267,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/Sofa/Component/SolidMechanics/FEM/Elastic/CMakeLists.txt b/Sofa/Component/SolidMechanics/FEM/Elastic/CMakeLists.txt
index 2e090b63ebb..fddd6033a0d 100644
--- a/Sofa/Component/SolidMechanics/FEM/Elastic/CMakeLists.txt
+++ b/Sofa/Component/SolidMechanics/FEM/Elastic/CMakeLists.txt
@@ -13,10 +13,10 @@ 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}/ElementLinearSmallStrainFEMForceField.h
- ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/ElementLinearSmallStrainFEMForceField.inl
+ ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/CorotationalFEMForceField.h
+ ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/CorotationalFEMForceField.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
@@ -68,8 +68,8 @@ 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}/ElementLinearSmallStrainFEMForceField.cpp
+ ${SOFACOMPONENTSOLIDMECHANICSFEMELASTIC_SOURCE_DIR}/CorotationalFEMForceField.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/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 84%
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 1425fdfa925..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,31 +111,16 @@ 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));
- /**
- * 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;
@@ -144,7 +129,7 @@ class ElementCorotationalFEMForceField :
public:
- ElementCorotationalFEMForceField();
+ CorotationalFEMForceField();
void init() override;
@@ -189,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