Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
b64aab4
Start refactoring of ObjectFactory
alxbilger Jun 22, 2026
9b9430c
clean plugin loading
alxbilger Jun 23, 2026
10dea21
cleaning
alxbilger Jun 23, 2026
3688674
separate concepts: data/builder/creator
alxbilger Jun 23, 2026
2dde2d8
introduce deduction rules
alxbilger Jun 23, 2026
19990ba
legacy template keyword
alxbilger Jun 23, 2026
af4ad09
warning
alxbilger Jun 23, 2026
1700e5c
extend factory registration to RequiredPlugin and SparseLDLSolver
alxbilger Jun 23, 2026
9b6e08f
stream operator
alxbilger Jun 23, 2026
0087f97
move to cpp
alxbilger Jun 23, 2026
079e09e
don't expose
alxbilger Jun 23, 2026
34a7d44
support legacy registration
alxbilger Jun 25, 2026
ea0b670
convert CorotationalFEMForceField
alxbilger Jun 25, 2026
f7c8d85
partial template matching
alxbilger Jun 25, 2026
4a78b69
in progress
alxbilger Jun 26, 2026
a550a53
clearer
alxbilger Jun 26, 2026
adf3da5
filter if plugins don't match
alxbilger Jun 26, 2026
4fcea7a
typo
alxbilger Jun 26, 2026
1b7a492
message unloaded plugins
alxbilger Jun 26, 2026
06b1910
known issues
alxbilger Jun 26, 2026
8892ad7
cleaning
alxbilger Jun 26, 2026
08248c8
more deduction rules
alxbilger Jun 26, 2026
133fe2c
more compatibility
alxbilger Jun 26, 2026
15eec5a
factorization
alxbilger Jun 27, 2026
e4a18f6
missing branch
alxbilger Jun 27, 2026
3a1bd00
module name in legacy mode
alxbilger Jun 27, 2026
92e0655
secure vector access
alxbilger Jun 27, 2026
1e953ac
add first tests
alxbilger Jun 27, 2026
9c8769e
refacto
alxbilger Jun 27, 2026
8d8032d
illustrate difference
alxbilger Jun 28, 2026
4cf2747
define the factory name of a component
alxbilger Jun 29, 2026
2d417f4
more tests
alxbilger Jun 29, 2026
fe972a5
more messages
alxbilger Jun 29, 2026
ba48254
factorization in a loop
alxbilger Jun 29, 2026
7075e5f
fix
alxbilger Jun 29, 2026
d89c4e3
more tests
alxbilger Jun 29, 2026
88e9c46
more tests and fixes
alxbilger Jun 30, 2026
0037609
deprecate functions
alxbilger Jun 30, 2026
df46e51
more deprecation
alxbilger Jun 30, 2026
9858bdf
fix legacy support
alxbilger Jun 30, 2026
d3b85fe
test legacy support
alxbilger Jun 30, 2026
d931f36
fix compilation
alxbilger Jun 30, 2026
c81cd67
documentation
alxbilger Jun 30, 2026
83f94a2
fix
alxbilger Jun 30, 2026
3ea17aa
add warning comment
alxbilger Jun 30, 2026
fa54234
fix empty constructor
alxbilger Jun 30, 2026
9a03908
remove ComponentLibrary and remove most of CategoryLibrary
alxbilger Jul 1, 2026
134cbb4
fix old registration (before the legacy)
alxbilger Jul 1, 2026
42e6e9d
change json
alxbilger Jul 1, 2026
082b036
try to fix
alxbilger Jul 1, 2026
9711eff
try again
alxbilger Jul 1, 2026
a4d7ae7
separation of concerns
alxbilger Jul 1, 2026
dd5db24
use 'template' keyword to treat 'addTemplateAttribute' as a dependent…
alxbilger Jul 1, 2026
084a234
fix MultiThreading
alxbilger Jul 1, 2026
fcb9bd1
use 'template' keyword to treat 'addTemplateAttribute' as a dependent…
alxbilger Jul 1, 2026
1f03f53
whole module
alxbilger Jul 1, 2026
548c010
template keyword
alxbilger Jul 1, 2026
f698c08
register BarycentricMapping using the legacy canCreate deduction rule
alxbilger Jul 1, 2026
1c711f8
move to cpp
alxbilger Jul 1, 2026
a7ecdbe
add findComponent
alxbilger Jul 1, 2026
15cef2c
fix
alxbilger Jul 1, 2026
7e10bb3
documentation
alxbilger Jul 1, 2026
c40888f
move into classes
alxbilger Jul 1, 2026
f45d1b6
move to files
alxbilger Jul 1, 2026
26e006a
decomposition
alxbilger Jul 1, 2026
2d0bc75
add deleted method
alxbilger Jul 2, 2026
deecea4
make it const
alxbilger Jul 2, 2026
6b93015
set all the registration data in BaseComponent
alxbilger Jul 2, 2026
9aaeb8e
deduce class name
alxbilger Jul 2, 2026
8866713
template deduction rule can be deduced from base class
alxbilger Jul 2, 2026
196594a
experiment
alxbilger Jul 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ class Distances : public core::DataEngine
DistancesInternalData<DataTypes> data;
friend class DistancesInternalData<DataTypes>;

