X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FParaMEDMEM_Swig%2Ftest_StructuredCoincidentDEC.py;h=f110cae6f6e7b1b919f1ac79aab80ffb86d0200a;hb=8411b13fec372c7635bf04d2bb81a869dc038fdd;hp=f9d83202bae54eae8edc956fcd6912a70ca74dc0;hpb=fb512e2b77325290aaa2b4c9fd8f22d5949b6369;p=tools%2Fmedcoupling.git diff --git a/src/ParaMEDMEM_Swig/test_StructuredCoincidentDEC.py b/src/ParaMEDMEM_Swig/test_StructuredCoincidentDEC.py index f9d83202b..f110cae6f 100755 --- a/src/ParaMEDMEM_Swig/test_StructuredCoincidentDEC.py +++ b/src/ParaMEDMEM_Swig/test_StructuredCoincidentDEC.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2014 CEA/DEN, EDF R&D +# Copyright (C) 2007-2020 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 @@ -32,7 +32,7 @@ class ParaMEDMEMBasicsTest2(unittest.TestCase): rank = MPI_Comm_rank(MPI_COMM_WORLD) # if size < 4: - raise RuntimeError, "Expect MPI_COMM_WORLD size >= 4" + raise RuntimeError("Expect MPI_COMM_WORLD size >= 4") # interface = CommInterface() # @@ -47,27 +47,27 @@ class ParaMEDMEMBasicsTest2(unittest.TestCase): comptopo = 0 icocofield= 0 # - 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_2 = data_dir + "/share/salome/resources/med/square1.med" + + filename_xml1 = data_dir + "/share/resources/med/square1_split" + filename_2 = data_dir + "/share/resources/med/square1.med" filename_seq_wr = tmp_dir + "/" filename_seq_med = tmp_dir + "/myWrField_seq_pointe221.med" - + dec = StructuredCoincidentDEC(source_group, target_group) MPI_Barrier(MPI_COMM_WORLD) if source_group.containsMyRank(): filename = filename_xml1 + str(rank+1) + ".med" meshname = "Mesh_2_" + str(rank+1) - mesh=MEDLoader.ReadUMeshFromFile(filename,meshname,0) + mesh=ReadUMeshFromFile(filename,meshname,0) paramesh=ParaMESH(mesh,source_group,"source mesh") comptopo=ComponentTopology(6) parafield=ParaFIELD(ON_CELLS,NO_TIME,paramesh,comptopo) - parafield.getField().setNature(ConservativeVolumic) + parafield.getField().setNature(IntensiveMaximum) nb_local=mesh.getNumberOfCells() global_numbering=paramesh.getGlobalNumberingCell2() value = [] @@ -78,19 +78,19 @@ class ParaMEDMEMBasicsTest2(unittest.TestCase): pass parafield.getField().setValues(value) icocofield = ICoCoMEDField(mesh,parafield.getField()) - dec.setMethod("P0") - dec.attachLocalField(parafield) + dec.setMethod("P0") + dec.attachLocalField(parafield) dec.synchronize() dec.sendData() pass if target_group.containsMyRank(): meshname2 = "Mesh_2" - mesh=MEDLoader.ReadUMeshFromFile(filename_2, meshname2,0) + mesh=ReadUMeshFromFile(filename_2, meshname2,0) paramesh=ParaMESH(mesh, self_group, "target mesh") comptopo=ComponentTopology(6,target_group) parafield=ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo) - parafield.getField().setNature(ConservativeVolumic) + parafield.getField().setNature(IntensiveMaximum) nb_local=mesh.getNumberOfCells() value = [0.0]*(nb_local*comptopo.nbLocalComponents()) parafield.getField().setValues(value) @@ -103,7 +103,7 @@ class ParaMEDMEMBasicsTest2(unittest.TestCase): for i in range(nb_local): first=comptopo.firstLocalComponent() for icomp in range(comptopo.nbLocalComponents()): - self.failUnless(math.fabs(recv_value[i*comptopo.nbLocalComponents()+icomp]- + self.assertTrue(math.fabs(recv_value[i*comptopo.nbLocalComponents()+icomp]- (float)(i*6+icomp+first))<1e-12) pass pass @@ -121,8 +121,8 @@ class ParaMEDMEMBasicsTest2(unittest.TestCase): source_group = 0 MPI_Barrier(MPI_COMM_WORLD) MPI_Finalize() - print "End of test StructuredCoincidentDEC" + print("End of test StructuredCoincidentDEC") pass - + unittest.main()