Skip to content

Commit 9c9c13b

Browse files
authored
Merge pull request #13 from hugtalbot/202506_new_registration_mechanism
Apply new factory registration mechanism
2 parents 79a7db1 + f2cbd10 commit 9c9c13b

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

src/sofa/metis/MetisOrderingMethod.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,11 @@ extern "C" {
2929
namespace sofa::metis
3030
{
3131

32-
int MetisOrderingMethodClass = sofa::core::RegisterObject("Nested dissection algorithm implemented in the METIS library.")
33-
.add<MetisOrderingMethod>();
32+
void registerMetisOrderingMethod(sofa::core::ObjectFactory* factory)
33+
{
34+
factory->registerObjects(sofa::core::ObjectRegistrationData("Nested dissection algorithm implemented in the METIS library.")
35+
.add<MetisOrderingMethod>());
36+
}
3437

3538
std::string MetisOrderingMethod::methodName() const
3639
{

src/sofa/metis/init.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,22 @@
2424

2525
#include <sofa/core/ObjectFactory.h>
2626
using sofa::core::ObjectFactory;
27+
#include <sofa/helper/system/PluginManager.h>
2728

2829
#include <Eigen/MetisSupport>
2930

3031
namespace sofa::metis
3132
{
33+
extern void registerMetisOrderingMethod(sofa::core::ObjectFactory* factory);
34+
3235
extern "C" {
3336
SOFA_METIS_API void initExternalModule();
3437
SOFA_METIS_API const char* getModuleName();
3538
SOFA_METIS_API const char* getModuleVersion();
3639
SOFA_METIS_API const char* getModuleDescription();
37-
SOFA_METIS_API const char* getModuleComponentList();
40+
SOFA_METIS_API void registerObjects(sofa::core::ObjectFactory* factory);
3841
}
3942

40-
4143
template<class EigenSolverFactory, class Scalar>
4244
void registerOrderingMethods()
4345
{
@@ -55,6 +57,9 @@ namespace sofa::metis
5557

5658
void init()
5759
{
60+
// make sure that this plugin is registered into the PluginManager
61+
sofa::helper::system::PluginManager::getInstance().registerPlugin(MODULE_NAME);
62+
5863
static bool first = true;
5964
if (first)
6065
{
@@ -87,11 +92,9 @@ namespace sofa::metis
8792
return "";
8893
}
8994

90-
const char* getModuleComponentList()
95+
void registerObjects(sofa::core::ObjectFactory* factory)
9196
{
92-
/// string containing the names of the classes provided by the plugin
93-
static std::string classes = ObjectFactory::getInstance()->listClassesFromTarget(sofa_tostring(SOFA_TARGET));
94-
return classes.c_str();
97+
registerMetisOrderingMethod(factory);
9598
}
9699

97100
}

0 commit comments

Comments
 (0)