Distances ( sofa::component::topology::container::dynamic::DynamicSparseGridTopologyContainer* hexaTopoContainer, core::behavior::MechanicalState<DataTypes>* targetPointSet );
explicit Distances(
topology::container::dynamic::DynamicSparseGridTopologyContainer* hexaTopoContainer = nullptr,
core::behavior::MechanicalState<DataTypes>* targetPointSet = nullptr );

~Distances() override {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,23 @@ namespace sofa::component::linearsolver::direct

using namespace sofa::linearalgebra;

constexpr std::string_view description { "Direct linear solver using a Sparse LDL^T factorization." };

template<class TMatrix, class TVector>
void registerComponent(sofa::core::ComponentFactory* factory)
{
factory->registerComponent(
core::CreateComponent<SparseLDLSolver<TMatrix, TVector>>()
.withModule(MODULE_NAME)
.withDescription(std::string(description))
.template addTemplateAttribute<TMatrix>("matrixType")
);
};

void registerSparseLDLSolver(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Direct linear solver using a Sparse LDL^T factorization.")
.add< SparseLDLSolver< CompressedRowSparseMatrix<SReal>, FullVector<SReal> > >(true)
.add< SparseLDLSolver< CompressedRowSparseMatrix<type::Mat<3, 3, SReal> >, FullVector<SReal> > >());
registerComponent<CompressedRowSparseMatrix<SReal>, FullVector<SReal>>(factory);
registerComponent<CompressedRowSparseMatrix<sofa::type::Mat<3, 3, SReal>>, FullVector<SReal>>(factory);
}

template class SOFA_COMPONENT_LINEARSOLVER_DIRECT_API SparseLDLSolver< CompressedRowSparseMatrix<SReal>,FullVector<SReal> >;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,14 @@ using namespace sofa::defaulttype;

void registerBarycentricMapping(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Mapping using barycentric coordinates of the child with respect to cells of its parent.")
.add< BarycentricMapping< Vec3Types, Vec3Types > >(true));
factory->registerComponent(
core::CreateComponent<BarycentricMapping<Vec3Types, Vec3Types>>()
.withModule(MODULE_NAME)
.withDescription("Mapping using barycentric coordinates of the child with respect to cells of its parent.")
.template addTemplateAttribute<Vec3Types>("inDofType")
.template addTemplateAttribute<Vec3Types>("outDofType")
.template withDeductionRule<core::CanCreateDeductionRule<BarycentricMapping< Vec3Types, Vec3Types >>>()
);
}

template class SOFA_COMPONENT_MAPPING_LINEAR_API BarycentricMapping< Vec3Types, Vec3Types >;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ using namespace sofa::defaulttype;

void registerBeamFEMForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Beam finite elements.")
.add< BeamFEMForceField<Rigid3Types> >());
factory->registerComponent(
core::CreateComponent<BeamFEMForceField<Rigid3Types>>()
.withModule(MODULE_NAME)
.withDescription("Beam finite elements.")
);
}

namespace _beamfemforcefield_
Expand All @@ -43,4 +46,4 @@ namespace _beamfemforcefield_

} // namespace _beamfemforcefield_

} // namespace sofa::component::solidmechanics::fem::elastic
} // namespace sofa::component::solidmechanics::fem::elastic
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,34 @@
namespace sofa::component::solidmechanics::fem::elastic
{

void registerCorotationalFEMForceField(sofa::core::ObjectFactory* factory)
static constexpr std::string_view description { "Hooke's law using the corotational approach" };

template <class DataTypes, class ElementType>
void registerComponent(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law using the corotational approach")
// .add< CorotationalFEMForceField<sofa::defaulttype::Vec1Types, sofa::geometry::Edge> >()
.add< CorotationalFEMForceField<sofa::defaulttype::Vec2Types, sofa::geometry::Edge> >()
.add< CorotationalFEMForceField<sofa::defaulttype::Vec3Types, sofa::geometry::Edge> >()
.add< CorotationalFEMForceField<sofa::defaulttype::Vec2Types, sofa::geometry::Triangle> >()
.add< CorotationalFEMForceField<sofa::defaulttype::Vec3Types, sofa::geometry::Triangle> >()
.add< CorotationalFEMForceField<sofa::defaulttype::Vec2Types, sofa::geometry::Quad> >()
.add< CorotationalFEMForceField<sofa::defaulttype::Vec3Types, sofa::geometry::Quad> >()
.add< CorotationalFEMForceField<sofa::defaulttype::Vec3Types, sofa::geometry::Tetrahedron> >()
.add< CorotationalFEMForceField<sofa::defaulttype::Vec3Types, sofa::geometry::Hexahedron> >()
.add< CorotationalFEMForceField<sofa::defaulttype::Vec3Types, sofa::geometry::Prism> >()
factory->registerComponent(
core::CreateComponent<CorotationalFEMForceField<DataTypes, ElementType>>()
.withModule(MODULE_NAME)
.withDescription(std::string(description))
.template addTemplateAttribute<DataTypes>("dofType")
.addTemplateAttribute("elementType", sofa::geometry::elementTypeToString(ElementType::Element_type))
);
}

void registerCorotationalFEMForceField(sofa::core::ObjectFactory* factory)
{
// registerComponent<sofa::defaulttype::Vec1Types, sofa::geometry::Edge>(factory);
registerComponent<sofa::defaulttype::Vec2Types, sofa::geometry::Edge>(factory);
registerComponent<sofa::defaulttype::Vec3Types, sofa::geometry::Edge>(factory);
registerComponent<sofa::defaulttype::Vec2Types, sofa::geometry::Triangle>(factory);
registerComponent<sofa::defaulttype::Vec3Types, sofa::geometry::Triangle>(factory);
registerComponent<sofa::defaulttype::Vec2Types, sofa::geometry::Quad>(factory);
registerComponent<sofa::defaulttype::Vec3Types, sofa::geometry::Quad>(factory);
registerComponent<sofa::defaulttype::Vec3Types, sofa::geometry::Tetrahedron>(factory);
registerComponent<sofa::defaulttype::Vec3Types, sofa::geometry::Hexahedron>(factory);
registerComponent<sofa::defaulttype::Vec3Types, sofa::geometry::Prism>(factory);
}

// template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField<sofa::defaulttype::Vec1Types, sofa::geometry::Edge>;
template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField<sofa::defaulttype::Vec2Types, sofa::geometry::Edge>;
template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API CorotationalFEMForceField<sofa::defaulttype::Vec3Types, sofa::geometry::Edge>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ using namespace sofa::defaulttype;

void registerFastTetrahedralCorotationalForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Fast Corotational Tetrahedral Mesh.")
.add< FastTetrahedralCorotationalForceField<Vec3Types> >());
factory->registerComponent(
core::CreateComponent<FastTetrahedralCorotationalForceField<Vec3Types>>()
.withModule(MODULE_NAME)
.withDescription("Fast Corotational Tetrahedral Mesh.")
.template addTemplateAttribute<Vec3Types>("dofType")
);
}

