Repository: SofaDefrost/ModelOrderReduction (language: python)

Issue:
v20.12 changes
Changes done for SOFA v20.12 release.
- reorganize source tree under src/ModelOrderReduction
- follow SOFA plugin good practices


Discussion / hints:

Fix patch:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index accef1a3..e3fae4be 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,75 +15,70 @@ find_package(SofaRigid REQUIRED)
 find_package(SofaMiscFem REQUIRED)
 find_package(SofaMiscMapping REQUIRED)
 find_package(SofaMiscCollision REQUIRED)
-
-find_package(SofaPython QUIET)
-if(SofaPython_FOUND)
-    message("SofaPyhon found")
-    set(MOR_PYTHON 1) # See initModelOrderReduction.h.in
-endif()
+find_package(Sofa.GL REQUIRED)
 
 option(USE_COMPRESSED_ROW_SPARSE "Use compressed row sparse format in the mappings" ON)
 
+set(MOR_SRC "src/ModelOrderReduction")
+
 set(HEADER_FILES
-    src/component/forcefield/HyperReducedHelper.h
-    src/component/forcefield/HyperReducedHexahedronFEMForceField.h
-    src/component/forcefield/HyperReducedHexahedronFEMForceField.inl
-    src/component/forcefield/HyperReducedRestShapeSpringsForceField.h
-    src/component/forcefield/HyperReducedRestShapeSpringsForceField.inl
-    src/component/forcefield/HyperReducedTetrahedralCorotationalFEMForceField.h
-    src/component/forcefield/HyperReducedTetrahedralCorotationalFEMForceField.inl
-    src/component/forcefield/HyperReducedTetrahedronFEMForceField.h
-    src/component/forcefield/HyperReducedTetrahedronFEMForceField.inl
-    src/component/forcefield/HyperReducedTetrahedronHyperelasticityFEMForceField.h
-    src/component/forcefield/HyperReducedTetrahedronHyperelasticityFEMForceField.inl
-    src/component/forcefield/HyperReducedTriangleFEMForceField.h
-    src/component/forcefield/HyperReducedTriangleFEMForceField.inl
-    src/component/forcefield/MechanicalMatrixMapperMOR.h
-    src/component/forcefield/MechanicalMatrixMapperMOR.inl
-
-    src/component/loader/MatrixLoader.h
-    src/component/loader/MatrixLoader.inl
-
-    src/component/mapping/ModelOrderReductionMapping.h
-    src/component/mapping/ModelOrderReductionMapping.inl
-    src/component/mapping/MORContactMapping.h
-    src/component/mapping/MORContactMapping.inl
-
-    src/component/contact/MORFrictionContact.h
-    src/component/contact/MORFrictionContact.inl
-    src/component/contact/MORUnilateralInteractionConstraint.h
-    src/component/contact/MORUnilateralInteractionConstraint.inl
-    src/component/contact/MORpointModel.h
-    src/component/contact/MORpointModel.inl
+    ${MOR_SRC}/config.h.in
+
+    ${MOR_SRC}/component/forcefield/HyperReducedHelper.h
+    ${MOR_SRC}/component/forcefield/HyperReducedHexahedronFEMForceField.h
+    ${MOR_SRC}/component/forcefield/HyperReducedHexahedronFEMForceField.inl
+    ${MOR_SRC}/component/forcefield/HyperReducedRestShapeSpringsForceField.h
+    ${MOR_SRC}/component/forcefield/HyperReducedRestShapeSpringsForceField.inl
+    ${MOR_SRC}/component/forcefield/HyperReducedTetrahedralCorotationalFEMForceField.h
+    ${MOR_SRC}/component/forcefield/HyperReducedTetrahedralCorotationalFEMForceField.inl
+    ${MOR_SRC}/component/forcefield/HyperReducedTetrahedronFEMForceField.h
+    ${MOR_SRC}/component/forcefield/HyperReducedTetrahedronFEMForceField.inl
+    ${MOR_SRC}/component/forcefield/HyperReducedTetrahedronHyperelasticityFEMForceField.h
+    ${MOR_SRC}/component/forcefield/HyperReducedTetrahedronHyperelasticityFEMForceField.inl
+    ${MOR_SRC}/component/forcefield/HyperReducedTriangleFEMForceField.h
+    ${MOR_SRC}/component/forcefield/HyperReducedTriangleFEMForceField.inl
+    ${MOR_SRC}/component/forcefield/MechanicalMatrixMapperMOR.h
+    ${MOR_SRC}/component/forcefield/MechanicalMatrixMapperMOR.inl
+
+    ${MOR_SRC}/component/loader/MatrixLoader.h
+    ${MOR_SRC}/component/loader/MatrixLoader.inl
+
+    ${MOR_SRC}/component/mapping/ModelOrderReductionMapping.h
+    ${MOR_SRC}/component/mapping/ModelOrderReductionMapping.inl
+    ${MOR_SRC}/component/mapping/MORContactMapping.h
+    ${MOR_SRC}/component/mapping/MORContactMapping.inl
+
+    ${MOR_SRC}/component/contact/MORFrictionContact.h
+    ${MOR_SRC}/component/contact/MORFrictionContact.inl
+    ${MOR_SRC}/component/contact/MORUnilateralInteractionConstraint.h
+    ${MOR_SRC}/component/contact/MORUnilateralInteractionConstraint.inl
+    ${MOR_SRC}/component/contact/MORpointModel.h
+    ${MOR_SRC}/component/contact/MORpointModel.inl
     )
 set(SOURCE_FILES
-    src/component/initModelOrderReduction.cpp
+    ${MOR_SRC}/initModelOrderReduction.cpp
 
-    src/component/forcefield/HyperReducedHexahedronFEMForceField.cpp
-    src/component/forcefield/HyperReducedRestShapeSpringsForceField.cpp
-    src/component/forcefield/HyperReducedTetrahedralCorotationalFEMForceField.cpp
-    src/component/forcefield/HyperReducedTetrahedronFEMForceField.cpp
-    src/component/forcefield/HyperReducedTetrahedronHyperelasticityFEMForceField.cpp
-    src/component/forcefield/HyperReducedTriangleFEMForceField.cpp
-    src/component/forcefield/MechanicalMatrixMapperMOR.cpp
+    ${MOR_SRC}/component/forcefield/HyperReducedHexahedronFEMForceField.cpp
+    ${MOR_SRC}/component/forcefield/HyperReducedRestShapeSpringsForceField.cpp
+    ${MOR_SRC}/component/forcefield/HyperReducedTetrahedralCorotationalFEMForceField.cpp
+    ${MOR_SRC}/component/forcefield/HyperReducedTetrahedronFEMForceField.cpp
+    ${MOR_SRC}/component/forcefield/HyperReducedTetrahedronHyperelasticityFEMForceField.cpp
+    ${MOR_SRC}/component/forcefield/HyperReducedTriangleFEMForceField.cpp
+    ${MOR_SRC}/component/forcefield/MechanicalMatrixMapperMOR.cpp
 
-    src/component/loader/MatrixLoader.cpp
+    ${MOR_SRC}/component/loader/MatrixLoader.cpp
 
-    src/component/mapping/ModelOrderReductionMapping.cpp
-    src/component/mapping/MORContactMapping.cpp
+    ${MOR_SRC}/component/mapping/ModelOrderReductionMapping.cpp
+    ${MOR_SRC}/component/mapping/MORContactMapping.cpp
 
-    src/component/contact/MORFrictionContact.cpp
-    src/component/contact/MORUnilateralInteractionConstraint.cpp
-    src/component/contact/MORpointModel.cpp
+    ${MOR_SRC}/component/contact/MORFrictionContact.cpp
+    ${MOR_SRC}/component/contact/MORUnilateralInteractionConstraint.cpp
+    ${MOR_SRC}/component/contact/MORpointModel.cpp
     )
 set(README_FILES
     README.md
     )
 
