From: Anthony Geay Date: Wed, 13 Dec 2017 13:31:02 +0000 (+0100) Subject: ParaMEDMEM python revival X-Git-Tag: V9_0_0~26 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0341996e5b1f5d46da40d510003bef6607cd37f3;p=tools%2Fmedcoupling.git ParaMEDMEM python revival --- diff --git a/src/ParaMEDMEM_Swig/CMakeLists.txt b/src/ParaMEDMEM_Swig/CMakeLists.txt index c09fdd220..17c86d796 100644 --- a/src/ParaMEDMEM_Swig/CMakeLists.txt +++ b/src/ParaMEDMEM_Swig/CMakeLists.txt @@ -58,7 +58,8 @@ SWIG_CHECK_GENERATION(ParaMEDMEM) INSTALL(TARGETS _ParaMEDMEM DESTINATION ${MEDCOUPLING_INSTALL_PYTHON}) INSTALL(FILES ParaMEDMEM.i DESTINATION ${MEDCOUPLING_INSTALL_HEADERS}) -INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/ParaMEDMEM.py test_InterpKernelDEC.py test_NonCoincidentDEC.py test_StructuredCoincidentDEC.py DESTINATION ${MEDCOUPLING_INSTALL_SCRIPT_PYTHON}) +INSTALL(FILES test_InterpKernelDEC.py test_NonCoincidentDEC.py test_StructuredCoincidentDEC.py DESTINATION ${MEDCOUPLING_INSTALL_SCRIPT_PYTHON}) +SALOME_INSTALL_SCRIPTS(${CMAKE_CURRENT_BINARY_DIR}/ParaMEDMEM.py ${MEDCOUPLING_INSTALL_PYTHON}) SALOME_INSTALL_SCRIPTS(${CMAKE_CURRENT_BINARY_DIR}/ParaMEDMEM.py ${MEDCOUPLING_INSTALL_SCRIPT_PYTHON}) INSTALL(FILES test_InterpKernelDEC.py test_NonCoincidentDEC.py test_StructuredCoincidentDEC.py DESTINATION ${MEDCOUPLING_INSTALL_SCRIPT_PYTHON}) diff --git a/src/ParaMEDMEM_Swig/ParaMEDMEM.i b/src/ParaMEDMEM_Swig/ParaMEDMEM.i index a1168109f..da9810e8a 100644 --- a/src/ParaMEDMEM_Swig/ParaMEDMEM.i +++ b/src/ParaMEDMEM_Swig/ParaMEDMEM.i @@ -19,6 +19,9 @@ %module ParaMEDMEM +#define MEDCOUPLING_EXPORT +#define INTERPKERNEL_EXPORT + %include "ParaMEDMEM.typemap" %include "MEDCouplingCommon.i" @@ -38,12 +41,14 @@ #include +using namespace INTERP_KERNEL; using namespace MEDCoupling; using namespace ICoCo; enum mpi_constants { mpi_comm_world, mpi_comm_self, mpi_double, mpi_int }; %} +%include "InterpolationOptions.hxx" %include "CommInterface.hxx" %include "ProcessorGroup.hxx" %include "DECOptions.hxx" @@ -52,9 +57,11 @@ enum mpi_constants { mpi_comm_world, mpi_comm_self, mpi_double, mpi_int }; %include "MPIProcessorGroup.hxx" %include "ComponentTopology.hxx" %include "DEC.hxx" +%include "DisjointDEC.hxx" %include "InterpKernelDEC.hxx" %include "StructuredCoincidentDEC.hxx" +%include "ICoCoField.hxx" %rename(ICoCoMEDField) ICoCo::MEDField; %include "ICoCoMEDField.hxx" diff --git a/src/ParaMEDMEM_Swig/test_InterpKernelDEC.py b/src/ParaMEDMEM_Swig/test_InterpKernelDEC.py index 056fd751f..8a42cc357 100755 --- a/src/ParaMEDMEM_Swig/test_InterpKernelDEC.py +++ b/src/ParaMEDMEM_Swig/test_InterpKernelDEC.py @@ -20,15 +20,17 @@ # from ParaMEDMEM import * +from MEDLoader import ReadUMeshFromFile import sys, os import unittest import math +from mpi4py import MPI + class ParaMEDMEMBasicsTest(unittest.TestCase): def testInterpKernelDEC_2D(self): - MPI_Init(sys.argv) - size = MPI_Comm_size(MPI_COMM_WORLD) - rank = MPI_Comm_rank(MPI_COMM_WORLD) + size = MPI.COMM_WORLD.size + rank = MPI.COMM_WORLD.rank if size != 5: raise RuntimeError("Expect MPI_COMM_WORLD size == 5") print(rank) @@ -68,8 +70,7 @@ class ParaMEDMEMBasicsTest(unittest.TestCase): nb_local=mesh.getNumberOfCells() value = [1.0]*nb_local parafield.getField().setValues(value) - icocofield = ICoCoMEDField(mesh,parafield.getField()) - dec.setMethod("P0") + icocofield = ICoCoMEDField(parafield.getField()) dec.attachLocalField(icocofield) pass else: @@ -83,8 +84,7 @@ class ParaMEDMEMBasicsTest(unittest.TestCase): nb_local=mesh.getNumberOfCells() value = [0.0]*nb_local parafield.getField().setValues(value) - icocofield = ICoCoMEDField(mesh,parafield.getField()) - dec.setMethod("P0") + icocofield = ICoCoMEDField(parafield.getField()) dec.attachLocalField(icocofield) pass