template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API FastTetrahedralCorotationalForceField<Vec3Types>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@ using namespace sofa::defaulttype;

void registerHexahedralFEMForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Hexahedral finite elements.")
.add< HexahedralFEMForceField<Vec3Types> >());
factory->registerComponent(
core::CreateComponent<HexahedralFEMForceField<Vec3Types>>()
.withModule(MODULE_NAME)
.withDescription("Hexahedral finite elements.")
.template addTemplateAttribute<Vec3Types>("dofType")
);
}

template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API HexahedralFEMForceField<Vec3Types>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@ using namespace sofa::defaulttype;

void registerHexahedralFEMForceFieldAndMass(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Hexahedral finite elements with mass")
.add< HexahedralFEMForceFieldAndMass<Vec3Types> >());
factory->registerComponent(
core::CreateComponent<HexahedralFEMForceFieldAndMass<Vec3Types>>()
.withModule(MODULE_NAME)
.withDescription("Hexahedral finite elements with mass")
.template addTemplateAttribute<Vec3Types>("dofType")
);
}

template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API HexahedralFEMForceFieldAndMass<Vec3Types>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@ using namespace sofa::defaulttype;

void registerHexahedronFEMForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Hexahedral finite elements.")
.add< HexahedronFEMForceField<Vec3Types> >());
factory->registerComponent(
core::CreateComponent<HexahedronFEMForceField<Vec3Types>>()
.withModule(MODULE_NAME)
.withDescription("Hexahedral finite elements.")
.template addTemplateAttribute<Vec3Types>("dofType")
);
}

template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API HexahedronFEMForceField<Vec3Types>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,16 @@ using namespace sofa::defaulttype;

void registerHexahedronFEMForceFieldAndMass(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Hexahedral finite elements with mass.")
.add< HexahedronFEMForceFieldAndMass<Vec3Types> >());
factory->registerComponent(
core::CreateComponent<HexahedronFEMForceFieldAndMass<Vec3Types>>()
.withModule(MODULE_NAME)
.withDescription("Hexahedral finite elements with mass.")
.template addTemplateAttribute<Vec3Types>("dofType")
);
}

