Back to index

salome-med  6.5.0
Public Member Functions
test_InterpKernelDEC.ParaMEDMEMBasicsTest Class Reference

List of all members.

Public Member Functions

def testInterpKernelDEC_2D

Detailed Description

Definition at line 27 of file test_InterpKernelDEC.py.


Member Function Documentation

Definition at line 28 of file test_InterpKernelDEC.py.

00028 
00029     def testInterpKernelDEC_2D(self):
00030         MPI_Init(sys.argv)
00031         size = MPI_Comm_size(MPI_COMM_WORLD)
00032         rank = MPI_Comm_rank(MPI_COMM_WORLD)
00033         if size != 5:
00034             raise RuntimeError, "Expect MPI_COMM_WORLD size == 5"
00035         print rank
00036         nproc_source = 3
00037         procs_source = range( nproc_source )
00038         procs_target = range( size - nproc_source + 1, size)
00039         
00040         interface = CommInterface()
00041         target_group = MPIProcessorGroup(interface, procs_target)
00042         source_group = MPIProcessorGroup(interface, procs_source)
00043         dec = InterpKernelDEC(source_group, target_group)
00044         
00045         mesh       =0
00046         support    =0
00047         paramesh   =0
00048         parafield  =0
00049         icocofield =0
00050         data_dir = os.environ['MED_ROOT_DIR']
00051         tmp_dir  = os.environ['TMP']
00052         
00053         if not tmp_dir or len(tmp_dir)==0:
00054             tmp_dir = "/tmp"
00055             pass
00056         
00057         filename_xml1 = os.path.join(data_dir, "share/salome/resources/med/square1_split")
00058         filename_xml2 = os.path.join(data_dir, "share/salome/resources/med/square2_split")
00059         
00060         MPI_Barrier(MPI_COMM_WORLD)
00061         if source_group.containsMyRank():
00062             filename = filename_xml1 + str(rank+1) + ".med"
00063             meshname = "Mesh_2_" + str(rank+1)
00064             mesh=MEDLoader.ReadUMeshFromFile(filename,meshname,0)
00065             paramesh=ParaMESH(mesh,source_group,"source mesh")
00066             comptopo = ComponentTopology()
00067             parafield = ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo)
00068             parafield.getField().setNature(ConservativeVolumic)
00069             nb_local=mesh.getNumberOfCells()
00070             value = [1.0]*nb_local
00071             parafield.getField().setValues(value)
00072             icocofield = ICoCoMEDField(mesh,parafield.getField())
00073             dec.setMethod("P0")
00074             dec.attachLocalField(icocofield)
00075             pass
00076         else:
00077             filename = filename_xml2 + str(rank - nproc_source + 1) + ".med"
00078             meshname = "Mesh_3_" + str(rank - nproc_source + 1)
00079             mesh=MEDLoader.ReadUMeshFromFile(filename,meshname,0)
00080             paramesh=ParaMESH(mesh,target_group,"target mesh")
00081             comptopo = ComponentTopology()
00082             parafield = ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo)
00083             parafield.getField().setNature(ConservativeVolumic)
00084             nb_local=mesh.getNumberOfCells()
00085             value = [0.0]*nb_local
00086             parafield.getField().setValues(value)
00087             icocofield = ICoCoMEDField(mesh,parafield.getField())
00088             dec.setMethod("P0")
00089             dec.attachLocalField(icocofield)
00090             pass
00091         
00092         if source_group.containsMyRank():
00093             field_before_int = parafield.getVolumeIntegral(0,True)
00094             dec.synchronize()
00095             dec.setForcedRenormalization(False)
00096             dec.sendData()
00097             dec.recvData()
00098             field_after_int=parafield.getVolumeIntegral(0,True);
00099             self.failUnless(math.fabs(field_after_int-field_before_int)<1e-8)
00100             pass
00101         else:
00102             dec.synchronize()
00103             dec.setForcedRenormalization(False)
00104             dec.recvData()
00105             dec.sendData()
00106             pass
00107         ## end
00108         interface = 0
00109         target_group = 0
00110         source_group = 0
00111         dec = 0
00112         mesh       =0
00113         support    =0
00114         paramesh   =0
00115         parafield  =0
00116         icocofield =0
00117         MPI_Barrier(MPI_COMM_WORLD)
00118         MPI_Finalize()
        pass

Here is the call graph for this function:


The documentation for this class was generated from the following file: