From: Anthony Geay Date: Tue, 27 Aug 2024 12:13:19 +0000 (+0200) Subject: [EDF30822] : Integration of iterative statistics into medcoupling X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=53b6d0de227193193bbf6dc36baaef33a4358347;p=tools%2Fmedcoupling.git [EDF30822] : Integration of iterative statistics into medcoupling --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2f70e4d86..4b5848813 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -36,7 +36,9 @@ IF(MEDCOUPLING_ENABLE_PYTHON) ADD_SUBDIRECTORY(PyWrapping) find_package(SalomeBasicIterativeStatistics) - add_subdirectory(Stat) + if( BASICITERATIVESTATISTICS_FOUND ) + add_subdirectory(Stat) + endif( BASICITERATIVESTATISTICS_FOUND ) ENDIF(MEDCOUPLING_ENABLE_PYTHON) IF(NOT MEDCOUPLING_MICROMED) diff --git a/src/CTestTestfileInstall.cmake.in b/src/CTestTestfileInstall.cmake.in index 6ef143d8f..f71d5f0f2 100644 --- a/src/CTestTestfileInstall.cmake.in +++ b/src/CTestTestfileInstall.cmake.in @@ -38,3 +38,4 @@ endif() SUBDIRS(MEDPartitioner_Swig) SUBDIRS(RENUMBER_Swig) SUBDIRS(PyWrapping) +SUBDIRS(Stat) diff --git a/src/MEDCoupling_Swig/CMakeLists.txt b/src/MEDCoupling_Swig/CMakeLists.txt index 1a99b2aa4..7474395ca 100644 --- a/src/MEDCoupling_Swig/CMakeLists.txt +++ b/src/MEDCoupling_Swig/CMakeLists.txt @@ -123,10 +123,10 @@ ENDIF() IF(WIN32 OR CYGWIN) SWIG_LINK_LIBRARIES(${MEDCouling_target_name} ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} medcouplingcpp) -ELSE(WIN32) +ELSE(WIN32 OR CYGWIN) # ${PYTHON_LIBRARIES} not needed see https://www.python.org/dev/peps/pep-0513/#libpythonx-y-so-1 SWIG_LINK_LIBRARIES(${MEDCouling_target_name} ${PLATFORM_LIBS} medcouplingcpp) -ENDIF(WIN32) +ENDIF(WIN32 OR CYGWIN) # ${PYTHON_LIBRARIES} not needed SWIG_CHECK_GENERATION(${MEDCouling_target_name}) SET_SOURCE_FILES_PROPERTIES(MEDCouplingRemapper.i PROPERTIES CPLUSPLUS ON) @@ -157,10 +157,10 @@ ENDIF() IF(WIN32 OR CYGWIN) SWIG_LINK_LIBRARIES(MEDCouplingRemapper ${PYTHON_LIBRARIES} medcouplingremapper) -ELSE(WIN32) +ELSE(WIN32 OR CYGWIN) # ${PYTHON_LIBRARIES} not needed see https://www.python.org/dev/peps/pep-0513/#libpythonx-y-so-1 SWIG_LINK_LIBRARIES(MEDCouplingRemapper medcouplingremapper) -ENDIF(WIN32) +ENDIF(WIN32 OR CYGWIN) IF(WIN32) SET_TARGET_PROPERTIES(_MEDCouplingRemapper PROPERTIES DEBUG_OUTPUT_NAME _MEDCouplingRemapper_d) diff --git a/src/PyWrapping/CMakeLists.txt b/src/PyWrapping/CMakeLists.txt index 65710dcb6..43340d095 100644 --- a/src/PyWrapping/CMakeLists.txt +++ b/src/PyWrapping/CMakeLists.txt @@ -71,7 +71,7 @@ IF(WIN32 OR CYGWIN) 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 medicoco) -ENDIF(WIN32) +ENDIF(WIN32 OR CYGWIN) IF(NOT MEDCOUPLING_MICROMED) LIST(APPEND SWIG_MODULE_medcoupling_EXTRA_FLAGS -DWITH_MED_FILE) diff --git a/src/Stat/CMakeLists.txt b/src/Stat/CMakeLists.txt index fe35a9b67..e9889c1a7 100644 --- a/src/Stat/CMakeLists.txt +++ b/src/Stat/CMakeLists.txt @@ -1,8 +1,25 @@ +# Copyright (C) 2024 CEA, EDF +# +# 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 +# -if (BASICITERATIVESTATISTICS_FOUND) - install(FILES MEDCouplingIterativeStatistics.py DESTINATION ${MEDCOUPLING_INSTALL_PYTHON}) +install(FILES MEDCouplingIterativeStatistics.py DESTINATION ${MEDCOUPLING_INSTALL_PYTHON}) - if (MEDCOUPLING_BUILD_PY_TESTS) - add_subdirectory(Test) - endif () +if (MEDCOUPLING_BUILD_PY_TESTS) + add_subdirectory(Test) endif () + diff --git a/src/Stat/Test/CMakeLists.txt b/src/Stat/Test/CMakeLists.txt index 2b41ac0c7..5e58213c4 100644 --- a/src/Stat/Test/CMakeLists.txt +++ b/src/Stat/Test/CMakeLists.txt @@ -1,7 +1,30 @@ +# Copyright (C) 2024 CEA, EDF +# +# 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 +# + SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_CURRENT_BINARY_DIR}/../../Stat) SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env) -ADD_TEST(NAME MEDCouplingIterativeStatistics - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/TestMEDCouplingIterativeStatistics.py) +set(TEST_INSTALL_DIRECTORY ${MEDCOUPLING_INSTALL_TESTS}/Stat) + +ADD_TEST(NAME MEDCouplingIterativeStatistics COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/TestMEDCouplingIterativeStatistics.py) SET_TESTS_PROPERTIES(MEDCouplingIterativeStatistics PROPERTIES ENVIRONMENT "${tests_env}") + +install(FILES TestMEDCouplingIterativeStatistics.py DESTINATION ${TEST_INSTALL_DIRECTORY}) +install(FILES CTestTestfileInstall.cmake DESTINATION ${TEST_INSTALL_DIRECTORY} RENAME CTestTestfile.cmake) diff --git a/src/Stat/Test/CTestTestfileInstall.cmake b/src/Stat/Test/CTestTestfileInstall.cmake new file mode 100644 index 000000000..cdf10550c --- /dev/null +++ b/src/Stat/Test/CTestTestfileInstall.cmake @@ -0,0 +1,35 @@ +# Copyright (C) 2024 CEA, EDF +# +# 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(TEST_NAMES + TestMEDCouplingIterativeStatistics +) + +SET(PYTHONPATH $ENV{PYTHONPATH}) +CMAKE_PATH(APPEND PYTHONPATH "../../bin") +FOREACH(tfile ${TEST_NAMES}) + SET(TEST_NAME ${COMPONENT_NAME}_${tfile}) + ADD_TEST(${TEST_NAME} python3 ${tfile}.py) + SET(TEST_ENVIRONMENT) + SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES + LABELS "${COMPONENT_NAME}" + TIMEOUT ${TIMEOUT} + ENVIRONMENT "${PYTHONPATH}" + ) +ENDFOREACH() diff --git a/src/Stat/Test/TestMEDCouplingIterativeStatistics.py b/src/Stat/Test/TestMEDCouplingIterativeStatistics.py index 3327bb9cc..4d5a14c77 100644 --- a/src/Stat/Test/TestMEDCouplingIterativeStatistics.py +++ b/src/Stat/Test/TestMEDCouplingIterativeStatistics.py @@ -188,4 +188,7 @@ class MEDCouplingIterativeStatisticsTest(unittest.TestCase): if __name__ == "__main__": + import logging + from iterative_stats.utils.logger import logger + logger.level = logging.INFO unittest.main()