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& nodeRestPositions) @@ -264,7 +264,7 @@ void ElementCorotationalFEMForceField::computeRotations( } template -void ElementCorotationalFEMForceField::computeInitialRotations() +void CorotationalFEMForceField::computeInitialRotations() { auto restPositionAccessor = this->sofa::core::behavior::ForceField::mstate->readRestPositions(); computeRotations(m_initialRotationsTransposed, restPositionAccessor.ref(), restPositionAccessor.ref()); diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.cpp b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.cpp deleted file mode 100644 index fd38c9e67bb..00000000000 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementCorotationalFEMForceField.cpp +++ /dev/null @@ -1,68 +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 on linear beams 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 >(true)); - - factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law on linear quads using the corotational approach") - .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)); -} - -// 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/ElementLinearSmallStrainFEMForceField.cpp b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.cpp deleted file mode 100644 index cb17452bdb2..00000000000 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.cpp +++ /dev/null @@ -1,68 +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 on linear beams 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 >(true)); - - factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law on linear quads assuming small strain") - .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)); -} - -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/FEMForceField.h b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/FEMForceField.h index 1c2519ee348..a0a718527e3 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/FEMForceField.h +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/FEMForceField.h @@ -48,7 +48,7 @@ class FEMForceField : sofa::core::behavior::TopologyAccessor, sofa::simulation::TaskSchedulerUser); -private: +protected: using trait = sofa::component::solidmechanics::fem::elastic::trait; using ElementGradient = typename trait::ElementGradient; diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/FEMForceField.inl b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/FEMForceField.inl index a1e60d07744..44d6dc85e07 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/FEMForceField.inl +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/FEMForceField.inl @@ -163,6 +163,7 @@ void FEMForceField::computeElementsForcesDeriv( const sofa::VecDeriv_t& dx) { SCOPED_TIMER("ElementForcesDeriv"); + beforeElementForceDeriv(mparams); this->beforeElementForceDeriv(mparams); diff --git a/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 71% 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 853867ff38e..cc48d5787e8 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.h +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/LinearSmallStrainFEMForceField.h @@ -35,33 +35,18 @@ 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)); - /** - * The purpose of this function is to register the name of this class according to the provided - * pattern. - * - * Example: ElementLinearSmallStrainFEMForceField will produce - * the class name "EdgeLinearSmallStrainFEMForceField". - */ - static const std::string GetCustomClassName() - { - return std::string(sofa::geometry::elementTypeToString(ElementType::Element_type)) + - "LinearSmallStrainFEMForceField"; - } - - static const std::string GetCustomTemplateName() { return DataTypes::Name(); } - private: - using trait = sofa::component::solidmechanics::fem::elastic::trait; + using trait = typename FEMForceField::trait; using ElementHessian = typename trait::ElementHessian; using ElementDisplacement = typename trait::ElementDisplacement; using StrainDisplacement = typename trait::StrainDisplacement; @@ -96,17 +81,17 @@ class ElementLinearSmallStrainFEMForceField : }; -#if !defined(ELASTICITY_COMPONENT_ELEMENT_LINEAR_SMALL_STRAIN_FEM_FORCE_FIELD_CPP) -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; -extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API ElementLinearSmallStrainFEMForceField; +#if !defined(SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_LINEAR_SMALL_STRAIN_FEM_FORCE_FIELD_CPP) +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; +extern template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField; #endif } // namespace sofa::component::solidmechanics::fem::elastic diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.inl b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/LinearSmallStrainFEMForceField.inl similarity index 92% rename from Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.inl rename to Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/LinearSmallStrainFEMForceField.inl index 8967dc3d4a2..6fea5667a99 100644 --- a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/ElementLinearSmallStrainFEMForceField.inl +++ b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/LinearSmallStrainFEMForceField.inl @@ -20,7 +20,7 @@ * Contact information: contact@sofa-framework.org * ******************************************************************************/ #pragma once -#include +#include #include #include @@ -28,7 +28,7 @@ namespace sofa::component::solidmechanics::fem::elastic { template -void ElementLinearSmallStrainFEMForceField::init() +void LinearSmallStrainFEMForceField::init() { BaseElementLinearFEMForceField::init(); FEMForceField::init(); @@ -41,7 +41,7 @@ void ElementLinearSmallStrainFEMForceField::init() template -void ElementLinearSmallStrainFEMForceField::computeElementsForces( +void LinearSmallStrainFEMForceField::computeElementsForces( const sofa::simulation::Range& range, const sofa::core::MechanicalParams* mparams, sofa::type::vector& elementForces, @@ -72,7 +72,7 @@ void ElementLinearSmallStrainFEMForceField::computeEleme } template -void ElementLinearSmallStrainFEMForceField::computeElementsForcesDeriv( +void LinearSmallStrainFEMForceField::computeElementsForcesDeriv( const sofa::simulation::Range& range, const sofa::core::MechanicalParams* mparams, sofa::type::vector& elementForcesDeriv, @@ -104,7 +104,7 @@ void ElementLinearSmallStrainFEMForceField::computeEleme } template -void ElementLinearSmallStrainFEMForceField::buildStiffnessMatrix( +void LinearSmallStrainFEMForceField::buildStiffnessMatrix( sofa::core::behavior::StiffnessMatrix* matrix) { if (this->isComponentStateInvalid()) @@ -141,7 +141,7 @@ void ElementLinearSmallStrainFEMForceField::buildStiffne } template -SReal ElementLinearSmallStrainFEMForceField::getPotentialEnergy( +SReal LinearSmallStrainFEMForceField::getPotentialEnergy( const sofa::core::MechanicalParams*, const sofa::DataVecCoord_t& x) const { @@ -149,7 +149,7 @@ SReal ElementLinearSmallStrainFEMForceField::getPotentia } template -void ElementLinearSmallStrainFEMForceField::addKToMatrix( +void LinearSmallStrainFEMForceField::addKToMatrix( sofa::linearalgebra::BaseMatrix* matrix, SReal kFact, unsigned& offset) { if (this->isComponentStateInvalid()) diff --git a/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/init.cpp b/Sofa/Component/SolidMechanics/FEM/Elastic/src/sofa/component/solidmechanics/fem/elastic/init.cpp index 343b296dbba..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 @@ -27,13 +27,13 @@ namespace sofa::component::solidmechanics::fem::elastic { extern void registerBeamFEMForceField(sofa::core::ObjectFactory* factory); -extern void registerElementCorotationalFEMForceField(sofa::core::ObjectFactory* factory); -extern void registerElementLinearSmallStrainFEMForceField(sofa::core::ObjectFactory* factory); +extern void registerCorotationalFEMForceField(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); @@ -67,13 +67,13 @@ const char* getModuleVersion() void registerObjects(sofa::core::ObjectFactory* factory) { registerBeamFEMForceField(factory); - registerElementCorotationalFEMForceField(factory); - registerElementLinearSmallStrainFEMForceField(factory); + registerCorotationalFEMForceField(factory); registerFastTetrahedralCorotationalForceField(factory); registerHexahedralFEMForceField(factory); registerHexahedralFEMForceFieldAndMass(factory); registerHexahedronFEMForceField(factory); registerHexahedronFEMForceFieldAndMass(factory); + registerLinearSmallStrainFEMForceField(factory); registerQuadBendingFEMForceField(factory); registerTetrahedralCorotationalFEMForceField(factory); registerTetrahedronFEMForceField(factory); diff --git a/applications/plugins/SofaCUDA/Component/CMakeLists.txt b/applications/plugins/SofaCUDA/Component/CMakeLists.txt index ce4d885c90b..effab0275a9 100644 --- a/applications/plugins/SofaCUDA/Component/CMakeLists.txt +++ b/applications/plugins/SofaCUDA/Component/CMakeLists.txt @@ -39,11 +39,11 @@ set(HEADER_FILES ### solidmechanics - ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementFEMKernelUtils.cuh - ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.h - ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.inl - ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.h - ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.inl + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaFEMKernelUtils.cuh + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.inl + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.h + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.inl ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.h ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.inl ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.h @@ -116,8 +116,8 @@ set(SOURCE_FILES ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mass/CudaUniformMass.cpp ### Solidmechanics - ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.cpp - ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.cpp + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.cpp ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.cpp ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.cpp ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/tensormass/CudaTetrahedralTensorMassForceField.cpp @@ -188,8 +188,8 @@ set(CUDA_SOURCES ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/mass/CudaUniformMass.cu ### solidmechanics - ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.cu - ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.cu + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.cu + ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.cu ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/elastic/CudaHexahedronFEMForceField.cu ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/fem/hyperelastic/CudaStandardTetrahedralFEMForceField.cu ${SOFACUDA_COMPONENT_SOURCE_DIR}/SofaCUDA/component/solidmechanics/tensormass/CudaTetrahedralTensorMassForceField.cu diff --git a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/init.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/init.cpp index c6b0ee6b438..968cd603fb6 100644 --- a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/init.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/init.cpp @@ -90,8 +90,8 @@ extern void registerPlaneForceField(sofa::core::ObjectFactory* factory); extern void registerSphereForceField(sofa::core::ObjectFactory* factory); // component::solidmechanics::fem::elastic -extern void registerElementCorotationalFEMForceField(sofa::core::ObjectFactory* factory); -extern void registerElementLinearSmallStrainFEMForceField(sofa::core::ObjectFactory* factory); +extern void registerCorotationalFEMForceField(sofa::core::ObjectFactory* factory); +extern void registerLinearSmallStrainFEMForceField(sofa::core::ObjectFactory* factory); extern void registerHexahedronFEMForceField(sofa::core::ObjectFactory* factory); extern void registerTetrahedronFEMForceField(sofa::core::ObjectFactory* factory); extern void registerTriangularFEMForceFieldOptim(sofa::core::ObjectFactory* factory); @@ -226,8 +226,8 @@ void registerObjects(sofa::core::ObjectFactory* factory) registerLinearForceField(factory); registerPlaneForceField(factory); registerSphereForceField(factory); - registerElementCorotationalFEMForceField(factory); - registerElementLinearSmallStrainFEMForceField(factory); + registerCorotationalFEMForceField(factory); + registerLinearSmallStrainFEMForceField(factory); registerHexahedronFEMForceField(factory); registerTetrahedronFEMForceField(factory); registerTriangularFEMForceFieldOptim(factory); diff --git a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.cpp similarity index 62% rename from applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.cpp index 5cd43daa6d2..ca58990357d 100644 --- a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include namespace sofa::component::solidmechanics::fem::elastic @@ -30,18 +30,18 @@ namespace sofa::component::solidmechanics::fem::elastic using namespace sofa::gpu::cuda; -template class SOFACUDA_COMPONENT_API CudaElementCorotationalFEMForceField; -template class SOFACUDA_COMPONENT_API CudaElementCorotationalFEMForceField; -template class SOFACUDA_COMPONENT_API CudaElementCorotationalFEMForceField; -template class SOFACUDA_COMPONENT_API CudaElementCorotationalFEMForceField; -template class SOFACUDA_COMPONENT_API CudaElementCorotationalFEMForceField; +template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField; +template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField; +template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField; +template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField; +template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFACUDA_COMPONENT_API CudaElementCorotationalFEMForceField; -template class SOFACUDA_COMPONENT_API CudaElementCorotationalFEMForceField; -template class SOFACUDA_COMPONENT_API CudaElementCorotationalFEMForceField; -template class SOFACUDA_COMPONENT_API CudaElementCorotationalFEMForceField; -template class SOFACUDA_COMPONENT_API CudaElementCorotationalFEMForceField; +template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField; +template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField; +template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField; +template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField; +template class SOFACUDA_COMPONENT_API CudaCorotationalFEMForceField; #endif } // namespace sofa::component::solidmechanics::fem::elastic @@ -49,51 +49,51 @@ template class SOFACUDA_COMPONENT_API CudaElementCorotationalFEMForceFieldregisterObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA for EdgeCorotationalFEMForceField") - .add< CudaElementCorotationalFEMForceField >() + .add< CudaCorotationalFEMForceField >() ); factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA for TriangleCorotationalFEMForceField") - .add< CudaElementCorotationalFEMForceField >() + .add< CudaCorotationalFEMForceField >() ); factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA for QuadCorotationalFEMForceField") - .add< CudaElementCorotationalFEMForceField >() + .add< CudaCorotationalFEMForceField >() ); factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA for TetrahedronCorotationalFEMForceField") - .add< CudaElementCorotationalFEMForceField >() + .add< CudaCorotationalFEMForceField >() ); factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA for HexahedronCorotationalFEMForceField") - .add< CudaElementCorotationalFEMForceField >() + .add< CudaCorotationalFEMForceField >() ); #ifdef SOFA_GPU_CUDA_DOUBLE factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA (double) for EdgeCorotationalFEMForceField") - .add< CudaElementCorotationalFEMForceField >() + .add< CudaCorotationalFEMForceField >() ); factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA (double) for TriangleCorotationalFEMForceField") - .add< CudaElementCorotationalFEMForceField >() + .add< CudaCorotationalFEMForceField >() ); factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA (double) for QuadCorotationalFEMForceField") - .add< CudaElementCorotationalFEMForceField >() + .add< CudaCorotationalFEMForceField >() ); factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA (double) for TetrahedronCorotationalFEMForceField") - .add< CudaElementCorotationalFEMForceField >() + .add< CudaCorotationalFEMForceField >() ); factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA (double) for HexahedronCorotationalFEMForceField") - .add< CudaElementCorotationalFEMForceField >() + .add< CudaCorotationalFEMForceField >() ); #endif } diff --git a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.cu b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.cu similarity index 90% rename from applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.cu rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.cu index 6616637dc55..a34a75c7646 100644 --- a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.cu +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.cu @@ -21,7 +21,7 @@ ******************************************************************************/ #include #include -#include "CudaElementFEMKernelUtils.cuh" +#include "CudaFEMKernelUtils.cuh" namespace sofa::gpu::cuda { @@ -30,7 +30,7 @@ namespace sofa::gpu::cuda * Combined kernel: compute rotations AND per-element forces in one pass. */ template -__global__ void ElementCorotationalFEMForceField_computeRotationsAndForce_kernel( +__global__ void CorotationalFEMForceField_computeRotationsAndForce_kernel( int nbElem, const int* __restrict__ elements, const T* __restrict__ initRotTransposed, @@ -92,7 +92,7 @@ __global__ void ElementCorotationalFEMForceField_computeRotationsAndForce_kernel * Kernel for addForce with pre-computed rotations. */ template -__global__ void ElementCorotationalFEMForceField_computeForce_kernel( +__global__ void CorotationalFEMForceField_computeForce_kernel( int nbElem, const int* __restrict__ elements, const T* __restrict__ rotations, @@ -141,7 +141,7 @@ __global__ void ElementCorotationalFEMForceField_computeForce_kernel( * Kernel for addDForce. */ template -__global__ void ElementCorotationalFEMForceField_computeDForce_kernel( +__global__ void CorotationalFEMForceField_computeDForce_kernel( int nbElem, const int* __restrict__ elements, const T* __restrict__ rotations, @@ -179,7 +179,7 @@ __global__ void ElementCorotationalFEMForceField_computeDForce_kernel( // ===================== Launch functions ===================== template -void ElementCorotationalFEMForceFieldCuda_addForceWithRotations( +void CorotationalFEMForceFieldCuda_addForceWithRotations( unsigned int nbElem, unsigned int nbVertex, unsigned int maxElemPerVertex, @@ -195,7 +195,7 @@ void ElementCorotationalFEMForceFieldCuda_addForceWithRotations( { const int computeThreads = 64; int numBlocks = (nbElem + computeThreads - 1) / computeThreads; - ElementCorotationalFEMForceField_computeRotationsAndForce_kernel + CorotationalFEMForceField_computeRotationsAndForce_kernel <<>>( nbElem, (const int*)elements, @@ -205,7 +205,7 @@ void ElementCorotationalFEMForceFieldCuda_addForceWithRotations( (const T*)x0, (T*)rotationsOut, (T*)eforce); - mycudaDebugError("ElementCorotationalFEMForceField_computeRotationsAndForce_kernel"); + mycudaDebugError("CorotationalFEMForceField_computeRotationsAndForce_kernel"); const int gatherThreads = 256; numBlocks = (nbVertex + gatherThreads - 1) / gatherThreads; @@ -220,7 +220,7 @@ void ElementCorotationalFEMForceFieldCuda_addForceWithRotations( } template -void ElementCorotationalFEMForceFieldCuda_addForce( +void CorotationalFEMForceFieldCuda_addForce( unsigned int nbElem, unsigned int nbVertex, unsigned int maxElemPerVertex, @@ -235,7 +235,7 @@ void ElementCorotationalFEMForceFieldCuda_addForce( { const int computeThreads = 64; int numBlocks = (nbElem + computeThreads - 1) / computeThreads; - ElementCorotationalFEMForceField_computeForce_kernel + CorotationalFEMForceField_computeForce_kernel <<>>( nbElem, (const int*)elements, @@ -244,7 +244,7 @@ void ElementCorotationalFEMForceFieldCuda_addForce( (const T*)x, (const T*)x0, (T*)eforce); - mycudaDebugError("ElementCorotationalFEMForceField_computeForce_kernel"); + mycudaDebugError("CorotationalFEMForceField_computeForce_kernel"); const int gatherThreads = 256; numBlocks = (nbVertex + gatherThreads - 1) / gatherThreads; @@ -259,7 +259,7 @@ void ElementCorotationalFEMForceFieldCuda_addForce( } template -void ElementCorotationalFEMForceFieldCuda_addDForce( +void CorotationalFEMForceFieldCuda_addDForce( unsigned int nbElem, unsigned int nbVertex, unsigned int maxElemPerVertex, @@ -274,7 +274,7 @@ void ElementCorotationalFEMForceFieldCuda_addDForce( { const int computeThreads = 64; int numBlocks = (nbElem + computeThreads - 1) / computeThreads; - ElementCorotationalFEMForceField_computeDForce_kernel + CorotationalFEMForceField_computeDForce_kernel <<>>( nbElem, (const int*)elements, @@ -283,7 +283,7 @@ void ElementCorotationalFEMForceFieldCuda_addDForce( (const T*)dx, (T*)eforce, kFactor); - mycudaDebugError("ElementCorotationalFEMForceField_computeDForce_kernel"); + mycudaDebugError("CorotationalFEMForceField_computeDForce_kernel"); const int gatherThreads = 256; numBlocks = (nbVertex + gatherThreads - 1) / gatherThreads; @@ -300,15 +300,15 @@ void ElementCorotationalFEMForceFieldCuda_addDForce( // ===================== Explicit template instantiations ===================== #define INSTANTIATE_COROTATIONAL(T, NNodes) \ - template void ElementCorotationalFEMForceFieldCuda_addForce( \ + template void CorotationalFEMForceFieldCuda_addForce( \ unsigned int, unsigned int, unsigned int, const void*, const void*, \ const void*, const void*, const void*, void*, void*, const void*); \ - template void ElementCorotationalFEMForceFieldCuda_addDForce( \ + template void CorotationalFEMForceFieldCuda_addDForce( \ unsigned int, unsigned int, unsigned int, const void*, const void*, \ const void*, const void*, void*, void*, const void*, T); #define INSTANTIATE_COROTATIONAL_WITH_ROTATIONS(T, NNodes) \ - template void ElementCorotationalFEMForceFieldCuda_addForceWithRotations( \ + template void CorotationalFEMForceFieldCuda_addForceWithRotations( \ unsigned int, unsigned int, unsigned int, const void*, const void*, \ const void*, const void*, const void*, void*, void*, void*, const void*); diff --git a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.h similarity index 85% rename from applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.h index 820b4c915a1..2d1d5e2f643 100644 --- a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.h +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.h @@ -22,13 +22,13 @@ #pragma once #include -#include +#include namespace sofa::gpu::cuda { template -void ElementCorotationalFEMForceFieldCuda_addForceWithRotations( +void CorotationalFEMForceFieldCuda_addForceWithRotations( unsigned int nbElem, unsigned int nbVertex, unsigned int maxElemPerVertex, @@ -43,7 +43,7 @@ void ElementCorotationalFEMForceFieldCuda_addForceWithRotations( const void* velems); template -void ElementCorotationalFEMForceFieldCuda_addForce( +void CorotationalFEMForceFieldCuda_addForce( unsigned int nbElem, unsigned int nbVertex, unsigned int maxElemPerVertex, @@ -57,7 +57,7 @@ void ElementCorotationalFEMForceFieldCuda_addForce( const void* velems); template -void ElementCorotationalFEMForceFieldCuda_addDForce( +void CorotationalFEMForceFieldCuda_addDForce( unsigned int nbElem, unsigned int nbVertex, unsigned int maxElemPerVertex, @@ -76,7 +76,7 @@ namespace sofa::component::solidmechanics::fem::elastic { /** - * CUDA-accelerated version of ElementCorotationalFEMForceField. + * CUDA-accelerated version of CorotationalFEMForceField. * * Works with any element type (Edge, Triangle, Quad, Tetrahedron, Hexahedron). * The addDForce method (the CG hot path, called ~250 times per timestep) runs entirely on GPU. @@ -87,13 +87,13 @@ namespace sofa::component::solidmechanics::fem::elastic * Kernel 2: gather per-vertex (1 thread/vertex, no atomics) */ template -class CudaElementCorotationalFEMForceField - : public ElementCorotationalFEMForceField +class CudaCorotationalFEMForceField + : public CorotationalFEMForceField { public: SOFA_CLASS( - SOFA_TEMPLATE2(CudaElementCorotationalFEMForceField, DataTypes, ElementType), - SOFA_TEMPLATE2(ElementCorotationalFEMForceField, DataTypes, ElementType)); + SOFA_TEMPLATE2(CudaCorotationalFEMForceField, DataTypes, ElementType), + SOFA_TEMPLATE2(CorotationalFEMForceField, DataTypes, ElementType)); using Real = sofa::Real_t; using Coord = sofa::Coord_t; @@ -101,16 +101,6 @@ class CudaElementCorotationalFEMForceField using VecCoord = sofa::VecCoord_t; using VecDeriv = sofa::VecDeriv_t; - static const std::string GetCustomClassName() - { - return ElementCorotationalFEMForceField::GetCustomClassName(); - } - - static const std::string GetCustomTemplateName() - { - return DataTypes::Name(); - } - void init() override; void addForce( @@ -128,7 +118,7 @@ class CudaElementCorotationalFEMForceField protected: - CudaElementCorotationalFEMForceField() = default; + CudaCorotationalFEMForceField() = default; void uploadStiffnessAndConnectivity(); void uploadRotations(); diff --git a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.inl b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.inl similarity index 89% rename from applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.inl rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.inl index 3cc1e29eea5..982ad644a51 100644 --- a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementCorotationalFEMForceField.inl +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaCorotationalFEMForceField.inl @@ -20,8 +20,8 @@ * Contact information: contact@sofa-framework.org * ******************************************************************************/ #pragma once -#include -#include +#include +#include #include #include @@ -29,9 +29,9 @@ namespace sofa::component::solidmechanics::fem::elastic { template -void CudaElementCorotationalFEMForceField::init() +void CudaCorotationalFEMForceField::init() { - ElementCorotationalFEMForceField::init(); + CorotationalFEMForceField::init(); if (!this->isComponentStateInvalid()) { @@ -41,7 +41,7 @@ void CudaElementCorotationalFEMForceField::init() } template -void CudaElementCorotationalFEMForceField::uploadStiffnessAndConnectivity() +void CudaCorotationalFEMForceField::uploadStiffnessAndConnectivity() { using trait = sofa::component::solidmechanics::fem::elastic::trait; @@ -150,7 +150,7 @@ void CudaElementCorotationalFEMForceField::uploadStiffne } template -void CudaElementCorotationalFEMForceField::uploadRotations() +void CudaCorotationalFEMForceField::uploadRotations() { using trait = sofa::component::solidmechanics::fem::elastic::trait; constexpr auto dim = trait::spatial_dimensions; @@ -174,7 +174,7 @@ void CudaElementCorotationalFEMForceField::uploadRotatio } template -void CudaElementCorotationalFEMForceField::uploadInitialRotationsTransposed() +void CudaCorotationalFEMForceField::uploadInitialRotationsTransposed() { using trait = sofa::component::solidmechanics::fem::elastic::trait; constexpr auto dim = trait::spatial_dimensions; @@ -204,7 +204,7 @@ void CudaElementCorotationalFEMForceField::uploadInitial } template -void CudaElementCorotationalFEMForceField::downloadRotations() +void CudaCorotationalFEMForceField::downloadRotations() { using trait = sofa::component::solidmechanics::fem::elastic::trait; constexpr auto dim = trait::spatial_dimensions; @@ -225,17 +225,17 @@ void CudaElementCorotationalFEMForceField::downloadRotat } template -void CudaElementCorotationalFEMForceField::buildStiffnessMatrix( +void CudaCorotationalFEMForceField::buildStiffnessMatrix( sofa::core::behavior::StiffnessMatrix* matrix) { if (m_gpuRotationMethodSupported && m_gpuRotationsUploaded) downloadRotations(); - ElementCorotationalFEMForceField::buildStiffnessMatrix(matrix); + CorotationalFEMForceField::buildStiffnessMatrix(matrix); } template -void CudaElementCorotationalFEMForceField::addForce( +void CudaCorotationalFEMForceField::addForce( const sofa::core::MechanicalParams* mparams, sofa::DataVecDeriv_t& d_f, const sofa::DataVecCoord_t& d_x, @@ -246,7 +246,7 @@ void CudaElementCorotationalFEMForceField::addForce( if (!m_gpuDataUploaded) { - ElementCorotationalFEMForceField::addForce(mparams, d_f, d_x, d_v); + CorotationalFEMForceField::addForce(mparams, d_f, d_x, d_v); uploadRotations(); return; } @@ -271,7 +271,7 @@ void CudaElementCorotationalFEMForceField::addForce( { if (m_gpuRotationMethodSupported) { - gpu::cuda::ElementCorotationalFEMForceFieldCuda_addForceWithRotations( + gpu::cuda::CorotationalFEMForceFieldCuda_addForceWithRotations( nbElem, nbVertex, m_maxElemPerVertex, m_gpuElements.deviceRead(), m_gpuInitialRotationsTransposed.deviceRead(), m_gpuStiffness.deviceRead(), x.deviceRead(), x0.deviceRead(), @@ -288,7 +288,7 @@ void CudaElementCorotationalFEMForceField::addForce( this->computeRotations(this->m_rotations, x, x0); uploadRotations(); - gpu::cuda::ElementCorotationalFEMForceFieldCuda_addForce( + gpu::cuda::CorotationalFEMForceFieldCuda_addForce( nbElem, nbVertex, m_maxElemPerVertex, m_gpuElements.deviceRead(), m_gpuRotations.deviceRead(), m_gpuStiffness.deviceRead(), x.deviceRead(), x0.deviceRead(), @@ -299,7 +299,7 @@ void CudaElementCorotationalFEMForceField::addForce( } template -void CudaElementCorotationalFEMForceField::addDForce( +void CudaCorotationalFEMForceField::addDForce( const sofa::core::MechanicalParams* mparams, sofa::DataVecDeriv_t& d_df, const sofa::DataVecDeriv_t& d_dx) @@ -310,7 +310,7 @@ void CudaElementCorotationalFEMForceField::addDForce( if (!m_gpuDataUploaded || !m_gpuRotationsUploaded) { // Fallback to CPU if GPU data not ready - ElementCorotationalFEMForceField::addDForce(mparams, d_df, d_dx); + CorotationalFEMForceField::addDForce(mparams, d_df, d_dx); return; } @@ -332,7 +332,7 @@ void CudaElementCorotationalFEMForceField::addDForce( const auto nbElem = static_cast(elements.size()); const auto nbVertex = static_cast(dx.size()); - gpu::cuda::ElementCorotationalFEMForceFieldCuda_addDForce( + gpu::cuda::CorotationalFEMForceFieldCuda_addDForce( nbElem, nbVertex, m_maxElemPerVertex, m_gpuElements.deviceRead(), m_gpuRotations.deviceRead(), m_gpuStiffness.deviceRead(), dx.deviceRead(), diff --git a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementFEMKernelUtils.cuh b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaFEMKernelUtils.cuh similarity index 100% rename from applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementFEMKernelUtils.cuh rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaFEMKernelUtils.cuh diff --git a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.cpp b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.cpp similarity index 61% rename from applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.cpp rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.cpp index d8d3b9ef1c3..0c624c5b03e 100644 --- a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.cpp +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include namespace sofa::component::solidmechanics::fem::elastic @@ -30,18 +30,18 @@ namespace sofa::component::solidmechanics::fem::elastic using namespace sofa::gpu::cuda; -template class SOFACUDA_COMPONENT_API CudaElementLinearSmallStrainFEMForceField; -template class SOFACUDA_COMPONENT_API CudaElementLinearSmallStrainFEMForceField; -template class SOFACUDA_COMPONENT_API CudaElementLinearSmallStrainFEMForceField; -template class SOFACUDA_COMPONENT_API CudaElementLinearSmallStrainFEMForceField; -template class SOFACUDA_COMPONENT_API CudaElementLinearSmallStrainFEMForceField; +template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField; +template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField; +template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField; +template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField; +template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField; #ifdef SOFA_GPU_CUDA_DOUBLE -template class SOFACUDA_COMPONENT_API CudaElementLinearSmallStrainFEMForceField; -template class SOFACUDA_COMPONENT_API CudaElementLinearSmallStrainFEMForceField; -template class SOFACUDA_COMPONENT_API CudaElementLinearSmallStrainFEMForceField; -template class SOFACUDA_COMPONENT_API CudaElementLinearSmallStrainFEMForceField; -template class SOFACUDA_COMPONENT_API CudaElementLinearSmallStrainFEMForceField; +template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField; +template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField; +template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField; +template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField; +template class SOFACUDA_COMPONENT_API CudaLinearSmallStrainFEMForceField; #endif } // namespace sofa::component::solidmechanics::fem::elastic @@ -49,51 +49,51 @@ template class SOFACUDA_COMPONENT_API CudaElementLinearSmallStrainFEMForceField< namespace sofa::gpu::cuda { -void registerElementLinearSmallStrainFEMForceField(sofa::core::ObjectFactory* factory) +void registerLinearSmallStrainFEMForceField(sofa::core::ObjectFactory* factory) { using namespace sofa::component::solidmechanics::fem::elastic; factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA for EdgeLinearSmallStrainFEMForceField") - .add< CudaElementLinearSmallStrainFEMForceField >() + .add< CudaLinearSmallStrainFEMForceField >() ); factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA for TriangleLinearSmallStrainFEMForceField") - .add< CudaElementLinearSmallStrainFEMForceField >() + .add< CudaLinearSmallStrainFEMForceField >() ); factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA for QuadLinearSmallStrainFEMForceField") - .add< CudaElementLinearSmallStrainFEMForceField >() + .add< CudaLinearSmallStrainFEMForceField >() ); factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA for TetrahedronLinearSmallStrainFEMForceField") - .add< CudaElementLinearSmallStrainFEMForceField >() + .add< CudaLinearSmallStrainFEMForceField >() ); factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA for HexahedronLinearSmallStrainFEMForceField") - .add< CudaElementLinearSmallStrainFEMForceField >() + .add< CudaLinearSmallStrainFEMForceField >() ); #ifdef SOFA_GPU_CUDA_DOUBLE factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA (double) for EdgeLinearSmallStrainFEMForceField") - .add< CudaElementLinearSmallStrainFEMForceField >() + .add< CudaLinearSmallStrainFEMForceField >() ); factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA (double) for TriangleLinearSmallStrainFEMForceField") - .add< CudaElementLinearSmallStrainFEMForceField >() + .add< CudaLinearSmallStrainFEMForceField >() ); factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA (double) for QuadLinearSmallStrainFEMForceField") - .add< CudaElementLinearSmallStrainFEMForceField >() + .add< CudaLinearSmallStrainFEMForceField >() ); factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA (double) for TetrahedronLinearSmallStrainFEMForceField") - .add< CudaElementLinearSmallStrainFEMForceField >() + .add< CudaLinearSmallStrainFEMForceField >() ); factory->registerObjects(sofa::core::ObjectRegistrationData( "Supports GPU-side computations using CUDA (double) for HexahedronLinearSmallStrainFEMForceField") - .add< CudaElementLinearSmallStrainFEMForceField >() + .add< CudaLinearSmallStrainFEMForceField >() ); #endif } diff --git a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.cu b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.cu similarity index 88% rename from applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.cu rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.cu index 9d0195ab580..e625c701d49 100644 --- a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.cu +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.cu @@ -21,7 +21,7 @@ ******************************************************************************/ #include #include -#include "CudaElementFEMKernelUtils.cuh" +#include "CudaFEMKernelUtils.cuh" namespace sofa::gpu::cuda { @@ -30,7 +30,7 @@ namespace sofa::gpu::cuda * Kernel for addForce: f = -K * (x - x0) */ template -__global__ void ElementLinearSmallStrainFEMForceField_computeForce_kernel( +__global__ void LinearSmallStrainFEMForceField_computeForce_kernel( int nbElem, const int* __restrict__ elements, const T* __restrict__ stiffness, @@ -61,7 +61,7 @@ __global__ void ElementLinearSmallStrainFEMForceField_computeForce_kernel( * Kernel for addDForce: df = -kFactor * K * dx */ template -__global__ void ElementLinearSmallStrainFEMForceField_computeDForce_kernel( +__global__ void LinearSmallStrainFEMForceField_computeDForce_kernel( int nbElem, const int* __restrict__ elements, const T* __restrict__ stiffness, @@ -91,7 +91,7 @@ __global__ void ElementLinearSmallStrainFEMForceField_computeDForce_kernel( // ===================== Launch functions ===================== template -void ElementLinearSmallStrainFEMForceFieldCuda_addForce( +void LinearSmallStrainFEMForceFieldCuda_addForce( unsigned int nbElem, unsigned int nbVertex, unsigned int maxElemPerVertex, @@ -105,7 +105,7 @@ void ElementLinearSmallStrainFEMForceFieldCuda_addForce( { const int computeThreads = 64; int numBlocks = (nbElem + computeThreads - 1) / computeThreads; - ElementLinearSmallStrainFEMForceField_computeForce_kernel + LinearSmallStrainFEMForceField_computeForce_kernel <<>>( nbElem, (const int*)elements, @@ -113,7 +113,7 @@ void ElementLinearSmallStrainFEMForceFieldCuda_addForce( (const T*)x, (const T*)x0, (T*)eforce); - mycudaDebugError("ElementLinearSmallStrainFEMForceField_computeForce_kernel"); + mycudaDebugError("LinearSmallStrainFEMForceField_computeForce_kernel"); const int gatherThreads = 256; numBlocks = (nbVertex + gatherThreads - 1) / gatherThreads; @@ -128,7 +128,7 @@ void ElementLinearSmallStrainFEMForceFieldCuda_addForce( } template -void ElementLinearSmallStrainFEMForceFieldCuda_addDForce( +void LinearSmallStrainFEMForceFieldCuda_addDForce( unsigned int nbElem, unsigned int nbVertex, unsigned int maxElemPerVertex, @@ -142,7 +142,7 @@ void ElementLinearSmallStrainFEMForceFieldCuda_addDForce( { const int computeThreads = 64; int numBlocks = (nbElem + computeThreads - 1) / computeThreads; - ElementLinearSmallStrainFEMForceField_computeDForce_kernel + LinearSmallStrainFEMForceField_computeDForce_kernel <<>>( nbElem, (const int*)elements, @@ -150,7 +150,7 @@ void ElementLinearSmallStrainFEMForceFieldCuda_addDForce( (const T*)dx, (T*)eforce, kFactor); - mycudaDebugError("ElementLinearSmallStrainFEMForceField_computeDForce_kernel"); + mycudaDebugError("LinearSmallStrainFEMForceField_computeDForce_kernel"); const int gatherThreads = 256; numBlocks = (nbVertex + gatherThreads - 1) / gatherThreads; @@ -167,10 +167,10 @@ void ElementLinearSmallStrainFEMForceFieldCuda_addDForce( // ===================== Explicit template instantiations ===================== #define INSTANTIATE_LINEAR(T, NNodes) \ - template void ElementLinearSmallStrainFEMForceFieldCuda_addForce( \ + template void LinearSmallStrainFEMForceFieldCuda_addForce( \ unsigned int, unsigned int, unsigned int, const void*, const void*, \ const void*, const void*, void*, void*, const void*); \ - template void ElementLinearSmallStrainFEMForceFieldCuda_addDForce( \ + template void LinearSmallStrainFEMForceFieldCuda_addDForce( \ unsigned int, unsigned int, unsigned int, const void*, const void*, \ const void*, void*, void*, const void*, T); diff --git a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.h b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.h similarity index 82% rename from applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.h rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.h index 45d119846e8..41490465d72 100644 --- a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.h +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.h @@ -22,13 +22,13 @@ #pragma once #include -#include +#include namespace sofa::gpu::cuda { template -void ElementLinearSmallStrainFEMForceFieldCuda_addForce( +void LinearSmallStrainFEMForceFieldCuda_addForce( unsigned int nbElem, unsigned int nbVertex, unsigned int maxElemPerVertex, @@ -41,7 +41,7 @@ void ElementLinearSmallStrainFEMForceFieldCuda_addForce( const void* velems); template -void ElementLinearSmallStrainFEMForceFieldCuda_addDForce( +void LinearSmallStrainFEMForceFieldCuda_addDForce( unsigned int nbElem, unsigned int nbVertex, unsigned int maxElemPerVertex, @@ -59,7 +59,7 @@ namespace sofa::component::solidmechanics::fem::elastic { /** - * CUDA-accelerated version of ElementLinearSmallStrainFEMForceField. + * CUDA-accelerated version of LinearSmallStrainFEMForceField. * * Works with any element type (Edge, Triangle, Quad, Tetrahedron, Hexahedron). * Both addForce and addDForce run entirely on GPU. @@ -71,13 +71,13 @@ namespace sofa::component::solidmechanics::fem::elastic * Compared to the corotational version, no rotation matrices are needed. */ template -class CudaElementLinearSmallStrainFEMForceField - : public ElementLinearSmallStrainFEMForceField +class CudaLinearSmallStrainFEMForceField + : public LinearSmallStrainFEMForceField { public: SOFA_CLASS( - SOFA_TEMPLATE2(CudaElementLinearSmallStrainFEMForceField, DataTypes, ElementType), - SOFA_TEMPLATE2(ElementLinearSmallStrainFEMForceField, DataTypes, ElementType)); + SOFA_TEMPLATE2(CudaLinearSmallStrainFEMForceField, DataTypes, ElementType), + SOFA_TEMPLATE2(LinearSmallStrainFEMForceField, DataTypes, ElementType)); using Real = sofa::Real_t; using Coord = sofa::Coord_t; @@ -85,16 +85,6 @@ class CudaElementLinearSmallStrainFEMForceField using VecCoord = sofa::VecCoord_t; using VecDeriv = sofa::VecDeriv_t; - static const std::string GetCustomClassName() - { - return ElementLinearSmallStrainFEMForceField::GetCustomClassName(); - } - - static const std::string GetCustomTemplateName() - { - return DataTypes::Name(); - } - void init() override; void addForce( @@ -110,7 +100,7 @@ class CudaElementLinearSmallStrainFEMForceField protected: - CudaElementLinearSmallStrainFEMForceField() = default; + CudaLinearSmallStrainFEMForceField() = default; void uploadStiffnessAndConnectivity(); diff --git a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.inl b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.inl similarity index 89% rename from applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.inl rename to applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.inl index f590bc86b66..967bb65ccf5 100644 --- a/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaElementLinearSmallStrainFEMForceField.inl +++ b/applications/plugins/SofaCUDA/Component/src/SofaCUDA/component/solidmechanics/fem/elastic/CudaLinearSmallStrainFEMForceField.inl @@ -20,8 +20,8 @@ * Contact information: contact@sofa-framework.org * ******************************************************************************/ #pragma once -#include -#include +#include +#include #include #include @@ -29,9 +29,9 @@ namespace sofa::component::solidmechanics::fem::elastic { template -void CudaElementLinearSmallStrainFEMForceField::init() +void CudaLinearSmallStrainFEMForceField::init() { - ElementLinearSmallStrainFEMForceField::init(); + LinearSmallStrainFEMForceField::init(); if (!this->isComponentStateInvalid()) { @@ -40,7 +40,7 @@ void CudaElementLinearSmallStrainFEMForceField::init() } template -void CudaElementLinearSmallStrainFEMForceField::uploadStiffnessAndConnectivity() +void CudaLinearSmallStrainFEMForceField::uploadStiffnessAndConnectivity() { using trait = sofa::component::solidmechanics::fem::elastic::trait; @@ -145,7 +145,7 @@ void CudaElementLinearSmallStrainFEMForceField::uploadSt } template -void CudaElementLinearSmallStrainFEMForceField::addForce( +void CudaLinearSmallStrainFEMForceField::addForce( const sofa::core::MechanicalParams* mparams, sofa::DataVecDeriv_t& d_f, const sofa::DataVecCoord_t& d_x, @@ -156,7 +156,7 @@ void CudaElementLinearSmallStrainFEMForceField::addForce if (!m_gpuDataUploaded) { - ElementLinearSmallStrainFEMForceField::addForce(mparams, d_f, d_x, d_v); + LinearSmallStrainFEMForceField::addForce(mparams, d_f, d_x, d_v); return; } @@ -177,7 +177,7 @@ void CudaElementLinearSmallStrainFEMForceField::addForce const auto nbElem = static_cast(elements.size()); const auto nbVertex = static_cast(x.size()); - gpu::cuda::ElementLinearSmallStrainFEMForceFieldCuda_addForce( + gpu::cuda::LinearSmallStrainFEMForceFieldCuda_addForce( nbElem, nbVertex, m_maxElemPerVertex, m_gpuElements.deviceRead(), m_gpuStiffness.deviceRead(), x.deviceRead(), x0.deviceRead(), @@ -188,7 +188,7 @@ void CudaElementLinearSmallStrainFEMForceField::addForce } template -void CudaElementLinearSmallStrainFEMForceField::addDForce( +void CudaLinearSmallStrainFEMForceField::addDForce( const sofa::core::MechanicalParams* mparams, sofa::DataVecDeriv_t& d_df, const sofa::DataVecDeriv_t& d_dx) @@ -199,7 +199,7 @@ void CudaElementLinearSmallStrainFEMForceField::addDForc if (!m_gpuDataUploaded) { // Fallback to CPU if GPU data not ready - ElementLinearSmallStrainFEMForceField::addDForce(mparams, d_df, d_dx); + LinearSmallStrainFEMForceField::addDForce(mparams, d_df, d_dx); return; } @@ -221,7 +221,7 @@ void CudaElementLinearSmallStrainFEMForceField::addDForc const auto nbElem = static_cast(elements.size()); const auto nbVertex = static_cast(dx.size()); - gpu::cuda::ElementLinearSmallStrainFEMForceFieldCuda_addDForce( + gpu::cuda::LinearSmallStrainFEMForceFieldCuda_addDForce( nbElem, nbVertex, m_maxElemPerVertex, m_gpuElements.deviceRead(), m_gpuStiffness.deviceRead(), dx.deviceRead(), df.deviceWrite(), diff --git a/applications/plugins/SofaCUDA/examples/.scene-tests b/applications/plugins/SofaCUDA/examples/.scene-tests index 033705ee8c7..0f0ae272277 100644 --- a/applications/plugins/SofaCUDA/examples/.scene-tests +++ b/applications/plugins/SofaCUDA/examples/.scene-tests @@ -33,16 +33,16 @@ timeout "TetrahedralTensorMassForceFieldCPU.scn" "60" ignore "TetrahedralTensorMassForceFieldCUDA.scn" ignore "TetrahedronFEM_with_SpringForceField.scn" -ignore "CudaElementCorotationalFEMForceField.scn" -ignore "CudaElementLinearSmallStrainFEMForceField.scn" -ignore "CudaElementCorotationalFEMForceField_hexa.scn" -ignore "CudaElementCorotationalFEMForceField_quad.scn" -ignore "CudaElementCorotationalFEMForceField_tetra.scn" -ignore "CudaElementCorotationalFEMForceField_triangle.scn" -ignore "CudaElementLinearSmallStrainFEMForceField_hexa.scn" -ignore "CudaElementLinearSmallStrainFEMForceField_quad.scn" -ignore "CudaElementLinearSmallStrainFEMForceField_tetra.scn" -ignore "CudaElementLinearSmallStrainFEMForceField_triangle.scn" -ignore "ElementCorotationalFEMForceField_tetra_cpu_gpu.scn" +ignore "CudaCorotationalFEMForceField.scn" +ignore "CudaLinearSmallStrainFEMForceField.scn" +ignore "CudaCorotationalFEMForceField_hexa.scn" +ignore "CudaCorotationalFEMForceField_quad.scn" +ignore "CudaCorotationalFEMForceField_tetra.scn" +ignore "CudaCorotationalFEMForceField_triangle.scn" +ignore "CudaLinearSmallStrainFEMForceField_hexa.scn" +ignore "CudaLinearSmallStrainFEMForceField_quad.scn" +ignore "CudaLinearSmallStrainFEMForceField_tetra.scn" +ignore "CudaLinearSmallStrainFEMForceField_triangle.scn" +ignore "CorotationalFEMForceField_tetra_cpu_gpu.scn" ignore "Tetrahedron_corotational.py" ignore "Hexahedron_corotational.py" diff --git a/applications/plugins/SofaCUDA/examples/CudaElementCorotationalFEMForceField.scn b/applications/plugins/SofaCUDA/examples/CudaCorotationalFEMForceField.scn similarity index 88% rename from applications/plugins/SofaCUDA/examples/CudaElementCorotationalFEMForceField.scn rename to applications/plugins/SofaCUDA/examples/CudaCorotationalFEMForceField.scn index 7ecf5da0d41..3f65d050936 100644 --- a/applications/plugins/SofaCUDA/examples/CudaElementCorotationalFEMForceField.scn +++ b/applications/plugins/SofaCUDA/examples/CudaCorotationalFEMForceField.scn @@ -30,8 +30,8 @@ - + --> @@ -58,8 +58,8 @@ - + @@ -78,7 +78,7 @@ - + --> diff --git a/applications/plugins/SofaCUDA/examples/CudaElementLinearSmallStrainFEMForceField.scn b/applications/plugins/SofaCUDA/examples/CudaLinearSmallStrainFEMForceField.scn similarity index 87% rename from applications/plugins/SofaCUDA/examples/CudaElementLinearSmallStrainFEMForceField.scn rename to applications/plugins/SofaCUDA/examples/CudaLinearSmallStrainFEMForceField.scn index 39a5017048d..5b88ab29745 100644 --- a/applications/plugins/SofaCUDA/examples/CudaElementLinearSmallStrainFEMForceField.scn +++ b/applications/plugins/SofaCUDA/examples/CudaLinearSmallStrainFEMForceField.scn @@ -29,8 +29,8 @@ - + --> @@ -57,8 +57,8 @@ - + @@ -77,7 +77,7 @@ - + --> diff --git a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementCorotationalFEMForceField_hexa.scn b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaCorotationalFEMForceField_hexa.scn similarity index 90% rename from applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementCorotationalFEMForceField_hexa.scn rename to applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaCorotationalFEMForceField_hexa.scn index a08c65e0024..4087b4d35f6 100644 --- a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementCorotationalFEMForceField_hexa.scn +++ b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaCorotationalFEMForceField_hexa.scn @@ -30,8 +30,8 @@ - + diff --git a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementCorotationalFEMForceField_quad.scn b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaCorotationalFEMForceField_quad.scn similarity index 92% rename from applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementCorotationalFEMForceField_quad.scn rename to applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaCorotationalFEMForceField_quad.scn index 047a96624f9..391720de4cd 100644 --- a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementCorotationalFEMForceField_quad.scn +++ b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaCorotationalFEMForceField_quad.scn @@ -30,7 +30,7 @@ - + diff --git a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementCorotationalFEMForceField_tetra.scn b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaCorotationalFEMForceField_tetra.scn similarity index 92% rename from applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementCorotationalFEMForceField_tetra.scn rename to applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaCorotationalFEMForceField_tetra.scn index 57a39e63286..99db3eb91d8 100644 --- a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementCorotationalFEMForceField_tetra.scn +++ b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaCorotationalFEMForceField_tetra.scn @@ -39,8 +39,8 @@ - + diff --git a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementCorotationalFEMForceField_triangle.scn b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaCorotationalFEMForceField_triangle.scn similarity index 92% rename from applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementCorotationalFEMForceField_triangle.scn rename to applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaCorotationalFEMForceField_triangle.scn index 0a47b7e393d..b0cf2b2f857 100644 --- a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementCorotationalFEMForceField_triangle.scn +++ b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaCorotationalFEMForceField_triangle.scn @@ -30,6 +30,6 @@ - + diff --git a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementLinearSmallStrainFEMForceField_hexa.scn b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaLinearSmallStrainFEMForceField_hexa.scn similarity index 94% rename from applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementLinearSmallStrainFEMForceField_hexa.scn rename to applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaLinearSmallStrainFEMForceField_hexa.scn index 228e4a08943..d97ce9cf27a 100644 --- a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementLinearSmallStrainFEMForceField_hexa.scn +++ b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaLinearSmallStrainFEMForceField_hexa.scn @@ -29,7 +29,7 @@ - diff --git a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementLinearSmallStrainFEMForceField_quad.scn b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaLinearSmallStrainFEMForceField_quad.scn similarity index 92% rename from applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementLinearSmallStrainFEMForceField_quad.scn rename to applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaLinearSmallStrainFEMForceField_quad.scn index 14babc5d207..2542b7b7e41 100644 --- a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementLinearSmallStrainFEMForceField_quad.scn +++ b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaLinearSmallStrainFEMForceField_quad.scn @@ -29,7 +29,7 @@ - + diff --git a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementLinearSmallStrainFEMForceField_tetra.scn b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaLinearSmallStrainFEMForceField_tetra.scn similarity index 91% rename from applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementLinearSmallStrainFEMForceField_tetra.scn rename to applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaLinearSmallStrainFEMForceField_tetra.scn index eac98ff93ac..8864c7a68d3 100644 --- a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementLinearSmallStrainFEMForceField_tetra.scn +++ b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaLinearSmallStrainFEMForceField_tetra.scn @@ -38,8 +38,8 @@ - + diff --git a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementLinearSmallStrainFEMForceField_triangle.scn b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaLinearSmallStrainFEMForceField_triangle.scn similarity index 92% rename from applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementLinearSmallStrainFEMForceField_triangle.scn rename to applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaLinearSmallStrainFEMForceField_triangle.scn index 03c6955697c..d383bf5db04 100644 --- a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaElementLinearSmallStrainFEMForceField_triangle.scn +++ b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/CudaLinearSmallStrainFEMForceField_triangle.scn @@ -29,7 +29,7 @@ - + diff --git a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/benchmarks/Hexahedron_corotational.py b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/benchmarks/Hexahedron_corotational.py index aec2063fbe6..295a7ac4e1a 100644 --- a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/benchmarks/Hexahedron_corotational.py +++ b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/benchmarks/Hexahedron_corotational.py @@ -52,7 +52,7 @@ def createScene(root_node): if g_fem_version == "legacy": hexahedron_node.addObject('HexahedronFEMForceField', name="LegacyFEM", template=g_fem_template, youngModulus="4000", poissonRatio="0.3", method="large") if g_fem_version == "new": - hexahedron_node.addObject('HexahedronCorotationalFEMForceField', name="NewFEM", template=g_fem_template, youngModulus="4000", poissonRatio="0.3") + hexahedron_node.addObject('CudaCorotationalFEMForceField', name="NewFEM", template=f"${g_fem_template},Hexahedron", youngModulus="4000", poissonRatio="0.3") def main(): diff --git a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/benchmarks/Tetrahedron_corotational.py b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/benchmarks/Tetrahedron_corotational.py index d9480c34dfa..734eb29e9cd 100644 --- a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/benchmarks/Tetrahedron_corotational.py +++ b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/benchmarks/Tetrahedron_corotational.py @@ -53,7 +53,7 @@ def createScene(root_node): if g_fem_version == "legacy": tetrahedron_node.addObject('TetrahedronFEMForceField', name="LegacyFEM", template=g_fem_template, youngModulus="4000", poissonRatio="0.3", method="large") if g_fem_version == "new": - tetrahedron_node.addObject('TetrahedronCorotationalFEMForceField', name="NewFEM", template=g_fem_template, youngModulus="4000", poissonRatio="0.3") + tetrahedron_node.addObject('CudaCorotationalFEMForceField', name="NewFEM", template=f"${g_fem_template},Tetrahedron", youngModulus="4000", poissonRatio="0.3") def main(): diff --git a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/cpu-gpu_validation/ElementCorotationalFEMForceField_tetra_cpu_gpu.scn b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/cpu-gpu_validation/CorotationalFEMForceField_tetra_cpu_gpu.scn similarity index 100% rename from applications/plugins/SofaCUDA/examples/ElementFEMForcefield/cpu-gpu_validation/ElementCorotationalFEMForceField_tetra_cpu_gpu.scn rename to applications/plugins/SofaCUDA/examples/ElementFEMForcefield/cpu-gpu_validation/CorotationalFEMForceField_tetra_cpu_gpu.scn diff --git a/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/cpu-gpu_validation/ElementCorotationalFEMForceField_tetra_cpu_gpu.scn.view b/applications/plugins/SofaCUDA/examples/ElementFEMForcefield/cpu-gpu_validation/CorotationalFEMForceField_tetra_cpu_gpu.scn.view similarity index 100% rename from applications/plugins/SofaCUDA/examples/ElementFEMForcefield/cpu-gpu_validation/ElementCorotationalFEMForceField_tetra_cpu_gpu.scn.view rename to applications/plugins/SofaCUDA/examples/ElementFEMForcefield/cpu-gpu_validation/CorotationalFEMForceField_tetra_cpu_gpu.scn.view diff --git a/examples/Component/Topology/Mapping/Hexa2PrismTopologicalMapping.scn b/examples/Component/Topology/Mapping/Hexa2PrismTopologicalMapping.scn index c2867de54c2..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"/> - + diff --git a/examples/Validation/cantilever_beam/CantileverBeam_ElementFEMForceField.xml b/examples/Validation/cantilever_beam/CantileverBeam_ElementFEMForceField.xml index 5953130431f..157de731557 100644 --- a/examples/Validation/cantilever_beam/CantileverBeam_ElementFEMForceField.xml +++ b/examples/Validation/cantilever_beam/CantileverBeam_ElementFEMForceField.xml @@ -31,7 +31,7 @@ - + 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..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,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..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,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..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,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..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,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..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,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..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,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..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,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..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,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..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,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..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,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..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,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..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,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..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,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..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,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..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,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..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,8 +10,9 @@ - +