-# Generate initModelOrderReduction.h from initModelOrderReduction.h.in
-configure_file(src/component/initModelOrderReduction.h.in "${CMAKE_BINARY_DIR}/include/ModelOrderReduction/initModelOrderReduction.h")
-install(FILES "${CMAKE_BINARY_DIR}/include/ModelOrderReduction/initModelOrderReduction.h" DESTINATION "include/ModelOrderReduction" COMPONENT headers)
-
 add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES} ${README_FILES})
 
 set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-DSOFA_BUILD_MODELORDERREDUCTION")
@@ -95,14 +90,9 @@ target_link_libraries(${PROJECT_NAME}
     SofaMiscFem SofaMiscMapping SofaMiscCollision # SofaMisc
     Sofa.GL
     )
-target_include_directories(${PROJECT_NAME} PUBLIC "$<INSTALL_INTERFACE:include>")
-target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>")
 
 # Config files and install rules for pythons scripts
-if(SofaPython_FOUND)
-    target_link_libraries(${PROJECT_NAME} SofaPython)
-    sofa_install_pythonscripts(PLUGIN_NAME ${PROJECT_NAME} PYTHONSCRIPTS_SOURCE_DIR "python")
-endif()
+sofa_install_pythonscripts(PLUGIN_NAME ${PROJECT_NAME} PYTHONSCRIPTS_SOURCE_DIR "python")
 
 # Move all resources when install: examples, doc and python files
 install(FILES "README.md" "LICENSE" DESTINATION .)
@@ -115,18 +105,19 @@ endif()
 if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tools")
     install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tools DESTINATION . COMPONENT resources)
 endif()
+
 ## Install rules for the library and headers; CMake package configurations files
 sofa_create_package_with_targets(
     PACKAGE_NAME ModelOrderReduction
     PACKAGE_VERSION ${PROJECT_VERSION}
-    TARGETS ${PROJECT_NAME}
-    INCLUDE_SOURCE_DIR "src/component"
-    INCLUDE_INSTALL_DIR "component"
+    TARGETS ${PROJECT_NAME} AUTO_SET_TARGET_PROPERTIES
+    INCLUDE_SOURCE_DIR "src"
+    INCLUDE_INSTALL_DIR "ModelOrderReduction"
     RELOCATABLE "plugins"
     )
 
 # if(SOFA_BUILD_TESTS)
