From db936066f3272de92c4246b5006e125462b6e583 Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=A9dric=20Aguerre?= Date: Tue, 27 Oct 2015 14:23:34 +0100 Subject: [PATCH] add mpi part --- src/ParaMEDMEMTest/CMakeLists.txt | 137 -------------- src/medtool/CMakeLists.txt | 29 +-- src/medtool/cmake_files/FindMEDFile.cmake | 5 + src/medtool/cmake_files/FindMetis.cmake | 4 + src/medtool/cmake_files/FindParMetis.cmake | 39 ++++ src/medtool/cmake_files/FindScotch.cmake | 4 + .../medtool/resources}/BDC-714.sauv | Bin {resources => src/medtool/resources}/Box1.med | Bin .../medtool/resources}/Box1Moderate.med | Bin {resources => src/medtool/resources}/Box2.med | Bin .../medtool/resources}/Box2Moderate.med | Bin {resources => src/medtool/resources}/Box3.med | Bin .../medtool/resources}/BoxEvenSmaller1.med | Bin .../medtool/resources}/BoxHexa1.med | Bin .../medtool/resources}/BoxHexa2.med | Bin .../medtool/resources}/BoxModSmall1.med | Bin .../medtool/resources}/BoxModSmall2.med | Bin .../medtool/resources}/BoxTetra2.med | Bin src/medtool/resources/CMakeLists.txt | 88 ++++----- .../resources}/ComplexIncludedTetra.med | Bin .../resources}/ComplexIncludingTetra.med | Bin .../medtool/resources}/CornerTetra.med | Bin .../medtool/resources}/DegenEdgeXY.med | Bin .../medtool/resources}/DegenFaceXYZ.med | Bin .../resources}/DegenTranslatedInPlane.med | Bin .../medtool/resources}/DividedGenTetra1.med | Bin .../medtool/resources}/DividedGenTetra2.med | Bin .../medtool/resources}/DividedUnitTetra.med | Bin .../resources}/DividedUnitTetraSimpler.med | Bin .../medtool/resources}/GenTetra1.med | Bin .../medtool/resources}/GenTetra2.med | Bin .../medtool/resources}/GeneralTetra.med | Bin .../medtool/resources}/HalfstripOnly.med | Bin .../medtool/resources}/HalfstripOnly2.med | Bin .../medtool/resources}/MovedHexaBox1.med | Bin .../medtool/resources}/MovedHexaBox2.med | Bin .../resources}/NudgedDividedUnitTetra.med | Bin .../NudgedDividedUnitTetraSimpler.med | Bin .../medtool/resources}/NudgedSimpler.med | Bin .../medtool/resources}/NudgedTetra.med | Bin .../resources}/SimpleHalfstripOnly.med | Bin .../resources}/SimpleIncludedTetra.med | Bin .../resources}/SimpleIncludingTetra.med | Bin .../medtool/resources}/TinyBox.med | Bin .../medtool/resources}/TrickyTetra1.med | Bin .../medtool/resources}/UnitTetra.med | Bin .../medtool/resources}/UnitTetraDegenT.med | Bin .../medtool/resources}/allPillesTest.sauv | 0 .../medtool/resources}/portico_3subs.sauv | 0 .../src/INTERP_KERNELTest/CMakeLists.txt | 2 - .../INTERP_KERNELTest/Interpolation3DTest.cxx | 37 ++-- .../src/INTERP_KERNELTest/MeshTestToolkit.txx | 22 +-- .../src/INTERP_KERNELTest/PerfTest.cxx | 48 ++--- .../TestInterpKernelUtils.cxx | 19 +- .../src/MEDCoupling/Test/CMakeLists.txt | 5 - .../src/MEDCoupling_Swig/CMakeLists.txt | 7 - src/medtool/src/MEDLoader/Swig/CMakeLists.txt | 16 +- .../Swig/MEDLoaderCouplingTrainingSession.py | 9 +- .../src/MEDLoader/Swig/SauvLoaderTest.py | 31 +-- src/medtool/src/MEDLoader/Test/CMakeLists.txt | 4 - .../src/MEDLoader/Test/SauvLoaderTest.cxx | 18 +- src/medtool/src/MEDPartitioner/CMakeLists.txt | 2 +- .../src/MEDPartitioner/MEDPARTITIONER_metis.c | 20 +- .../src/MEDPartitioner/Test/CMakeLists.txt | 2 - .../Test/MEDPARTITIONERTest.cxx | 176 +++++++++--------- .../Test/MEDPARTITIONERTest.hxx | 9 +- .../Test/MEDPARTITIONERTestPara.cxx | 123 ++++++------ .../src/MEDPartitioner_Swig/CMakeLists.txt | 4 +- .../MEDPartitioner_Swig/MEDPartitionerTest.py | 4 +- .../src}/ParaMEDLoader/CMakeLists.txt | 4 +- .../src}/ParaMEDLoader/ParaMEDFileMesh.cxx | 0 .../src}/ParaMEDLoader/ParaMEDFileMesh.hxx | 0 .../src}/ParaMEDLoader/ParaMEDLoader.cxx | 0 .../src}/ParaMEDLoader/ParaMEDLoader.hxx | 0 src/{ => medtool/src}/ParaMEDMEM/BASICS_JR | 0 .../src}/ParaMEDMEM/BlockTopology.cxx | 0 .../src}/ParaMEDMEM/BlockTopology.hxx | 0 .../src}/ParaMEDMEM/CMakeLists.txt | 5 +- .../src}/ParaMEDMEM/CommInterface.cxx | 0 .../src}/ParaMEDMEM/CommInterface.hxx | 0 .../src}/ParaMEDMEM/ComponentTopology.cxx | 0 .../src}/ParaMEDMEM/ComponentTopology.hxx | 0 src/{ => medtool/src}/ParaMEDMEM/DEC.cxx | 0 src/{ => medtool/src}/ParaMEDMEM/DEC.hxx | 0 .../src}/ParaMEDMEM/DECOptions.hxx | 0 .../src}/ParaMEDMEM/DisjointDEC.cxx | 0 .../src}/ParaMEDMEM/DisjointDEC.hxx | 0 .../src}/ParaMEDMEM/ElementLocator.cxx | 0 .../src}/ParaMEDMEM/ElementLocator.hxx | 0 .../src}/ParaMEDMEM/ExplicitCoincidentDEC.cxx | 0 .../src}/ParaMEDMEM/ExplicitCoincidentDEC.hxx | 0 .../src}/ParaMEDMEM/ExplicitMapping.hxx | 0 .../src}/ParaMEDMEM/ExplicitTopology.cxx | 0 .../src}/ParaMEDMEM/ExplicitTopology.hxx | 0 .../src}/ParaMEDMEM/ICoCoField.cxx | 0 .../src}/ParaMEDMEM/ICoCoField.hxx | 0 .../src}/ParaMEDMEM/ICoCoMEDField.cxx | 0 .../src}/ParaMEDMEM/ICoCoMEDField.hxx | 0 .../src}/ParaMEDMEM/InterpKernelDEC.cxx | 0 .../src}/ParaMEDMEM/InterpKernelDEC.hxx | 0 .../src}/ParaMEDMEM/InterpolationMatrix.cxx | 0 .../src}/ParaMEDMEM/InterpolationMatrix.hxx | 0 .../ParaMEDMEM/LinearTimeInterpolator.cxx | 0 .../ParaMEDMEM/LinearTimeInterpolator.hxx | 0 .../src}/ParaMEDMEM/MPIAccess.cxx | 0 .../src}/ParaMEDMEM/MPIAccess.hxx | 0 .../src}/ParaMEDMEM/MPIAccessDEC.cxx | 0 .../src}/ParaMEDMEM/MPIAccessDEC.hxx | 0 .../src}/ParaMEDMEM/MPIProcessorGroup.cxx | 0 .../src}/ParaMEDMEM/MPIProcessorGroup.hxx | 0 .../src}/ParaMEDMEM/MxN_Mapping.cxx | 0 .../src}/ParaMEDMEM/MxN_Mapping.hxx | 0 .../src}/ParaMEDMEM/NonCoincidentDEC.cxx | 0 .../src}/ParaMEDMEM/NonCoincidentDEC.hxx | 0 .../src}/ParaMEDMEM/OverlapDEC.cxx | 0 .../src}/ParaMEDMEM/OverlapDEC.hxx | 0 .../src}/ParaMEDMEM/OverlapElementLocator.cxx | 0 .../src}/ParaMEDMEM/OverlapElementLocator.hxx | 0 .../ParaMEDMEM/OverlapInterpolationMatrix.cxx | 0 .../ParaMEDMEM/OverlapInterpolationMatrix.hxx | 0 .../src}/ParaMEDMEM/OverlapMapping.cxx | 0 .../src}/ParaMEDMEM/OverlapMapping.hxx | 0 .../src}/ParaMEDMEM/ParaFIELD.cxx | 0 .../src}/ParaMEDMEM/ParaFIELD.hxx | 0 src/{ => medtool/src}/ParaMEDMEM/ParaGRID.cxx | 0 src/{ => medtool/src}/ParaMEDMEM/ParaGRID.hxx | 0 src/{ => medtool/src}/ParaMEDMEM/ParaMESH.cxx | 0 src/{ => medtool/src}/ParaMEDMEM/ParaMESH.hxx | 0 .../src}/ParaMEDMEM/ProcessorGroup.cxx | 0 .../src}/ParaMEDMEM/ProcessorGroup.hxx | 0 src/{ => medtool/src}/ParaMEDMEM/README_JR | 0 .../ParaMEDMEM/StructuredCoincidentDEC.cxx | 0 .../ParaMEDMEM/StructuredCoincidentDEC.hxx | 0 src/{ => medtool/src}/ParaMEDMEM/TODO_JR | 0 .../src}/ParaMEDMEM/TimeInterpolator.cxx | 0 .../src}/ParaMEDMEM/TimeInterpolator.hxx | 0 src/{ => medtool/src}/ParaMEDMEM/Topology.cxx | 0 src/{ => medtool/src}/ParaMEDMEM/Topology.hxx | 0 .../src}/ParaMEDMEMTest/MPI2Connector.cxx | 0 .../src}/ParaMEDMEMTest/MPI2Connector.hxx | 0 .../src}/ParaMEDMEMTest/MPIAccessDECTest.cxx | 0 .../src}/ParaMEDMEMTest/MPIAccessDECTest.hxx | 0 .../src}/ParaMEDMEMTest/MPIAccessTest.cxx | 0 .../src}/ParaMEDMEMTest/MPIAccessTest.hxx | 0 .../src}/ParaMEDMEMTest/MPIMainTest.hxx | 0 .../src}/ParaMEDMEMTest/ParaMEDMEMTest.cxx | 0 .../src}/ParaMEDMEMTest/ParaMEDMEMTest.hxx | 0 .../ParaMEDMEMTest/ParaMEDMEMTestMPI2_1.cxx | 0 .../ParaMEDMEMTest/ParaMEDMEMTestMPI2_2.cxx | 0 .../ParaMEDMEMTest_BlockTopology.cxx | 0 .../ParaMEDMEMTest_FabienAPI.cxx | 0 .../ParaMEDMEMTest_Gauthier1.cxx | 0 .../ParaMEDMEMTest/ParaMEDMEMTest_ICoco.cxx | 0 .../ParaMEDMEMTest_InterpKernelDEC.cxx | 0 .../ParaMEDMEMTest_MEDLoader.cxx | 0 .../ParaMEDMEMTest_MPIProcessorGroup.cxx | 0 .../ParaMEDMEMTest_NonCoincidentDEC.cxx | 0 .../ParaMEDMEMTest_OverlapDEC.cxx | 0 ...ParaMEDMEMTest_StructuredCoincidentDEC.cxx | 0 .../src}/ParaMEDMEMTest/TestMPIAccess.cxx | 0 .../src}/ParaMEDMEMTest/TestMPIAccessDEC.cxx | 0 .../src}/ParaMEDMEMTest/TestParaMEDMEM.cxx | 0 .../src}/ParaMEDMEMTest/test_AllToAllDEC.cxx | 0 .../ParaMEDMEMTest/test_AllToAllTimeDEC.cxx | 0 .../src}/ParaMEDMEMTest/test_AllToAllvDEC.cxx | 0 .../ParaMEDMEMTest/test_AllToAllvTimeDEC.cxx | 0 .../test_AllToAllvTimeDoubleDEC.cxx | 0 .../ParaMEDMEMTest/test_MPI_Access_Cancel.cxx | 0 .../test_MPI_Access_Cyclic_ISend_IRecv.cxx | 0 .../test_MPI_Access_Cyclic_Send_Recv.cxx | 0 .../ParaMEDMEMTest/test_MPI_Access_IProbe.cxx | 0 .../test_MPI_Access_ISendRecv.cxx | 0 .../test_MPI_Access_ISend_IRecv.cxx | 0 ...test_MPI_Access_ISend_IRecv_BottleNeck.cxx | 0 .../test_MPI_Access_ISend_IRecv_Length.cxx | 0 .../test_MPI_Access_ISend_IRecv_Length_1.cxx | 0 .../ParaMEDMEMTest/test_MPI_Access_Probe.cxx | 0 .../test_MPI_Access_SendRecv.cxx | 0 .../test_MPI_Access_Send_Recv.cxx | 0 .../test_MPI_Access_Send_Recv_Length.cxx | 0 .../ParaMEDMEMTest/test_MPI_Access_Time.cxx | 0 .../ParaMEDMEMTest/test_MPI_Access_Time_0.cxx | 0 .../src}/ParaMEDMEMTest/test_perf.cxx | 0 .../src}/ParaMEDMEM_Swig/CMakeLists.txt | 9 +- .../src}/ParaMEDMEM_Swig/ParaMEDMEM.i | 0 .../src}/ParaMEDMEM_Swig/ParaMEDMEM.typemap | 0 .../ParaMEDMEM_Swig/test_InterpKernelDEC.py | 0 .../ParaMEDMEM_Swig/test_NonCoincidentDEC.py | 0 .../test_StructuredCoincidentDEC.py | 0 src/medtool/src/RENUMBER/testRenumbering.py | 18 +- src/medtool/src/RENUMBER_Swig/CMakeLists.txt | 4 +- 191 files changed, 409 insertions(+), 495 deletions(-) delete mode 100644 src/ParaMEDMEMTest/CMakeLists.txt create mode 100644 src/medtool/cmake_files/FindParMetis.cmake rename {resources => src/medtool/resources}/BDC-714.sauv (100%) rename {resources => src/medtool/resources}/Box1.med (100%) rename {resources => src/medtool/resources}/Box1Moderate.med (100%) rename {resources => src/medtool/resources}/Box2.med (100%) rename {resources => src/medtool/resources}/Box2Moderate.med (100%) rename {resources => src/medtool/resources}/Box3.med (100%) rename {resources => src/medtool/resources}/BoxEvenSmaller1.med (100%) rename {resources => src/medtool/resources}/BoxHexa1.med (100%) rename {resources => src/medtool/resources}/BoxHexa2.med (100%) rename {resources => src/medtool/resources}/BoxModSmall1.med (100%) rename {resources => src/medtool/resources}/BoxModSmall2.med (100%) rename {resources => src/medtool/resources}/BoxTetra2.med (100%) rename {resources => src/medtool/resources}/ComplexIncludedTetra.med (100%) rename {resources => src/medtool/resources}/ComplexIncludingTetra.med (100%) rename {resources => src/medtool/resources}/CornerTetra.med (100%) rename {resources => src/medtool/resources}/DegenEdgeXY.med (100%) rename {resources => src/medtool/resources}/DegenFaceXYZ.med (100%) rename {resources => src/medtool/resources}/DegenTranslatedInPlane.med (100%) rename {resources => src/medtool/resources}/DividedGenTetra1.med (100%) rename {resources => src/medtool/resources}/DividedGenTetra2.med (100%) rename {resources => src/medtool/resources}/DividedUnitTetra.med (100%) rename {resources => src/medtool/resources}/DividedUnitTetraSimpler.med (100%) rename {resources => src/medtool/resources}/GenTetra1.med (100%) rename {resources => src/medtool/resources}/GenTetra2.med (100%) rename {resources => src/medtool/resources}/GeneralTetra.med (100%) rename {resources => src/medtool/resources}/HalfstripOnly.med (100%) rename {resources => src/medtool/resources}/HalfstripOnly2.med (100%) rename {resources => src/medtool/resources}/MovedHexaBox1.med (100%) rename {resources => src/medtool/resources}/MovedHexaBox2.med (100%) rename {resources => src/medtool/resources}/NudgedDividedUnitTetra.med (100%) rename {resources => src/medtool/resources}/NudgedDividedUnitTetraSimpler.med (100%) rename {resources => src/medtool/resources}/NudgedSimpler.med (100%) rename {resources => src/medtool/resources}/NudgedTetra.med (100%) rename {resources => src/medtool/resources}/SimpleHalfstripOnly.med (100%) rename {resources => src/medtool/resources}/SimpleIncludedTetra.med (100%) rename {resources => src/medtool/resources}/SimpleIncludingTetra.med (100%) rename {resources => src/medtool/resources}/TinyBox.med (100%) rename {resources => src/medtool/resources}/TrickyTetra1.med (100%) rename {resources => src/medtool/resources}/UnitTetra.med (100%) rename {resources => src/medtool/resources}/UnitTetraDegenT.med (100%) rename {resources => src/medtool/resources}/allPillesTest.sauv (100%) rename {resources => src/medtool/resources}/portico_3subs.sauv (100%) rename src/{ => medtool/src}/ParaMEDLoader/CMakeLists.txt (93%) rename src/{ => medtool/src}/ParaMEDLoader/ParaMEDFileMesh.cxx (100%) rename src/{ => medtool/src}/ParaMEDLoader/ParaMEDFileMesh.hxx (100%) rename src/{ => medtool/src}/ParaMEDLoader/ParaMEDLoader.cxx (100%) rename src/{ => medtool/src}/ParaMEDLoader/ParaMEDLoader.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/BASICS_JR (100%) rename src/{ => medtool/src}/ParaMEDMEM/BlockTopology.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/BlockTopology.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/CMakeLists.txt (95%) rename src/{ => medtool/src}/ParaMEDMEM/CommInterface.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/CommInterface.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/ComponentTopology.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/ComponentTopology.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/DEC.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/DEC.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/DECOptions.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/DisjointDEC.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/DisjointDEC.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/ElementLocator.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/ElementLocator.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/ExplicitCoincidentDEC.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/ExplicitCoincidentDEC.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/ExplicitMapping.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/ExplicitTopology.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/ExplicitTopology.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/ICoCoField.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/ICoCoField.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/ICoCoMEDField.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/ICoCoMEDField.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/InterpKernelDEC.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/InterpKernelDEC.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/InterpolationMatrix.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/InterpolationMatrix.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/LinearTimeInterpolator.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/LinearTimeInterpolator.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/MPIAccess.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/MPIAccess.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/MPIAccessDEC.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/MPIAccessDEC.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/MPIProcessorGroup.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/MPIProcessorGroup.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/MxN_Mapping.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/MxN_Mapping.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/NonCoincidentDEC.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/NonCoincidentDEC.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/OverlapDEC.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/OverlapDEC.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/OverlapElementLocator.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/OverlapElementLocator.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/OverlapInterpolationMatrix.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/OverlapInterpolationMatrix.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/OverlapMapping.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/OverlapMapping.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/ParaFIELD.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/ParaFIELD.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/ParaGRID.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/ParaGRID.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/ParaMESH.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/ParaMESH.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/ProcessorGroup.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/ProcessorGroup.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/README_JR (100%) rename src/{ => medtool/src}/ParaMEDMEM/StructuredCoincidentDEC.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/StructuredCoincidentDEC.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/TODO_JR (100%) rename src/{ => medtool/src}/ParaMEDMEM/TimeInterpolator.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/TimeInterpolator.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/Topology.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEM/Topology.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/MPI2Connector.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/MPI2Connector.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/MPIAccessDECTest.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/MPIAccessDECTest.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/MPIAccessTest.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/MPIAccessTest.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/MPIMainTest.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/ParaMEDMEMTest.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/ParaMEDMEMTest.hxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/ParaMEDMEMTestMPI2_1.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/ParaMEDMEMTestMPI2_2.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/ParaMEDMEMTest_BlockTopology.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/ParaMEDMEMTest_FabienAPI.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/ParaMEDMEMTest_Gauthier1.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/ParaMEDMEMTest_ICoco.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/ParaMEDMEMTest_MEDLoader.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/ParaMEDMEMTest_MPIProcessorGroup.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/ParaMEDMEMTest_NonCoincidentDEC.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/ParaMEDMEMTest_OverlapDEC.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/ParaMEDMEMTest_StructuredCoincidentDEC.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/TestMPIAccess.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/TestMPIAccessDEC.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/TestParaMEDMEM.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/test_AllToAllDEC.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/test_AllToAllTimeDEC.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/test_AllToAllvDEC.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/test_AllToAllvTimeDEC.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/test_AllToAllvTimeDoubleDEC.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/test_MPI_Access_Cancel.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/test_MPI_Access_Cyclic_ISend_IRecv.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/test_MPI_Access_Cyclic_Send_Recv.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/test_MPI_Access_IProbe.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/test_MPI_Access_ISendRecv.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/test_MPI_Access_ISend_IRecv.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/test_MPI_Access_ISend_IRecv_BottleNeck.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/test_MPI_Access_ISend_IRecv_Length.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/test_MPI_Access_ISend_IRecv_Length_1.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/test_MPI_Access_Probe.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/test_MPI_Access_SendRecv.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/test_MPI_Access_Send_Recv.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/test_MPI_Access_Send_Recv_Length.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/test_MPI_Access_Time.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/test_MPI_Access_Time_0.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEMTest/test_perf.cxx (100%) rename src/{ => medtool/src}/ParaMEDMEM_Swig/CMakeLists.txt (89%) rename src/{ => medtool/src}/ParaMEDMEM_Swig/ParaMEDMEM.i (100%) rename src/{ => medtool/src}/ParaMEDMEM_Swig/ParaMEDMEM.typemap (100%) rename src/{ => medtool/src}/ParaMEDMEM_Swig/test_InterpKernelDEC.py (100%) rename src/{ => medtool/src}/ParaMEDMEM_Swig/test_NonCoincidentDEC.py (100%) rename src/{ => medtool/src}/ParaMEDMEM_Swig/test_StructuredCoincidentDEC.py (100%) diff --git a/src/ParaMEDMEMTest/CMakeLists.txt b/src/ParaMEDMEMTest/CMakeLists.txt deleted file mode 100644 index 513031360..000000000 --- a/src/ParaMEDMEMTest/CMakeLists.txt +++ /dev/null @@ -1,137 +0,0 @@ -# Copyright (C) 2012-2015 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 -# - -ADD_DEFINITIONS(${MPI_DEFINITIONS} ${CPPUNIT_DEFINITIONS}) - -INCLUDE_DIRECTORIES( - ${MPI_INCLUDE_DIRS} - ${CPPUNIT_INCLUDE_DIRS} - ${CMAKE_CURRENT_SOURCE_DIR}/../ParaMEDLoader - ${CMAKE_CURRENT_SOURCE_DIR}/../ParaMEDMEM - ${CMAKE_CURRENT_SOURCE_DIR}/../MEDLoader - ${CMAKE_CURRENT_SOURCE_DIR}/../MEDCoupling - ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL - ${CMAKE_CURRENT_SOURCE_DIR}/../INTERP_KERNEL/Bases - ) - -SET(ParaMEDMEMTest_SOURCES - ParaMEDMEMTest.cxx - ParaMEDMEMTest_MPIProcessorGroup.cxx - ParaMEDMEMTest_BlockTopology.cxx - ParaMEDMEMTest_InterpKernelDEC.cxx - ParaMEDMEMTest_StructuredCoincidentDEC.cxx - ParaMEDMEMTest_MEDLoader.cxx - ParaMEDMEMTest_ICoco.cxx - ParaMEDMEMTest_Gauthier1.cxx - ParaMEDMEMTest_FabienAPI.cxx - ParaMEDMEMTest_NonCoincidentDEC.cxx - ParaMEDMEMTest_OverlapDEC.cxx - MPIAccessDECTest.cxx - test_AllToAllDEC.cxx - test_AllToAllvDEC.cxx - test_AllToAllTimeDEC.cxx - test_AllToAllvTimeDEC.cxx - test_AllToAllvTimeDoubleDEC.cxx - MPIAccessTest.cxx - test_MPI_Access_Send_Recv.cxx - test_MPI_Access_Cyclic_Send_Recv.cxx - test_MPI_Access_SendRecv.cxx - test_MPI_Access_ISend_IRecv.cxx - test_MPI_Access_Cyclic_ISend_IRecv.cxx - test_MPI_Access_ISendRecv.cxx - test_MPI_Access_Probe.cxx - test_MPI_Access_IProbe.cxx - test_MPI_Access_Cancel.cxx - test_MPI_Access_Send_Recv_Length.cxx - test_MPI_Access_ISend_IRecv_Length.cxx - test_MPI_Access_ISend_IRecv_Length_1.cxx - test_MPI_Access_Time.cxx - test_MPI_Access_Time_0.cxx - test_MPI_Access_ISend_IRecv_BottleNeck.cxx - ) - -ADD_LIBRARY(ParaMEDMEMTest SHARED ${ParaMEDMEMTest_SOURCES}) -SET_TARGET_PROPERTIES(ParaMEDMEMTest PROPERTIES COMPILE_FLAGS "") -TARGET_LINK_LIBRARIES(ParaMEDMEMTest paramedmem paramedloader ${CPPUNIT_LIBRARIES}) -INSTALL(TARGETS ParaMEDMEMTest DESTINATION ${SALOME_INSTALL_LIBS}) - -SET(TESTSParaMEDMEM) -SET(TestParaMEDMEM_SOURCES - TestParaMEDMEM.cxx - ) -SET(TESTSParaMEDMEM ${TESTSParaMEDMEM} TestParaMEDMEM) - -SET(TestMPIAccessDEC_SOURCES - TestMPIAccessDEC.cxx - ) -SET(TESTSParaMEDMEM ${TESTSParaMEDMEM} TestMPIAccessDEC) - -SET(TestMPIAccess_SOURCES - TestMPIAccess.cxx - ) -SET(TESTSParaMEDMEM ${TESTSParaMEDMEM} TestMPIAccess) - -SET(test_perf_SOURCES - test_perf.cxx - ) -SET(TESTSParaMEDMEM ${TESTSParaMEDMEM} test_perf) - -IF(MPI2_IS_OK) - SET(ParaMEDMEMTestMPI2_1_SOURCES - MPI2Connector.cxx - ParaMEDMEMTestMPI2_1.cxx - ) - SET(TESTSParaMEDMEM ${TESTSParaMEDMEM} ParaMEDMEMTestMPI2_1) - - SET(ParaMEDMEMTestMPI2_2_SOURCES - MPI2Connector.cxx - ParaMEDMEMTestMPI2_2.cxx - ) - SET(TESTSParaMEDMEM ${TESTSParaMEDMEM} ParaMEDMEMTestMPI2_2) -ENDIF(MPI2_IS_OK) - -FOREACH(bintestparamem ${TESTSParaMEDMEM}) - ADD_EXECUTABLE(${bintestparamem} ${${bintestparamem}_SOURCES}) - TARGET_LINK_LIBRARIES(${bintestparamem} ParaMEDMEMTest) -ENDFOREACH(bintestparamem ${TESTSParaMEDMEM}) - -# Now add CMake tests - test_perf, ParaMEDMEMTestMPI2_1 and ParaMEDMEMTestMPI2_2 -# are left aside, as they are too specific -# -# -- some tests require 2, 3, 4 or 5 procs -- -ADD_TEST(NAME TestParaMEDMEM_Proc2 COMMAND ${MPIEXEC} -np 2 $) -ADD_TEST(NAME TestParaMEDMEM_Proc3 COMMAND ${MPIEXEC} -np 3 $) -ADD_TEST(NAME TestParaMEDMEM_Proc4 COMMAND ${MPIEXEC} -np 4 $) -ADD_TEST(NAME TestParaMEDMEM_Proc5 COMMAND ${MPIEXEC} -np 5 $) - -ADD_TEST(NAME TestMPIAccess_Proc2 COMMAND ${MPIEXEC} -np 2 $) -ADD_TEST(NAME TestMPIAccess_Proc3 COMMAND ${MPIEXEC} -np 3 $) - -ADD_TEST(NAME TestMPIAccessDEC_Proc4 COMMAND ${MPIEXEC} -np 4 $) - -# Installation rules -INSTALL(TARGETS ${TESTSParaMEDMEM} DESTINATION ${SALOME_INSTALL_BINS}) -SET(COMMON_HEADERS_HXX - MPIMainTest.hxx - MPIAccessDECTest.hxx - MPIAccessTest.hxx - ParaMEDMEMTest.hxx - MPI2Connector.hxx -) -INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS}) diff --git a/src/medtool/CMakeLists.txt b/src/medtool/CMakeLists.txt index 4bbaae984..ba75c06cb 100644 --- a/src/medtool/CMakeLists.txt +++ b/src/medtool/CMakeLists.txt @@ -86,16 +86,10 @@ IF(NOT SALOME_MED_MICROMED) #FIND_PACKAGE(SalomeLibXml2) #SALOME_LOG_OPTIONAL_PACKAGE(LibXml2 SALOME_MED_ENABLE_PARTITIONER) IF(DEFINED ENV{LIBXML2_ROOT_DIR}) - SET(CMAKE_PREFIX_PATH "$ENV{LIBXML2_ROOT_DIR}") + SET(LIBXML2_ROOT_DIR $ENV{LIBXML2_ROOT_DIR} CACHE PATH "Path to the LibXml2.") + LIST(APPEND CMAKE_PREFIX_PATH "${LIBXML2_ROOT_DIR}") ENDIF() FIND_PACKAGE(LibXml2) - MESSAGE("LIBXML2_FOUND: ${LIBXML2_FOUND}") - MESSAGE("LIBXML2_INCLUDE_DIR: ${LIBXML2_INCLUDE_DIR}") - MESSAGE("LIBXML2_LIBRARIES: ${LIBXML2_LIBRARIES}") - MESSAGE("LIBXML2_DEFINITIONS: ${LIBXML2_DEFINITIONS}") - MESSAGE("LIBXML2_XMLLINT_EXECUTABLE: ${LIBXML2_XMLLINT_EXECUTABLE}") - MESSAGE("LIBXML2_VERSION_STRING: ${LIBXML2_VERSION_STRING}") - IF(SALOME_MED_PARTITIONER_METIS) #FIND_PACKAGE(SalomeMetis) #SALOME_LOG_OPTIONAL_PACKAGE(Metis SALOME_MED_PARTITIONER_METIS) @@ -120,11 +114,17 @@ IF(SALOME_BUILD_TESTS) ENDIF(SALOME_BUILD_TESTS) IF(SALOME_USE_MPI) - FIND_PACKAGE(SalomeMPI REQUIRED) + #FIND_PACKAGE(SalomeMPI REQUIRED) + FIND_PACKAGE(MPI REQUIRED) ADD_DEFINITIONS("-DHAVE_MPI") + SET(MPI_INCLUDE_DIRS ${MPI_C_INCLUDE_PATH} ${MPI_CXX_INCLUDE_PATH}) + SET(MPI_LIBRARIES ${MPI_C_LIBRARIES} ${MPI_CXX_LIBRARIES}) + SET(MPI_DEFINITIONS "${MPI_CXX_COMPILE_FLAGS}") + IF(SALOME_MED_PARTITIONER_PARMETIS) - FIND_PACKAGE(SalomeParMetis) - SALOME_LOG_OPTIONAL_PACKAGE(ParMetis SALOME_MED_PARTITIONER_PARMETIS) + #FIND_PACKAGE(SalomeParMetis) + FIND_PACKAGE(ParMetis) + #SALOME_LOG_OPTIONAL_PACKAGE(ParMetis SALOME_MED_PARTITIONER_PARMETIS) ADD_DEFINITIONS("-DMED_ENABLE_PARMETIS") ENDIF(SALOME_MED_PARTITIONER_PARMETIS) ENDIF(SALOME_USE_MPI) @@ -133,7 +133,8 @@ IF(SALOME_MED_ENABLE_RENUMBER) #FIND_PACKAGE(SalomeBoost) #SALOME_LOG_OPTIONAL_PACKAGE(Boost SALOME_MED_ENABLE_RENUMBER) IF(DEFINED ENV{BOOST_ROOT_DIR}) - SET(CMAKE_PREFIX_PATH "$ENV{BOOST_ROOT_DIR}") + SET(BOOST_ROOT_DIR $ENV{BOOST_ROOT_DIR} CACHE PATH "Path to the Boost.") + LIST(APPEND CMAKE_PREFIX_PATH "${BOOST_ROOT_DIR}") ENDIF() SET(Boost_USE_STATIC_LIBS OFF) SET(Boost_USE_MULTITHREADED ON) @@ -152,7 +153,8 @@ IF(SALOME_BUILD_DOC) #SALOME_LOG_OPTIONAL_PACKAGE(Sphinx SALOME_BUILD_DOC) FIND_PACKAGE(Doxygen) IF(DEFINED ENV{GRAPHVIZ_ROOT_DIR}) - SET(CMAKE_PREFIX_PATH "$ENV{GRAPHVIZ_ROOT_DIR}") + SET(GRAPHVIZ_ROOT_DIR $ENV{GRAPHVIZ_ROOT_DIR} CACHE PATH "Path to the Graphviz.") + LIST(APPEND CMAKE_PREFIX_PATH "${GRAPHVIZ_ROOT_DIR}") ENDIF() FIND_PACKAGE(Graphviz) FIND_PACKAGE(Sphinx) @@ -245,6 +247,7 @@ IF(WIN32) ADD_DEFINITIONS("-D_USE_MATH_DEFINES") ENDIF(WIN32) +#ADD_DEFINITIONS("-DMEDTOOL_ROOT_DIR=${CMAKE_INSTALL_PREFIX}") ADD_SUBDIRECTORY(src) #ADD_SUBDIRECTORY(adm_local) diff --git a/src/medtool/cmake_files/FindMEDFile.cmake b/src/medtool/cmake_files/FindMEDFile.cmake index 82b8eee53..546969240 100644 --- a/src/medtool/cmake_files/FindMEDFile.cmake +++ b/src/medtool/cmake_files/FindMEDFile.cmake @@ -50,5 +50,10 @@ ELSE(MEDFILE_F_LIBRARIES) SET(MEDFILE_LIBRARIES ${MEDFILE_C_LIBRARIES}) ENDIF(MEDFILE_F_LIBRARIES) +IF(NOT MEDFILE_INCLUDE_DIRS + OR (NOT MEDFILE_C_LIBRARIES AND NOT MEDFILE_F_LIBRARIES)) + MESSAGE(FATAL_ERROR "MEDFile not found; please set MEDFILE_ROOT_DIR and check target directory.") +ENDIF() + INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(MEDFile REQUIRED_VARS MEDFILE_INCLUDE_DIRS MEDFILE_LIBRARIES) diff --git a/src/medtool/cmake_files/FindMetis.cmake b/src/medtool/cmake_files/FindMetis.cmake index 5173cba6d..c4f627362 100644 --- a/src/medtool/cmake_files/FindMetis.cmake +++ b/src/medtool/cmake_files/FindMetis.cmake @@ -32,6 +32,10 @@ ENDIF(METIS_ROOT_DIR) FIND_LIBRARY(METIS_LIBRARIES metis) FIND_PATH(METIS_INCLUDE_DIRS metis.h) +IF(NOT METIS_LIBRARIES OR NOT METIS_INCLUDE_DIRS) + MESSAGE(FATAL_ERROR "Metis not found; please set METIS_ROOT_DIR and check target directory.") +ENDIF() + INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Metis REQUIRED_VARS METIS_INCLUDE_DIRS METIS_LIBRARIES) FILE(READ ${METIS_INCLUDE_DIRS}/metis.h metis_h_content) diff --git a/src/medtool/cmake_files/FindParMetis.cmake b/src/medtool/cmake_files/FindParMetis.cmake new file mode 100644 index 000000000..7eb0701a3 --- /dev/null +++ b/src/medtool/cmake_files/FindParMetis.cmake @@ -0,0 +1,39 @@ +# Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE +# +# 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 +# + +# ------ + +MESSAGE(STATUS "Check for parmetis ...") + +SET(PARMETIS_ROOT_DIR $ENV{PARMETIS_ROOT_DIR} CACHE PATH "Path to the PARMETIS.") +IF(PARMETIS_ROOT_DIR) + LIST(APPEND CMAKE_PREFIX_PATH "${PARMETIS_ROOT_DIR}") +ENDIF(PARMETIS_ROOT_DIR) + +FIND_LIBRARY(PARMETIS_LIBRARIES parmetis) +FIND_LIBRARY(PARMETIS_SEQ_LIBRARIES metis) +SET(PARMETIS_LIBRARIES ${PARMETIS_LIBRARIES} ${PARMETIS_SEQ_LIBRARIES}) +FIND_PATH(PARMETIS_INCLUDE_DIRS parmetis.h) + +IF(NOT PARMETIS_LIBRARIES OR NOT PARMETIS_INCLUDE_DIRS) + MESSAGE(FATAL_ERROR "Parallel Metis not found; please set PARMETIS_ROOT_DIR and check target directory.") +ENDIF() + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(ParMetis REQUIRED_VARS PARMETIS_INCLUDE_DIRS PARMETIS_LIBRARIES) diff --git a/src/medtool/cmake_files/FindScotch.cmake b/src/medtool/cmake_files/FindScotch.cmake index b63d30dcb..351c3e92e 100644 --- a/src/medtool/cmake_files/FindScotch.cmake +++ b/src/medtool/cmake_files/FindScotch.cmake @@ -31,5 +31,9 @@ FIND_LIBRARY(SCOTCH_ERR_LIBRARIES scotcherr) SET(SCOTCH_LIBRARIES ${SCOTCH_LIBRARIES} ${SCOTCH_ERR_LIBRARIES}) FIND_PATH(SCOTCH_INCLUDE_DIRS scotch.h PATH_SUFFIXES "/scotch") +IF(NOT SCOTCH_LIBRARIES OR NOT SCOTCH_ERR_LIBRARIES OR NOT SCOTCH_INCLUDE_DIRS) + MESSAGE(FATAL_ERROR "Scotch not found; please set SCOTCH_ROOT_DIR and check target directory.") +ENDIF() + INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Scotch REQUIRED_VARS SCOTCH_INCLUDE_DIRS SCOTCH_LIBRARIES) diff --git a/resources/BDC-714.sauv b/src/medtool/resources/BDC-714.sauv similarity index 100% rename from resources/BDC-714.sauv rename to src/medtool/resources/BDC-714.sauv diff --git a/resources/Box1.med b/src/medtool/resources/Box1.med similarity index 100% rename from resources/Box1.med rename to src/medtool/resources/Box1.med diff --git a/resources/Box1Moderate.med b/src/medtool/resources/Box1Moderate.med similarity index 100% rename from resources/Box1Moderate.med rename to src/medtool/resources/Box1Moderate.med diff --git a/resources/Box2.med b/src/medtool/resources/Box2.med similarity index 100% rename from resources/Box2.med rename to src/medtool/resources/Box2.med diff --git a/resources/Box2Moderate.med b/src/medtool/resources/Box2Moderate.med similarity index 100% rename from resources/Box2Moderate.med rename to src/medtool/resources/Box2Moderate.med diff --git a/resources/Box3.med b/src/medtool/resources/Box3.med similarity index 100% rename from resources/Box3.med rename to src/medtool/resources/Box3.med diff --git a/resources/BoxEvenSmaller1.med b/src/medtool/resources/BoxEvenSmaller1.med similarity index 100% rename from resources/BoxEvenSmaller1.med rename to src/medtool/resources/BoxEvenSmaller1.med diff --git a/resources/BoxHexa1.med b/src/medtool/resources/BoxHexa1.med similarity index 100% rename from resources/BoxHexa1.med rename to src/medtool/resources/BoxHexa1.med diff --git a/resources/BoxHexa2.med b/src/medtool/resources/BoxHexa2.med similarity index 100% rename from resources/BoxHexa2.med rename to src/medtool/resources/BoxHexa2.med diff --git a/resources/BoxModSmall1.med b/src/medtool/resources/BoxModSmall1.med similarity index 100% rename from resources/BoxModSmall1.med rename to src/medtool/resources/BoxModSmall1.med diff --git a/resources/BoxModSmall2.med b/src/medtool/resources/BoxModSmall2.med similarity index 100% rename from resources/BoxModSmall2.med rename to src/medtool/resources/BoxModSmall2.med diff --git a/resources/BoxTetra2.med b/src/medtool/resources/BoxTetra2.med similarity index 100% rename from resources/BoxTetra2.med rename to src/medtool/resources/BoxTetra2.med diff --git a/src/medtool/resources/CMakeLists.txt b/src/medtool/resources/CMakeLists.txt index 6d185dc17..e891af65c 100644 --- a/src/medtool/resources/CMakeLists.txt +++ b/src/medtool/resources/CMakeLists.txt @@ -134,51 +134,51 @@ SET(MED_RESOURCES_FILES # TimeStamps.med # zzzz121b.med # zzzz121b_without_tr6.med - # UnitTetra.med - # GeneralTetra.med - # NudgedSimpler.med - # NudgedTetra.med - # CornerTetra.med - # SimpleIncludedTetra.med - # SimpleIncludingTetra.med + UnitTetra.med + GeneralTetra.med + NudgedSimpler.med + NudgedTetra.med + CornerTetra.med + SimpleIncludedTetra.med + SimpleIncludingTetra.med Test2D.med Test2Dpoly.med Test3D.med Test3Dpoly.med - #UnitTetraDegenT.med - # DegenEdgeXY.med - # DegenFaceXYZ.med - # DegenTranslatedInPlane.med - # ComplexIncludedTetra.med - # ComplexIncludingTetra.med - # HalfstripOnly.med - # HalfstripOnly2.med - #SimpleHalfstripOnly.med - #GenTetra1.med - #GenTetra2.med - #TrickyTetra1.med + UnitTetraDegenT.med + DegenEdgeXY.med + DegenFaceXYZ.med + DegenTranslatedInPlane.med + ComplexIncludedTetra.med + ComplexIncludingTetra.med + HalfstripOnly.med + HalfstripOnly2.med + SimpleHalfstripOnly.med + GenTetra1.med + GenTetra2.med + TrickyTetra1.med LargeUnitTetra.med # LargeInconsistentTetra.med - # DividedUnitTetraSimpler.med - # DividedUnitTetra.med - # NudgedDividedUnitTetra.med - # NudgedDividedUnitTetraSimpler.med - # DividedGenTetra1.med - # DividedGenTetra2.med - # Box1.med - # Box2.med - # Box3.med - # Box1Moderate.med - # Box2Moderate.med - # BoxModSmall1.med - # BoxModSmall2.med - # BoxEvenSmaller1.med - # TinyBox.med - # BoxHexa1.med - # BoxHexa2.med - # MovedHexaBox1.med - # MovedHexaBox2.med - # BoxTetra2.med + DividedUnitTetraSimpler.med + DividedUnitTetra.med + NudgedDividedUnitTetra.med + NudgedDividedUnitTetraSimpler.med + DividedGenTetra1.med + DividedGenTetra2.med + Box1.med + Box2.med + Box3.med + Box1Moderate.med + Box2Moderate.med + BoxModSmall1.med + BoxModSmall2.med + BoxEvenSmaller1.med + TinyBox.med + BoxHexa1.med + BoxHexa2.med + MovedHexaBox1.med + MovedHexaBox2.med + BoxTetra2.med square1.med # square1_split # square1_split1.med @@ -203,9 +203,9 @@ SET(MED_RESOURCES_FILES # blow5_ascii_pd_displacement # blow5_ascii_pd_thickness #test_2D.sauve - #allPillesTest.sauv - #BDC-714.sauv - #portico_3subs.sauv + allPillesTest.sauv + BDC-714.sauv + portico_3subs.sauv agitateur.med ) @@ -225,6 +225,10 @@ SET(MED_RESOURCES_FILES # ) # ENDIF(MED_ENABLE_GUI) +FOREACH(resfile ${MED_RESOURCES_FILES}) + CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/${resfile}" "${CMAKE_CURRENT_BINARY_DIR}/${resfile}" COPYONLY) +ENDFOREACH(resfile) + INSTALL(FILES ${MED_RESOURCES_FILES} DESTINATION ${MEDTOOL_INSTALL_RES_DATA}) #MESSAGE(STATUS "Creation of ${CMAKE_CURRENT_BINARY_DIR}/MEDCatalog.xml") diff --git a/resources/ComplexIncludedTetra.med b/src/medtool/resources/ComplexIncludedTetra.med similarity index 100% rename from resources/ComplexIncludedTetra.med rename to src/medtool/resources/ComplexIncludedTetra.med diff --git a/resources/ComplexIncludingTetra.med b/src/medtool/resources/ComplexIncludingTetra.med similarity index 100% rename from resources/ComplexIncludingTetra.med rename to src/medtool/resources/ComplexIncludingTetra.med diff --git a/resources/CornerTetra.med b/src/medtool/resources/CornerTetra.med similarity index 100% rename from resources/CornerTetra.med rename to src/medtool/resources/CornerTetra.med diff --git a/resources/DegenEdgeXY.med b/src/medtool/resources/DegenEdgeXY.med similarity index 100% rename from resources/DegenEdgeXY.med rename to src/medtool/resources/DegenEdgeXY.med diff --git a/resources/DegenFaceXYZ.med b/src/medtool/resources/DegenFaceXYZ.med similarity index 100% rename from resources/DegenFaceXYZ.med rename to src/medtool/resources/DegenFaceXYZ.med diff --git a/resources/DegenTranslatedInPlane.med b/src/medtool/resources/DegenTranslatedInPlane.med similarity index 100% rename from resources/DegenTranslatedInPlane.med rename to src/medtool/resources/DegenTranslatedInPlane.med diff --git a/resources/DividedGenTetra1.med b/src/medtool/resources/DividedGenTetra1.med similarity index 100% rename from resources/DividedGenTetra1.med rename to src/medtool/resources/DividedGenTetra1.med diff --git a/resources/DividedGenTetra2.med b/src/medtool/resources/DividedGenTetra2.med similarity index 100% rename from resources/DividedGenTetra2.med rename to src/medtool/resources/DividedGenTetra2.med diff --git a/resources/DividedUnitTetra.med b/src/medtool/resources/DividedUnitTetra.med similarity index 100% rename from resources/DividedUnitTetra.med rename to src/medtool/resources/DividedUnitTetra.med diff --git a/resources/DividedUnitTetraSimpler.med b/src/medtool/resources/DividedUnitTetraSimpler.med similarity index 100% rename from resources/DividedUnitTetraSimpler.med rename to src/medtool/resources/DividedUnitTetraSimpler.med diff --git a/resources/GenTetra1.med b/src/medtool/resources/GenTetra1.med similarity index 100% rename from resources/GenTetra1.med rename to src/medtool/resources/GenTetra1.med diff --git a/resources/GenTetra2.med b/src/medtool/resources/GenTetra2.med similarity index 100% rename from resources/GenTetra2.med rename to src/medtool/resources/GenTetra2.med diff --git a/resources/GeneralTetra.med b/src/medtool/resources/GeneralTetra.med similarity index 100% rename from resources/GeneralTetra.med rename to src/medtool/resources/GeneralTetra.med diff --git a/resources/HalfstripOnly.med b/src/medtool/resources/HalfstripOnly.med similarity index 100% rename from resources/HalfstripOnly.med rename to src/medtool/resources/HalfstripOnly.med diff --git a/resources/HalfstripOnly2.med b/src/medtool/resources/HalfstripOnly2.med similarity index 100% rename from resources/HalfstripOnly2.med rename to src/medtool/resources/HalfstripOnly2.med diff --git a/resources/MovedHexaBox1.med b/src/medtool/resources/MovedHexaBox1.med similarity index 100% rename from resources/MovedHexaBox1.med rename to src/medtool/resources/MovedHexaBox1.med diff --git a/resources/MovedHexaBox2.med b/src/medtool/resources/MovedHexaBox2.med similarity index 100% rename from resources/MovedHexaBox2.med rename to src/medtool/resources/MovedHexaBox2.med diff --git a/resources/NudgedDividedUnitTetra.med b/src/medtool/resources/NudgedDividedUnitTetra.med similarity index 100% rename from resources/NudgedDividedUnitTetra.med rename to src/medtool/resources/NudgedDividedUnitTetra.med diff --git a/resources/NudgedDividedUnitTetraSimpler.med b/src/medtool/resources/NudgedDividedUnitTetraSimpler.med similarity index 100% rename from resources/NudgedDividedUnitTetraSimpler.med rename to src/medtool/resources/NudgedDividedUnitTetraSimpler.med diff --git a/resources/NudgedSimpler.med b/src/medtool/resources/NudgedSimpler.med similarity index 100% rename from resources/NudgedSimpler.med rename to src/medtool/resources/NudgedSimpler.med diff --git a/resources/NudgedTetra.med b/src/medtool/resources/NudgedTetra.med similarity index 100% rename from resources/NudgedTetra.med rename to src/medtool/resources/NudgedTetra.med diff --git a/resources/SimpleHalfstripOnly.med b/src/medtool/resources/SimpleHalfstripOnly.med similarity index 100% rename from resources/SimpleHalfstripOnly.med rename to src/medtool/resources/SimpleHalfstripOnly.med diff --git a/resources/SimpleIncludedTetra.med b/src/medtool/resources/SimpleIncludedTetra.med similarity index 100% rename from resources/SimpleIncludedTetra.med rename to src/medtool/resources/SimpleIncludedTetra.med diff --git a/resources/SimpleIncludingTetra.med b/src/medtool/resources/SimpleIncludingTetra.med similarity index 100% rename from resources/SimpleIncludingTetra.med rename to src/medtool/resources/SimpleIncludingTetra.med diff --git a/resources/TinyBox.med b/src/medtool/resources/TinyBox.med similarity index 100% rename from resources/TinyBox.med rename to src/medtool/resources/TinyBox.med diff --git a/resources/TrickyTetra1.med b/src/medtool/resources/TrickyTetra1.med similarity index 100% rename from resources/TrickyTetra1.med rename to src/medtool/resources/TrickyTetra1.med diff --git a/resources/UnitTetra.med b/src/medtool/resources/UnitTetra.med similarity index 100% rename from resources/UnitTetra.med rename to src/medtool/resources/UnitTetra.med diff --git a/resources/UnitTetraDegenT.med b/src/medtool/resources/UnitTetraDegenT.med similarity index 100% rename from resources/UnitTetraDegenT.med rename to src/medtool/resources/UnitTetraDegenT.med diff --git a/resources/allPillesTest.sauv b/src/medtool/resources/allPillesTest.sauv similarity index 100% rename from resources/allPillesTest.sauv rename to src/medtool/resources/allPillesTest.sauv diff --git a/resources/portico_3subs.sauv b/src/medtool/resources/portico_3subs.sauv similarity index 100% rename from resources/portico_3subs.sauv rename to src/medtool/resources/portico_3subs.sauv diff --git a/src/medtool/src/INTERP_KERNELTest/CMakeLists.txt b/src/medtool/src/INTERP_KERNELTest/CMakeLists.txt index af3ddab5f..e783ed6d4 100644 --- a/src/medtool/src/INTERP_KERNELTest/CMakeLists.txt +++ b/src/medtool/src/INTERP_KERNELTest/CMakeLists.txt @@ -86,8 +86,6 @@ TARGET_LINK_LIBRARIES(InterpKernelTest ${InterpKernelTest_LIBS}) ADD_EXECUTABLE(TestINTERP_KERNEL ${TestINTERP_KERNEL_SOURCES}) TARGET_LINK_LIBRARIES(TestINTERP_KERNEL InterpKernelTest ${CPPUNIT_LIBRARIES} ${PLATFORM_LIBS}) ADD_TEST(TestINTERP_KERNEL TestINTERP_KERNEL) -#SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env) -SET_TESTS_PROPERTIES(TestINTERP_KERNEL PROPERTIES ENVIRONMENT "${tests_env}") INSTALL(TARGETS TestINTERP_KERNEL DESTINATION ${MEDTOOL_INSTALL_BINS}) INSTALL(TARGETS InterpKernelTest DESTINATION ${MEDTOOL_INSTALL_LIBS}) diff --git a/src/medtool/src/INTERP_KERNELTest/Interpolation3DTest.cxx b/src/medtool/src/INTERP_KERNELTest/Interpolation3DTest.cxx index db32ed895..dbeb6ec67 100644 --- a/src/medtool/src/INTERP_KERNELTest/Interpolation3DTest.cxx +++ b/src/medtool/src/INTERP_KERNELTest/Interpolation3DTest.cxx @@ -31,7 +31,7 @@ #include "VectorUtils.hxx" -// levels : +// levels : // 1 - titles and volume results // 2 - symmetry / diagonal results and intersection matrix output // 3 - empty @@ -79,7 +79,7 @@ void Interpolation3DTest::getVolumes(ParaMEDMEM::MEDCouplingUMesh& mesh, double double Interpolation3DTest::sumVolume(const IntersectionMatrix& m) const { - + std::vector volumes; for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter) { @@ -89,7 +89,7 @@ double Interpolation3DTest::sumVolume(const IntersectionMatrix& m) const // vol += std::abs(iter2->second); } } - + // sum in ascending order to avoid rounding errors sort(volumes.begin(), volumes.end()); @@ -163,7 +163,7 @@ bool Interpolation3DTest::areCompatitable(const IntersectionMatrix& m1, const In } return compatitable; } - + bool Interpolation3DTest::testSymmetric(const IntersectionMatrix& m1, const IntersectionMatrix& m2) const { @@ -242,9 +242,9 @@ void Interpolation3DTest::dumpIntersectionMatrix(const IntersectionMatrix& m) co { for(std::map::const_iterator iter2 = iter->begin() ; iter2 != iter->end() ; ++iter2) { - + std::cout << "V(" << i << ", " << iter2->first << ") = " << iter2->second << std::endl; - + } ++i; } @@ -259,18 +259,25 @@ void Interpolation3DTest::setUp() void Interpolation3DTest::tearDown() { delete interpolator; -} +} void Interpolation3DTest::calcIntersectionMatrix(const char* mesh1path, const char* mesh1, const char* mesh2path, const char* mesh2, IntersectionMatrix& m) const { - const string dataBaseDir = getenv("MED_ROOT_DIR"); - const string dataDir = dataBaseDir + "/share/salome/resources/med/"; + string dataDir = ""; + if ( getenv("MEDTOOL_ROOT_DIR") ) { + dataDir = getenv("MEDTOOL_ROOT_DIR"); + dataDir += "/share/resources/med/"; + } + else { + dataDir = get_current_dir_name(); + dataDir += "/../../resources/"; + } LOG(1, std::endl << "=== -> intersecting src = " << mesh1 << ", target = " << mesh2 ); LOG(5, "Loading " << mesh1 << " from " << mesh1path); MESH sMesh(MED_DRIVER, dataDir+mesh1path, mesh1); - + LOG(5, "Loading " << mesh2 << " from " << mesh2path); MESH tMesh(MED_DRIVER, dataDir+mesh2path, mesh2); @@ -284,7 +291,7 @@ void Interpolation3DTest::calcIntersectionMatrix(const char* mesh1path, const ch } LOG(1, "Intersection calculation done. " << std::endl ); - + } void Interpolation3DTest::intersectMeshes(const char* mesh1path, const char* mesh1, const char* mesh2path, const char* mesh2, const double correctVol, const double prec, bool doubleTest) const @@ -300,7 +307,7 @@ void Interpolation3DTest::intersectMeshes(const char* mesh1path, const char* mes IntersectionMatrix matrix1; calcIntersectionMatrix(mesh1path, mesh1, mesh2path, mesh2, matrix1); -#if LOG_LEVEL >= 2 +#if LOG_LEVEL >= 2 dumpIntersectionMatrix(matrix1); #endif @@ -320,14 +327,14 @@ void Interpolation3DTest::intersectMeshes(const char* mesh1path, const char* mes } else { - + IntersectionMatrix matrix2; - calcIntersectionMatrix(mesh2path, mesh2, mesh1path, mesh1, matrix2); + calcIntersectionMatrix(mesh2path, mesh2, mesh1path, mesh1, matrix2); #if LOG_LEVEL >= 2 dumpIntersectionMatrix(matrix2); #endif - + const double vol2 = sumVolume(matrix2); LOG(1, "vol1 = " << vol1 << ", vol2 = " << vol2 << ", correctVol = " << correctVol ); diff --git a/src/medtool/src/INTERP_KERNELTest/MeshTestToolkit.txx b/src/medtool/src/INTERP_KERNELTest/MeshTestToolkit.txx index 9096963ce..de2934321 100644 --- a/src/medtool/src/INTERP_KERNELTest/MeshTestToolkit.txx +++ b/src/medtool/src/INTERP_KERNELTest/MeshTestToolkit.txx @@ -38,7 +38,7 @@ #include -// levels : +// levels : // 1 - titles and volume results // 2 - symmetry / diagonal results and intersection matrix output // 3 - empty @@ -138,7 +138,7 @@ namespace INTERP_TEST } /** - * Verifies if for a given intersection matrix the sum of each row is equal to the volumes + * Verifies if for a given intersection matrix the sum of each row is equal to the volumes * of the corresponding source elements and the sum of each column is equal to the volumes * of the corresponding target elements. This will be true as long as the meshes correspond * to the same geometry. The equalities are in the "epsilon-sense", making sure the relative @@ -252,7 +252,7 @@ namespace INTERP_TEST //if(m2[j - 1].count(i+1) > 0) // { std::map theMap = m2.at(j); - const double v2 = fabs(theMap[i]); + const double v2 = fabs(theMap[i]); if(v1 != v2) { LOG(2, "V1( " << i << ", " << j << ") = " << v1 << " which is different from V2( " << j << ", " << i << ") = " << v2 << " | diff = " << v1 - v2 ); @@ -267,7 +267,7 @@ namespace INTERP_TEST } if(!isSymmetric) { - LOG(1, "*** matrices are not symmetric"); + LOG(1, "*** matrices are not symmetric"); } return isSymmetric; } @@ -335,9 +335,9 @@ namespace INTERP_TEST * Calculates the intersection matrix for two meshes. * If the source and target meshes are the same, a CppUnit assertion raised if testVolumes() returns false. * - * @param mesh1path the path to the file containing the source mesh, relative to {$MED_ROOT_DIR}/share/salome/resources/med/ + * @param mesh1path the path to the file containing the source mesh, relative to {$MEDTOOL_ROOT_DIR}/share/resources/med/ * @param mesh1 the name of the source mesh - * @param mesh2path the path to the file containing the target mesh, relative to {$MED_ROOT_DIR}/share/salome/resources/med/ + * @param mesh2path the path to the file containing the target mesh, relative to {$MEDTOOL_ROOT_DIR}/share/resources/med/ * @param mesh2 the name of the target mesh * @param m intersection matrix in which to store the result of the intersection */ @@ -397,9 +397,9 @@ namespace INTERP_TEST * it will be confirmed that the intersection matrix is diagonal, otherwise the intersection matrices will be * calculated once which each mesh as source mesh, and it will be verified that the they are each others' transpose. * - * @param mesh1path the path to the file containing the source mesh, relative to {$MED_ROOT_DIR}/share/salome/resources/med/ + * @param mesh1path the path to the file containing the source mesh, relative to {$MEDTOOL_ROOT_DIR}/share/resources/med/ * @param mesh1 the name of the source mesh - * @param mesh2path the path to the file containing the target mesh, relative to {$MED_ROOT_DIR}/share/salome/resources/med/ + * @param mesh2path the path to the file containing the target mesh, relative to {$MEDTOOL_ROOT_DIR}/share/resources/med/ * @param mesh2 the name of the target mesh * @param correctVol the total volume of the intersection of the two meshes * @param prec maximum relative error to be tolerated in volume comparisions @@ -420,7 +420,7 @@ namespace INTERP_TEST IntersectionMatrix matrix1; calcIntersectionMatrix(mesh1path, mesh1, mesh2path, mesh2, matrix1); -#if LOG_LEVEL >= 2 +#if LOG_LEVEL >= 2 dumpIntersectionMatrix(matrix1); #endif @@ -441,7 +441,7 @@ namespace INTERP_TEST else { IntersectionMatrix matrix2; - calcIntersectionMatrix(mesh2path, mesh2, mesh1path, mesh1, matrix2); + calcIntersectionMatrix(mesh2path, mesh2, mesh1path, mesh1, matrix2); #if LOG_LEVEL >= 2 dumpIntersectionMatrix(matrix2); @@ -460,7 +460,7 @@ namespace INTERP_TEST /** * Utility method used to facilitate the call to intersect meshes. - * It calls intersectMeshes, using "mesh1.med" as file name for the mesh with name "mesh1" and + * It calls intersectMeshes, using "mesh1.med" as file name for the mesh with name "mesh1" and * "mesh2.med" as file name for the mesh with name "mesh2". The rest of the arguments are passed * along as they are. * diff --git a/src/medtool/src/INTERP_KERNELTest/PerfTest.cxx b/src/medtool/src/INTERP_KERNELTest/PerfTest.cxx index 85d67be1a..8c5c8d641 100644 --- a/src/medtool/src/INTERP_KERNELTest/PerfTest.cxx +++ b/src/medtool/src/INTERP_KERNELTest/PerfTest.cxx @@ -31,11 +31,11 @@ /** * \file PerfTest.cxx - * Test program which takes two meshes and calculates their intersection matrix. - * - * USAGE : PerfTest mesh1 mesh2 + * Test program which takes two meshes and calculates their intersection matrix. + * + * USAGE : PerfTest mesh1 mesh2 * where mesh1 and mesh2 are the names of two meshes located in - * the files mesh1.med, mesh2.med in {$MED_ROOT_DIR}/share/salome/resources/med/ + * the files mesh1.med, mesh2.med in {$MEDTOOL_ROOT_DIR}/share/resources/med/ * */ @@ -47,48 +47,48 @@ namespace INTERP_TEST */ class PerfTestToolkit : public MeshTestToolkit<3,3> { - + public: /** * Calculates the intersection matrix for two meshes. - * Outputs the names of the meshes intersected, the number of elements in each mesh, + * Outputs the names of the meshes intersected, the number of elements in each mesh, * the number of matrix elements and the number of non-zero matrix elements, etc. * These values help to determine how well the filtering algorithm is working. * - * @param mesh1path the path to the file containing the source mesh, relative to {$MED_ROOT_DIR}/share/salome/resources/med/ + * @param mesh1path the path to the file containing the source mesh, relative to {$MEDTOOL_ROOT_DIR}/share/resources/med/ * @param mesh1 the name of the source mesh - * @param mesh2path the path to the file containing the target mesh, relative to {$MED_ROOT_DIR}/share/salome/resources/med/ + * @param mesh2path the path to the file containing the target mesh, relative to {$MEDTOOL_ROOT_DIR}/share/resources/med/ * @param mesh2 the name of the target mesh * @param m intersection matrix in which to store the result of the intersection */ - void calcIntersectionMatrix(const char* mesh1path, const char* mesh1, const char* mesh2path, const char* mesh2, IntersectionMatrix& m) + void calcIntersectionMatrix(const char* mesh1path, const char* mesh1, const char* mesh2path, const char* mesh2, IntersectionMatrix& m) { LOG(1, std::endl << "=== -> intersecting src = " << mesh1 << ", target = " << mesh2 ); - + LOG(5, "Loading " << mesh1 << " from " << mesh1path); MEDCouplingAutoRefCountObjectPtr sMeshML=MEDFileUMesh::New(INTERP_TEST::getResourceFile(mesh1path).c_str(),mesh1); MEDCouplingAutoRefCountObjectPtr sMesh=sMeshML->getMeshAtLevel(0); - - + + LOG(5, "Loading " << mesh2 << " from " << mesh2path); MEDCouplingAutoRefCountObjectPtr tMeshML=MEDFileUMesh::New(INTERP_TEST::getResourceFile(mesh2path).c_str(),mesh2); MEDCouplingAutoRefCountObjectPtr tMesh=tMeshML->getMeshAtLevel(0); - + MEDCouplingNormalizedUnstructuredMesh<3,3> sMesh_wrapper(sMesh); MEDCouplingNormalizedUnstructuredMesh<3,3> tMesh_wrapper(tMesh); - + Interpolation3D interpolator; interpolator.interpolateMeshes(sMesh_wrapper, tMesh_wrapper,m,"P0P0"); - + std::pair eff = countNumberOfMatrixEntries(m); - LOG(1, eff.first << " of " << numTargetElems * numSrcElems << " intersections calculated : ratio = " + LOG(1, eff.first << " of " << numTargetElems * numSrcElems << " intersections calculated : ratio = " << double(eff.first) / double(numTargetElems * numSrcElems)); - LOG(1, eff.second << " non-zero elements of " << eff.first << " total : filter efficiency = " + LOG(1, eff.second << " non-zero elements of " << eff.first << " total : filter efficiency = " << double(eff.second) / double(eff.first)); - + LOG(1, "Intersection calculation done. " << std::endl ); - + } /** @@ -100,7 +100,7 @@ namespace INTERP_TEST */ std::pair countNumberOfMatrixEntries(const IntersectionMatrix& m) { - + int numElems = 0; int numNonZero = 0; for(IntersectionMatrix::const_iterator iter = m.begin() ; iter != m.end() ; ++iter) @@ -116,12 +116,12 @@ namespace INTERP_TEST } return std::make_pair(numElems, numNonZero); } - + }; } /** - * Main method of the program. + * Main method of the program. * Intersects the meshes and outputs some information about the calculation as well as the * intersection matrix on std::cout. * @@ -133,7 +133,7 @@ int main(int argc, char** argv) using INTERP_TEST::PerfTestToolkit; assert(argc == 3); - + // load meshes const std::string mesh1 = argv[1]; const std::string mesh2 = argv[2]; @@ -148,7 +148,7 @@ int main(int argc, char** argv) testTools.calcIntersectionMatrix(mesh1path.c_str(), mesh1.c_str(), mesh2path.c_str(), mesh2.c_str(), m); testTools.dumpIntersectionMatrix(m); - + return 0; } diff --git a/src/medtool/src/INTERP_KERNELTest/TestInterpKernelUtils.cxx b/src/medtool/src/INTERP_KERNELTest/TestInterpKernelUtils.cxx index d82a4c273..6aa73854a 100644 --- a/src/medtool/src/INTERP_KERNELTest/TestInterpKernelUtils.cxx +++ b/src/medtool/src/INTERP_KERNELTest/TestInterpKernelUtils.cxx @@ -20,23 +20,24 @@ #include "TestInterpKernelUtils.hxx" #include +#include namespace INTERP_TEST { std::string getResourceFile( const std::string& filename ) { std::string resourceFile = ""; - - if ( getenv("top_srcdir") ) { - // we are in 'make test' step - resourceFile = getenv("top_srcdir"); - resourceFile += "/resources/"; + + if ( getenv("MEDTOOL_ROOT_DIR") ) { + // use MEDTOOL_ROOT_DIR env.var + resourceFile = getenv("MEDTOOL_ROOT_DIR"); + resourceFile += "/share/resources/med/"; } - else if ( getenv("MED_ROOT_DIR") ) { - // use MED_ROOT_DIR env.var - resourceFile = getenv("MED_ROOT_DIR"); - resourceFile += "/share/salome/resources/med/"; + else { + resourceFile = get_current_dir_name(); + resourceFile += "/../../resources/"; } + resourceFile += filename; return resourceFile; } diff --git a/src/medtool/src/MEDCoupling/Test/CMakeLists.txt b/src/medtool/src/MEDCoupling/Test/CMakeLists.txt index 2b8adefc7..5deb19f7f 100644 --- a/src/medtool/src/MEDCoupling/Test/CMakeLists.txt +++ b/src/medtool/src/MEDCoupling/Test/CMakeLists.txt @@ -54,22 +54,17 @@ SET(TestMEDCouplingExamples_SOURCES MEDCouplingBasicsTest0.cxx ) -#SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env) - ADD_EXECUTABLE(TestMEDCoupling ${TestMEDCoupling_SOURCES}) TARGET_LINK_LIBRARIES(TestMEDCoupling medcoupling ${CPPUNIT_LIBRARIES} ${PLATFORM_LIBS}) ADD_TEST(TestMEDCoupling TestMEDCoupling) -SET_TESTS_PROPERTIES(TestMEDCoupling PROPERTIES ENVIRONMENT "${tests_env}") ADD_EXECUTABLE(TestMEDCouplingRemapper ${TestMEDCouplingRemapper_SOURCES}) TARGET_LINK_LIBRARIES(TestMEDCouplingRemapper medcouplingremapper ${CPPUNIT_LIBRARIES} ${PLATFORM_LIBS}) ADD_TEST(TestMEDCouplingRemapper TestMEDCouplingRemapper) -SET_TESTS_PROPERTIES(TestMEDCouplingRemapper PROPERTIES ENVIRONMENT "${tests_env}") ADD_EXECUTABLE(TestMEDCouplingExamples ${TestMEDCouplingExamples_SOURCES}) TARGET_LINK_LIBRARIES(TestMEDCouplingExamples medcoupling ${CPPUNIT_LIBRARIES} ${PLATFORM_LIBS}) ADD_TEST(TestMEDCouplingExamples TestMEDCouplingExamples) -SET_TESTS_PROPERTIES(TestMEDCouplingExamples PROPERTIES ENVIRONMENT "${tests_env}") INSTALL(TARGETS TestMEDCoupling TestMEDCouplingRemapper TestMEDCouplingExamples DESTINATION ${MEDTOOL_INSTALL_BINS}) diff --git a/src/medtool/src/MEDCoupling_Swig/CMakeLists.txt b/src/medtool/src/MEDCoupling_Swig/CMakeLists.txt index e0186342a..59cef51d2 100644 --- a/src/medtool/src/MEDCoupling_Swig/CMakeLists.txt +++ b/src/medtool/src/MEDCoupling_Swig/CMakeLists.txt @@ -89,20 +89,13 @@ INSTALL(FILES MEDCoupling.i MEDCouplingCommon.i MEDCouplingRefCountObject.i MEDC INSTALL(FILES MEDCouplingBasicsTest.py MEDCouplingRemapperTest.py MEDCouplingDataForTest.py MEDCouplingNumPyTest.py MEDCouplingPickleTest.py DESTINATION ${MEDTOOL_INSTALL_SCRIPT_PYTHON}) INSTALL(FILES MEDCouplingExamplesTest.py DESTINATION ${MEDTOOL_INSTALL_SCRIPT_PYTHON}) -#SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env) - ADD_TEST(MEDCouplingBasicsTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingBasicsTest.py) -SET_TESTS_PROPERTIES(MEDCouplingBasicsTest PROPERTIES ENVIRONMENT "${tests_env}") ADD_TEST(MEDCouplingExamplesTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingExamplesTest.py) -SET_TESTS_PROPERTIES(MEDCouplingExamplesTest PROPERTIES ENVIRONMENT "${tests_env}") ADD_TEST(MEDCouplingRemapperTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingRemapperTest.py) -SET_TESTS_PROPERTIES(MEDCouplingRemapperTest PROPERTIES ENVIRONMENT "${tests_env}") IF(NUMPY_FOUND) ADD_TEST(MEDCouplingNumPyTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingNumPyTest.py) - SET_TESTS_PROPERTIES(MEDCouplingNumPyTest PROPERTIES ENVIRONMENT "${tests_env}") ADD_TEST(MEDCouplingPickleTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDCouplingPickleTest.py) - SET_TESTS_PROPERTIES(MEDCouplingPickleTest PROPERTIES ENVIRONMENT "${tests_env}") ENDIF(NUMPY_FOUND) # Application tests diff --git a/src/medtool/src/MEDLoader/Swig/CMakeLists.txt b/src/medtool/src/MEDLoader/Swig/CMakeLists.txt index 54a9a602c..99a282168 100644 --- a/src/medtool/src/MEDLoader/Swig/CMakeLists.txt +++ b/src/medtool/src/MEDLoader/Swig/CMakeLists.txt @@ -81,31 +81,27 @@ INSTALL(FILES sauv2med PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EX INSTALL(FILES case2med PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ DESTINATION ${MEDTOOL_INSTALL_BINS} ) INSTALL(FILES med2case PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ DESTINATION ${MEDTOOL_INSTALL_BINS} ) -#SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env) - ADD_TEST(MEDLoaderTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDLoaderTest.py) -SET_TESTS_PROPERTIES(MEDLoaderTest PROPERTIES ENVIRONMENT "${tests_env}") ADD_TEST(MEDLoaderTest2 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDLoaderTest2.py) -SET_TESTS_PROPERTIES(MEDLoaderTest2 PROPERTIES ENVIRONMENT "${tests_env}") ADD_TEST(MEDLoaderTest3 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDLoaderTest3.py) -SET_TESTS_PROPERTIES(MEDLoaderTest3 PROPERTIES ENVIRONMENT "${tests_env}") ADD_TEST(MEDLoaderTest4 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDLoaderTest4.py) -SET_TESTS_PROPERTIES(MEDLoaderTest4 PROPERTIES ENVIRONMENT "${tests_env}") ADD_TEST(MEDLoaderExamplesTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDLoaderExamplesTest.py) -SET_TESTS_PROPERTIES(MEDLoaderExamplesTest PROPERTIES ENVIRONMENT "${tests_env}") ADD_TEST(SauvLoaderTest ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/SauvLoaderTest.py) -SET_TESTS_PROPERTIES(SauvLoaderTest PROPERTIES ENVIRONMENT "${tests_env}") IF(NUMPY_FOUND) ADD_TEST(MEDLoaderCouplingTrainingSession ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/MEDLoaderCouplingTrainingSession.py) - SET_TESTS_PROPERTIES(MEDLoaderCouplingTrainingSession PROPERTIES ENVIRONMENT "${tests_env}") ENDIF(NUMPY_FOUND) # Application tests SET(TEST_INSTALL_DIRECTORY ${MEDTOOL_INSTALL_SCRIPT_SCRIPTS}/test/MEDCoupling/MEDLoader/Swig) -INSTALL(FILES MEDLoaderDataForTest.py MEDLoaderTest.py MEDLoaderTest2.py MEDLoaderTest3.py MEDLoaderTest4.py SauvLoaderTest.py MEDLoaderExamplesTest.py MEDLoaderCouplingTrainingSession.py CaseIO.py CaseReader.py CaseWriter.py VTKReader.py MEDLoaderSplitter.py medutilities.py DESTINATION ${TEST_INSTALL_DIRECTORY}) +SET(MEDLOADER_TEST_FILES MEDLoaderDataForTest.py MEDLoaderTest.py MEDLoaderTest2.py MEDLoaderTest3.py MEDLoaderTest4.py SauvLoaderTest.py MEDLoaderExamplesTest.py MEDLoaderCouplingTrainingSession.py CaseIO.py CaseReader.py CaseWriter.py VTKReader.py MEDLoaderSplitter.py medutilities.py) + +FOREACH(testfile ${MEDLOADER_TEST_FILES}) + CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/${testfile}" "${CMAKE_CURRENT_BINARY_DIR}/${testfile}" COPYONLY) +ENDFOREACH(testfile) +INSTALL(FILES ${MEDLOADER_TEST_FILES} DESTINATION ${TEST_INSTALL_DIRECTORY}) INSTALL(FILES CTestTestfileInstall.cmake DESTINATION ${TEST_INSTALL_DIRECTORY} diff --git a/src/medtool/src/MEDLoader/Swig/MEDLoaderCouplingTrainingSession.py b/src/medtool/src/MEDLoader/Swig/MEDLoaderCouplingTrainingSession.py index 8001e2798..668b56260 100644 --- a/src/medtool/src/MEDLoader/Swig/MEDLoaderCouplingTrainingSession.py +++ b/src/medtool/src/MEDLoader/Swig/MEDLoaderCouplingTrainingSession.py @@ -480,8 +480,13 @@ print "IntegralGlobConstraint %lf == %lf"%(srcField.getArray().accumulate()[0],t from numpy import * from math import acos -med_root_dir=os.getenv("MED_ROOT_DIR") -agitateur_file=os.path.join(os.getenv("MED_ROOT_DIR"),"share","salome","resources","med","agitateur.med") +med_root_dir=os.getenv("MEDTOOL_ROOT_DIR") +if med_root_dir: + agitateur_file=os.path.join(os.getenv("MEDTOOL_ROOT_DIR"),"share","resources","med","agitateur.med") +else: + current_dir = os.path.dirname(os.path.realpath(__file__)) + agitateur_file=os.path.join(current_dir, "..", "..", "..", "resources","agitateur.med") + pass data=MEDFileData(agitateur_file) ts=data.getFields()[0].getTimeSteps() print ts diff --git a/src/medtool/src/MEDLoader/Swig/SauvLoaderTest.py b/src/medtool/src/MEDLoader/Swig/SauvLoaderTest.py index 502e4e468..b60a4fd3d 100644 --- a/src/medtool/src/MEDLoader/Swig/SauvLoaderTest.py +++ b/src/medtool/src/MEDLoader/Swig/SauvLoaderTest.py @@ -25,11 +25,18 @@ from MEDLoaderDataForTest import MEDLoaderDataForTest class SauvLoaderTest(unittest.TestCase): + def __getResourcesDirectory(self): + med_root_dir=os.getenv("MEDTOOL_ROOT_DIR") + if med_root_dir: + return os.path.join( os.getenv("MEDTOOL_ROOT_DIR"), "share","resources","med") + else: + current_dir = os.path.dirname(os.path.realpath(__file__)) + return os.path.join(current_dir, "..", "..", "..", "resources") + pass + def testSauv2Med(self): # get a file containing all types of readable piles - self.assertTrue( os.getenv("MED_ROOT_DIR") ) - sauvFile = os.path.join( os.getenv("MED_ROOT_DIR"), "share","salome", - "resources","med","allPillesTest.sauv") + sauvFile = os.path.join( self.__getResourcesDirectory(),"allPillesTest.sauv") self.assertTrue( os.access( sauvFile, os.F_OK)) # read SAUV and write MED @@ -38,7 +45,7 @@ class SauvLoaderTest(unittest.TestCase): d2=sr.loadInMEDFileDS(); d2.write(medFile,0); - # check + # check self.assertEqual(1,d2.getNumberOfMeshes()) self.assertEqual(8+97,d2.getNumberOfFields()) mm = d2.getMeshes() @@ -50,9 +57,7 @@ class SauvLoaderTest(unittest.TestCase): def testMed2Sauv(self): # read pointe.med - self.assertTrue( os.getenv("MED_ROOT_DIR") ) - medFile = os.path.join( os.getenv("MED_ROOT_DIR"), "share","salome", - "resources","med","pointe.med") + medFile = os.path.join(self.__getResourcesDirectory(),"pointe.med") self.assertTrue( os.access( medFile, os.F_OK)) pointeMed = MEDFileData.New( medFile ) @@ -241,9 +246,7 @@ class SauvLoaderTest(unittest.TestCase): @unittest.skipUnless(MEDLoader.HasXDR(),"requires XDR") def testMissingGroups(self): """test for issue 0021749: [CEA 601] Some missing groups in mesh after reading a SAUV file with SauvReader.""" - self.assertTrue( os.getenv("MED_ROOT_DIR") ) - sauvFile = os.path.join( os.getenv("MED_ROOT_DIR"), "share","salome", - "resources","med","BDC-714.sauv") + sauvFile = os.path.join(self.__getResourcesDirectory(),"BDC-714.sauv") self.assertTrue( os.access( sauvFile, os.F_OK)) name_of_group_on_cells='Slice10:ABSORBER' name_of_group_on_cells2='Slice10:00LR' @@ -336,13 +339,13 @@ class SauvLoaderTest(unittest.TestCase): sw.setCpyGrpIfOnASingleFamilyStatus(True) self.assertTrue(sw.getCpyGrpIfOnASingleFamilyStatus()) sw.write(sauvFile) - + f = open(sauvFile) # String pattern for the header of the sub meshes record ("PILE" number, number of named objects, number of objects) pattern_pile= re.compile(r'\sPILE\sNUMERO\s+(?P[0-9]+)NBRE\sOBJETS\sNOMMES\s+(?P[0-9]+)NBRE\sOBJETS\s+(?P[0-9]+)') # String pattern for a sub mesh header (cell type, number of components and three numbers) pattern_header=re.compile(r'\s+(?P[0-9]+)\s+(?P[0-9]+)\s+[0-9]+\s+[0-9]+\s+[0-9]+') - + nbobjects=0 line = f.readline() while(line): @@ -356,13 +359,13 @@ class SauvLoaderTest(unittest.TestCase): pass line=f.readline() pass - + # Skipping the objects names f.readline() # Skipping the objects ids f.readline() - # Looking for each sub-mesh header + # Looking for each sub-mesh header line = f.readline() cur_object=0 while(line and cur_object < nbobjects): diff --git a/src/medtool/src/MEDLoader/Test/CMakeLists.txt b/src/medtool/src/MEDLoader/Test/CMakeLists.txt index 96d121401..e61fc9378 100644 --- a/src/medtool/src/MEDLoader/Test/CMakeLists.txt +++ b/src/medtool/src/MEDLoader/Test/CMakeLists.txt @@ -39,18 +39,14 @@ SET(TestSauvLoader_SOURCES SauvLoaderTest.cxx ) -#SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env) - ADD_EXECUTABLE(TestMEDLoader ${TestMEDLoader_SOURCES}) TARGET_LINK_LIBRARIES(TestMEDLoader medloader ${CPPUNIT_LIBRARIES} ${PLATFORM_LIBS}) ADD_TEST(TestMEDLoader TestMEDLoader) -SET_TESTS_PROPERTIES(TestMEDLoader PROPERTIES ENVIRONMENT "${tests_env}") ADD_EXECUTABLE(TestSauvLoader ${TestSauvLoader_SOURCES}) TARGET_LINK_LIBRARIES(TestSauvLoader medloader ${CPPUNIT_LIBRARIES} ${PLATFORM_LIBS}) ADD_TEST(TestSauvLoader TestSauvLoader) -SET_TESTS_PROPERTIES(TestSauvLoader PROPERTIES ENVIRONMENT "${tests_env}") INSTALL(TARGETS TestMEDLoader TestSauvLoader DESTINATION ${MEDTOOL_INSTALL_BINS}) diff --git a/src/medtool/src/MEDLoader/Test/SauvLoaderTest.cxx b/src/medtool/src/MEDLoader/Test/SauvLoaderTest.cxx index b6195f6df..df1570008 100644 --- a/src/medtool/src/MEDLoader/Test/SauvLoaderTest.cxx +++ b/src/medtool/src/MEDLoader/Test/SauvLoaderTest.cxx @@ -44,7 +44,7 @@ void SauvLoaderTest::testSauv2Med() MEDCouplingAutoRefCountObjectPtr d2=sr->loadInMEDFileDS(); // write MED d2->write("allPillesTest.med",0); - // check + // check CPPUNIT_ASSERT_EQUAL(1,d2->getNumberOfMeshes()); CPPUNIT_ASSERT_EQUAL(8+97,d2->getNumberOfFields()); MEDFileMesh * m = d2->getMeshes()->getMeshAtPos(0); @@ -332,16 +332,16 @@ std::string SauvLoaderTest::getResourceFile( const std::string& filename ) { std::string resourceFile = ""; - if ( getenv("top_srcdir") ) { - // we are in 'make test' step - resourceFile = getenv("top_srcdir"); - resourceFile += "/resources/"; + if ( getenv("MEDTOOL_ROOT_DIR") ) { + // use MEDTOOL_ROOT_DIR env.var + resourceFile = getenv("MEDTOOL_ROOT_DIR"); + resourceFile += "/share/resources/med/"; } - else if ( getenv("MED_ROOT_DIR") ) { - // use MED_ROOT_DIR env.var - resourceFile = getenv("MED_ROOT_DIR"); - resourceFile += "/share/salome/resources/med/"; + else { + resourceFile = get_current_dir_name(); + resourceFile += "/../../../resources/"; } + resourceFile += filename; #ifdef WIN32 std::string fixedpath = resourceFile; diff --git a/src/medtool/src/MEDPartitioner/CMakeLists.txt b/src/medtool/src/MEDPartitioner/CMakeLists.txt index d1642c5cf..a57506609 100644 --- a/src/medtool/src/MEDPartitioner/CMakeLists.txt +++ b/src/medtool/src/MEDPartitioner/CMakeLists.txt @@ -131,7 +131,7 @@ IF(${SALOME_USE_MPI}) SET(medpartitionercpp_LDFLAGS ${medpartitionercpp_LDFLAGS} ${MPI_LIBRARIES}) SET_TARGET_PROPERTIES(medpartitioner_para PROPERTIES COMPILE_FLAGS "${medpartitionercpp_DEFINITIONS}") TARGET_LINK_LIBRARIES(medpartitioner_para medpartitionercpp ${medpartitionercpp_LDFLAGS}) - INSTALL(TARGETS medpartitioner_para DESTINATION ${SALOME_INSTALL_BINS}) + INSTALL(TARGETS medpartitioner_para DESTINATION ${MEDTOOL_INSTALL_BINS}) ENDIF(${SALOME_USE_MPI}) ADD_DEFINITIONS(${medpartitionercpp_DEFINITIONS}) diff --git a/src/medtool/src/MEDPartitioner/MEDPARTITIONER_metis.c b/src/medtool/src/MEDPartitioner/MEDPARTITIONER_metis.c index f67c84932..7967cab1c 100644 --- a/src/medtool/src/MEDPartitioner/MEDPARTITIONER_metis.c +++ b/src/medtool/src/MEDPartitioner/MEDPARTITIONER_metis.c @@ -38,42 +38,42 @@ typedef int idxtype; #endif // defined(MED_ENABLE_METIS) & !defined(MED_ENABLE_PARMETIS) -void MEDPARTITIONER_METIS_PartGraphRecursive(int *nvtxs, idxtype *xadj, idxtype *adjncy, idxtype *vwgt, - idxtype *adjwgt, int *wgtflag, int *numflag, int *nparts, +void MEDPARTITIONER_METIS_PartGraphRecursive(int *nvtxs, idxtype *xadj, idxtype *adjncy, idxtype *vwgt, + idxtype *adjwgt, int *wgtflag, int *numflag, int *nparts, int *options, int *edgecut, idxtype *part) { #if defined(MED_ENABLE_METIS) #ifndef MED_ENABLE_METIS_V5 - METIS_PartGraphRecursive(nvtxs, xadj, adjncy, vwgt, - adjwgt, wgtflag, numflag, nparts, + METIS_PartGraphRecursive(nvtxs, xadj, adjncy, vwgt, + adjwgt, wgtflag, numflag, nparts, options, edgecut, part); #else int ncon=1; options[METIS_OPTION_NCUTS]=1; options[METIS_OPTION_NITER]=1; options[METIS_OPTION_UFACTOR]=1; - METIS_PartGraphRecursive(nvtxs, &ncon, xadj, adjncy, vwgt, 0 /* vsize*/, + METIS_PartGraphRecursive(nvtxs, &ncon, xadj, adjncy, vwgt, 0 /* vsize*/, adjwgt, nparts,/* tpwgts*/ 0,/* ubvec */ 0, options, edgecut, part); #endif #endif } -void MEDPARTITIONER_METIS_PartGraphKway(int *nvtxs, idxtype *xadj, idxtype *adjncy, idxtype *vwgt, - idxtype *adjwgt, int *wgtflag, int *numflag, int *nparts, +void MEDPARTITIONER_METIS_PartGraphKway(int *nvtxs, idxtype *xadj, idxtype *adjncy, idxtype *vwgt, + idxtype *adjwgt, int *wgtflag, int *numflag, int *nparts, int *options, int *edgecut, idxtype *part) { #if defined(MED_ENABLE_METIS) #ifndef MED_ENABLE_METIS_V5 - METIS_PartGraphKway(nvtxs, xadj, adjncy, vwgt, - adjwgt, wgtflag, numflag, nparts, + METIS_PartGraphKway(nvtxs, xadj, adjncy, vwgt, + adjwgt, wgtflag, numflag, nparts, options, edgecut, part); #else int ncon=1; options[METIS_OPTION_NCUTS]=1; options[METIS_OPTION_NITER]=1; options[METIS_OPTION_UFACTOR]=1; - METIS_PartGraphKway(nvtxs, &ncon, xadj, adjncy, vwgt, 0 /* vsize*/, + METIS_PartGraphKway(nvtxs, &ncon, xadj, adjncy, vwgt, 0 /* vsize*/, adjwgt, nparts, 0 , 0 /* ubvec */, options, edgecut, part); #endif diff --git a/src/medtool/src/MEDPartitioner/Test/CMakeLists.txt b/src/medtool/src/MEDPartitioner/Test/CMakeLists.txt index 25e10b994..c1dd6f3bf 100644 --- a/src/medtool/src/MEDPartitioner/Test/CMakeLists.txt +++ b/src/medtool/src/MEDPartitioner/Test/CMakeLists.txt @@ -51,9 +51,7 @@ INSTALL(TARGETS TestMEDPARTITIONER DESTINATION ${MEDTOOL_INSTALL_BINS}) INSTALL(FILES ${MEDPARTITIONERTest_HEADERS_HXX} DESTINATION ${MEDTOOL_INSTALL_HEADERS}) -#SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env) ADD_TEST(TestMEDPARTITIONER TestMEDPARTITIONER) -SET_TESTS_PROPERTIES(TestMEDPARTITIONER PROPERTIES ENVIRONMENT "${tests_env}") # Application tests diff --git a/src/medtool/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx b/src/medtool/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx index 5144d40d3..9b6743a1c 100644 --- a/src/medtool/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx +++ b/src/medtool/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx @@ -37,11 +37,13 @@ #include #include +#include #include #include #include #include #include +#include #ifdef HAVE_MPI #include @@ -83,19 +85,17 @@ void MEDPARTITIONERTest::setbigSize() std::string MEDPARTITIONERTest::getPartitionerExe() const { std::string execName; - if ( getenv("top_builddir")) // make distcheck + if ( getenv("MEDTOOL_ROOT_DIR") ) { - execName = getenv("top_builddir"); - execName += "/src/MEDPartitioner/medpartitioner"; - } - else if ( getenv("MED_ROOT_DIR") ) - { - execName=getenv("MED_ROOT_DIR"); //.../INSTALL/MED - execName+="/bin/salome/medpartitioner"; + execName=getenv("MEDTOOL_ROOT_DIR"); //.../INSTALL/MED + execName+="/bin/medpartitioner"; } else { - CPPUNIT_FAIL("Can't find medpartitioner, neither MED_ROOT_DIR nor top_builddir is set"); + execName = get_current_dir_name(); + execName += "/../../MEDPartitioner/medpartitioner"; + if (! std::ifstream(execName.c_str())) + CPPUNIT_FAIL("Can't find medpartitioner, please set MEDTOOL_ROOT_DIR"); } return execName; } @@ -179,7 +179,7 @@ ParaMEDMEM::MEDCouplingUMesh * MEDPARTITIONERTest::buildCUBE3DMesh() ii=ii + _ni + 2 ; conn.push_back(ii); conn.push_back(ii-1); - + ii=i + j*(_ni+1) + (k+1)*(_ni+1)*(_nj+1); conn.push_back(ii); conn.push_back(ii+1); @@ -197,7 +197,7 @@ ParaMEDMEM::MEDCouplingUMesh * MEDPARTITIONERTest::buildCUBE3DMesh() cout << endl; cout << "\nnb conn " << (_ni)*(_nj)*(_nk)*8 << " " << conn.size() << endl; for (int i=0; i<(int)conn.size(); i=i+8) - { + { for (int j=0; j<8; j++) cout << conn[i+j] << " "; cout << endl; @@ -205,7 +205,7 @@ ParaMEDMEM::MEDCouplingUMesh * MEDPARTITIONERTest::buildCUBE3DMesh() cout << endl; } */ - + MEDCouplingUMesh *mesh=MEDCouplingUMesh::New(); mesh->setMeshDimension(3); int nbc=conn.size()/8; //nb of cells @@ -267,13 +267,13 @@ ParaMEDMEM::MEDCouplingUMesh * MEDPARTITIONERTest::buildCARRE3DMesh() cout<setMeshDimension(2); int nbc=conn.size()/4; //nb of cells @@ -335,14 +335,14 @@ ParaMEDMEM::MEDCouplingUMesh * MEDPARTITIONERTest::buildFACE3DMesh() cout<setMeshDimension(2); int nbc=conn.size()/4; //nb of cells @@ -415,7 +415,7 @@ MEDCouplingFieldDouble * MEDPARTITIONERTest::buildVecFieldOnNodes() field.push_back(j+.2); field.push_back(k+.3); } - + MEDCouplingUMesh *mesh=MEDLoader::ReadUMeshFromFile(_file_name.c_str(),_mesh_name.c_str(),0); int nbOfNodes=mesh->getNumberOfNodes(); MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME); @@ -452,7 +452,7 @@ void MEDPARTITIONERTest::createTestMeshWithoutField() } mesh->decrRef(); } - + { vector meshes; MEDCouplingUMesh * mesh1 = buildCUBE3DMesh(); @@ -465,7 +465,7 @@ void MEDPARTITIONERTest::createTestMeshWithoutField() meshes.push_back(mesh1); meshes.push_back(mesh2); MEDLoader::WriteUMeshes(_file_name_with_faces.c_str(), meshes, true); - + ParaMEDMEM::MEDFileUMesh* mfm=ParaMEDMEM::MEDFileUMesh::New(_file_name_with_faces.c_str(), mesh1->getName().c_str()); DataArrayInt* FacesFam=DataArrayInt::New(); FacesFam->alloc(mfm->getSizeAtLevel(-1),1); @@ -487,7 +487,7 @@ void MEDPARTITIONERTest::createTestMeshWithoutField() mfm->write(_file_name_with_faces.c_str(),0); FacesFam->decrRef(); CellsFam->decrRef(); - + /*ce truc marche pas! ParaMEDMEM::MEDFileUMesh* mfm=ParaMEDMEM::MEDFileUMesh::New(_file_name_with_faces.c_str(), mesh1->getName()); vector ms; @@ -495,7 +495,7 @@ void MEDPARTITIONERTest::createTestMeshWithoutField() mfm->setGroupsFromScratch(-1, ms); mfm->write(_file_name_with_faces.c_str(),0); */ - + if (_verbose) cout<decrRef(); mfm->decrRef(); } - + { MEDCouplingUMesh * mesh = buildCARRE3DMesh(); MEDLoader::WriteUMesh(_file_name2.c_str(),mesh,true); @@ -553,7 +553,7 @@ void MEDPARTITIONERTest::createHugeTestMesh(int ni, int nj, int nk, int nbx, int \n$tagMesh \ \n \ \n"; - + string tagSubfiles, tagSubfile="\ \n \ $fileName\n \ @@ -565,7 +565,7 @@ void MEDPARTITIONERTest::createHugeTestMesh(int ni, int nj, int nk, int nbx, int testMesh\n \ \n \ \n"; - + int xyz=1; string sxyz; DataArrayDouble* coordsInit=mesh->getCoords()->deepCpy(); @@ -573,7 +573,7 @@ void MEDPARTITIONERTest::createHugeTestMesh(int ni, int nj, int nk, int nbx, int double deltax=cooFin[0]-cooDep[0]; double deltay=cooFin[1]-cooDep[1]; double deltaz=cooFin[2]-cooDep[2]; - + double dz=0.; for (int z=0; zgetCoords(); //int nbOfComp=coords->getNumberOfComponents(); //be 3D int nbOfTuple=coords->getNumberOfTuples(); @@ -600,11 +600,11 @@ void MEDPARTITIONERTest::createHugeTestMesh(int ni, int nj, int nk, int nbx, int } MEDLoader::WriteUMesh(fileName.c_str(),mesh,true); - + tagSubfiles+=tagSubfile; tagSubfiles.replace(tagSubfiles.find("$xyz"),4,sxyz); tagSubfiles.replace(tagSubfiles.find("$fileName"),9,fileName); - + tagMeshes+=tagMesh; tagMeshes.replace(tagMeshes.find("$xyz"),4,sxyz); xyz++; @@ -615,7 +615,7 @@ void MEDPARTITIONERTest::createHugeTestMesh(int ni, int nj, int nk, int nbx, int dz+=deltaz; } coordsInit->decrRef(); - + tagXml.replace(tagXml.find("$subdomainNumber"),16,sxyz); tagXml.replace(tagXml.find("$tagSubfile"),11,tagSubfiles); tagXml.replace(tagXml.find("$tagMesh"),8,tagMeshes); @@ -626,7 +626,7 @@ void MEDPARTITIONERTest::createHugeTestMesh(int ni, int nj, int nk, int nbx, int f<decrRef(); } @@ -666,17 +666,17 @@ void MEDPARTITIONERTest::createTestMeshWithVecFieldOnCells() f3->setDescription("MyDescriptionNE"); DataArrayDouble *array=DataArrayDouble::New(); //int nb=f1->getMesh()->getNumberOfNodes(); - + /*8 pt de gauss by cell int nb=f3->getMesh()->getNumberOfCells()*8; array->alloc(nb,2); double *ptr=array->getPointer(); for (int i=0; igetMesh()->getNumberOfCells(); int nb=nbcell*nbptgauss; int nbcomp=2; @@ -753,7 +753,7 @@ void MEDPARTITIONERTest::verifyTestMeshWithVecFieldOnNodes() { cout<<"\n types in "<::iterator t=types.begin(); t!=types.end(); ++t) cout<<" "<<*t; - for (std::set::const_iterator t=types.begin(); t!=types.end(); ++t) + for (std::set::const_iterator t=types.begin(); t!=types.end(); ++t) { //INTERP_KERNEL::CellModel essai=INTERP_KERNEL::CellModel::GetCellModel(*t); cout<<" "<<(INTERP_KERNEL::CellModel::GetCellModel(*t)).getRepr(); @@ -761,7 +761,7 @@ void MEDPARTITIONERTest::verifyTestMeshWithVecFieldOnNodes() cout<decrRef(); - + MEDFileUMesh * mf = MEDFileUMesh::New(_file_name.c_str(),_mesh_name.c_str(),-1,-1); vector lev; lev=mf->getNonEmptyLevels(); @@ -839,7 +839,7 @@ void MEDPARTITIONERTest::testMeshCollectionSinglePartitionMetis() bool empty_groups=false; MEDPARTITIONER::ParaDomainSelector parallelizer(false); MEDPARTITIONER::MeshCollection collection(fileName,parallelizer); - + MEDPARTITIONER::ParallelTopology* aPT = (MEDPARTITIONER::ParallelTopology*) collection.getTopology(); aPT->setGlobalNumerotationDefault(collection.getParaDomainSelector()); //Creating the graph and partitioning it @@ -847,13 +847,13 @@ void MEDPARTITIONERTest::testMeshCollectionSinglePartitionMetis() new_topo.reset( collection.createPartition(ndomains,MEDPARTITIONER::Graph::METIS) ); //Creating a new mesh collection from the partitioning MEDPARTITIONER::MeshCollection new_collection(collection,new_topo.get(),split_family,empty_groups); - + //example to create files //MyGlobals::_General_Informations.clear(); //MyGlobals::_General_Informations.push_back(SerializeFromString("finalMeshName=Merge")); //if (MyGlobals::_Verbose>100) cout << "generalInformations : \n"<setGlobalNumerotationDefault(collection.getParaDomainSelector()); - + for (int ndomains=2 ; ndomains<=16 ; ndomains++) { //Creating the graph and partitioning it @@ -883,7 +883,7 @@ void MEDPARTITIONERTest::testMeshCollectionComplexPartitionMetis() new_topo.reset( collection.createPartition(ndomains,MEDPARTITIONER::Graph::METIS) ); //Creating a new mesh collection from the partitioning MEDPARTITIONER::MeshCollection new_collection(collection,new_topo.get(),split_family,empty_groups); - + CPPUNIT_ASSERT_EQUAL(ndomains,new_collection.getNbOfLocalMeshes()); CPPUNIT_ASSERT_EQUAL(ndomains,new_collection.getNbOfGlobalMeshes()); CPPUNIT_ASSERT_EQUAL(collection.getNbOfLocalCells(),new_collection.getNbOfLocalCells()); @@ -921,7 +921,7 @@ void MEDPARTITIONERTest::testMeshCollectionSinglePartitionScotch() bool empty_groups=false; MEDPARTITIONER::ParaDomainSelector parallelizer(false); MEDPARTITIONER::MeshCollection collection(fileName,parallelizer); - + MEDPARTITIONER::ParallelTopology* aPT = (MEDPARTITIONER::ParallelTopology*) collection.getTopology(); aPT->setGlobalNumerotationDefault(collection.getParaDomainSelector()); //Creating the graph and partitioning it @@ -929,13 +929,13 @@ void MEDPARTITIONERTest::testMeshCollectionSinglePartitionScotch() new_topo.reset( collection.createPartition(ndomains,MEDPARTITIONER::Graph::SCOTCH) ); //Creating a new mesh collection from the partitioning MEDPARTITIONER::MeshCollection new_collection(collection,new_topo.get(),split_family,empty_groups); - + //example to create files //MyGlobals::_General_Informations.clear(); //MyGlobals::_General_Informations.push_back(SerializeFromString("finalMeshName=Merge")); //if (MyGlobals::_Verbose>100) cout << "generalInformations : \n"<setGlobalNumerotationDefault(collection.getParaDomainSelector()); - + for (int ndomains=2 ; ndomains<=16 ; ndomains++) { //Creating the graph and partitioning it @@ -965,7 +965,7 @@ void MEDPARTITIONERTest::testMeshCollectionComplexPartitionScotch() new_topo.reset( collection.createPartition(ndomains,MEDPARTITIONER::Graph::SCOTCH) ); //Creating a new mesh collection from the partitioning MEDPARTITIONER::MeshCollection new_collection(collection,new_topo.get(),split_family,empty_groups); - + CPPUNIT_ASSERT_EQUAL(ndomains,new_collection.getNbOfLocalMeshes()); CPPUNIT_ASSERT_EQUAL(ndomains,new_collection.getNbOfGlobalMeshes()); CPPUNIT_ASSERT_EQUAL(collection.getNbOfLocalCells(),new_collection.getNbOfLocalCells()); @@ -991,13 +991,13 @@ void MEDPARTITIONERTest::launchMetisOrScotchMedpartitionerOnTestMeshes(std::stri { int res; string cmd,execName,sourceName,targetName; - + execName=getPartitionerExe(); - + cmd="which "+execName+" 2>/dev/null 1>/dev/null"; //no trace res=system(cmd.c_str()); CPPUNIT_ASSERT_EQUAL_MESSAGE(execName + " - INVALID PATH TO medpartitioner", 0, res); - + cmd=execName+" --ndomains=2 --split-method="+MetisOrScotch; //on same proc sourceName=_file_name; targetName=_file_name; @@ -1006,7 +1006,7 @@ void MEDPARTITIONERTest::launchMetisOrScotchMedpartitionerOnTestMeshes(std::stri if (_verbose) cout<getLevel0Mesh(false); ParaMEDMEM::MEDCouplingUMesh* faceMesh=initialMesh->getLevelM1Mesh(false); - + cmd=execName+" --ndomains=5 --split-method="+MetisOrScotch; //on same proc sourceName=fileName; targetName=fileName; @@ -1055,7 +1055,7 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForMesh(std res=system(cmd.c_str()); CPPUNIT_ASSERT_EQUAL(0, res); input=targetName+".xml"; - + MEDPARTITIONER::ParaDomainSelector parallelizer(false); MEDPARTITIONER::MeshCollection collection(input,parallelizer); CPPUNIT_ASSERT_EQUAL(3, collection.getMeshDimension()); @@ -1065,14 +1065,14 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForMesh(std for (std::size_t i = 0; i < cellMeshes.size(); i++) nbcells+=cellMeshes[i]->getNumberOfCells(); CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells); - + std::vectorfaceMeshes=collection.getFaceMesh(); CPPUNIT_ASSERT_EQUAL(5, (int) faceMeshes.size()); int nbfaces=0; for (std::size_t i=0; i < faceMeshes.size(); i++) nbfaces+=faceMeshes[i]->getNumberOfCells(); CPPUNIT_ASSERT_EQUAL(faceMesh->getNumberOfCells(), nbfaces); - + //merge split meshes and test equality cmd=execName+" --ndomains=1 --split-method="+MetisOrScotch; //on same proc sourceName=targetName+".xml"; @@ -1082,25 +1082,25 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForMesh(std if (_verbose) cout<getLevel0Mesh(false); ParaMEDMEM::MEDCouplingUMesh* refusedFaceMesh=refusedMesh->getLevelM1Mesh(false); - + CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), refusedCellMesh->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(faceMesh->getNumberOfCells(), refusedFaceMesh->getNumberOfCells()); - + /*not the good job ParaMEDMEM::MEDCouplingMesh* mergeCell=cellMesh->mergeMyselfWith(refusedCellMesh); CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), mergeCell->getNumberOfCells()); - + ParaMEDMEM::MEDCouplingMesh* mergeFace=faceMesh->mergeMyselfWith(refusedFaceMesh); CPPUNIT_ASSERT_EQUAL(faceMesh->getNumberOfCells(), mergeFace->getNumberOfCells()); - + CPPUNIT_ASSERT(faceMesh->isEqual(refusedFaceMesh,1e-12)); */ - + std::vector meshes; std::vector corr; meshes.push_back(cellMesh); @@ -1108,7 +1108,7 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForMesh(std meshes.push_back(refusedCellMesh); MEDCouplingUMesh* fusedCell=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr); CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), fusedCell->getNumberOfCells()); - + meshes.resize(0); for (std::size_t i = 0; i < corr.size(); i++) corr[i]->decrRef(); @@ -1118,7 +1118,7 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForMesh(std meshes.push_back(refusedFaceMesh); MEDCouplingUMesh* fusedFace=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr); CPPUNIT_ASSERT_EQUAL(faceMesh->getNumberOfCells(), fusedFace->getNumberOfCells()); - + for (std::size_t i = 0; i < corr.size(); i++) corr[i]->decrRef(); fusedFace->decrRef(); @@ -1141,10 +1141,10 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnC execName=getPartitionerExe(); fileName=_file_name; fileName.replace(fileName.find(".med"),4,"_WithVecFieldOnCells.med"); - + ParaMEDMEM::MEDFileUMesh* initialMesh=ParaMEDMEM::MEDFileUMesh::New(fileName.c_str(),_mesh_name.c_str()); ParaMEDMEM::MEDCouplingUMesh* cellMesh=initialMesh->getLevel0Mesh(false); - + cmd=execName+" --ndomains=5 --split-method="+MetisOrScotch; //on same proc sourceName=fileName; targetName=fileName; @@ -1154,7 +1154,7 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnC res=system(cmd.c_str()); CPPUNIT_ASSERT_EQUAL(0, res); input=targetName+".xml"; - + //merge split meshes and test equality cmd=execName+" --ndomains=1 --split-method="+MetisOrScotch; //on same proc sourceName=targetName+".xml"; @@ -1164,13 +1164,13 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnC if (_verbose) cout<getLevel0Mesh(false); - + CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), refusedCellMesh->getNumberOfCells()); - + std::vector meshes; std::vector corr; meshes.push_back(cellMesh); @@ -1178,22 +1178,22 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnC meshes.push_back(refusedCellMesh); MEDCouplingUMesh* fusedCell=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr); CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), fusedCell->getNumberOfCells()); - + MEDCouplingFieldDouble* field1=MEDLoader::ReadFieldCell(fileName.c_str(),initialMesh->getName().c_str(),0,"VectorFieldOnCells",0,1); MEDCouplingFieldDouble* field2=MEDLoader::ReadFieldCell(refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"VectorFieldOnCells",0,1); - + int nbcells=corr[1]->getNumberOfTuples(); CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells); //use corr to test equality of field DataArrayDouble* f1=field1->getArray(); DataArrayDouble* f2=field2->getArray(); - if (_verbose>300) + if (_verbose>300) { cout<<"\nf1 : "<reprZip(); cout<<"\nf2 : "<reprZip(); //field2->advancedRepradvancedRepr(); for (std::size_t i = 0; i < corr.size(); i++) cout << "\ncorr " << i << " : " << corr[i]->reprZip(); - + } int nbequal=0; int nbcomp=field1->getNumberOfComponents(); @@ -1211,7 +1211,7 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnC } } CPPUNIT_ASSERT_EQUAL(nbcells*nbcomp, nbequal); - + for (std::size_t i = 0; i < corr.size(); i++) corr[i]->decrRef(); field1->decrRef(); @@ -1230,10 +1230,10 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnG execName=getPartitionerExe(); fileName=_file_name; fileName.replace(fileName.find(".med"),4,"_WithVecFieldOnGaussNe.med"); - + ParaMEDMEM::MEDFileUMesh* initialMesh=ParaMEDMEM::MEDFileUMesh::New(fileName.c_str(),_mesh_name.c_str()); ParaMEDMEM::MEDCouplingUMesh* cellMesh=initialMesh->getLevel0Mesh(false); - + cmd=execName+" --ndomains=5 --split-method="+MetisOrScotch; //on same proc sourceName=fileName; targetName=fileName; @@ -1243,7 +1243,7 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnG res=system(cmd.c_str()); CPPUNIT_ASSERT_EQUAL(0, res); input=targetName+".xml"; - + //merge split meshes and test equality cmd=execName+" --ndomains=1 --split-method="+MetisOrScotch; //on same proc sourceName=targetName+".xml"; @@ -1253,13 +1253,13 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnG if (_verbose) cout<getLevel0Mesh(false); - + CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), refusedCellMesh->getNumberOfCells()); - + std::vector meshes; std::vector corr; meshes.push_back(cellMesh); @@ -1267,22 +1267,22 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnG meshes.push_back(refusedCellMesh); MEDCouplingUMesh* fusedCell=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr); CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), fusedCell->getNumberOfCells()); - + MEDCouplingFieldDouble* field1=MEDLoader::ReadField(ON_GAUSS_NE,fileName.c_str(),initialMesh->getName().c_str(),0,"MyFieldOnGaussNE",5,6); MEDCouplingFieldDouble* field2=MEDLoader::ReadField(ON_GAUSS_NE,refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"MyFieldOnGaussNE",5,6); - + int nbcells=corr[1]->getNumberOfTuples(); CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells); //use corr to test equality of field DataArrayDouble* f1=field1->getArray(); DataArrayDouble* f2=field2->getArray(); - if (_verbose>300) + if (_verbose>300) { cout << "\nf1 : " << f1->reprZip(); //123.4 for 12th cell,3rd component, 4th gausspoint cout << "\nf2 : " << f2->reprZip(); //field2->advancedRepradvancedRepr(); for (std::size_t i = 0; i < corr.size(); i++) cout << "\ncorr " << i << " : " << corr[i]->reprZip(); - + } int nbequal=0; int nbptgauss=8; @@ -1301,7 +1301,7 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnG } } CPPUNIT_ASSERT_EQUAL(nbcells*nbcomp*nbptgauss, nbequal); - + for (std::size_t i = 0; i < corr.size(); i++) corr[i]->decrRef(); field1->decrRef(); diff --git a/src/medtool/src/MEDPartitioner/Test/MEDPARTITIONERTest.hxx b/src/medtool/src/MEDPartitioner/Test/MEDPARTITIONERTest.hxx index 5e437cb32..f6cd5a13b 100644 --- a/src/medtool/src/MEDPartitioner/Test/MEDPARTITIONERTest.hxx +++ b/src/medtool/src/MEDPartitioner/Test/MEDPARTITIONERTest.hxx @@ -56,7 +56,7 @@ class MEDPARTITIONERTEST_EXPORT MEDPARTITIONERTest : public CppUnit::TestFixture CPPUNIT_TEST( testMeshCollectionComplexPartitionScotch ); CPPUNIT_TEST( testScotchSmallSize ); #endif - + #if defined(HAVE_MPI) #if defined(MED_ENABLE_PARMETIS) //test with mpi on system @@ -85,13 +85,14 @@ public: int _nb_target_huge; std::string _mesh_name; //initial test mesh file med int _verbose; - + //for utils void setSize(int ni, int nj, int nk); void setSmallSize(); void setMedianSize(); void setbigSize(); std::string getPartitionerExe() const; + std::string getPartitionerParaExe() const; ParaMEDMEM::MEDCouplingUMesh * buildCUBE3DMesh(); ParaMEDMEM::MEDCouplingUMesh * buildFACE3DMesh(); ParaMEDMEM::MEDCouplingUMesh * buildCARRE3DMesh(); @@ -113,7 +114,7 @@ public: void launchMedpartitionerOnTestMeshes(); void launchMedpartitionerOnHugeTestMeshes(); void deleteTestMeshes(); - + //for CPPUNIT_TEST void setUp(); void tearDown(); @@ -129,7 +130,7 @@ public: void testMeshCollectionComplexPartitionScotch(); void testScotchSmallSize(); #endif - + #if defined(HAVE_MPI) void testMpirunSmallSize(); void testMpirunMedianSize(); diff --git a/src/medtool/src/MEDPartitioner/Test/MEDPARTITIONERTestPara.cxx b/src/medtool/src/MEDPartitioner/Test/MEDPARTITIONERTestPara.cxx index 5daaa525d..c38d51755 100644 --- a/src/medtool/src/MEDPartitioner/Test/MEDPARTITIONERTestPara.cxx +++ b/src/medtool/src/MEDPartitioner/Test/MEDPARTITIONERTestPara.cxx @@ -50,18 +50,35 @@ using namespace ParaMEDMEM; using namespace MEDPARTITIONER; #if defined(HAVE_MPI) +std::string MEDPARTITIONERTest::getPartitionerParaExe() const +{ + std::string execName; + if ( getenv("MEDTOOL_ROOT_DIR") ) + { + execName=getenv("MEDTOOL_ROOT_DIR"); //.../INSTALL/MED + execName+="/bin/medpartitioner_para"; + } + else + { + execName = get_current_dir_name(); + execName += "/../../MEDPartitioner/medpartitioner_para"; + if (! std::ifstream(execName.c_str())) + CPPUNIT_FAIL("Can't find medpartitioner_para, please set MEDTOOL_ROOT_DIR"); + } + return execName; +} + void MEDPARTITIONERTest::verifyMedpartitionerOnSmallSizeForMesh() { int res; string fileName,cmd,execName,sourceName,targetName,input; - execName=getenv("MED_ROOT_DIR"); //.../INSTALL/MED - execName+="/bin/salome/medpartitioner_para"; + execName=getPartitionerParaExe(); fileName=_file_name_with_faces; - + ParaMEDMEM::MEDFileUMesh* initialMesh=ParaMEDMEM::MEDFileUMesh::New(fileName.c_str(),_mesh_name.c_str()); ParaMEDMEM::MEDCouplingUMesh* cellMesh=initialMesh->getLevel0Mesh(false); ParaMEDMEM::MEDCouplingUMesh* faceMesh=initialMesh->getLevelM1Mesh(false); - + cmd="mpirun -np 5 "+execName+" --ndomains=5 --split-method=metis"; //on same proc sourceName=fileName; targetName=fileName; @@ -71,7 +88,7 @@ void MEDPARTITIONERTest::verifyMedpartitionerOnSmallSizeForMesh() res=system(cmd.c_str()); CPPUNIT_ASSERT_EQUAL(0, res); input=targetName+".xml"; - + MEDPARTITIONER::ParaDomainSelector parallelizer(false); MEDPARTITIONER::MeshCollection collection(input,parallelizer); CPPUNIT_ASSERT_EQUAL(3, collection.getMeshDimension()); @@ -81,14 +98,14 @@ void MEDPARTITIONERTest::verifyMedpartitionerOnSmallSizeForMesh() for (std::size_t i = 0; i < cellMeshes.size(); i++) nbcells+=cellMeshes[i]->getNumberOfCells(); CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells); - + std::vectorfaceMeshes=collection.getFaceMesh(); CPPUNIT_ASSERT_EQUAL(5, (int) faceMeshes.size()); int nbfaces=0; for (std::size_t i=0; i < faceMeshes.size(); i++) nbfaces+=faceMeshes[i]->getNumberOfCells(); CPPUNIT_ASSERT_EQUAL(faceMesh->getNumberOfCells(), nbfaces); - + //merge split meshes and test equality cmd="mpirun -np 1 "+execName+" --ndomains=1 --split-method=metis"; //on same proc sourceName=targetName+".xml"; @@ -98,25 +115,25 @@ void MEDPARTITIONERTest::verifyMedpartitionerOnSmallSizeForMesh() if (_verbose) cout<getLevel0Mesh(false); ParaMEDMEM::MEDCouplingUMesh* refusedFaceMesh=refusedMesh->getLevelM1Mesh(false); - + CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), refusedCellMesh->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(faceMesh->getNumberOfCells(), refusedFaceMesh->getNumberOfCells()); - + /*not the good job ParaMEDMEM::MEDCouplingMesh* mergeCell=cellMesh->mergeMyselfWith(refusedCellMesh); CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), mergeCell->getNumberOfCells()); - + ParaMEDMEM::MEDCouplingMesh* mergeFace=faceMesh->mergeMyselfWith(refusedFaceMesh); CPPUNIT_ASSERT_EQUAL(faceMesh->getNumberOfCells(), mergeFace->getNumberOfCells()); - + CPPUNIT_ASSERT(faceMesh->isEqual(refusedFaceMesh,1e-12)); */ - + std::vector meshes; std::vector corr; meshes.push_back(cellMesh); @@ -124,7 +141,7 @@ void MEDPARTITIONERTest::verifyMedpartitionerOnSmallSizeForMesh() meshes.push_back(refusedCellMesh); MEDCouplingUMesh* fusedCell=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr); CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), fusedCell->getNumberOfCells()); - + meshes.resize(0); for (std::size_t i = 0; i < corr.size(); i++) corr[i]->decrRef(); @@ -134,7 +151,7 @@ void MEDPARTITIONERTest::verifyMedpartitionerOnSmallSizeForMesh() meshes.push_back(refusedFaceMesh); MEDCouplingUMesh* fusedFace=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr); CPPUNIT_ASSERT_EQUAL(faceMesh->getNumberOfCells(), fusedFace->getNumberOfCells()); - + for (std::size_t i = 0; i < corr.size(); i++) corr[i]->decrRef(); fusedFace->decrRef(); @@ -152,14 +169,13 @@ void MEDPARTITIONERTest::verifyMedpartitionerOnSmallSizeForFieldOnCells() { int res; string fileName,cmd,execName,sourceName,targetName,input; - execName=getenv("MED_ROOT_DIR"); //.../INSTALL/MED - execName+="/bin/salome/medpartitioner_para"; + execName=getPartitionerParaExe(); fileName=_file_name; fileName.replace(fileName.find(".med"),4,"_WithVecFieldOnCells.med"); - + ParaMEDMEM::MEDFileUMesh* initialMesh=ParaMEDMEM::MEDFileUMesh::New(fileName.c_str(),_mesh_name.c_str()); ParaMEDMEM::MEDCouplingUMesh* cellMesh=initialMesh->getLevel0Mesh(false); - + cmd="mpirun -np 5 "+execName+" --ndomains=5 --split-method=metis"; //on same proc sourceName=fileName; targetName=fileName; @@ -169,7 +185,7 @@ void MEDPARTITIONERTest::verifyMedpartitionerOnSmallSizeForFieldOnCells() res=system(cmd.c_str()); CPPUNIT_ASSERT_EQUAL(0, res); input=targetName+".xml"; - + //merge split meshes and test equality cmd="mpirun -np 1 "+execName+" --ndomains=1 --split-method=metis"; //on same proc sourceName=targetName+".xml"; @@ -179,13 +195,13 @@ void MEDPARTITIONERTest::verifyMedpartitionerOnSmallSizeForFieldOnCells() if (_verbose) cout<getLevel0Mesh(false); - + CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), refusedCellMesh->getNumberOfCells()); - + std::vector meshes; std::vector corr; meshes.push_back(cellMesh); @@ -193,22 +209,22 @@ void MEDPARTITIONERTest::verifyMedpartitionerOnSmallSizeForFieldOnCells() meshes.push_back(refusedCellMesh); MEDCouplingUMesh* fusedCell=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr); CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), fusedCell->getNumberOfCells()); - + MEDCouplingFieldDouble* field1=MEDLoader::ReadFieldCell(fileName.c_str(),initialMesh->getName().c_str(),0,"VectorFieldOnCells",0,1); MEDCouplingFieldDouble* field2=MEDLoader::ReadFieldCell(refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"VectorFieldOnCells",0,1); - + int nbcells=corr[1]->getNumberOfTuples(); CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells); //use corr to test equality of field DataArrayDouble* f1=field1->getArray(); DataArrayDouble* f2=field2->getArray(); - if (_verbose>300) + if (_verbose>300) { cout<<"\nf1 : "<reprZip(); cout<<"\nf2 : "<reprZip(); //field2->advancedRepradvancedRepr(); for (std::size_t i = 0; i < corr.size(); i++) cout << "\ncorr " << i << " : " << corr[i]->reprZip(); - + } int nbequal=0; int nbcomp=field1->getNumberOfComponents(); @@ -226,7 +242,7 @@ void MEDPARTITIONERTest::verifyMedpartitionerOnSmallSizeForFieldOnCells() } } CPPUNIT_ASSERT_EQUAL(nbcells*nbcomp, nbequal); - + for (std::size_t i = 0; i < corr.size(); i++) corr[i]->decrRef(); field1->decrRef(); @@ -240,14 +256,13 @@ void MEDPARTITIONERTest::verifyMedpartitionerOnSmallSizeForFieldOnGaussNe() { int res; string fileName,cmd,execName,sourceName,targetName,input; - execName=getenv("MED_ROOT_DIR"); //.../INSTALL/MED - execName+="/bin/salome/medpartitioner_para"; + execName=getPartitionerParaExe(); fileName=_file_name; fileName.replace(fileName.find(".med"),4,"_WithVecFieldOnGaussNe.med"); - + ParaMEDMEM::MEDFileUMesh* initialMesh=ParaMEDMEM::MEDFileUMesh::New(fileName.c_str(),_mesh_name.c_str()); ParaMEDMEM::MEDCouplingUMesh* cellMesh=initialMesh->getLevel0Mesh(false); - + cmd="mpirun -np 5 "+execName+" --ndomains=5 --split-method=metis"; //on same proc sourceName=fileName; targetName=fileName; @@ -257,7 +272,7 @@ void MEDPARTITIONERTest::verifyMedpartitionerOnSmallSizeForFieldOnGaussNe() res=system(cmd.c_str()); CPPUNIT_ASSERT_EQUAL(0, res); input=targetName+".xml"; - + //merge split meshes and test equality cmd="mpirun -np 1 "+execName+" --ndomains=1 --split-method=metis"; //on same proc sourceName=targetName+".xml"; @@ -267,13 +282,13 @@ void MEDPARTITIONERTest::verifyMedpartitionerOnSmallSizeForFieldOnGaussNe() if (_verbose) cout<getLevel0Mesh(false); - + CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), refusedCellMesh->getNumberOfCells()); - + std::vector meshes; std::vector corr; meshes.push_back(cellMesh); @@ -281,22 +296,22 @@ void MEDPARTITIONERTest::verifyMedpartitionerOnSmallSizeForFieldOnGaussNe() meshes.push_back(refusedCellMesh); MEDCouplingUMesh* fusedCell=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr); CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), fusedCell->getNumberOfCells()); - + MEDCouplingFieldDouble* field1=MEDLoader::ReadField(ON_GAUSS_NE,fileName.c_str(),initialMesh->getName().c_str(),0,"MyFieldOnGaussNE",5,6); MEDCouplingFieldDouble* field2=MEDLoader::ReadField(ON_GAUSS_NE,refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"MyFieldOnGaussNE",5,6); - + int nbcells=corr[1]->getNumberOfTuples(); CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells); //use corr to test equality of field DataArrayDouble* f1=field1->getArray(); DataArrayDouble* f2=field2->getArray(); - if (_verbose>300) + if (_verbose>300) { cout << "\nf1 : " << f1->reprZip(); //123.4 for 12th cell,3rd component, 4th gausspoint cout << "\nf2 : " << f2->reprZip(); //field2->advancedRepradvancedRepr(); for (std::size_t i = 0; i < corr.size(); i++) cout << "\ncorr " << i << " : " << corr[i]->reprZip(); - + } int nbequal=0; int nbptgauss=8; @@ -315,7 +330,7 @@ void MEDPARTITIONERTest::verifyMedpartitionerOnSmallSizeForFieldOnGaussNe() } } CPPUNIT_ASSERT_EQUAL(nbcells*nbcomp*nbptgauss, nbequal); - + for (std::size_t i = 0; i < corr.size(); i++) corr[i]->decrRef(); field1->decrRef(); @@ -327,8 +342,8 @@ void MEDPARTITIONERTest::verifyMedpartitionerOnSmallSizeForFieldOnGaussNe() void MEDPARTITIONERTest::launchMedpartitionerOnTestMeshes() { - - /* examples + + /* examples export INFI=/home/vb144235/resources/blade.med //no need export MESH=Fuse_1 export INFI=tmp_testMeshxxx.med @@ -339,17 +354,16 @@ void MEDPARTITIONERTest::launchMedpartitionerOnTestMeshes() */ int res; string cmd,execName,sourceName,targetName; - + res=system("which mpirun 2>/dev/null 1>/dev/null"); //no trace CPPUNIT_ASSERT_EQUAL(0, res); - - execName=getenv("MED_ROOT_DIR"); //.../INSTALL/MED - execName+="/bin/salome/medpartitioner_para"; - + + execName=getPartitionerParaExe(); + cmd="which "+execName+" 2>/dev/null 1>/dev/null"; //no trace res=system(cmd.c_str()); CPPUNIT_ASSERT_EQUAL(0, res); - + cmd="mpirun -np 2 "+execName+" --ndomains=2 --split-method=metis"; //on same proc sourceName=_file_name; targetName=_file_name; @@ -358,7 +372,7 @@ void MEDPARTITIONERTest::launchMedpartitionerOnTestMeshes() if (_verbose) cout<