From a88d0ffe3100966d3e47a15f7d74d57576ccadd6 Mon Sep 17 00:00:00 2001 From: abn Date: Tue, 30 Mar 2021 21:39:44 +0200 Subject: [PATCH] [ICoCo]: ICoCo part as a new sub library: libmedicoco.so + Python wrapping is done in "medcoupling" --- CMakeLists.txt | 2 +- MEDCouplingConfig.cmake.in | 1 + src/CMakeLists.txt | 2 + src/CTestTestfileInstall.cmake.in | 1 + src/ICoCo/CMakeLists.txt | 50 +++++++++++++++++++ src/ICoCo/Readme.txt | 4 +- src/ICoCo/Swig/CMakeLists.txt | 47 +++++++++++++++++ src/ICoCo/Swig/CTestTestfileInstall.cmake | 30 +++++++++++ .../Swig}/ICoCoMEDFieldTest.py | 0 src/ICoCo/Swig/tests.set | 23 +++++++++ src/MEDCoupling/CMakeLists.txt | 11 +--- src/MEDCoupling_Swig/MEDCoupling.i | 1 - src/MEDCoupling_Swig/tests.set | 1 - src/ParaMEDMEM/CMakeLists.txt | 2 +- src/PyWrapping/CMakeLists.txt | 4 +- 15 files changed, 162 insertions(+), 17 deletions(-) create mode 100644 src/ICoCo/CMakeLists.txt create mode 100644 src/ICoCo/Swig/CMakeLists.txt create mode 100644 src/ICoCo/Swig/CTestTestfileInstall.cmake rename src/{MEDCoupling_Swig => ICoCo/Swig}/ICoCoMEDFieldTest.py (100%) create mode 100644 src/ICoCo/Swig/tests.set diff --git a/CMakeLists.txt b/CMakeLists.txt index b12898f1a..8ef4fbb50 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -287,7 +287,7 @@ INCLUDE(CMakePackageConfigHelpers) # List of targets in this project we want to make visible to the rest of the world. # They all have to be INSTALL'd with the option "EXPORT ${PROJECT_NAME}TargetGroup" SET(_${PROJECT_NAME}_exposed_targets - interpkernel medcouplingcpp medcouplingremapper) + interpkernel medcouplingcpp medcouplingremapper medicoco) IF(NOT MEDCOUPLING_MICROMED) LIST(APPEND _${PROJECT_NAME}_exposed_targets medloader) diff --git a/MEDCouplingConfig.cmake.in b/MEDCouplingConfig.cmake.in index 3b4152a73..c70c95833 100644 --- a/MEDCouplingConfig.cmake.in +++ b/MEDCouplingConfig.cmake.in @@ -117,6 +117,7 @@ SET(MEDCOUPLING_INSTALL_DOC "@MEDCOUPLING_INSTALL_BINS@") SET(MEDCoupling_interpkernel interpkernel) SET(MEDCoupling_medcouplingcpp medcouplingcpp) SET(MEDCoupling_medcoupling medcouplingcpp) +SET(MEDCoupling_medicoco medicoco) SET(MEDCoupling_medcouplingremapper medcouplingremapper) SET(MEDCoupling_medloader medloader) SET(MEDCoupling_renumbercpp renumbercpp) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4bd90dfd1..cbdccb0a8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -25,6 +25,8 @@ ENDIF(MEDCOUPLING_BUILD_TESTS) # MEDCoupling ADD_SUBDIRECTORY(MEDCoupling) +ADD_SUBDIRECTORY(ICoCo) + IF(MEDCOUPLING_ENABLE_PYTHON) ADD_SUBDIRECTORY(MEDCoupling_Swig) ADD_SUBDIRECTORY(PyWrapping) diff --git a/src/CTestTestfileInstall.cmake.in b/src/CTestTestfileInstall.cmake.in index b889475d5..9e6c9e0dd 100644 --- a/src/CTestTestfileInstall.cmake.in +++ b/src/CTestTestfileInstall.cmake.in @@ -23,6 +23,7 @@ SET(TIMEOUT 120) SUBDIRS(INTERP_KERNELTest) SUBDIRS(MEDCoupling) SUBDIRS(MEDCoupling_Swig) +SUBDIRS(ICoCo_Swig) SUBDIRS(MEDLoader) SUBDIRS(MEDLoader_Swig) SUBDIRS(MEDPartitioner) diff --git a/src/ICoCo/CMakeLists.txt b/src/ICoCo/CMakeLists.txt new file mode 100644 index 000000000..284ae2704 --- /dev/null +++ b/src/ICoCo/CMakeLists.txt @@ -0,0 +1,50 @@ +# Copyright (C) 2012-2021 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# Author : Adrien Bruneton (CEA/DES) + +IF (NOT DEFINED MSVC) + ADD_DEFINITIONS(-Wsign-compare -Wconversion) +ENDIF() + +IF(MEDCOUPLING_ENABLE_PYTHON) + ADD_SUBDIRECTORY(Swig) +ENDIF() + + +INCLUDE_DIRECTORIES( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/../MEDCoupling + ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL + ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/Bases + ) + +SET(icoco_SOURCES + ICoCoField.cpp # [ABN] Yes, .cpp, this is imposed by ICoCo. + ICoCoMEDDoubleField.cxx + ICoCoMEDIntField.cxx +) + +ADD_LIBRARY(medicoco ${icoco_SOURCES}) +SET_TARGET_PROPERTIES(medicoco PROPERTIES OUTPUT_NAME "medicoco") +TARGET_LINK_LIBRARIES(medicoco medcouplingcpp) +INSTALL(TARGETS medicoco EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${MEDCOUPLING_INSTALL_LIBS}) + +FILE(GLOB icoco_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx" + "${CMAKE_CURRENT_SOURCE_DIR}/*.h") +INSTALL(FILES ${icoco_HEADERS_HXX} DESTINATION ${MEDCOUPLING_INSTALL_HEADERS}) diff --git a/src/ICoCo/Readme.txt b/src/ICoCo/Readme.txt index 0880fd3d1..b344bf66c 100644 --- a/src/ICoCo/Readme.txt +++ b/src/ICoCo/Readme.txt @@ -1,4 +1,4 @@ -Linked into target 'paramedmem' library. +Linked into target 'mc_icoco' library. The files below are part of the official ICoCo API and should NOT be modified: - ICoCoField.h @@ -11,4 +11,4 @@ The files below are part of the official ICoCo API and should NOT be modified: Their official version can be found in the TRUST repository: - https://sourceforge.net/projects/trust/ + https://github.com/cea-trust-platform/icoco-coupling diff --git a/src/ICoCo/Swig/CMakeLists.txt b/src/ICoCo/Swig/CMakeLists.txt new file mode 100644 index 000000000..620da515e --- /dev/null +++ b/src/ICoCo/Swig/CMakeLists.txt @@ -0,0 +1,47 @@ +# Copyright (C) 2012-2021 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# Author: Adrien Bruneton (CEA/DES) +# + +# +# Only managing Python tests here. Python wrapping is done solely at the "medcoupling" level +# (see PyWrapping source directory) +# + +INCLUDE(tests.set) + +SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_CURRENT_BINARY_DIR}/../../PyWrapping) +SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env) + +FOREACH(test ${ALL_TESTS}) + GET_FILENAME_COMPONENT(testname ${test} NAME_WE) + ADD_TEST(NAME ${testname} + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${test}) + SET_TESTS_PROPERTIES(${testname} PROPERTIES ENVIRONMENT "${tests_env}") +ENDFOREACH() + +# Application tests + +SET(TEST_INSTALL_DIRECTORY ${MEDCOUPLING_INSTALL_TESTS}/ICoCo_Swig) +INSTALL(FILES ${ALL_TESTS} DESTINATION ${TEST_INSTALL_DIRECTORY}) + +INSTALL(FILES CTestTestfileInstall.cmake + DESTINATION ${TEST_INSTALL_DIRECTORY} + RENAME CTestTestfile.cmake) +INSTALL(FILES tests.set DESTINATION ${TEST_INSTALL_DIRECTORY}) diff --git a/src/ICoCo/Swig/CTestTestfileInstall.cmake b/src/ICoCo/Swig/CTestTestfileInstall.cmake new file mode 100644 index 000000000..f6228fc81 --- /dev/null +++ b/src/ICoCo/Swig/CTestTestfileInstall.cmake @@ -0,0 +1,30 @@ +# Copyright (C) 2015-2021 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +INCLUDE(tests.set) + +FOREACH(tfile ${ALL_TESTS}) + GET_FILENAME_COMPONENT(BASE_NAME ${tfile} NAME_WE) + SET(TEST_NAME ${COMPONENT_NAME}_${BASE_NAME}) + ADD_TEST(${TEST_NAME} python ${tfile}) + SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES + LABELS "${COMPONENT_NAME}" + TIMEOUT ${TIMEOUT} + ) +ENDFOREACH() diff --git a/src/MEDCoupling_Swig/ICoCoMEDFieldTest.py b/src/ICoCo/Swig/ICoCoMEDFieldTest.py similarity index 100% rename from src/MEDCoupling_Swig/ICoCoMEDFieldTest.py rename to src/ICoCo/Swig/ICoCoMEDFieldTest.py diff --git a/src/ICoCo/Swig/tests.set b/src/ICoCo/Swig/tests.set new file mode 100644 index 000000000..841b7d914 --- /dev/null +++ b/src/ICoCo/Swig/tests.set @@ -0,0 +1,23 @@ +# Copyright (C) 2017-2021 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +SET(ALL_TESTS + ICoCoMEDFieldTest.py +) + diff --git a/src/MEDCoupling/CMakeLists.txt b/src/MEDCoupling/CMakeLists.txt index 2bc6b1bba..07b2a2a26 100644 --- a/src/MEDCoupling/CMakeLists.txt +++ b/src/MEDCoupling/CMakeLists.txt @@ -37,7 +37,6 @@ INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/Geometric2D ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/ExprEval ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/GaussPoints - ${CMAKE_CURRENT_SOURCE_DIR}/../ICoCo ) SET(medcoupling_SOURCES @@ -78,9 +77,6 @@ SET(medcoupling_SOURCES MEDCouplingPartDefinition.cxx MEDCouplingSkyLineArray.cxx MEDCouplingVoronoi.cxx - ../ICoCo/ICoCoField.cpp # [ABN] Yes, .cpp, this is imposed by ICoCo. - ../ICoCo/ICoCoMEDDoubleField.cxx - ../ICoCo/ICoCoMEDIntField.cxx ) SET(medcouplingremapper_SOURCES @@ -96,12 +92,9 @@ ADD_LIBRARY(medcouplingremapper ${medcouplingremapper_SOURCES}) TARGET_LINK_LIBRARIES(medcouplingremapper medcouplingcpp) INSTALL(TARGETS medcouplingremapper EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${MEDCOUPLING_INSTALL_LIBS}) -FILE(GLOB medcoupling_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx" - "${CMAKE_CURRENT_SOURCE_DIR}/../ICoCo/*.hxx" - "${CMAKE_CURRENT_SOURCE_DIR}/../ICoCo/*.h") +FILE(GLOB medcoupling_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") FILE(GLOB medcoupling_HEADERS_TXX "${CMAKE_CURRENT_SOURCE_DIR}/*.txx") -FILE(GLOB icoco_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/../ICoCo/*.hxx") -INSTALL(FILES ${medcoupling_HEADERS_HXX} ${medcoupling_HEADERS_TXX} ${icoco_HEADERS_HXX} MEDCouplingNatureOfFieldEnum DESTINATION ${MEDCOUPLING_INSTALL_HEADERS}) +INSTALL(FILES ${medcoupling_HEADERS_HXX} ${medcoupling_HEADERS_TXX} MEDCouplingNatureOfFieldEnum DESTINATION ${MEDCOUPLING_INSTALL_HEADERS}) # To allow usage as SWIG dependencies: SET(medcoupling_HEADERS_HXX PARENT_SCOPE) diff --git a/src/MEDCoupling_Swig/MEDCoupling.i b/src/MEDCoupling_Swig/MEDCoupling.i index 4405b92c6..8f938325e 100644 --- a/src/MEDCoupling_Swig/MEDCoupling.i +++ b/src/MEDCoupling_Swig/MEDCoupling.i @@ -24,7 +24,6 @@ #endif %include "MEDCouplingCommon.i" -%include "ICoCoMEDField.i" %pythoncode %{ def MEDCouplingDataArrayDoubleIadd(self,*args): diff --git a/src/MEDCoupling_Swig/tests.set b/src/MEDCoupling_Swig/tests.set index 149ce0fb0..182197c86 100644 --- a/src/MEDCoupling_Swig/tests.set +++ b/src/MEDCoupling_Swig/tests.set @@ -29,7 +29,6 @@ SET(BASE_TESTS MEDCouplingExamplesTest.py MEDCouplingRemapperTest.py UsersGuideExamplesTest.py - ICoCoMEDFieldTest.py ) # if numpy is used diff --git a/src/ParaMEDMEM/CMakeLists.txt b/src/ParaMEDMEM/CMakeLists.txt index 5f9ec81a3..bde52ceec 100644 --- a/src/ParaMEDMEM/CMakeLists.txt +++ b/src/ParaMEDMEM/CMakeLists.txt @@ -70,7 +70,7 @@ SET(paramedmem_SOURCES ) ADD_LIBRARY(paramedmem ${paramedmem_SOURCES}) -TARGET_LINK_LIBRARIES(paramedmem medcouplingcpp ${MPI_LIBRARIES}) +TARGET_LINK_LIBRARIES(paramedmem medcouplingcpp medicoco ${MPI_LIBRARIES}) INSTALL(TARGETS paramedmem EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${MEDCOUPLING_INSTALL_LIBS}) FILE(GLOB paramedmem_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") diff --git a/src/PyWrapping/CMakeLists.txt b/src/PyWrapping/CMakeLists.txt index f9c96dfc9..e406b1d08 100644 --- a/src/PyWrapping/CMakeLists.txt +++ b/src/PyWrapping/CMakeLists.txt @@ -67,10 +67,10 @@ INCLUDE_DIRECTORIES( ) IF(WIN32) - SET(medcoupling_LIB_dependancies ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} medcouplingremapper) + SET(medcoupling_LIB_dependancies ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} medcouplingremapper medicoco) ELSE(WIN32) # ${PYTHON_LIBRARIES} not needed see https://www.python.org/dev/peps/pep-0513/#libpythonx-y-so-1 - SET(medcoupling_LIB_dependancies ${PLATFORM_LIBS} medcouplingremapper) + SET(medcoupling_LIB_dependancies ${PLATFORM_LIBS} medcouplingremapper medicoco) ENDIF(WIN32) IF(NOT MEDCOUPLING_MICROMED) -- 2.39.2