-#     add_subdirectory(src/component/ModelOrderReduction_test)
+#     add_subdirectory(${MOR_SRC}/component/ModelOrderReduction_test)
 # endif()
 
 include(cmake/packaging.cmake)
diff --git a/src/component/contact/MORFrictionContact.cpp b/src/ModelOrderReduction/component/contact/MORFrictionContact.cpp
similarity index 100%
rename from src/component/contact/MORFrictionContact.cpp
rename to src/ModelOrderReduction/component/contact/MORFrictionContact.cpp
diff --git a/src/component/contact/MORFrictionContact.h b/src/ModelOrderReduction/component/contact/MORFrictionContact.h
similarity index 99%
rename from src/component/contact/MORFrictionContact.h
rename to src/ModelOrderReduction/component/contact/MORFrictionContact.h
index bc51ed93..2a23ab47 100644
--- a/src/component/contact/MORFrictionContact.h
+++ b/src/ModelOrderReduction/component/contact/MORFrictionContact.h
@@ -21,7 +21,7 @@
 ******************************************************************************/
 #ifndef MOR_MORFRICTIONCONTACT_H
 #define MOR_MORFRICTIONCONTACT_H
-#include <ModelOrderReduction/initModelOrderReduction.h>
+#include <ModelOrderReduction/config.h>
 
 #include <SofaConstraint/FrictionContact.h>
 #include <sofa/core/collision/Contact.h>
diff --git a/src/component/contact/MORFrictionContact.inl b/src/ModelOrderReduction/component/contact/MORFrictionContact.inl
similarity index 100%
rename from src/component/contact/MORFrictionContact.inl
rename to src/ModelOrderReduction/component/contact/MORFrictionContact.inl
diff --git a/src/component/contact/MORUnilateralInteractionConstraint.cpp b/src/ModelOrderReduction/component/contact/MORUnilateralInteractionConstraint.cpp
similarity index 96%
rename from src/component/contact/MORUnilateralInteractionConstraint.cpp
rename to src/ModelOrderReduction/component/contact/MORUnilateralInteractionConstraint.cpp
index 18257793..7ebb1356 100644
--- a/src/component/contact/MORUnilateralInteractionConstraint.cpp
+++ b/src/ModelOrderReduction/component/contact/MORUnilateralInteractionConstraint.cpp
@@ -44,7 +44,7 @@ int MORUnilateralInteractionConstraintClass = core::RegisterObject("TODO-MORUnil
         ;
 
 
-template class MORUnilateralInteractionConstraint<Vec3Types>;
+template class SOFA_MODELORDERREDUCTION_API MORUnilateralInteractionConstraint<Vec3Types>;
 
 
 
diff --git a/src/component/contact/MORUnilateralInteractionConstraint.h b/src/ModelOrderReduction/component/contact/MORUnilateralInteractionConstraint.h
similarity index 98%
rename from src/component/contact/MORUnilateralInteractionConstraint.h
rename to src/ModelOrderReduction/component/contact/MORUnilateralInteractionConstraint.h
index de6fd51e..f881e6e4 100644
--- a/src/component/contact/MORUnilateralInteractionConstraint.h
+++ b/src/ModelOrderReduction/component/contact/MORUnilateralInteractionConstraint.h
@@ -159,7 +159,7 @@ class MORUnilateralInteractionConstraint : public UnilateralInteractionConstrain
 
 
 #if  !defined(MOR_MORUNILATERALINTERACTIONCONSTRAINT_CPP)
-extern template class MORUnilateralInteractionConstraint<defaulttype::Vec3Types>;
+extern template class SOFA_MODELORDERREDUCTION_API MORUnilateralInteractionConstraint<defaulttype::Vec3Types>;
 #endif
 
 } // namespace constraintset
diff --git a/src/component/contact/MORUnilateralInteractionConstraint.inl b/src/ModelOrderReduction/component/contact/MORUnilateralInteractionConstraint.inl
similarity index 100%
rename from src/component/contact/MORUnilateralInteractionConstraint.inl
rename to src/ModelOrderReduction/component/contact/MORUnilateralInteractionConstraint.inl
diff --git a/src/component/contact/MORpointModel.cpp b/src/ModelOrderReduction/component/contact/MORpointModel.cpp
similarity index 96%
rename from src/component/contact/MORpointModel.cpp
rename to src/ModelOrderReduction/component/contact/MORpointModel.cpp
index 9fef2234..f690547d 100644
--- a/src/component/contact/MORpointModel.cpp
+++ b/src/ModelOrderReduction/component/contact/MORpointModel.cpp
@@ -44,7 +44,7 @@ int MORPointCollisionModelClass = core::RegisterObject("Collision model which re
         .addAlias("MORPoint")
         ;
 
-template class MORPointCollisionModel<defaulttype::Vec3Types>;
+template class SOFA_MODELORDERREDUCTION_API MORPointCollisionModel<defaulttype::Vec3Types>;
 
 
 } // namespace collision
