# - getProcDict (pyTree) -
import Generator.PyTree as G
import Distributor2.PyTree as D2
import Converter.PyTree as C
import Connector.PyTree as X
import KCore.test as test

N = 11
t = C.newPyTree(['Base'])
pos = 0
for i in xrange(N):
    a = G.cart( (pos,0,0), (1,1,1), (10+i, 10, 10) )
    pos += 10 + i - 1
    t[2][1][2].append(a)

t = X.connectMatch(t)
t, stats = D2.distribute(t, 3)

proc = D2.getProcDict(t)
test.testO(proc, 1)

proc = D2.getProcDict(t, prefixByBase=True)
test.testO(proc, 2)
Esempio n. 2
0
t = X.connectMatch(t)
t, stats = D2.distribute(t, NProc=5, algorithm='fast', useCom=0)
if Cmpi.rank == 0: C.convertPyTree2File(t, LOCAL + '/in.cgns')
Cmpi.barrier()

# full
graph = Cmpi.computeGraph(t, type='match')
if Cmpi.rank == 0: test.testO(graph, 1)

# skel (doit etre identique)
t = Cmpi.convertFile2SkeletonTree(LOCAL + '/in.cgns')
graph = Cmpi.computeGraph(t, type='match')
if Cmpi.rank == 0: test.testO(graph, 2)

# load skel (doit etre identique)
t = Cmpi.convertFile2SkeletonTree(LOCAL + '/in.cgns')
t = Cmpi.readZones(t, LOCAL + '/in.cgns', rank=Cmpi.rank)
graph = Cmpi.computeGraph(t, type='match')
if Cmpi.rank == 0: test.testO(graph, 3)

# partial (doit etre identique)
t = Cmpi.convertFile2SkeletonTree(LOCAL + '/in.cgns')
procDict = D2.getProcDict(t)
t = Cmpi.readZones(t, LOCAL + '/in.cgns', rank=Cmpi.rank)
t = Cmpi.convert2PartialTree(t)
# procDict est requis pour les arbres partiels
# Le graph est correct uniquement quand on lance sur 5 procs
graph = Cmpi.computeGraph(t, type='match', procDict=procDict)
if Cmpi.rank == 0:
    test.testO(graph, 4)