X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FParaMEDMEM_Swig%2Ftest_NonCoincidentDEC.py;h=5df6ca3637c1f32d548b20e19f7c939a509868b0;hb=c4551c56aa89896595842e5b41b048044681b4e8;hp=03e50b76236bde2ecc71cb298f60eb3becb3c884;hpb=48782c06022ca2caa36f849cb5a29ea4fe2aaa83;p=tools%2Fmedcoupling.git diff --git a/src/ParaMEDMEM_Swig/test_NonCoincidentDEC.py b/src/ParaMEDMEM_Swig/test_NonCoincidentDEC.py index 03e50b762..5df6ca363 100755 --- a/src/ParaMEDMEM_Swig/test_NonCoincidentDEC.py +++ b/src/ParaMEDMEM_Swig/test_NonCoincidentDEC.py @@ -1,23 +1,24 @@ #!/usr/bin/env python - -# Copyright (C) 2005 OPEN CASCADE, CEA, EDF R&D, LEG -# PRINCIPIA R&D, EADS CCR, Lip6, BV, CEDRAT +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2016 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. -# -# 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 +# 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 +# +# 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 -# +# + from ParaMEDMEM import * import sys, os @@ -26,11 +27,11 @@ MPI_Init(sys.argv) size = MPI_Comm_size(MPI_COMM_WORLD) rank = MPI_Comm_rank(MPI_COMM_WORLD) if size != 5: - raise RuntimeError, "Expect MPI_COMM_WORLD size == 5" + raise RuntimeError("Expect MPI_COMM_WORLD size == 5") nproc_source = 3 -procs_source = range( nproc_source ) -procs_target = range( size - nproc_source + 1, size) +procs_source = list(range(nproc_source)) +procs_target = list(range(size - nproc_source + 1, size)) interface = CommInterface() @@ -49,17 +50,17 @@ icocofield = 0 dec = NonCoincidentDEC(source_group, target_group) -data_dir = os.environ['MED_ROOT_DIR'] +data_dir = os.environ['MEDCOUPLING_ROOT_DIR'] tmp_dir = os.environ['TMP'] if tmp_dir == '': tmp_dir = "/tmp" pass -filename_xml1 = data_dir + "/share/salome/resources/med/square1_split" -filename_xml2 = data_dir + "/share/salome/resources/med/square2_split" +filename_xml1 = data_dir + "/share/resources/med/square1_split" +filename_xml2 = data_dir + "/share/resources/med/square2_split" MPI_Barrier(MPI_COMM_WORLD) - + if source_group.containsMyRank(): filename = filename_xml1 + str(rank+1) + ".med" @@ -113,12 +114,12 @@ if source_group.containsMyRank(): field_before_int = [parafield.getVolumeIntegral(1)] MPI_Bcast(field_before_int, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD); dec.synchronize() - print "DEC usage" + print("DEC usage") dec.setForcedRenormalization(False) dec.sendData() pass - + if target_group.containsMyRank(): MPI_Bcast(field_before_int, 1, MPI_DOUBLE, 0, MPI_COMM_WORLD) @@ -133,11 +134,11 @@ MPI_Bcast(field_after_int , 1, MPI_DOUBLE, size-1, MPI_COMM_WORLD) epsilon = 1e-6 if abs(field_before_int[0] - field_after_int[0]) > epsilon: - print "Field before is not equal field after: %s != %s"%\ - (field_before_int[0],field_after_int[0]) + print("Field before is not equal field after: %s != %s"%\ + (field_before_int[0],field_after_int[0])) pass MPI_Barrier(MPI_COMM_WORLD) MPI_Finalize() -print "# End of testNonCoincidentDEC" +print("# End of testNonCoincidentDEC")