diff --git a/src/component/contact/MORpointModel.h b/src/ModelOrderReduction/component/contact/MORpointModel.h
similarity index 95%
rename from src/component/contact/MORpointModel.h
rename to src/ModelOrderReduction/component/contact/MORpointModel.h
index 3eb21024..42bc2661 100644
--- a/src/component/contact/MORpointModel.h
+++ b/src/ModelOrderReduction/component/contact/MORpointModel.h
@@ -21,7 +21,7 @@
 ******************************************************************************/
 #ifndef MOR_POINTCOLLISIONMODEL_H
 #define MOR_POINTCOLLISIONMODEL_H
-#include <ModelOrderReduction/initModelOrderReduction.h>
+#include <ModelOrderReduction/config.h>
 
 #include <SofaMeshCollision/PointModel.h>
 #include <SofaMeshCollision/PointModel.inl>
@@ -81,7 +81,7 @@ class MORPointCollisionModel : public PointCollisionModel<TDataTypes>
 
 
 #if  !defined(MOR_POINTCOLLISIONMODEL_CPP)
-extern template class MORPointCollisionModel<defaulttype::Vec3Types>;
+extern template class SOFA_MODELORDERREDUCTION_API MORPointCollisionModel<defaulttype::Vec3Types>;
 
 #endif
 
diff --git a/src/component/contact/MORpointModel.inl b/src/ModelOrderReduction/component/contact/MORpointModel.inl
similarity index 100%
rename from src/component/contact/MORpointModel.inl
rename to src/ModelOrderReduction/component/contact/MORpointModel.inl
diff --git a/src/component/forcefield/HyperReducedHelper.h b/src/ModelOrderReduction/component/forcefield/HyperReducedHelper.h
similarity index 99%
rename from src/component/forcefield/HyperReducedHelper.h
rename to src/ModelOrderReduction/component/forcefield/HyperReducedHelper.h
index 73a0d59f..73c5c643 100644
--- a/src/component/forcefield/HyperReducedHelper.h
+++ b/src/ModelOrderReduction/component/forcefield/HyperReducedHelper.h
@@ -16,7 +16,7 @@
 ******************************************************************************/
 #ifndef HYPERREDUCEDHELPER_H
 #define HYPERREDUCEDHELPER_H
-#include <ModelOrderReduction/initModelOrderReduction.h>
+#include <ModelOrderReduction/config.h>
 
 #include <sofa/core/behavior/BaseMechanicalState.h>
 #include <sofa/core/objectmodel/Event.h>
diff --git a/src/component/forcefield/HyperReducedHexahedronFEMForceField.cpp b/src/ModelOrderReduction/component/forcefield/HyperReducedHexahedronFEMForceField.cpp
similarity index 100%
rename from src/component/forcefield/HyperReducedHexahedronFEMForceField.cpp
rename to src/ModelOrderReduction/component/forcefield/HyperReducedHexahedronFEMForceField.cpp
diff --git a/src/component/forcefield/HyperReducedHexahedronFEMForceField.h b/src/ModelOrderReduction/component/forcefield/HyperReducedHexahedronFEMForceField.h
similarity index 99%
rename from src/component/forcefield/HyperReducedHexahedronFEMForceField.h
rename to src/ModelOrderReduction/component/forcefield/HyperReducedHexahedronFEMForceField.h
index e24b6cc0..46fb0b0f 100644
--- a/src/component/forcefield/HyperReducedHexahedronFEMForceField.h
+++ b/src/ModelOrderReduction/component/forcefield/HyperReducedHexahedronFEMForceField.h
@@ -16,7 +16,7 @@
 ******************************************************************************/
 #ifndef SOFA_COMPONENT_FORCEFIELD_HYPERREDUCEDHEXAHEDRONFEMFORCEFIELD_H
 #define SOFA_COMPONENT_FORCEFIELD_HYPERREDUCEDHEXAHEDRONFEMFORCEFIELD_H
-#include <ModelOrderReduction/initModelOrderReduction.h>
+#include <ModelOrderReduction/config.h>
 
 #include "HyperReducedHelper.h"
 #include <SofaSimpleFem/HexahedronFEMForceField.h>
diff --git a/src/component/forcefield/HyperReducedHexahedronFEMForceField.inl b/src/ModelOrderReduction/component/forcefield/HyperReducedHexahedronFEMForceField.inl
similarity index 100%
rename from src/component/forcefield/HyperReducedHexahedronFEMForceField.inl
rename to src/ModelOrderReduction/component/forcefield/HyperReducedHexahedronFEMForceField.inl
diff --git a/src/component/forcefield/HyperReducedRestShapeSpringsForceField.cpp b/src/ModelOrderReduction/component/forcefield/HyperReducedRestShapeSpringsForceField.cpp
similarity index 100%
rename from src/component/forcefield/HyperReducedRestShapeSpringsForceField.cpp
rename to src/ModelOrderReduction/component/forcefield/HyperReducedRestShapeSpringsForceField.cpp
diff --git a/src/component/forcefield/HyperReducedRestShapeSpringsForceField.h b/src/ModelOrderReduction/component/forcefield/HyperReducedRestShapeSpringsForceField.h
similarity index 99%
rename from src/component/forcefield/HyperReducedRestShapeSpringsForceField.h
rename to src/ModelOrderReduction/component/forcefield/HyperReducedRestShapeSpringsForceField.h
index f5d76dd2..cf9b1951 100644
--- a/src/component/forcefield/HyperReducedRestShapeSpringsForceField.h
+++ b/src/ModelOrderReduction/component/forcefield/HyperReducedRestShapeSpringsForceField.h
@@ -16,7 +16,7 @@
 ******************************************************************************/
 #ifndef SOFA_COMPONENT_FORCEFIELD_HYPERREDUCEDRESTSHAPESPRINGFORCEFIELD_H
 #define SOFA_COMPONENT_FORCEFIELD_HYPERREDUCEDRESTSHAPESPRINGFORCEFIELD_H
