|
21 | 21 | ******************************************************************************/ |
22 | 22 | #include <SofaMJEDFEM/config.h> |
23 | 23 | #include <sofa/core/ObjectFactory.h> |
| 24 | +#include <sofa/helper/system/PluginManager.h> |
| 25 | + |
24 | 26 | using sofa::core::ObjectFactory; |
25 | 27 |
|
26 | | -namespace sofa::component |
| 28 | +namespace sofamjedfem |
27 | 29 | { |
| 30 | + extern void registerMJEDTetrahedralForceField(sofa::core::ObjectFactory *factory); |
| 31 | +} // namespace sofamjedfem |
28 | 32 |
|
29 | | -extern "C" { |
30 | | - SOFA_MJED_FEM_API void initExternalModule(); |
31 | | - SOFA_MJED_FEM_API const char* getModuleName(); |
32 | | - SOFA_MJED_FEM_API const char* getModuleVersion(); |
33 | | - SOFA_MJED_FEM_API const char* getModuleLicense(); |
34 | | - SOFA_MJED_FEM_API const char* getModuleDescription(); |
35 | | - SOFA_MJED_FEM_API const char* getModuleComponentList(); |
36 | | -} |
37 | 33 |
|
38 | | -void initExternalModule() |
| 34 | +namespace sofa::component |
39 | 35 | { |
40 | | - static bool first = true; |
41 | | - if (first) |
| 36 | + using namespace sofamjedfem; |
| 37 | + |
| 38 | + extern "C" { |
| 39 | + SOFA_MJED_FEM_API void initExternalModule(); |
| 40 | + SOFA_MJED_FEM_API const char* getModuleName(); |
| 41 | + SOFA_MJED_FEM_API const char* getModuleVersion(); |
| 42 | + SOFA_MJED_FEM_API const char* getModuleLicense(); |
| 43 | + SOFA_MJED_FEM_API const char* getModuleDescription(); |
| 44 | + SOFA_MJED_FEM_API const char* getModuleComponentList(); |
| 45 | + SOFA_MJED_FEM_API void registerObjects(sofa::core::ObjectFactory* factory); |
| 46 | + } |
| 47 | + |
| 48 | + void initExternalModule() |
42 | 49 | { |
43 | | - first = false; |
| 50 | + static bool first = true; |
| 51 | + if (first) |
| 52 | + { |
| 53 | + // make sure that this plugin is registered into the PluginManager |
| 54 | + sofa::helper::system::PluginManager::getInstance().registerPlugin(MODULE_NAME); |
| 55 | + |
| 56 | + first = false; |
| 57 | + } |
44 | 58 | } |
45 | | -} |
46 | 59 |
|
47 | | -const char* getModuleName() |
48 | | -{ |
49 | | - return sofa_tostring(SOFA_TARGET); |
50 | | -} |
| 60 | + const char* getModuleName() |
| 61 | + { |
| 62 | + return sofa_tostring(SOFA_TARGET); |
| 63 | + } |
51 | 64 |
|
52 | | -const char* getModuleVersion() |
53 | | -{ |
54 | | - return sofa_tostring(SOFAMJEDFEM_VERSION); |
55 | | -} |
| 65 | + const char* getModuleVersion() |
| 66 | + { |
| 67 | + return sofa_tostring(SOFAMJEDFEM_VERSION); |
| 68 | + } |
56 | 69 |
|
57 | | -const char* getModuleLicense() |
58 | | -{ |
59 | | - return "LGPL"; |
60 | | -} |
| 70 | + const char* getModuleLicense() |
| 71 | + { |
| 72 | + return "LGPL"; |
| 73 | + } |
61 | 74 |
|
62 | | -const char* getModuleDescription() |
63 | | -{ |
64 | | - return "This plugin implements the Multiplicative Jacobian Energy Decomposition or MJED method."; |
65 | | -} |
| 75 | + const char* getModuleDescription() |
| 76 | + { |
| 77 | + return "This plugin implements the Multiplicative Jacobian Energy Decomposition or MJED method."; |
| 78 | + } |
66 | 79 |
|
67 | | -const char* getModuleComponentList() |
68 | | -{ |
69 | | - /// string containing the names of the classes provided by the plugin |
70 | | - static std::string classes = ObjectFactory::getInstance()->listClassesFromTarget(sofa_tostring(SOFA_TARGET)); |
71 | | - return classes.c_str(); |
72 | | -} |
| 80 | + const char* getModuleComponentList() |
| 81 | + { |
| 82 | + /// string containing the names of the classes provided by the plugin |
| 83 | + static std::string classes = ObjectFactory::getInstance()->listClassesFromTarget(sofa_tostring(SOFA_TARGET)); |
| 84 | + return classes.c_str(); |
| 85 | + } |
| 86 | + |
| 87 | + void registerObjects(sofa::core::ObjectFactory* factory) |
| 88 | + { |
| 89 | + registerMJEDTetrahedralForceField(factory); |
| 90 | + } |
73 | 91 |
|
74 | 92 | } // namespace sofa::component |
0 commit comments