template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API HexahedronFEMForceFieldAndMass<Vec3Types>;



} // namespace sofa::component::solidmechanics::fem::elastic
} // namespace sofa::component::solidmechanics::fem::elastic
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,34 @@
namespace sofa::component::solidmechanics::fem::elastic
{

void registerLinearSmallStrainFEMForceField(sofa::core::ObjectFactory* factory)
static constexpr std::string_view description { "Hooke's law assuming small strain" };

template <class DataTypes, class ElementType>
void registerComponent(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(sofa::core::ObjectRegistrationData("Hooke's law assuming small strain")
.add< LinearSmallStrainFEMForceField<sofa::defaulttype::Vec1Types, sofa::geometry::Edge> >()
.add< LinearSmallStrainFEMForceField<sofa::defaulttype::Vec2Types, sofa::geometry::Edge> >()
.add< LinearSmallStrainFEMForceField<sofa::defaulttype::Vec3Types, sofa::geometry::Edge> >()
.add< LinearSmallStrainFEMForceField<sofa::defaulttype::Vec2Types, sofa::geometry::Triangle> >()
.add< LinearSmallStrainFEMForceField<sofa::defaulttype::Vec3Types, sofa::geometry::Triangle> >()
.add< LinearSmallStrainFEMForceField<sofa::defaulttype::Vec2Types, sofa::geometry::Quad> >()
.add< LinearSmallStrainFEMForceField<sofa::defaulttype::Vec3Types, sofa::geometry::Quad> >()
.add< LinearSmallStrainFEMForceField<sofa::defaulttype::Vec3Types, sofa::geometry::Tetrahedron> >()
.add< LinearSmallStrainFEMForceField<sofa::defaulttype::Vec3Types, sofa::geometry::Hexahedron> >()
.add< LinearSmallStrainFEMForceField<sofa::defaulttype::Vec3Types, sofa::geometry::Prism> >()
factory->registerComponent(
core::CreateComponent<LinearSmallStrainFEMForceField<DataTypes, ElementType>>()
.withModule(MODULE_NAME)
.withDescription(std::string(description))
.template addTemplateAttribute<DataTypes>("dofType")
.addTemplateAttribute("elementType", sofa::geometry::elementTypeToString(ElementType::Element_type))
);
}

void registerLinearSmallStrainFEMForceField(sofa::core::ObjectFactory* factory)
{
registerComponent<sofa::defaulttype::Vec1Types, sofa::geometry::Edge>(factory);
registerComponent<sofa::defaulttype::Vec2Types, sofa::geometry::Edge>(factory);
registerComponent<sofa::defaulttype::Vec3Types, sofa::geometry::Edge>(factory);
registerComponent<sofa::defaulttype::Vec2Types, sofa::geometry::Triangle>(factory);
registerComponent<sofa::defaulttype::Vec3Types, sofa::geometry::Triangle>(factory);
registerComponent<sofa::defaulttype::Vec2Types, sofa::geometry::Quad>(factory);
registerComponent<sofa::defaulttype::Vec3Types, sofa::geometry::Quad>(factory);
registerComponent<sofa::defaulttype::Vec3Types, sofa::geometry::Tetrahedron>(factory);
registerComponent<sofa::defaulttype::Vec3Types, sofa::geometry::Hexahedron>(factory);
registerComponent<sofa::defaulttype::Vec3Types, sofa::geometry::Prism>(factory);
}

template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField<sofa::defaulttype::Vec1Types, sofa::geometry::Edge>;
template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField<sofa::defaulttype::Vec2Types, sofa::geometry::Edge>;
template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API LinearSmallStrainFEMForceField<sofa::defaulttype::Vec3Types, sofa::geometry::Edge>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ using namespace sofa::defaulttype;

void registerQuadBendingFEMForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Bending Quad finite elements")
.add< QuadBendingFEMForceField<Vec3Types> >());
factory->registerComponent(
core::CreateComponent<QuadBendingFEMForceField<Vec3Types>>()
.withModule(MODULE_NAME)
.withDescription("Bending Quad finite elements")
.template addTemplateAttribute<Vec3Types>("dofType")
);
}

template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API QuadBendingFEMForceField<Vec3Types>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ using namespace sofa::defaulttype;

void registerTetrahedralCorotationalFEMForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Corotational FEM Tetrahedral finite elements")
.add< TetrahedralCorotationalFEMForceField<Vec3Types> >());
factory->registerComponent(
core::CreateComponent<TetrahedralCorotationalFEMForceField<Vec3Types>>()
.withModule(MODULE_NAME)
.withDescription("Corotational FEM Tetrahedral finite elements")
.template addTemplateAttribute<Vec3Types>("dofType")
);
}

template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API TetrahedralCorotationalFEMForceField<Vec3Types>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ using namespace sofa::defaulttype;

void registerTetrahedronFEMForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Tetrahedral finite elements.")
.add< TetrahedronFEMForceField<Vec3Types> >());
factory->registerComponent(
core::CreateComponent<TetrahedronFEMForceField<Vec3Types>>()
.withModule(MODULE_NAME)
.withDescription("Tetrahedral finite elements.")
.template addTemplateAttribute<Vec3Types>("dofType")
);
}

