diff --git a/Sofa/Component/Engine/Select/tests/MeshROI_test.cpp b/Sofa/Component/Engine/Select/tests/MeshROI_test.cpp index 2f5dd0ad8ef..aa3e96d8ab6 100644 --- a/Sofa/Component/Engine/Select/tests/MeshROI_test.cpp +++ b/Sofa/Component/Engine/Select/tests/MeshROI_test.cpp @@ -73,7 +73,7 @@ struct MeshROI_test : public BaseSimulationTest, " " " " " " - " " + " " " " " " " " ; @@ -136,7 +136,7 @@ struct MeshROI_test : public BaseSimulationTest, " " " " " " - " " + " " " " " " " " ; @@ -157,7 +157,7 @@ struct MeshROI_test : public BaseSimulationTest, - + diff --git a/Sofa/Component/Mass/tests/DiagonalMass_test.cpp b/Sofa/Component/Mass/tests/DiagonalMass_test.cpp index 882614ea793..1c4d0c378db 100644 --- a/Sofa/Component/Mass/tests/DiagonalMass_test.cpp +++ b/Sofa/Component/Mass/tests/DiagonalMass_test.cpp @@ -155,7 +155,7 @@ class DiagonalMass_test : public BaseTest "" " " " " - " " + " " " " " " " " ; @@ -188,7 +188,7 @@ class DiagonalMass_test : public BaseTest " " " " " " - " " + " " " " " " " " ; @@ -219,7 +219,7 @@ class DiagonalMass_test : public BaseTest " " " " " " - " " + " " " " " " " " ; @@ -249,7 +249,7 @@ class DiagonalMass_test : public BaseTest " " " " " " - " " + " " " " " " " " ; diff --git a/Sofa/Component/Topology/Container/Constant/src/sofa/component/topology/container/constant/CubeTopology.cpp b/Sofa/Component/Topology/Container/Constant/src/sofa/component/topology/container/constant/CubeTopology.cpp index e666b76e0b1..d2eaa4d0ec2 100644 --- a/Sofa/Component/Topology/Container/Constant/src/sofa/component/topology/container/constant/CubeTopology.cpp +++ b/Sofa/Component/Topology/Container/Constant/src/sofa/component/topology/container/constant/CubeTopology.cpp @@ -57,9 +57,11 @@ void CubeTopology::parse(core::objectmodel::BaseObjectDescription* arg) this->setPos(d_min.getValue()[0], d_max.getValue()[0], d_min.getValue()[1], d_max.getValue()[1], d_min.getValue()[2], d_max.getValue()[2]); } -int CubeTopologyClass = core::RegisterObject("Surface of a cube in 3D") - .add< CubeTopology >() - ; +void registerCubeTopology(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Surface topology of a cube in 3D (points, edges and quads).") + .add< CubeTopology >()); +} CubeTopology::CubeTopology(int _nx, int _ny, int _nz) : d_nx(initData(&d_nx, _nx, "nx", "x grid resolution")) diff --git a/Sofa/Component/Topology/Container/Constant/src/sofa/component/topology/container/constant/MeshTopology.cpp b/Sofa/Component/Topology/Container/Constant/src/sofa/component/topology/container/constant/MeshTopology.cpp index 47f8a909fbf..f8384eca4a1 100644 --- a/Sofa/Component/Topology/Container/Constant/src/sofa/component/topology/container/constant/MeshTopology.cpp +++ b/Sofa/Component/Topology/Container/Constant/src/sofa/component/topology/container/constant/MeshTopology.cpp @@ -478,11 +478,11 @@ void MeshTopology::QuadUpdate::doUpdate() using namespace sofa::defaulttype; using core::topology::BaseMeshTopology; - -int MeshTopologyClass = core::RegisterObject("Generic mesh topology") - .addAlias("Mesh") - .add< MeshTopology >() - ; +void registerMeshTopology(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Generic constant topology loaded from a mesh file.") + .add< MeshTopology >()); +} MeshTopology::MeshTopology() : d_seqPoints(initData(&d_seqPoints, "position", "List of point positions")) diff --git a/Sofa/Component/Topology/Container/Constant/src/sofa/component/topology/container/constant/SphereQuadTopology.cpp b/Sofa/Component/Topology/Container/Constant/src/sofa/component/topology/container/constant/SphereQuadTopology.cpp index d99065cf2b9..73e7bfaf9de 100644 --- a/Sofa/Component/Topology/Container/Constant/src/sofa/component/topology/container/constant/SphereQuadTopology.cpp +++ b/Sofa/Component/Topology/Container/Constant/src/sofa/component/topology/container/constant/SphereQuadTopology.cpp @@ -29,10 +29,11 @@ namespace sofa::component::topology::container::constant using namespace sofa::type; using namespace sofa::defaulttype; -int SphereQuadTopologyClass = core::RegisterObject("Sphere topology constructed with deformed quads") - .addAlias("SphereQuad") - .add< SphereQuadTopology >() - ; +void registerSphereQuadTopology(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Sphere topology constructed with deformed quads.") + .add< SphereQuadTopology >()); +} SphereQuadTopology::SphereQuadTopology(int nx, int ny, int nz) : CubeTopology(nx, ny, nz), diff --git a/Sofa/Component/Topology/Container/Constant/src/sofa/component/topology/container/constant/init.cpp b/Sofa/Component/Topology/Container/Constant/src/sofa/component/topology/container/constant/init.cpp index 8e3c0970fbc..52c2b119c28 100644 --- a/Sofa/Component/Topology/Container/Constant/src/sofa/component/topology/container/constant/init.cpp +++ b/Sofa/Component/Topology/Container/Constant/src/sofa/component/topology/container/constant/init.cpp @@ -21,13 +21,20 @@ ******************************************************************************/ #include #include +#include + namespace sofa::component::topology::container::constant { - + +extern void registerCubeTopology(sofa::core::ObjectFactory* factory); +extern void registerMeshTopology(sofa::core::ObjectFactory* factory); +extern void registerSphereQuadTopology(sofa::core::ObjectFactory* factory); + extern "C" { SOFA_EXPORT_DYNAMIC_LIBRARY void initExternalModule(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleName(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleVersion(); + SOFA_EXPORT_DYNAMIC_LIBRARY void registerObjects(sofa::core::ObjectFactory* factory); } void initExternalModule() @@ -45,11 +52,21 @@ const char* getModuleVersion() return MODULE_VERSION; } +void registerObjects(sofa::core::ObjectFactory* factory) +{ + registerCubeTopology(factory); + registerMeshTopology(factory); + registerSphereQuadTopology(factory); +} + void init() { static bool first = true; if (first) { + // make sure that this plugin is registered into the PluginManager + sofa::helper::system::PluginManager::getInstance().registerPlugin(MODULE_NAME); + first = false; } } diff --git a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/DynamicSparseGridGeometryAlgorithms.cpp b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/DynamicSparseGridGeometryAlgorithms.cpp index 372842adb2f..a134550bdeb 100644 --- a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/DynamicSparseGridGeometryAlgorithms.cpp +++ b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/DynamicSparseGridGeometryAlgorithms.cpp @@ -28,11 +28,13 @@ namespace sofa::component::topology::container::dynamic { using namespace sofa::defaulttype; -int DynamicSparseGridGeometryAlgorithmsClass = core::RegisterObject ( "Hexahedron set geometry algorithms" ) - .add< DynamicSparseGridGeometryAlgorithms > ( true ) // default template - .add< DynamicSparseGridGeometryAlgorithms >() - ; +void registerDynamicSparseGridGeometryAlgorithms(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Dynamic sparse grid geometry algorithms.") + .add< DynamicSparseGridGeometryAlgorithms >(true) // default template + .add< DynamicSparseGridGeometryAlgorithms >()); +} template <> int DynamicSparseGridGeometryAlgorithms::findNearestElementInRestPos(const Coord& pos, sofa::type::Vec3& baryC, Real& distance) const @@ -43,5 +45,4 @@ int DynamicSparseGridGeometryAlgorithms::findNearestElementInRestPos( template class SOFA_COMPONENT_TOPOLOGY_CONTAINER_DYNAMIC_API DynamicSparseGridGeometryAlgorithms; template class SOFA_COMPONENT_TOPOLOGY_CONTAINER_DYNAMIC_API DynamicSparseGridGeometryAlgorithms; - } // namespace sofa::component::topology::container::dynamic diff --git a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/DynamicSparseGridTopologyContainer.cpp b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/DynamicSparseGridTopologyContainer.cpp index 6858eaab746..8f7c5684a5f 100644 --- a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/DynamicSparseGridTopologyContainer.cpp +++ b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/DynamicSparseGridTopologyContainer.cpp @@ -30,13 +30,14 @@ namespace sofa::component::topology::container::dynamic { -using namespace std; using namespace sofa::type; using namespace sofa::defaulttype; -int DynamicSparseGridTopologyContainerClass = core::RegisterObject ( "Hexahedron set topology container" ) - .add< DynamicSparseGridTopologyContainer >() - ; +void registerDynamicSparseGridTopologyContainer(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Dynamic sparse grid geometry container.") + .add< DynamicSparseGridTopologyContainer >()); +} DynamicSparseGridTopologyContainer::DynamicSparseGridTopologyContainer() : d_resolution (initData (&d_resolution, type::Vec3i (0, 0, 0 ), "resolution", "voxel grid resolution" ) ) @@ -78,7 +79,7 @@ void DynamicSparseGridTopologyContainer::init() for( unsigned int i = 0; i < iirg.size(); i++) { - idrg2tpo.insert( make_pair( iirg[i], i )); + idrg2tpo.insert( std::make_pair( iirg[i], i )); } // Init values diff --git a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/DynamicSparseGridTopologyModifier.cpp b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/DynamicSparseGridTopologyModifier.cpp index 2a7687a7d95..3f88626577c 100644 --- a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/DynamicSparseGridTopologyModifier.cpp +++ b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/DynamicSparseGridTopologyModifier.cpp @@ -30,9 +30,11 @@ namespace sofa::component::topology::container::dynamic { -int DynamicSparseGridTopologyModifierClass = core::RegisterObject ( "Hexahedron set topology modifier" ) - .add< DynamicSparseGridTopologyModifier >(); - +void registerDynamicSparseGridTopologyModifier(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Dynamic sparse grid geometry modifier.") + .add< DynamicSparseGridTopologyModifier >()); +} void DynamicSparseGridTopologyModifier::init() { diff --git a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/EdgeSetGeometryAlgorithms.cpp b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/EdgeSetGeometryAlgorithms.cpp index f315be2f8d8..98ddf0cc07d 100644 --- a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/EdgeSetGeometryAlgorithms.cpp +++ b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/EdgeSetGeometryAlgorithms.cpp @@ -28,15 +28,18 @@ namespace sofa::component::topology::container::dynamic { + using namespace sofa::defaulttype; -int EdgeSetGeometryAlgorithmsClass = core::RegisterObject("Edge set geometry algorithms") + +void registerEdgeSetGeometryAlgorithms(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Geometry algorithms dedicated to an edge topology.") .add< EdgeSetGeometryAlgorithms >(true) // default template .add< EdgeSetGeometryAlgorithms >() .add< EdgeSetGeometryAlgorithms >() .add< EdgeSetGeometryAlgorithms >() - .add< EdgeSetGeometryAlgorithms >() - - ; + .add< EdgeSetGeometryAlgorithms >()); +} template class SOFA_COMPONENT_TOPOLOGY_CONTAINER_DYNAMIC_API EdgeSetGeometryAlgorithms; template class SOFA_COMPONENT_TOPOLOGY_CONTAINER_DYNAMIC_API EdgeSetGeometryAlgorithms; @@ -44,5 +47,4 @@ template class SOFA_COMPONENT_TOPOLOGY_CONTAINER_DYNAMIC_API EdgeSetGeometryAlgo template class SOFA_COMPONENT_TOPOLOGY_CONTAINER_DYNAMIC_API EdgeSetGeometryAlgorithms; template class SOFA_COMPONENT_TOPOLOGY_CONTAINER_DYNAMIC_API EdgeSetGeometryAlgorithms; - } //namespace sofa::component::topology::container::dynamic diff --git a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/EdgeSetTopologyContainer.cpp b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/EdgeSetTopologyContainer.cpp index b2c62930c8f..6d3de29e77f 100644 --- a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/EdgeSetTopologyContainer.cpp +++ b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/EdgeSetTopologyContainer.cpp @@ -36,11 +36,13 @@ namespace sofa::component::topology::container::dynamic { -using namespace std; using namespace sofa::defaulttype; -int EdgeSetTopologyContainerClass = core::RegisterObject("Edge set topology container") - .add< EdgeSetTopologyContainer >() - ; + +void registerEdgeSetTopologyContainer(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Topology container for an edge topology.") + .add< EdgeSetTopologyContainer >()); +} EdgeSetTopologyContainer::EdgeSetTopologyContainer() : PointSetTopologyContainer( ) diff --git a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/EdgeSetTopologyModifier.cpp b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/EdgeSetTopologyModifier.cpp index cf7b145525b..0edd32a39a0 100644 --- a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/EdgeSetTopologyModifier.cpp +++ b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/EdgeSetTopologyModifier.cpp @@ -40,12 +40,13 @@ namespace sofa::component::topology::container::dynamic { -using namespace sofa::defaulttype; -int EdgeSetTopologyModifierClass = core::RegisterObject("Edge set topology modifier") - .add< EdgeSetTopologyModifier >(); -using namespace std; -using namespace sofa::defaulttype; +void registerEdgeSetTopologyModifier(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Topology modifier dedicated to an edge topology.") + .add< EdgeSetTopologyModifier >()); +} + using namespace sofa::core::topology; void EdgeSetTopologyModifier::init() diff --git a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/HexahedronSetGeometryAlgorithms.cpp b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/HexahedronSetGeometryAlgorithms.cpp index 2a5341d54c2..db5d1b4e6eb 100644 --- a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/HexahedronSetGeometryAlgorithms.cpp +++ b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/HexahedronSetGeometryAlgorithms.cpp @@ -27,15 +27,17 @@ namespace sofa::component::topology::container::dynamic { + using namespace sofa::defaulttype; -int HexahedronSetGeometryAlgorithmsClass = core::RegisterObject("Hexahedron set geometry algorithms") - .add< HexahedronSetGeometryAlgorithms >(true) // default template - .add< HexahedronSetGeometryAlgorithms >() - ; +void registerHexahedronSetGeometryAlgorithms(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Geometry algorithms dedicated to an hexahedral topology.") + .add< HexahedronSetGeometryAlgorithms >(true) // default template + .add< HexahedronSetGeometryAlgorithms >()); +} template class SOFA_COMPONENT_TOPOLOGY_CONTAINER_DYNAMIC_API HexahedronSetGeometryAlgorithms; template class SOFA_COMPONENT_TOPOLOGY_CONTAINER_DYNAMIC_API HexahedronSetGeometryAlgorithms; - } //namespace sofa::component::topology::container::dynamic diff --git a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/HexahedronSetTopologyContainer.cpp b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/HexahedronSetTopologyContainer.cpp index cf6cfe185ca..f9fa154edba 100644 --- a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/HexahedronSetTopologyContainer.cpp +++ b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/HexahedronSetTopologyContainer.cpp @@ -28,15 +28,15 @@ namespace sofa::component::topology::container::dynamic { -using namespace std; -using namespace sofa::defaulttype; using sofa::core::topology::edgesInHexahedronArray; using sofa::core::topology::quadsOrientationInHexahedronArray; using sofa::core::topology::verticesInHexahedronArray; -int HexahedronSetTopologyContainerClass = core::RegisterObject("Hexahedron set topology container") - .add< HexahedronSetTopologyContainer >() - ; +void registerHexahedronSetTopologyContainer(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Topology container dedicated to an hexahedral topology.") + .add< HexahedronSetTopologyContainer >()); +} HexahedronSetTopologyContainer::HexahedronSetTopologyContainer() : QuadSetTopologyContainer() diff --git a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/HexahedronSetTopologyModifier.cpp b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/HexahedronSetTopologyModifier.cpp index 82a295788d7..93f8c310868 100644 --- a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/HexahedronSetTopologyModifier.cpp +++ b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/HexahedronSetTopologyModifier.cpp @@ -30,11 +30,13 @@ namespace sofa::component::topology::container::dynamic { -int HexahedronSetTopologyModifierClass = core::RegisterObject("Hexahedron set topology modifier") - .add< HexahedronSetTopologyModifier >(); -using namespace std; -using namespace sofa::defaulttype; +void registerHexahedronSetTopologyModifier(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Topology modifier dedicated to an hexahedral topology.") + .add< HexahedronSetTopologyModifier >()); +} + using namespace sofa::core::topology; void HexahedronSetTopologyModifier::init() diff --git a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/MultilevelHexahedronSetTopologyContainer.cpp b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/MultilevelHexahedronSetTopologyContainer.cpp index 8d57a6b00e9..050ef68e952 100644 --- a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/MultilevelHexahedronSetTopologyContainer.cpp +++ b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/MultilevelHexahedronSetTopologyContainer.cpp @@ -33,13 +33,13 @@ namespace sofa::component::topology::container::dynamic { -using namespace std; using namespace sofa::type; -using namespace sofa::defaulttype; -int MultilevelHexahedronSetTopologyContainerClass = core::RegisterObject("Hexahedron set topology container") - .add< MultilevelHexahedronSetTopologyContainer >() - ; +void registerMultilevelHexahedronSetTopologyContainer(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Multilevel Hexahedron set topology container.") + .add< MultilevelHexahedronSetTopologyContainer >()); +} MultilevelHexahedronSetTopologyContainer::MultilevelHexahedronSetTopologyContainer() : HexahedronSetTopologyContainer(), diff --git a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/PointSetGeometryAlgorithms.cpp b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/PointSetGeometryAlgorithms.cpp index 8022a9d2364..2f7f39b68a7 100644 --- a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/PointSetGeometryAlgorithms.cpp +++ b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/PointSetGeometryAlgorithms.cpp @@ -29,12 +29,14 @@ namespace sofa::component::topology::container::dynamic { using namespace sofa::defaulttype; -int PointSetGeometryAlgorithmsClass = core::RegisterObject("Point set geometry algorithms") + +void registerPointSetGeometryAlgorithms(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Geometry algorithms dedicated to a point topology.") .add< PointSetGeometryAlgorithms >(true) // default template .add< PointSetGeometryAlgorithms >() - .add< PointSetGeometryAlgorithms >() - - ; + .add< PointSetGeometryAlgorithms >()); +} template class SOFA_COMPONENT_TOPOLOGY_CONTAINER_DYNAMIC_API PointSetGeometryAlgorithms; template class SOFA_COMPONENT_TOPOLOGY_CONTAINER_DYNAMIC_API PointSetGeometryAlgorithms; @@ -42,5 +44,4 @@ template class SOFA_COMPONENT_TOPOLOGY_CONTAINER_DYNAMIC_API PointSetGeometryAlg template class SOFA_COMPONENT_TOPOLOGY_CONTAINER_DYNAMIC_API PointSetGeometryAlgorithms; template class SOFA_COMPONENT_TOPOLOGY_CONTAINER_DYNAMIC_API PointSetGeometryAlgorithms; - } //namespace sofa::component::topology::container::dynamic diff --git a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/PointSetTopologyContainer.cpp b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/PointSetTopologyContainer.cpp index b644cdf4511..ef8b6d401e1 100644 --- a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/PointSetTopologyContainer.cpp +++ b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/PointSetTopologyContainer.cpp @@ -49,11 +49,11 @@ struct GeneratePointID } -using namespace sofa::defaulttype; - -int PointSetTopologyContainerClass = core::RegisterObject("Point set topology container") - .add< PointSetTopologyContainer >() - ; +void registerPointSetTopologyContainer(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Topology container dedicated to a point topology.") + .add< PointSetTopologyContainer >()); +} PointSetTopologyContainer::PointSetTopologyContainer(Size npoints) : d_initPoints (initData(&d_initPoints, "position", "Initial position of points",true,true)) diff --git a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/PointSetTopologyModifier.cpp b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/PointSetTopologyModifier.cpp index 6573eb11f4b..cc35bf05f07 100644 --- a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/PointSetTopologyModifier.cpp +++ b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/PointSetTopologyModifier.cpp @@ -33,12 +33,13 @@ namespace sofa::component::topology::container::dynamic { -int PointSetTopologyModifierClass = core::RegisterObject("Point set topology modifier") - .add< PointSetTopologyModifier >(); -using namespace std; -using namespace sofa::defaulttype; -using namespace sofa::core::behavior; +void registerPointSetTopologyModifier(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Topology modifier dedicated to a point topology.") + .add< PointSetTopologyModifier >()); +} + using namespace sofa::core::topology; void PointSetTopologyModifier::init() diff --git a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/QuadSetGeometryAlgorithms.cpp b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/QuadSetGeometryAlgorithms.cpp index 9711e21b402..cf6a9461cbf 100644 --- a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/QuadSetGeometryAlgorithms.cpp +++ b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/QuadSetGeometryAlgorithms.cpp @@ -28,15 +28,17 @@ namespace sofa::component::topology::container::dynamic { + using namespace sofa::defaulttype; -int QuadSetGeometryAlgorithmsClass = core::RegisterObject("Quad set geometry algorithms") - .add< QuadSetGeometryAlgorithms >(true) // default template - .add< QuadSetGeometryAlgorithms >() - ; +void registerQuadSetGeometryAlgorithms(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Geometry algorithms dedicated to a quad topology.") + .add< QuadSetGeometryAlgorithms >(true) // default template + .add< QuadSetGeometryAlgorithms >()); +} template class SOFA_COMPONENT_TOPOLOGY_CONTAINER_DYNAMIC_API QuadSetGeometryAlgorithms; template class SOFA_COMPONENT_TOPOLOGY_CONTAINER_DYNAMIC_API QuadSetGeometryAlgorithms; - } //namespace sofa::component::topology::container::dynamic diff --git a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/QuadSetTopologyContainer.cpp b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/QuadSetTopologyContainer.cpp index ba4b361d837..05d4641150b 100644 --- a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/QuadSetTopologyContainer.cpp +++ b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/QuadSetTopologyContainer.cpp @@ -28,12 +28,11 @@ namespace sofa::component::topology::container::dynamic { -using namespace std; -using namespace sofa::defaulttype; - -int QuadSetTopologyContainerClass = core::RegisterObject("Quad set topology container") - .add< QuadSetTopologyContainer >() - ; +void registerQuadSetTopologyContainer(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Topology container dedicated to a quad topology.") + .add< QuadSetTopologyContainer >()); +} QuadSetTopologyContainer::QuadSetTopologyContainer() : EdgeSetTopologyContainer() diff --git a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/QuadSetTopologyModifier.cpp b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/QuadSetTopologyModifier.cpp index fc6efdd5d74..bee7780caa3 100644 --- a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/QuadSetTopologyModifier.cpp +++ b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/QuadSetTopologyModifier.cpp @@ -30,15 +30,15 @@ namespace sofa::component::topology::container::dynamic { -int QuadSetTopologyModifierClass = core::RegisterObject("Quad set topology modifier") - .add< QuadSetTopologyModifier >(); +void registerQuadSetTopologyModifier(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Topology modifier dedicated to a quad topology.") + .add< QuadSetTopologyModifier >()); +} -using namespace std; -using namespace sofa::defaulttype; using namespace sofa::core::topology; - void QuadSetTopologyModifier::init() { EdgeSetTopologyModifier::init(); diff --git a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/TetrahedronSetGeometryAlgorithms.cpp b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/TetrahedronSetGeometryAlgorithms.cpp index 33b6549d15b..7bf78f2b1a5 100644 --- a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/TetrahedronSetGeometryAlgorithms.cpp +++ b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/TetrahedronSetGeometryAlgorithms.cpp @@ -27,15 +27,17 @@ namespace sofa::component::topology::container::dynamic { + using namespace sofa::defaulttype; -int TetrahedronSetGeometryAlgorithmsClass = core::RegisterObject("Tetrahedron set geometry algorithms") - .add< TetrahedronSetGeometryAlgorithms >(true) // default template - .add< TetrahedronSetGeometryAlgorithms >() - ; +void registerTetrahedronSetGeometryAlgorithms(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Geometry algorithms dedicated to a tetrahedral topology.") + .add< TetrahedronSetGeometryAlgorithms >(true) // default template + .add< TetrahedronSetGeometryAlgorithms >()); +} template class SOFA_COMPONENT_TOPOLOGY_CONTAINER_DYNAMIC_API TetrahedronSetGeometryAlgorithms; template class SOFA_COMPONENT_TOPOLOGY_CONTAINER_DYNAMIC_API TetrahedronSetGeometryAlgorithms; - } //namespace sofa::component::topology::container::dynamic diff --git a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/TetrahedronSetTopologyContainer.cpp b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/TetrahedronSetTopologyContainer.cpp index c4eede995d3..5f9fedd0175 100644 --- a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/TetrahedronSetTopologyContainer.cpp +++ b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/TetrahedronSetTopologyContainer.cpp @@ -27,13 +27,13 @@ namespace sofa::component::topology::container::dynamic { -using namespace std; -using namespace sofa::defaulttype; using sofa::core::topology::edgesInTetrahedronArray; -int TetrahedronSetTopologyContainerClass = core::RegisterObject("Tetrahedron set topology container") - .add< TetrahedronSetTopologyContainer >() - ; +void registerTetrahedronSetTopologyContainer(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Topology container dedicated to a tetrahedral topology.") + .add< TetrahedronSetTopologyContainer >()); +} ///convention triangles in tetra (orientation interior) diff --git a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/TetrahedronSetTopologyModifier.cpp b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/TetrahedronSetTopologyModifier.cpp index 43d7a420445..faee40cbb0f 100644 --- a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/TetrahedronSetTopologyModifier.cpp +++ b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/TetrahedronSetTopologyModifier.cpp @@ -33,11 +33,13 @@ namespace sofa::component::topology::container::dynamic { -int TetrahedronSetTopologyModifierClass = core::RegisterObject("Tetrahedron set topology modifier") - .add< TetrahedronSetTopologyModifier >(); -using namespace std; -using namespace sofa::defaulttype; +void registerTetrahedronSetTopologyModifier(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Topology modifier dedicated to a tetrahedral topology.") + .add< TetrahedronSetTopologyModifier >()); +} + using namespace sofa::core::topology; //const unsigned int edgesInTetrahedronArray[6][2] = {{0,1}, {0,2}, {0,3}, {1,2}, {1,3}, {2,3}}; diff --git a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/TriangleSetGeometryAlgorithms.cpp b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/TriangleSetGeometryAlgorithms.cpp index 180a0443b4f..9953a160abc 100644 --- a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/TriangleSetGeometryAlgorithms.cpp +++ b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/TriangleSetGeometryAlgorithms.cpp @@ -27,14 +27,15 @@ namespace sofa::component::topology::container::dynamic { + using namespace sofa::defaulttype; -int TriangleSetGeometryAlgorithmsClass = core::RegisterObject("Triangle set geometry algorithms") +void registerTriangleSetGeometryAlgorithms(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Geometry algorithms dedicated to a triangular topology.") .add< TriangleSetGeometryAlgorithms >(true) // default template - .add< TriangleSetGeometryAlgorithms >() - ; - - + .add< TriangleSetGeometryAlgorithms >()); +} // methods specilizations declaration template<> SOFA_COMPONENT_TOPOLOGY_CONTAINER_DYNAMIC_API @@ -50,12 +51,9 @@ int TriangleSetGeometryAlgorithms::SplitAlongPath(PointI sofa::type::vector< sofa::type::Vec3 >& coords_list, sofa::type::vector& new_edges, SReal epsilonSnapPath, SReal epsilonSnapBorder); - - template class SOFA_COMPONENT_TOPOLOGY_CONTAINER_DYNAMIC_API TriangleSetGeometryAlgorithms; template class SOFA_COMPONENT_TOPOLOGY_CONTAINER_DYNAMIC_API TriangleSetGeometryAlgorithms; - template<> int TriangleSetGeometryAlgorithms::SplitAlongPath(PointID, Coord&, PointID, Coord&, sofa::type::vector< sofa::geometry::ElementType>&, diff --git a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/TriangleSetTopologyContainer.cpp b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/TriangleSetTopologyContainer.cpp index 48ab563d783..871f7896046 100644 --- a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/TriangleSetTopologyContainer.cpp +++ b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/TriangleSetTopologyContainer.cpp @@ -26,13 +26,12 @@ namespace sofa::component::topology::container::dynamic { -using namespace std; -using namespace sofa::defaulttype; - -int TriangleSetTopologyContainerClass = core::RegisterObject("Triangle set topology container") - .add< TriangleSetTopologyContainer >() - ; +void registerTriangleSetTopologyContainer(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Topology container dedicated to a triangular topology.") + .add< TriangleSetTopologyContainer >()); +} TriangleSetTopologyContainer::TriangleSetTopologyContainer() : EdgeSetTopologyContainer() diff --git a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/TriangleSetTopologyModifier.cpp b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/TriangleSetTopologyModifier.cpp index f076b2cafcd..f03f972b45c 100644 --- a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/TriangleSetTopologyModifier.cpp +++ b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/TriangleSetTopologyModifier.cpp @@ -33,12 +33,13 @@ namespace sofa::component::topology::container::dynamic { -int TriangleSetTopologyModifierClass = core::RegisterObject("Triangle set topology modifier") - .add< TriangleSetTopologyModifier >() - ; -using namespace std; -using namespace sofa::defaulttype; +void registerTriangleSetTopologyModifier(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Topology modifier dedicated to a triangular topology.") + .add< TriangleSetTopologyModifier >()); +} + using namespace sofa::core::topology; void TriangleSetTopologyModifier::init() diff --git a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/init.cpp b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/init.cpp index 88ac7674543..1caad7ab75e 100644 --- a/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/init.cpp +++ b/Sofa/Component/Topology/Container/Dynamic/src/sofa/component/topology/container/dynamic/init.cpp @@ -21,13 +21,39 @@ ******************************************************************************/ #include #include +#include + namespace sofa::component::topology::container::dynamic { - + +extern void registerDynamicSparseGridGeometryAlgorithms(sofa::core::ObjectFactory* factory); +extern void registerDynamicSparseGridTopologyContainer(sofa::core::ObjectFactory* factory); +extern void registerDynamicSparseGridTopologyModifier(sofa::core::ObjectFactory* factory); +extern void registerEdgeSetGeometryAlgorithms(sofa::core::ObjectFactory* factory); +extern void registerEdgeSetTopologyContainer(sofa::core::ObjectFactory* factory); +extern void registerEdgeSetTopologyModifier(sofa::core::ObjectFactory* factory); +extern void registerHexahedronSetGeometryAlgorithms(sofa::core::ObjectFactory* factory); +extern void registerHexahedronSetTopologyContainer(sofa::core::ObjectFactory* factory); +extern void registerHexahedronSetTopologyModifier(sofa::core::ObjectFactory* factory); +extern void registerMultilevelHexahedronSetTopologyContainer(sofa::core::ObjectFactory* factory); +extern void registerPointSetGeometryAlgorithms(sofa::core::ObjectFactory* factory); +extern void registerPointSetTopologyContainer(sofa::core::ObjectFactory* factory); +extern void registerPointSetTopologyModifier(sofa::core::ObjectFactory* factory); +extern void registerQuadSetGeometryAlgorithms(sofa::core::ObjectFactory* factory); +extern void registerQuadSetTopologyContainer(sofa::core::ObjectFactory* factory); +extern void registerQuadSetTopologyModifier(sofa::core::ObjectFactory* factory); +extern void registerTetrahedronSetGeometryAlgorithms(sofa::core::ObjectFactory* factory); +extern void registerTetrahedronSetTopologyContainer(sofa::core::ObjectFactory* factory); +extern void registerTetrahedronSetTopologyModifier(sofa::core::ObjectFactory* factory); +extern void registerTriangleSetGeometryAlgorithms(sofa::core::ObjectFactory* factory); +extern void registerTriangleSetTopologyContainer(sofa::core::ObjectFactory* factory); +extern void registerTriangleSetTopologyModifier(sofa::core::ObjectFactory* factory); + extern "C" { SOFA_EXPORT_DYNAMIC_LIBRARY void initExternalModule(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleName(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleVersion(); + SOFA_EXPORT_DYNAMIC_LIBRARY void registerObjects(sofa::core::ObjectFactory* factory); } void initExternalModule() @@ -45,11 +71,40 @@ const char* getModuleVersion() return MODULE_VERSION; } +void registerObjects(sofa::core::ObjectFactory* factory) +{ + registerDynamicSparseGridGeometryAlgorithms(factory); + registerDynamicSparseGridTopologyContainer(factory); + registerDynamicSparseGridTopologyModifier(factory); + registerEdgeSetGeometryAlgorithms(factory); + registerEdgeSetTopologyContainer(factory); + registerEdgeSetTopologyModifier(factory); + registerHexahedronSetGeometryAlgorithms(factory); + registerHexahedronSetTopologyContainer(factory); + registerHexahedronSetTopologyModifier(factory); + registerMultilevelHexahedronSetTopologyContainer(factory); + registerPointSetGeometryAlgorithms(factory); + registerPointSetTopologyContainer(factory); + registerPointSetTopologyModifier(factory); + registerQuadSetGeometryAlgorithms(factory); + registerQuadSetTopologyContainer(factory); + registerQuadSetTopologyModifier(factory); + registerTetrahedronSetGeometryAlgorithms(factory); + registerTetrahedronSetTopologyContainer(factory); + registerTetrahedronSetTopologyModifier(factory); + registerTriangleSetGeometryAlgorithms(factory); + registerTriangleSetTopologyContainer(factory); + registerTriangleSetTopologyModifier(factory); +} + void init() { static bool first = true; if (first) { + // make sure that this plugin is registered into the PluginManager + sofa::helper::system::PluginManager::getInstance().registerPlugin(MODULE_NAME); + first = false; } } diff --git a/Sofa/Component/Topology/Container/Grid/src/sofa/component/topology/container/grid/CylinderGridTopology.cpp b/Sofa/Component/Topology/Container/Grid/src/sofa/component/topology/container/grid/CylinderGridTopology.cpp index 66d02134b14..d2fadfe0bf8 100644 --- a/Sofa/Component/Topology/Container/Grid/src/sofa/component/topology/container/grid/CylinderGridTopology.cpp +++ b/Sofa/Component/Topology/Container/Grid/src/sofa/component/topology/container/grid/CylinderGridTopology.cpp @@ -29,12 +29,11 @@ namespace sofa::component::topology::container::grid using namespace sofa::type; using namespace sofa::defaulttype; - - -int CylinderGridTopologyClass = core::RegisterObject("Cylinder grid in 3D") - .addAlias("CylinderGrid") - .add< CylinderGridTopology >() - ; +void registerCylinderGridTopology(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Cylinder grid in 3D.") + .add< CylinderGridTopology >()); +} CylinderGridTopology::CylinderGridTopology(int nx, int ny, int nz) : GridTopology(nx, ny, nz) diff --git a/Sofa/Component/Topology/Container/Grid/src/sofa/component/topology/container/grid/GridTopology.cpp b/Sofa/Component/Topology/Container/Grid/src/sofa/component/topology/container/grid/GridTopology.cpp index 166d08df145..ae70dd43d2a 100644 --- a/Sofa/Component/Topology/Container/Grid/src/sofa/component/topology/container/grid/GridTopology.cpp +++ b/Sofa/Component/Topology/Container/Grid/src/sofa/component/topology/container/grid/GridTopology.cpp @@ -27,11 +27,11 @@ namespace sofa::component::topology::container::grid { -int GridTopologyClass = core::RegisterObject("Base class fo a regular grid in 3D") - .addAlias("Grid") - .add< GridTopology >() - ; - +void registerGridTopology(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Base class fo a regular grid in 3D.") + .add< GridTopology >()); +} GridTopology::GridUpdate::GridUpdate(GridTopology *t): m_topology(t) diff --git a/Sofa/Component/Topology/Container/Grid/src/sofa/component/topology/container/grid/RegularGridTopology.cpp b/Sofa/Component/Topology/Container/Grid/src/sofa/component/topology/container/grid/RegularGridTopology.cpp index da3187e7395..1f28f85aa55 100644 --- a/Sofa/Component/Topology/Container/Grid/src/sofa/component/topology/container/grid/RegularGridTopology.cpp +++ b/Sofa/Component/Topology/Container/Grid/src/sofa/component/topology/container/grid/RegularGridTopology.cpp @@ -411,11 +411,10 @@ void RegularGridTopology::createTexCoords() } } - -int RegularGridTopologyClass = core::RegisterObject("Regular grid in 3D") - .addAlias("RegularGrid") - .add< RegularGridTopology >() - ; - +void registerRegularGridTopology(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Regular grid in 3D.") + .add< RegularGridTopology >()); +} } //namespace sofa::component::topology::container::grid diff --git a/Sofa/Component/Topology/Container/Grid/src/sofa/component/topology/container/grid/SparseGridMultipleTopology.cpp b/Sofa/Component/Topology/Container/Grid/src/sofa/component/topology/container/grid/SparseGridMultipleTopology.cpp index f13bd44174c..b485ae44b92 100644 --- a/Sofa/Component/Topology/Container/Grid/src/sofa/component/topology/container/grid/SparseGridMultipleTopology.cpp +++ b/Sofa/Component/Topology/Container/Grid/src/sofa/component/topology/container/grid/SparseGridMultipleTopology.cpp @@ -27,18 +27,19 @@ namespace sofa::component::topology::container::grid { -int SparseGridMultipleTopologyClass = core::RegisterObject("Sparse grid in 3D") - .addAlias("SparseGridMultiple") - .add< SparseGridMultipleTopology >() - ; - - -SparseGridMultipleTopology::SparseGridMultipleTopology( bool _isVirtual ) : SparseGridRamificationTopology(_isVirtual), - d_fileTopologies(initData(&d_fileTopologies, type::vector< std::string >() , "fileTopologies", "All topology filenames")), - d_dataStiffnessCoefs(initData(&d_dataStiffnessCoefs, type::vector< float >() , "stiffnessCoefs", "A stiffness coefficient for each topology filename")), - d_dataMassCoefs(initData(&d_dataMassCoefs, type::vector< float >() , "massCoefs", "A mass coefficient for each topology filename")), - d_computeRamifications(initData(&d_computeRamifications, true , "computeRamifications", "Are ramifications wanted?")), - d_erasePreviousCoef(initData(&d_erasePreviousCoef, false , "erasePreviousCoef", "Does a new stiffness/mass coefficient replace the previous or blend half/half with it?")) +void registerSparseGridMultipleTopology(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Sparse grid in 3D.") + .add< SparseGridMultipleTopology >()); +} + +SparseGridMultipleTopology::SparseGridMultipleTopology( bool _isVirtual ) + : SparseGridRamificationTopology(_isVirtual) + , d_fileTopologies(initData(&d_fileTopologies, type::vector< std::string >() , "fileTopologies", "All topology filenames")) + , d_dataStiffnessCoefs(initData(&d_dataStiffnessCoefs, type::vector< float >() , "stiffnessCoefs", "A stiffness coefficient for each topology filename")) + , d_dataMassCoefs(initData(&d_dataMassCoefs, type::vector< float >() , "massCoefs", "A mass coefficient for each topology filename")) + , d_computeRamifications(initData(&d_computeRamifications, true , "computeRamifications", "Are ramifications wanted?")) + , d_erasePreviousCoef(initData(&d_erasePreviousCoef, false , "erasePreviousCoef", "Does a new stiffness/mass coefficient replace the previous or blend half/half with it?")) { _fileTopologies.setOriginalData(&d_fileTopologies); _dataStiffnessCoefs.setOriginalData(&d_dataStiffnessCoefs); diff --git a/Sofa/Component/Topology/Container/Grid/src/sofa/component/topology/container/grid/SparseGridRamificationTopology.cpp b/Sofa/Component/Topology/Container/Grid/src/sofa/component/topology/container/grid/SparseGridRamificationTopology.cpp index 62f036d2445..ea4c192920c 100644 --- a/Sofa/Component/Topology/Container/Grid/src/sofa/component/topology/container/grid/SparseGridRamificationTopology.cpp +++ b/Sofa/Component/Topology/Container/Grid/src/sofa/component/topology/container/grid/SparseGridRamificationTopology.cpp @@ -27,10 +27,11 @@ namespace sofa::component::topology::container::grid { -int SparseGridRamificationTopologyClass = core::RegisterObject("Sparse grid in 3D (modified)") - .addAlias("SparseGridRamification") - .add< SparseGridRamificationTopology >() - ; +void registerSparseGridRamificationTopology(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Sparse grid in 3D (modified).") + .add< SparseGridRamificationTopology >()); +} SparseGridRamificationTopology::SparseGridRamificationTopology(bool isVirtual) : SparseGridTopology(isVirtual) diff --git a/Sofa/Component/Topology/Container/Grid/src/sofa/component/topology/container/grid/SparseGridTopology.cpp b/Sofa/Component/Topology/Container/Grid/src/sofa/component/topology/container/grid/SparseGridTopology.cpp index 10a1f45173d..43b5e136953 100644 --- a/Sofa/Component/Topology/Container/Grid/src/sofa/component/topology/container/grid/SparseGridTopology.cpp +++ b/Sofa/Component/Topology/Container/Grid/src/sofa/component/topology/container/grid/SparseGridTopology.cpp @@ -42,11 +42,11 @@ using namespace sofa::helper; namespace sofa::component::topology::container::grid { -int SparseGridTopologyClass = core::RegisterObject("Sparse grid in 3D") - .addAlias("SparseGrid") - .add< SparseGridTopology >() - ; - +void registerSparseGridTopology(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Sparse grid in 3D.") + .add< SparseGridTopology >()); +} const float SparseGridTopology::WEIGHT27[8][27] = { diff --git a/Sofa/Component/Topology/Container/Grid/src/sofa/component/topology/container/grid/SphereGridTopology.cpp b/Sofa/Component/Topology/Container/Grid/src/sofa/component/topology/container/grid/SphereGridTopology.cpp index 2e2e93c1653..39ea54ec88e 100644 --- a/Sofa/Component/Topology/Container/Grid/src/sofa/component/topology/container/grid/SphereGridTopology.cpp +++ b/Sofa/Component/Topology/Container/Grid/src/sofa/component/topology/container/grid/SphereGridTopology.cpp @@ -29,12 +29,11 @@ namespace sofa::component::topology::container::grid using namespace sofa::type; using namespace sofa::defaulttype; - - -int SphereGridTopologyClass = core::RegisterObject("Sphere grid in 3D") - .addAlias("SphereGrid") - .add< SphereGridTopology >() - ; +void registerSphereGridTopology(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Sphere grid in 3D.") + .add< SphereGridTopology >()); +} SphereGridTopology::SphereGridTopology(int nx, int ny, int nz) : GridTopology(nx, ny, nz) diff --git a/Sofa/Component/Topology/Container/Grid/src/sofa/component/topology/container/grid/init.cpp b/Sofa/Component/Topology/Container/Grid/src/sofa/component/topology/container/grid/init.cpp index a134bb36d20..59702ee2338 100644 --- a/Sofa/Component/Topology/Container/Grid/src/sofa/component/topology/container/grid/init.cpp +++ b/Sofa/Component/Topology/Container/Grid/src/sofa/component/topology/container/grid/init.cpp @@ -21,13 +21,24 @@ ******************************************************************************/ #include #include +#include + namespace sofa::component::topology::container::grid { - + +extern void registerCylinderGridTopology(sofa::core::ObjectFactory* factory); +extern void registerGridTopology(sofa::core::ObjectFactory* factory); +extern void registerRegularGridTopology(sofa::core::ObjectFactory* factory); +extern void registerSparseGridMultipleTopology(sofa::core::ObjectFactory* factory); +extern void registerSparseGridRamificationTopology(sofa::core::ObjectFactory* factory); +extern void registerSparseGridTopology(sofa::core::ObjectFactory* factory); +extern void registerSphereGridTopology(sofa::core::ObjectFactory* factory); + extern "C" { SOFA_EXPORT_DYNAMIC_LIBRARY void initExternalModule(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleName(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleVersion(); + SOFA_EXPORT_DYNAMIC_LIBRARY void registerObjects(sofa::core::ObjectFactory* factory); } void initExternalModule() @@ -45,11 +56,25 @@ const char* getModuleVersion() return MODULE_VERSION; } +void registerObjects(sofa::core::ObjectFactory* factory) +{ + registerCylinderGridTopology(factory); + registerGridTopology(factory); + registerRegularGridTopology(factory); + registerSparseGridMultipleTopology(factory); + registerSparseGridRamificationTopology(factory); + registerSparseGridTopology(factory); + registerSphereGridTopology(factory); +} + void init() { static bool first = true; if (first) { + // make sure that this plugin is registered into the PluginManager + sofa::helper::system::PluginManager::getInstance().registerPlugin(MODULE_NAME); + first = false; } } diff --git a/Sofa/Component/Topology/Container/src/sofa/component/topology/container/init.cpp b/Sofa/Component/Topology/Container/src/sofa/component/topology/container/init.cpp index ff104b239f8..99b3ffeac8d 100644 --- a/Sofa/Component/Topology/Container/src/sofa/component/topology/container/init.cpp +++ b/Sofa/Component/Topology/Container/src/sofa/component/topology/container/init.cpp @@ -25,6 +25,9 @@ #include #include +#include +#include + namespace sofa::component::topology::container { @@ -32,6 +35,7 @@ extern "C" { SOFA_EXPORT_DYNAMIC_LIBRARY void initExternalModule(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleName(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleVersion(); + SOFA_EXPORT_DYNAMIC_LIBRARY void registerObjects(sofa::core::ObjectFactory* factory); } void initExternalModule() @@ -49,6 +53,13 @@ const char* getModuleVersion() return MODULE_VERSION; } +void registerObjects(sofa::core::ObjectFactory* factory) +{ + factory->registerObjectsFromPlugin("Sofa.Component.Topology.Container.Constant"); + factory->registerObjectsFromPlugin("Sofa.Component.Topology.Container.Dynamic"); + factory->registerObjectsFromPlugin("Sofa.Component.Topology.Container.Grid"); +} + void init() { static bool first = true; @@ -59,6 +70,9 @@ void init() sofa::component::topology::container::dynamic::init(); sofa::component::topology::container::grid::init(); + // make sure that this plugin is registered into the PluginManager + sofa::helper::system::PluginManager::getInstance().registerPlugin(MODULE_NAME); + first = false; } } diff --git a/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/CenterPointTopologicalMapping.cpp b/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/CenterPointTopologicalMapping.cpp index 4e9ad9e2c77..c53d1e9b848 100644 --- a/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/CenterPointTopologicalMapping.cpp +++ b/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/CenterPointTopologicalMapping.cpp @@ -31,14 +31,15 @@ namespace sofa::component::topology::mapping { -using namespace sofa::defaulttype; + using namespace sofa::component::topology::mapping; using namespace sofa::core::topology; -// Register in the Factory -int CenterPointTopologicalMappingClass = core::RegisterObject ( "" ) - .add< CenterPointTopologicalMapping >() - ; +void registerCenterPointTopologicalMapping(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Topological mapping where each primitive in the input topology will be mapped to a point in the output topology.") + .add< CenterPointTopologicalMapping >()); +} // Implementation CenterPointTopologicalMapping::CenterPointTopologicalMapping () diff --git a/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/Edge2QuadTopologicalMapping.cpp b/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/Edge2QuadTopologicalMapping.cpp index 2f5bcfe4a2a..4b46f4c3194 100644 --- a/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/Edge2QuadTopologicalMapping.cpp +++ b/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/Edge2QuadTopologicalMapping.cpp @@ -39,11 +39,11 @@ using namespace sofa::defaulttype; using namespace sofa::component::topology::mapping; using namespace sofa::core::topology; -// Register in the Factory -int Edge2QuadTopologicalMappingClass = core::RegisterObject("Special case of mapping where EdgeSetTopology is converted to QuadSetTopology.") - .add< Edge2QuadTopologicalMapping >() - - ; +void registerEdge2QuadTopologicalMapping(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Topological mapping where EdgeSetTopology is converted to QuadSetTopology.") + .add< Edge2QuadTopologicalMapping >()); +} // Implementation Edge2QuadTopologicalMapping::Edge2QuadTopologicalMapping() diff --git a/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/Hexa2QuadTopologicalMapping.cpp b/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/Hexa2QuadTopologicalMapping.cpp index c7a9f35ef73..c749876cfe9 100644 --- a/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/Hexa2QuadTopologicalMapping.cpp +++ b/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/Hexa2QuadTopologicalMapping.cpp @@ -42,18 +42,14 @@ namespace sofa::component::topology::mapping { -using namespace sofa::defaulttype; - using namespace sofa::component::topology; using namespace sofa::core::topology; -// Register in the Factory -int Hexa2QuadTopologicalMappingClass = core::RegisterObject("Special case of mapping where HexahedronSetTopology is converted to QuadSetTopology") - .add< Hexa2QuadTopologicalMapping >() - - ; - -// Implementation +void registerHexa2QuadTopologicalMapping(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Topological mapping where HexahedronSetTopology is converted to QuadSetTopology") + .add< Hexa2QuadTopologicalMapping >()); +} Hexa2QuadTopologicalMapping::Hexa2QuadTopologicalMapping() : sofa::core::topology::TopologicalMapping() diff --git a/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/Hexa2TetraTopologicalMapping.cpp b/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/Hexa2TetraTopologicalMapping.cpp index 818c9de3f78..3a0ff141ab2 100644 --- a/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/Hexa2TetraTopologicalMapping.cpp +++ b/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/Hexa2TetraTopologicalMapping.cpp @@ -41,18 +41,14 @@ namespace sofa::component::topology::mapping { -using namespace sofa::defaulttype; - using namespace sofa::component::topology::mapping; using namespace sofa::core::topology; -// Register in the Factory -int Hexa2TetraTopologicalMappingClass = core::RegisterObject("Special case of mapping where HexahedronSetTopology is converted to TetrahedronSetTopology") - .add< Hexa2TetraTopologicalMapping >() - - ; - -// Implementation +void registerHexa2TetraTopologicalMapping(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Topological mapping where HexahedronSetTopology is converted to TetrahedronSetTopology") + .add< Hexa2TetraTopologicalMapping >()); +} Hexa2TetraTopologicalMapping::Hexa2TetraTopologicalMapping() : sofa::core::topology::TopologicalMapping() diff --git a/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/IdentityTopologicalMapping.cpp b/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/IdentityTopologicalMapping.cpp index 04f1d379292..12334c60a8a 100644 --- a/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/IdentityTopologicalMapping.cpp +++ b/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/IdentityTopologicalMapping.cpp @@ -48,16 +48,14 @@ namespace sofa::component::topology::mapping { -using namespace sofa::defaulttype; - using namespace sofa::component::topology::mapping; using namespace sofa::core::topology; -// Register in the Factory -int IdentityTopologicalMappingClass = core::RegisterObject("This class is a specific implementation of TopologicalMapping where the destination topology should be kept identical to the source topology. The implementation currently assumes that both topology have been initialized identically.") - .add< IdentityTopologicalMapping >() - - ; +void registerIdentityTopologicalMapping(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("TopologicalMapping where the destination topology should be kept identical to the source topology. The implementation currently assumes that both topology have been initialized identically.") + .add< IdentityTopologicalMapping >()); +} IdentityTopologicalMapping::IdentityTopologicalMapping() { diff --git a/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/Quad2TriangleTopologicalMapping.cpp b/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/Quad2TriangleTopologicalMapping.cpp index 1d949df3185..9158923af67 100644 --- a/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/Quad2TriangleTopologicalMapping.cpp +++ b/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/Quad2TriangleTopologicalMapping.cpp @@ -53,13 +53,11 @@ typedef BaseMeshTopology In; /// Output Topology typedef BaseMeshTopology Out; -// Register in the Factory -int Quad2TriangleTopologicalMappingClass = core::RegisterObject("Special case of mapping where QuadSetTopology is converted to TriangleSetTopology") - .add< Quad2TriangleTopologicalMapping >() - - ; - -// Implementation +void registerQuad2TriangleTopologicalMapping(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Topological mapping where QuadSetTopology is converted to TriangleSetTopology") + .add< Quad2TriangleTopologicalMapping >()); +} Quad2TriangleTopologicalMapping::Quad2TriangleTopologicalMapping() : sofa::core::topology::TopologicalMapping() diff --git a/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/SubsetTopologicalMapping.cpp b/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/SubsetTopologicalMapping.cpp index efbda7a7405..3330149e011 100644 --- a/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/SubsetTopologicalMapping.cpp +++ b/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/SubsetTopologicalMapping.cpp @@ -47,16 +47,14 @@ namespace sofa::component::topology::mapping { -using namespace sofa::defaulttype; - using namespace sofa::component::topology::mapping; using namespace sofa::core::topology; -// Register in the Factory -int SubsetTopologicalMappingClass = core::RegisterObject("This class is a specific implementation of TopologicalMapping where the destination topology is a subset of the source topology. The implementation currently assumes that both topologies have been initialized correctly.") - .add< SubsetTopologicalMapping >() - - ; +void registerSubsetTopologicalMapping(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("TopologicalMapping where the destination topology is a subset of the source topology. The implementation currently assumes that both topologies have been initialized correctly.") + .add< SubsetTopologicalMapping >()); +} SubsetTopologicalMapping::SubsetTopologicalMapping() : d_samePoints(initData(&d_samePoints, false, "samePoints", "True if the same set of points is used in both topologies")) diff --git a/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/Tetra2TriangleTopologicalMapping.cpp b/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/Tetra2TriangleTopologicalMapping.cpp index 5158b94a940..315dab425f9 100644 --- a/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/Tetra2TriangleTopologicalMapping.cpp +++ b/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/Tetra2TriangleTopologicalMapping.cpp @@ -42,18 +42,14 @@ namespace sofa::component::topology::mapping { -using namespace sofa::defaulttype; - using namespace sofa::component::topology::mapping; using namespace sofa::core::topology; -// Register in the Factory -int Tetra2TriangleTopologicalMappingClass = core::RegisterObject("Special case of mapping where TetrahedronSetTopology is converted to TriangleSetTopology") - .add< Tetra2TriangleTopologicalMapping >() - - ; - -// Implementation +void registerTetra2TriangleTopologicalMapping(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Topological mapping where TetrahedronSetTopology is converted to TriangleSetTopology") + .add< Tetra2TriangleTopologicalMapping >()); +} Tetra2TriangleTopologicalMapping::Tetra2TriangleTopologicalMapping() : sofa::core::topology::TopologicalMapping() diff --git a/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/Triangle2EdgeTopologicalMapping.cpp b/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/Triangle2EdgeTopologicalMapping.cpp index a43dbf4e255..a8c83f5b0a1 100644 --- a/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/Triangle2EdgeTopologicalMapping.cpp +++ b/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/Triangle2EdgeTopologicalMapping.cpp @@ -41,14 +41,14 @@ namespace sofa::component::topology::mapping { -using namespace sofa::defaulttype; - using namespace sofa::component::topology::mapping; using namespace sofa::core::topology; -// Register in the Factory -int Triangle2EdgeTopologicalMappingClass = core::RegisterObject("Special case of mapping where TriangleSetTopology is converted to EdgeSetTopology") - .add< Triangle2EdgeTopologicalMapping >(); +void registerTriangle2EdgeTopologicalMapping(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Topological mapping where TriangleSetTopology is converted to EdgeSetTopology") + .add< Triangle2EdgeTopologicalMapping >()); +} Triangle2EdgeTopologicalMapping::Triangle2EdgeTopologicalMapping() : sofa::core::topology::TopologicalMapping() diff --git a/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/init.cpp b/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/init.cpp index c84007bf931..7a520cdffd2 100644 --- a/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/init.cpp +++ b/Sofa/Component/Topology/Mapping/src/sofa/component/topology/mapping/init.cpp @@ -21,13 +21,26 @@ ******************************************************************************/ #include #include +#include + namespace sofa::component::topology::mapping { - + +extern void registerCenterPointTopologicalMapping(sofa::core::ObjectFactory* factory); +extern void registerEdge2QuadTopologicalMapping(sofa::core::ObjectFactory* factory); +extern void registerHexa2QuadTopologicalMapping(sofa::core::ObjectFactory* factory); +extern void registerHexa2TetraTopologicalMapping(sofa::core::ObjectFactory* factory); +extern void registerIdentityTopologicalMapping(sofa::core::ObjectFactory* factory); +extern void registerQuad2TriangleTopologicalMapping(sofa::core::ObjectFactory* factory); +extern void registerSubsetTopologicalMapping(sofa::core::ObjectFactory* factory); +extern void registerTetra2TriangleTopologicalMapping(sofa::core::ObjectFactory* factory); +extern void registerTriangle2EdgeTopologicalMapping(sofa::core::ObjectFactory* factory); + extern "C" { SOFA_EXPORT_DYNAMIC_LIBRARY void initExternalModule(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleName(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleVersion(); + SOFA_EXPORT_DYNAMIC_LIBRARY void registerObjects(sofa::core::ObjectFactory* factory); } void initExternalModule() @@ -45,11 +58,27 @@ const char* getModuleVersion() return MODULE_VERSION; } +void registerObjects(sofa::core::ObjectFactory* factory) +{ + registerCenterPointTopologicalMapping(factory); + registerEdge2QuadTopologicalMapping(factory); + registerHexa2QuadTopologicalMapping(factory); + registerHexa2TetraTopologicalMapping(factory); + registerIdentityTopologicalMapping(factory); + registerQuad2TriangleTopologicalMapping(factory); + registerSubsetTopologicalMapping(factory); + registerTetra2TriangleTopologicalMapping(factory); + registerTriangle2EdgeTopologicalMapping(factory); +} + void init() { static bool first = true; if (first) { + // make sure that this plugin is registered into the PluginManager + sofa::helper::system::PluginManager::getInstance().registerPlugin(MODULE_NAME); + first = false; } } diff --git a/Sofa/Component/Topology/Utility/src/sofa/component/topology/utility/TopologicalChangeProcessor.cpp b/Sofa/Component/Topology/Utility/src/sofa/component/topology/utility/TopologicalChangeProcessor.cpp index 9532d64031d..f9cacb1af93 100644 --- a/Sofa/Component/Topology/Utility/src/sofa/component/topology/utility/TopologicalChangeProcessor.cpp +++ b/Sofa/Component/Topology/Utility/src/sofa/component/topology/utility/TopologicalChangeProcessor.cpp @@ -50,11 +50,11 @@ namespace sofa::component::topology::utility using namespace sofa::type; using namespace defaulttype; - - -int TopologicalChangeProcessorClass = core::RegisterObject("Read topological Changes and process them.") - .add< TopologicalChangeProcessor >(); - +void registerTopologicalChangeProcessor(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Read topological changes and process them.") + .add< TopologicalChangeProcessor >()); +} TopologicalChangeProcessor::TopologicalChangeProcessor() : d_filename(initData(&d_filename, "filename", "input file name for topological changes.")) diff --git a/Sofa/Component/Topology/Utility/src/sofa/component/topology/utility/TopologyBoundingTrasher.cpp b/Sofa/Component/Topology/Utility/src/sofa/component/topology/utility/TopologyBoundingTrasher.cpp index 4f2eda6e674..853dd829362 100644 --- a/Sofa/Component/Topology/Utility/src/sofa/component/topology/utility/TopologyBoundingTrasher.cpp +++ b/Sofa/Component/Topology/Utility/src/sofa/component/topology/utility/TopologyBoundingTrasher.cpp @@ -28,11 +28,13 @@ namespace sofa::component::topology::utility { -using namespace sofa::type; using namespace sofa::defaulttype; -int TopologyBoundingTrasherClass = core::RegisterObject("A class to remove all elements going outside from the given Bounding Box.") - .add< TopologyBoundingTrasher >(true); +void registerTopologyBoundingTrasher(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Component removing all elements going outside from the given bounding box.") + .add< TopologyBoundingTrasher >()); +} template class SOFA_COMPONENT_TOPOLOGY_UTILITY_API TopologyBoundingTrasher; diff --git a/Sofa/Component/Topology/Utility/src/sofa/component/topology/utility/TopologyChecker.cpp b/Sofa/Component/Topology/Utility/src/sofa/component/topology/utility/TopologyChecker.cpp index a2b86bf7270..cc5994e227a 100644 --- a/Sofa/Component/Topology/Utility/src/sofa/component/topology/utility/TopologyChecker.cpp +++ b/Sofa/Component/Topology/Utility/src/sofa/component/topology/utility/TopologyChecker.cpp @@ -33,13 +33,13 @@ namespace sofa::component::topology::utility { -using namespace defaulttype; using namespace sofa::core::topology; - -int TopologyCheckerClass = core::RegisterObject("Read topological Changes and process them.") - .add< TopologyChecker >(); - +void registerTopologyChecker(sofa::core::ObjectFactory* factory) +{ + factory->registerObjects(core::ObjectRegistrationData("Read topological Changes and process them.") + .add< TopologyChecker >()); +} TopologyChecker::TopologyChecker() : d_eachStep(initData(&d_eachStep, false, "eachStep", "Check topology at each step")) diff --git a/Sofa/Component/Topology/Utility/src/sofa/component/topology/utility/init.cpp b/Sofa/Component/Topology/Utility/src/sofa/component/topology/utility/init.cpp index c4cbe818890..fc671fdd1e1 100644 --- a/Sofa/Component/Topology/Utility/src/sofa/component/topology/utility/init.cpp +++ b/Sofa/Component/Topology/Utility/src/sofa/component/topology/utility/init.cpp @@ -21,13 +21,20 @@ ******************************************************************************/ #include #include +#include + namespace sofa::component::topology::utility { - + +extern void registerTopologicalChangeProcessor(sofa::core::ObjectFactory* factory); +extern void registerTopologyBoundingTrasher(sofa::core::ObjectFactory* factory); +extern void registerTopologyChecker(sofa::core::ObjectFactory* factory); + extern "C" { SOFA_EXPORT_DYNAMIC_LIBRARY void initExternalModule(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleName(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleVersion(); + SOFA_EXPORT_DYNAMIC_LIBRARY void registerObjects(sofa::core::ObjectFactory* factory); } void initExternalModule() @@ -45,11 +52,21 @@ const char* getModuleVersion() return MODULE_VERSION; } +void registerObjects(sofa::core::ObjectFactory* factory) +{ + registerTopologicalChangeProcessor(factory); + registerTopologyBoundingTrasher(factory); + registerTopologyChecker(factory); +} + void init() { static bool first = true; if (first) { + // make sure that this plugin is registered into the PluginManager + sofa::helper::system::PluginManager::getInstance().registerPlugin(MODULE_NAME); + first = false; } } diff --git a/Sofa/Component/Topology/src/sofa/component/topology/init.cpp b/Sofa/Component/Topology/src/sofa/component/topology/init.cpp index 90c1fb75ffc..145ed36c9ec 100644 --- a/Sofa/Component/Topology/src/sofa/component/topology/init.cpp +++ b/Sofa/Component/Topology/src/sofa/component/topology/init.cpp @@ -25,6 +25,9 @@ #include #include +#include +#include + namespace sofa::component::topology { @@ -32,6 +35,7 @@ extern "C" { SOFA_EXPORT_DYNAMIC_LIBRARY void initExternalModule(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleName(); SOFA_EXPORT_DYNAMIC_LIBRARY const char* getModuleVersion(); + SOFA_EXPORT_DYNAMIC_LIBRARY void registerObjects(sofa::core::ObjectFactory* factory); } void initExternalModule() @@ -49,6 +53,13 @@ const char* getModuleVersion() return MODULE_VERSION; } +void registerObjects(sofa::core::ObjectFactory* factory) +{ + factory->registerObjectsFromPlugin("Sofa.Component.Topology.Container"); + factory->registerObjectsFromPlugin("Sofa.Component.Topology.Mapping"); + factory->registerObjectsFromPlugin("Sofa.Component.Topology.Utility"); +} + void init() { static bool first = true; @@ -59,6 +70,9 @@ void init() sofa::component::topology::mapping::init(); sofa::component::topology::utility::init(); + // make sure that this plugin is registered into the PluginManager + sofa::helper::system::PluginManager::getInstance().registerPlugin(MODULE_NAME); + first = false; } } diff --git a/Sofa/Component/src/sofa/component/init.cpp b/Sofa/Component/src/sofa/component/init.cpp index 540a98d851b..c9626de10c1 100644 --- a/Sofa/Component/src/sofa/component/init.cpp +++ b/Sofa/Component/src/sofa/component/init.cpp @@ -86,6 +86,7 @@ void registerObjects(sofa::core::ObjectFactory* factory) factory->registerObjectsFromPlugin("Sofa.Component.Haptics"); factory->registerObjectsFromPlugin("Sofa.Component.Diffusion"); factory->registerObjectsFromPlugin("Sofa.Component.ODESolver"); + factory->registerObjectsFromPlugin("Sofa.Component.Topology"); factory->registerObjectsFromPlugin("Sofa.Component.LinearSolver"); factory->registerObjectsFromPlugin("Sofa.Component.Engine"); } diff --git a/Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp b/Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp index 67f2e841145..b2d0cd8f36d 100644 --- a/Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp +++ b/Sofa/framework/Helper/src/sofa/helper/ComponentChange.cpp @@ -784,6 +784,15 @@ const std::map< std::string, Dealiased, std::less<> > dealiasedComponents = { {"ImplicitEulerSolver", Dealiased("v24.12","EulerImplicitSolver")}, {"ImplicitEuler", Dealiased("v24.12","EulerImplicitSolver")}, {"VariationalSolver", Dealiased("v24.12","VariationalSymplecticSolver")}, + {"Mesh", Dealiased("v24.12","MeshTopology")}, + {"SphereQuad", Dealiased("v24.12","SphereQuadTopology")}, + {"CylinderGrid", Dealiased("v24.12","CylinderGridTopology")}, + {"Grid", Dealiased("v24.12","GridTopology")}, + {"RegularGrid", Dealiased("v24.12","RegularGridTopology")}, + {"SparseGridMultiple", Dealiased("v24.12","SparseGridMultipleTopology")}, + {"SparseGridRamification", Dealiased("v24.12","SparseGridRamificationTopology")}, + {"SparseGrid", Dealiased("v24.12","SparseGridTopology")}, + {"SphereGrid", Dealiased("v24.12","SphereGridTopology")}, {"SVDLinear", Dealiased("v24.12","SVDLinearSolver")}, {"SVD", Dealiased("v24.12","SVDLinearSolver")}, {"CGSolver", Dealiased("v24.12","CGLinearSolver")}, @@ -796,7 +805,7 @@ const std::map< std::string, Dealiased, std::less<> > dealiasedComponents = { {"SSORLinearSolver", Dealiased("v24.12","SSORPreconditioner")}, {"SSORSolver", Dealiased("v24.12","SSORPreconditioner")}, {"RigidEngine", Dealiased("v24.12","RigidToQuatEngine")}, - + }; } // namespace sofa::helper::lifecycle diff --git a/applications/projects/SceneChecking/tests/SceneChecker_test.cpp b/applications/projects/SceneChecking/tests/SceneChecker_test.cpp index b5511140d91..9de8d0bbcf4 100644 --- a/applications/projects/SceneChecking/tests/SceneChecker_test.cpp +++ b/applications/projects/SceneChecking/tests/SceneChecker_test.cpp @@ -209,15 +209,15 @@ struct SceneChecker_test : public BaseSimulationTest void checkUsingAlias(bool sceneWithAlias) { - const std::string withAlias = "Mesh"; - const std::string withoutAlias = "MeshTopology"; + const std::string withAlias = "VisualModel"; + const std::string withoutAlias = "VisualModelImpl"; const std::string componentName = sceneWithAlias ? withAlias : withoutAlias; std::stringstream scene; scene << " \n" << " \n" << " \n" - << " \n" + << " \n" << " \n" << " <" << componentName << "/> \n" << " \n"; diff --git a/examples/Component/Constraint/Lagrangian/FixedLagrangianConstaint_Vec3.scn b/examples/Component/Constraint/Lagrangian/FixedLagrangianConstaint_Vec3.scn index ef74dbb59a4..47d32cedd42 100644 --- a/examples/Component/Constraint/Lagrangian/FixedLagrangianConstaint_Vec3.scn +++ b/examples/Component/Constraint/Lagrangian/FixedLagrangianConstaint_Vec3.scn @@ -29,7 +29,7 @@ - +