import Generator.PyTree as G import Converter.Mpi as Cmpi import KCore.test as test LOCAL = test.getLocal() # Cree le fichier test HDF if Cmpi.rank == 0: a = G.cart((0, 0, 0), (1, 1, 1), (10, 10, 10)) b = G.cart((12, 0, 0), (1, 1, 1), (10, 10, 10)) t = C.newPyTree(['Base', a, b]) C.convertPyTree2File(t, LOCAL + '/test.hdf') Cmpi.barrier() # Relit des zones par procs t = Cmpi.convertFile2SkeletonTree(LOCAL + '/test.hdf') (t, dic) = Distributor2.distribute(t, NProc=2, algorithm='fast') t = Cmpi.readZones(t, LOCAL + '/test.hdf', rank=Cmpi.rank) if Cmpi.rank == 0: test.testT(t, 1) # Cree le fichier test ADF if Cmpi.rank == 0: a = G.cart((0, 0, 0), (1, 1, 1), (10, 10, 10)) b = G.cart((12, 0, 0), (1, 1, 1), (10, 10, 10)) t = C.newPyTree(['Base', a, b]) C.convertPyTree2File(t, LOCAL + '/test.adf') Cmpi.barrier() # Relit des zones par procs t = Cmpi.convertFile2SkeletonTree(LOCAL + '/test.adf') (t, dic) = Distributor2.distribute(t, NProc=2, algorithm='fast')
# - getProcDict (pyTree) - import Converter.PyTree as C import Converter.Internal as Internal import Converter.Mpi as Cmpi import Distributor2.PyTree as Distributor2 import Generator.PyTree as G import KCore.test as test # Cree le fichier test if Cmpi.rank == 0: a = G.cart((0,0,0), (1,1,1), (10,10,10)) b = G.cart((12,0,0), (1,1,1), (10,10,10)) t = C.newPyTree(['Base',a,b]) C.convertPyTree2File(t, 'in.cgns') Cmpi.barrier() # Relit des zones par procs t = Cmpi.convertFile2SkeletonTree('in.cgns') (t, dic) = Distributor2.distribute(t, NProc=2, algorithm='fast') procDict = Cmpi.getProcDict(t) if Cmpi.rank == 0: print procDict #>> {'cart.0': 1, 'cart': 0}
# - convert2PartialTree (pyTree) - import Converter.PyTree as C import Converter.Mpi as Cmpi import Distributor2.PyTree as Distributor2 import Generator.PyTree as G # Cree le fichier test if Cmpi.rank == 0: a = G.cart((0,0,0), (1,1,1), (10,10,10)) b = G.cart((12,0,0), (1,1,1), (10,10,10)) t = C.newPyTree(['Base',a,b]) C.convertPyTree2File(t, 'test.cgns') Cmpi.barrier() # Relit des zones par procs t = Cmpi.convertFile2SkeletonTree('test.cgns') (t, dic) = Distributor2.distribute(t, NProc=Cmpi.size, algorithm='fast') t = Cmpi.readZones(t, 'test.cgns', proc=Cmpi.rank) # Arbre partiel (sans zones squelettes) t = Cmpi.convert2PartialTree(t) if Cmpi.rank == 0: C.convertPyTree2File(t, 'out.cgns')
# - createBBoxTree (pyTree) - import Converter.PyTree as C import Converter.Mpi as Cmpi import Distributor2.PyTree as Distributor2 import Generator.PyTree as G import KCore.test as test LOCAL = test.getLocal() # Cree le fichier test if Cmpi.rank == 0: a = G.cart((0,0,0), (1,1,1), (10,10,10)) b = G.cart((12,0,0), (1,1,1), (10,10,10)) t = C.newPyTree(['Base',a,b]) C.convertPyTree2File(t, LOCAL+'/in.cgns') Cmpi.barrier() # Relit des zones par procs t = Cmpi.convertFile2SkeletonTree(LOCAL+'/in.cgns') (t, dic) = Distributor2.distribute(t, NProc=Cmpi.size, algorithm='fast') t = Cmpi.readZones(t, LOCAL+'/in.cgns', rank=Cmpi.rank) # Cree le bbox tree a partir du squelette charge tb = Cmpi.createBBoxTree(t) if Cmpi.rank == 0: test.testT(tb, 1) # Cree le bbox a partir d'un arbre partiel t = Cmpi.convert2PartialTree(t) tb = Cmpi.createBBoxTree(t) if Cmpi.rank == 0: test.testT(tb, 2)
#!/usr/bin/env python # coding: utf-8 r"""<TBC>""" # - Calcul d'isosurfaces a la paroi en distribue - import Converter.PyTree as C import Distributor2.PyTree as Distributor2 import Converter.Mpi as Cmpi import Transform.PyTree as T import Post.PyTree as P rank = Cmpi.rank size = Cmpi.size # lecture du squelette a = Cmpi.convertFile2SkeletonTree('cart.cgns') # equilibrage (a, dic) = Distributor2.distribute(a, NProc=size, algorithm='fast', useCom=0) # load des zones locales dans le squelette a = Cmpi.readZones(a, 'cart.cgns', proc=rank) # Passage en arbre partiel a = Cmpi.convert2PartialTree(a) # Calcul de l'iso surface isos = P.isoSurfMC(a, 'F', 0.3) isos = Cmpi.setProc(isos, rank) # affecte les isos au proc local t = C.newPyTree(['Base']) t[2][1][2] += isos
import Converter.PyTree as C import Distributor2.PyTree as Distributor2 import Generator.PyTree as G import Converter.Mpi as Cmpi import KCore.test as test # Cree le fichier test HDF if Cmpi.rank == 0: a = G.cart((0, 0, 0), (1, 1, 1), (10, 10, 10)) b = G.cart((12, 0, 0), (1, 1, 1), (10, 10, 10)) t = C.newPyTree(['Base', a, b]) C.convertPyTree2File(t, 'test.hdf') Cmpi.barrier() # Relit des zones par procs t = Cmpi.convertFile2SkeletonTree('test.hdf') (t, dic) = Distributor2.distribute(t, NProc=2, algorithm='fast') t = Cmpi.readZones(t, 'test.hdf', proc=Cmpi.rank) if Cmpi.rank == 0: test.testT(t, 1) # Cree le fichier test ADF if Cmpi.rank == 0: a = G.cart((0, 0, 0), (1, 1, 1), (10, 10, 10)) b = G.cart((12, 0, 0), (1, 1, 1), (10, 10, 10)) t = C.newPyTree(['Base', a, b]) C.convertPyTree2File(t, 'test.adf') Cmpi.barrier() # Relit des zones par procs t = Cmpi.convertFile2SkeletonTree('test.adf') (t, dic) = Distributor2.distribute(t, NProc=2, algorithm='fast')
# - ExtractMesh distribue - import Converter.PyTree as C import Distributor2.PyTree as Distributor2 import Converter.Mpi as Cmpi import Transform.PyTree as T import Post.Mpi as Pmpi import Converter.Internal as Internal rank = Cmpi.rank size = Cmpi.size # Maillage d'extraction (distribue) FILE = 'receiver.cgns' e = Cmpi.convertFile2SkeletonTree(FILE) (e, dic) = Distributor2.distribute(e, NProc=size, algorithm='fast', useCom=0) e = Cmpi.readZones(e, FILE, rank=rank) # Maillage source (distribue) FILE = 'donor.cgns' a = Cmpi.convertFile2SkeletonTree(FILE) (a, dic) = Distributor2.distribute(a, NProc=size, algorithm='fast', useCom=0) a = Cmpi.readZones(a, FILE, rank=rank) # Extract mesh e = Pmpi.extractMesh(a, e) # Reconstruit l'arbre complet a l'ecriture Cmpi.convertPyTree2File(e, 'out.cgns')