-#include <ModelOrderReduction/initModelOrderReduction.h>
+#include <ModelOrderReduction/config.h>
 
 #include "HyperReducedHelper.h"
 #include <SofaDeformable/RestShapeSpringsForceField.h>
diff --git a/src/component/forcefield/HyperReducedRestShapeSpringsForceField.inl b/src/ModelOrderReduction/component/forcefield/HyperReducedRestShapeSpringsForceField.inl
similarity index 100%
rename from src/component/forcefield/HyperReducedRestShapeSpringsForceField.inl
rename to src/ModelOrderReduction/component/forcefield/HyperReducedRestShapeSpringsForceField.inl
diff --git a/src/component/forcefield/HyperReducedTetrahedralCorotationalFEMForceField.cpp b/src/ModelOrderReduction/component/forcefield/HyperReducedTetrahedralCorotationalFEMForceField.cpp
similarity index 100%
rename from src/component/forcefield/HyperReducedTetrahedralCorotationalFEMForceField.cpp
rename to src/ModelOrderReduction/component/forcefield/HyperReducedTetrahedralCorotationalFEMForceField.cpp
diff --git a/src/component/forcefield/HyperReducedTetrahedralCorotationalFEMForceField.h b/src/ModelOrderReduction/component/forcefield/HyperReducedTetrahedralCorotationalFEMForceField.h
similarity index 99%
rename from src/component/forcefield/HyperReducedTetrahedralCorotationalFEMForceField.h
rename to src/ModelOrderReduction/component/forcefield/HyperReducedTetrahedralCorotationalFEMForceField.h
index e125047c..791c97f4 100644
--- a/src/component/forcefield/HyperReducedTetrahedralCorotationalFEMForceField.h
+++ b/src/ModelOrderReduction/component/forcefield/HyperReducedTetrahedralCorotationalFEMForceField.h
@@ -16,7 +16,7 @@
 ******************************************************************************/
 #ifndef SOFA_COMPONENT_FORCEFIELD_HYPERREDUCEDTETRAHEDRALCOROTATIONALFEMFORCEFIELD_H
 #define SOFA_COMPONENT_FORCEFIELD_HYPERREDUCEDTETRAHEDRALCOROTATIONALFEMFORCEFIELD_H
-#include <ModelOrderReduction/initModelOrderReduction.h>
+#include <ModelOrderReduction/config.h>
 
 #include "HyperReducedHelper.h"
 #include <SofaGeneralSimpleFem/TetrahedralCorotationalFEMForceField.h>
diff --git a/src/component/forcefield/HyperReducedTetrahedralCorotationalFEMForceField.inl b/src/ModelOrderReduction/component/forcefield/HyperReducedTetrahedralCorotationalFEMForceField.inl
similarity index 100%
rename from src/component/forcefield/HyperReducedTetrahedralCorotationalFEMForceField.inl
rename to src/ModelOrderReduction/component/forcefield/HyperReducedTetrahedralCorotationalFEMForceField.inl
diff --git a/src/component/forcefield/HyperReducedTetrahedronFEMForceField.cpp b/src/ModelOrderReduction/component/forcefield/HyperReducedTetrahedronFEMForceField.cpp
similarity index 97%
rename from src/component/forcefield/HyperReducedTetrahedronFEMForceField.cpp
rename to src/ModelOrderReduction/component/forcefield/HyperReducedTetrahedronFEMForceField.cpp
index 6daa9ac0..a39879b6 100644
--- a/src/component/forcefield/HyperReducedTetrahedronFEMForceField.cpp
+++ b/src/ModelOrderReduction/component/forcefield/HyperReducedTetrahedronFEMForceField.cpp
@@ -19,7 +19,7 @@
 #include <sofa/defaulttype/VecTypes.h>
 #include <sofa/core/ObjectFactory.h>
 #include <assert.h>
-#include <ModelOrderReduction/initModelOrderReduction.h>
+#include <ModelOrderReduction/config.h>
 
 namespace sofa
 {
diff --git a/src/component/forcefield/HyperReducedTetrahedronFEMForceField.h b/src/ModelOrderReduction/component/forcefield/HyperReducedTetrahedronFEMForceField.h
similarity index 99%
rename from src/component/forcefield/HyperReducedTetrahedronFEMForceField.h
rename to src/ModelOrderReduction/component/forcefield/HyperReducedTetrahedronFEMForceField.h
index 3a317998..df60f01e 100644
--- a/src/component/forcefield/HyperReducedTetrahedronFEMForceField.h
+++ b/src/ModelOrderReduction/component/forcefield/HyperReducedTetrahedronFEMForceField.h
@@ -16,7 +16,7 @@
 ******************************************************************************/
 #ifndef SOFA_COMPONENT_FORCEFIELD_HYPERREDUCEDTETRAHEDRONFEMFORCEFIELD_H
 #define SOFA_COMPONENT_FORCEFIELD_HYPERREDUCEDTETRAHEDRONFEMFORCEFIELD_H
-#include <ModelOrderReduction/initModelOrderReduction.h>
+#include <ModelOrderReduction/config.h>
 
 #include "HyperReducedHelper.h"
 #include <SofaSimpleFem/TetrahedronFEMForceField.h>
diff --git a/src/component/forcefield/HyperReducedTetrahedronFEMForceField.inl b/src/ModelOrderReduction/component/forcefield/HyperReducedTetrahedronFEMForceField.inl
similarity index 100%
rename from src/component/forcefield/HyperReducedTetrahedronFEMForceField.inl
rename to src/ModelOrderReduction/component/forcefield/HyperReducedTetrahedronFEMForceField.inl
diff --git a/src/component/forcefield/HyperReducedTetrahedronHyperelasticityFEMForceField.cpp b/src/ModelOrderReduction/component/forcefield/HyperReducedTetrahedronHyperelasticityFEMForceField.cpp
similarity index 100%
rename from src/component/forcefield/HyperReducedTetrahedronHyperelasticityFEMForceField.cpp
rename to src/ModelOrderReduction/component/forcefield/HyperReducedTetrahedronHyperelasticityFEMForceField.cpp
diff --git a/src/component/forcefield/HyperReducedTetrahedronHyperelasticityFEMForceField.h b/src/ModelOrderReduction/component/forcefield/HyperReducedTetrahedronHyperelasticityFEMForceField.h
similarity index 99%
rename from src/component/forcefield/HyperReducedTetrahedronHyperelasticityFEMForceField.h
rename to src/ModelOrderReduction/component/forcefield/HyperReducedTetrahedronHyperelasticityFEMForceField.h
index 53d5e66f..a410f365 100644
--- a/src/component/forcefield/HyperReducedTetrahedronHyperelasticityFEMForceField.h
+++ b/src/ModelOrderReduction/component/forcefield/HyperReducedTetrahedronHyperelasticityFEMForceField.h
@@ -17,7 +17,7 @@
 
 #ifndef SOFA_COMPONENT_FORCEFIELD_HYPERREDUCEDTETRAHEDRONHYPERELASTICITYFEMFORCEFIELD_H
 #define SOFA_COMPONENT_FORCEFIELD_HYPERREDUCEDTETRAHEDRONHYPERELASTICITYFEMFORCEFIELD_H
-#include <ModelOrderReduction/initModelOrderReduction.h>
+#include <ModelOrderReduction/config.h>
 
 #if !defined(__GNUC__) || (__GNUC__ > 3 || (_GNUC__ == 3 && __GNUC_MINOR__ > 3))
 #pragma once
diff --git a/src/component/forcefield/HyperReducedTetrahedronHyperelasticityFEMForceField.inl b/src/ModelOrderReduction/component/forcefield/HyperReducedTetrahedronHyperelasticityFEMForceField.inl
similarity index 100%
rename from src/component/forcefield/HyperReducedTetrahedronHyperelasticityFEMForceField.inl
rename to src/ModelOrderReduction/component/forcefield/HyperReducedTetrahedronHyperelasticityFEMForceField.inl
diff --git a/src/component/forcefield/HyperReducedTriangleFEMForceField.cpp b/src/ModelOrderReduction/component/forcefield/HyperReducedTriangleFEMForceField.cpp
similarity index 100%
rename from src/component/forcefield/HyperReducedTriangleFEMForceField.cpp
rename to src/ModelOrderReduction/component/forcefield/HyperReducedTriangleFEMForceField.cpp
diff --git a/src/component/forcefield/HyperReducedTriangleFEMForceField.h b/src/ModelOrderReduction/component/forcefield/HyperReducedTriangleFEMForceField.h
similarity index 99%
rename from src/component/forcefield/HyperReducedTriangleFEMForceField.h
rename to src/ModelOrderReduction/component/forcefield/HyperReducedTriangleFEMForceField.h
index 325a4c0f..703316c1 100644
--- a/src/component/forcefield/HyperReducedTriangleFEMForceField.h
+++ b/src/ModelOrderReduction/component/forcefield/HyperReducedTriangleFEMForceField.h
@@ -16,7 +16,7 @@
 ******************************************************************************/
 #ifndef SOFA_COMPONENT_FORCEFIELD_HYPERREDUCEDTRIANGLEFEMFORCEFIELD_H
 #define SOFA_COMPONENT_FORCEFIELD_HYPERREDUCEDTRIANGLEFEMFORCEFIELD_H
-#include <ModelOrderReduction/initModelOrderReduction.h>
+#include <ModelOrderReduction/config.h>
 
 #if !defined(__GNUC__) || (__GNUC__ > 3 || (_GNUC__ == 3 && __GNUC_MINOR__ > 3))
 #pragma once
diff --git a/src/component/forcefield/HyperReducedTriangleFEMForceField.inl b/src/ModelOrderReduction/component/forcefield/HyperReducedTriangleFEMForceField.inl
similarity index 100%
rename from src/component/forcefield/HyperReducedTriangleFEMForceField.inl
rename to src/ModelOrderReduction/component/forcefield/HyperReducedTriangleFEMForceField.inl
diff --git a/src/component/forcefield/MechanicalMatrixMapperMOR.cpp b/src/ModelOrderReduction/component/forcefield/MechanicalMatrixMapperMOR.cpp
similarity index 100%
rename from src/component/forcefield/MechanicalMatrixMapperMOR.cpp
rename to src/ModelOrderReduction/component/forcefield/MechanicalMatrixMapperMOR.cpp
diff --git a/src/component/forcefield/MechanicalMatrixMapperMOR.h b/src/ModelOrderReduction/component/forcefield/MechanicalMatrixMapperMOR.h
similarity index 98%
rename from src/component/forcefield/MechanicalMatrixMapperMOR.h
rename to src/ModelOrderReduction/component/forcefield/MechanicalMatrixMapperMOR.h
index 527938d7..260f22af 100644
--- a/src/component/forcefield/MechanicalMatrixMapperMOR.h
+++ b/src/ModelOrderReduction/component/forcefield/MechanicalMatrixMapperMOR.h
@@ -16,7 +16,7 @@
 ******************************************************************************/
 #ifndef MECHANICALMATRIXMAPPERMOR_H
 #define MECHANICALMATRIXMAPPERMOR_H
-#include <ModelOrderReduction/initModelOrderReduction.h>
+#include <ModelOrderReduction/config.h>
 
 #include <SofaGeneralAnimationLoop/MechanicalMatrixMapper.h>
 
diff --git a/src/component/forcefield/MechanicalMatrixMapperMOR.inl b/src/ModelOrderReduction/component/forcefield/MechanicalMatrixMapperMOR.inl
similarity index 100%
rename from src/component/forcefield/MechanicalMatrixMapperMOR.inl
rename to src/ModelOrderReduction/component/forcefield/MechanicalMatrixMapperMOR.inl
diff --git a/src/component/loader/MatrixLoader.cpp b/src/ModelOrderReduction/component/loader/MatrixLoader.cpp
similarity index 100%
rename from src/component/loader/MatrixLoader.cpp
rename to src/ModelOrderReduction/component/loader/MatrixLoader.cpp
diff --git a/src/component/loader/MatrixLoader.h b/src/ModelOrderReduction/component/loader/MatrixLoader.h
similarity index 97%
rename from src/component/loader/MatrixLoader.h
rename to src/ModelOrderReduction/component/loader/MatrixLoader.h
index e8f6059b..1eeb4fdf 100644
--- a/src/component/loader/MatrixLoader.h
+++ b/src/ModelOrderReduction/component/loader/MatrixLoader.h
@@ -16,7 +16,7 @@
 ******************************************************************************/
 #ifndef SOFA_COMPONENT_LOADER_MATRIXLOADER_H
 #define SOFA_COMPONENT_LOADER_MATRIXLOADER_H
-#include <ModelOrderReduction/initModelOrderReduction.h>
+#include <ModelOrderReduction/config.h>
 
 #include <iostream>
 #include <vector>
diff --git a/src/component/loader/MatrixLoader.inl b/src/ModelOrderReduction/component/loader/MatrixLoader.inl
similarity index 100%
rename from src/component/loader/MatrixLoader.inl
rename to src/ModelOrderReduction/component/loader/MatrixLoader.inl
diff --git a/src/component/mapping/MORContactMapping.cpp b/src/ModelOrderReduction/component/mapping/MORContactMapping.cpp
similarity index 100%
rename from src/component/mapping/MORContactMapping.cpp
rename to src/ModelOrderReduction/component/mapping/MORContactMapping.cpp
diff --git a/src/component/mapping/MORContactMapping.h b/src/ModelOrderReduction/component/mapping/MORContactMapping.h
similarity index 99%
rename from src/component/mapping/MORContactMapping.h
rename to src/ModelOrderReduction/component/mapping/MORContactMapping.h
index 3300e54d..34eb458e 100644
--- a/src/component/mapping/MORContactMapping.h
+++ b/src/ModelOrderReduction/component/mapping/MORContactMapping.h
@@ -21,7 +21,7 @@
 ******************************************************************************/
 #ifndef SOFA_COMPONENT_MAPPING_MORCONTACTMAPPING_H
 #define SOFA_COMPONENT_MAPPING_MORCONTACTMAPPING_H
-#include <ModelOrderReduction/initModelOrderReduction.h>
+#include <ModelOrderReduction/config.h>
 #include <sofa/core/Mapping.h>
 #include <SofaBaseLinearSolver/CompressedRowSparseMatrix.h>
 #include <sofa/defaulttype/VecTypes.h>
diff --git a/src/component/mapping/MORContactMapping.inl b/src/ModelOrderReduction/component/mapping/MORContactMapping.inl
similarity index 100%
rename from src/component/mapping/MORContactMapping.inl
rename to src/ModelOrderReduction/component/mapping/MORContactMapping.inl
diff --git a/src/component/mapping/ModelOrderReductionMapping.cpp b/src/ModelOrderReduction/component/mapping/ModelOrderReductionMapping.cpp
similarity index 100%
rename from src/component/mapping/ModelOrderReductionMapping.cpp
rename to src/ModelOrderReduction/component/mapping/ModelOrderReductionMapping.cpp
diff --git a/src/component/mapping/ModelOrderReductionMapping.h b/src/ModelOrderReduction/component/mapping/ModelOrderReductionMapping.h
similarity index 99%
rename from src/component/mapping/ModelOrderReductionMapping.h
rename to src/ModelOrderReduction/component/mapping/ModelOrderReductionMapping.h
index 829521e9..9dcd7ea9 100644
--- a/src/component/mapping/ModelOrderReductionMapping.h
+++ b/src/ModelOrderReduction/component/mapping/ModelOrderReductionMapping.h
@@ -16,7 +16,7 @@
 ******************************************************************************/
 #ifndef SOFA_COMPONENT_MAPPING_MODELORDERREDUCTIONMAPPING_H
 #define SOFA_COMPONENT_MAPPING_MODELORDERREDUCTIONMAPPING_H
-#include <ModelOrderReduction/initModelOrderReduction.h>
+#include <ModelOrderReduction/config.h>
 
 #include <vector>
 
diff --git a/src/component/mapping/ModelOrderReductionMapping.inl b/src/ModelOrderReduction/component/mapping/ModelOrderReductionMapping.inl
similarity index 100%
rename from src/component/mapping/ModelOrderReductionMapping.inl
rename to src/ModelOrderReduction/component/mapping/ModelOrderReductionMapping.inl
diff --git a/src/component/initModelOrderReduction.h.in b/src/ModelOrderReduction/config.h.in
similarity index 94%
rename from src/component/initModelOrderReduction.h.in
rename to src/ModelOrderReduction/config.h.in
index 0bee3119..b7a373b3 100644
--- a/src/component/initModelOrderReduction.h.in
+++ b/src/ModelOrderReduction/config.h.in
@@ -23,11 +23,9 @@
 #ifdef SOFA_BUILD_MODELORDERREDUCTION
 #define SOFA_MODELORDERREDUCTION_API SOFA_EXPORT_DYNAMIC_LIBRARY
 #else
-#define SOFA_MODELORDERREDUCTION_API  SOFA_IMPORT_DYNAMIC_LIBRARY
+#define SOFA_MODELORDERREDUCTION_API SOFA_IMPORT_DYNAMIC_LIBRARY
 #endif
 
-#cmakedefine MOR_PYTHON
-
 /** \mainpage
   This is a the starting page of the plugin documentation, defined in file initModelOrderReduction.h
   */
diff --git a/src/component/initModelOrderReduction.cpp b/src/ModelOrderReduction/initModelOrderReduction.cpp
similarity index 90%
rename from src/component/initModelOrderReduction.cpp
rename to src/ModelOrderReduction/initModelOrderReduction.cpp
index bbe455a7..405af5a6 100644
--- a/src/component/initModelOrderReduction.cpp
+++ b/src/ModelOrderReduction/initModelOrderReduction.cpp
@@ -14,17 +14,12 @@
 *                                                                             *
 * Contact information: https://project.inria.fr/modelorderreduction/contact   *
 ******************************************************************************/
-#include <ModelOrderReduction/initModelOrderReduction.h>
+#include <ModelOrderReduction/config.h>
 #include <sofa/core/ObjectFactory.h>
 
 #include <sofa/helper/system/PluginManager.h>
 using sofa::helper::system::PluginManager;
 
-#ifdef MOR_PYTHON
-#include <SofaPython/PythonEnvironment.h>
-using sofa::simulation::PythonEnvironment;
-#endif
-
 #include <fstream>
 
 namespace sofa
@@ -50,10 +45,6 @@ void initExternalModule()
     {
         first = false;
     }
-
-#ifdef MOR_PYTHON
-    PythonEnvironment::addPythonModulePathsForPluginsByName("ModelOrderReduction");
-#endif
 }
 
 const char* getModuleName()


Test patch:
diff --git a/src/ModelOrderReduction_test/CMakeLists.txt b/ModelOrderReduction_test/CMakeLists.txt
similarity index 100%
rename from src/ModelOrderReduction_test/CMakeLists.txt
rename to ModelOrderReduction_test/CMakeLists.txt
diff --git a/src/ModelOrderReduction_test/ModelOrderReduction_test.cpp b/ModelOrderReduction_test/ModelOrderReduction_test.cpp
similarity index 100%
rename from src/ModelOrderReduction_test/ModelOrderReduction_test.cpp
rename to ModelOrderReduction_test/ModelOrderReduction_test.cpp