template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API TetrahedronFEMForceField<Vec3Types>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ using namespace sofa::defaulttype;

void registerTriangleFEMForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Triangular finite elements for static topology.")
.add< TriangleFEMForceField<Vec3Types> >());
factory->registerComponent(
core::CreateComponent<TriangleFEMForceField<Vec3Types>>()
.withModule(MODULE_NAME)
.withDescription("Triangular finite elements for static topology.")
.template addTemplateAttribute<Vec3Types>("dofType")
);
}

template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API TriangleFEMForceField<Vec3Types>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ using namespace sofa::defaulttype;

void registerTriangularAnisotropicFEMForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Triangular finite element model using anisotropic material.")
.add< TriangularAnisotropicFEMForceField<Vec3Types> >());
factory->registerComponent(
core::CreateComponent<TriangularAnisotropicFEMForceField<Vec3Types>>()
.withModule(MODULE_NAME)
.withDescription("Triangular finite element model using anisotropic material.")
.template addTemplateAttribute<Vec3Types>("dofType")
);
}

template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API TriangularAnisotropicFEMForceField<Vec3Types>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@ using namespace sofa::defaulttype;

void registerTriangularFEMForceField(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Corotational Triangular finite elements for dynamic topology.")
.add< TriangularFEMForceField<Vec3Types> >());
factory->registerComponent(
core::CreateComponent<TriangularFEMForceField<Vec3Types>>()
.withModule(MODULE_NAME)
.withDescription("Corotational Triangular finite elements for dynamic topology.")
.template addTemplateAttribute<Vec3Types>("dofType")
);
}

template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API TriangularFEMForceField<Vec3Types>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@ using namespace sofa::defaulttype;

void registerTriangularFEMForceFieldOptim(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("Corotational Triangular finite elements.")
.add< TriangularFEMForceFieldOptim<Vec3Types> >());
factory->registerComponent(
core::CreateComponent<TriangularFEMForceFieldOptim<Vec3Types>>()
.withModule(MODULE_NAME)
.withDescription("Corotational Triangular finite elements.")
.template addTemplateAttribute<Vec3Types>("dofType")
);
}

template class SOFA_COMPONENT_SOLIDMECHANICS_FEM_ELASTIC_API TriangularFEMForceFieldOptim<Vec3Types>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,28 @@ template class SOFA_COMPONENT_STATECONTAINER_API MechanicalObject<Vec6Types>;
template class SOFA_COMPONENT_STATECONTAINER_API MechanicalObject<Rigid3Types>;
template class SOFA_COMPONENT_STATECONTAINER_API MechanicalObject<Rigid2Types>;

static constexpr std::string_view description {"Mechanical state vectors"};

template<class T>
void registerComponent(sofa::core::ComponentFactory* factory)
{
factory->registerComponent(
core::CreateComponent<MechanicalObject<T>>("MechanicalObject")
.withModule(MODULE_NAME)
.withDescription(std::string(description))
.template addTemplateAttribute<T>("dofType")
);
};

void registerMechanicalObject(sofa::core::ObjectFactory* factory)
{
factory->registerObjects(core::ObjectRegistrationData("mechanical state vectors")
.add< MechanicalObject<Vec3Types> >(true) // default template
.add< MechanicalObject<Vec2Types> >()
.add< MechanicalObject<Vec1Types> >()
.add< MechanicalObject<Vec6Types> >()
.add< MechanicalObject<Rigid3Types> >()
.add< MechanicalObject<Rigid2Types> >());
registerComponent<Vec3Types>(factory);
registerComponent<Vec2Types>(factory);
registerComponent<Vec1Types>(factory);
registerComponent<Vec6Types>(factory);
registerComponent<Rigid3Types>(factory);
registerComponent<Rigid2Types>(factory);

}

template<>
Expand Down
Loading
Loading