def _addXZones(t, graph, variables=None, cartesian=False): if graph == {}: return t reqs = [] if rank in graph: g = graph[rank] # graph du proc courant for oppNode in g: # Envoie les zones necessaires au noeud oppose #print '%d: On envoie a %d: %s'%(rank,oppNode,g[oppNode]) names = g[oppNode] data = [] # data est une liste de zones for n in names: zone = Internal.getNodeFromName2(t, n) if variables is not None: v = C.getVarNames(zone, excludeXYZ=True)[0] for i in variables: v.remove(i) zonep = C.rmVars(zone, v) if cartesian: Compressor._compressCartesian(zonep) data.append(zonep) else: if cartesian: zonep = Compressor._compressCartesian(zonep) data.append(zonep) else: data.append(zone) s = KCOMM.isend(data, dest=oppNode) reqs.append(s) # Reception for node in graph: #print rank, graph[node].keys() if rank in graph[node]: #print '%d: On doit recevoir de %d: %s'%(rank,node,graph[node][rank]) data = KCOMM.recv(source=node) for z in data: # data est une liste de zones if cartesian: Compressor._uncompressCartesian(z) #print '%d: recoit la zone %s.'%(rank,z[0]) # tag z Internal.createChild(z, 'XZone', 'UserDefinedData_t') # Existe deja? zone = Internal.getNodeFromName2(t, z[0]) if zone is not None: # replace bases = Internal.getBases(t) for b in bases: c = Internal.getNodePosition(zone, b) if c != -1: b[2][c] = z else: # append to first base bases = Internal.getBases(t) bases[0][2].append(z) MPI.Request.Waitall(reqs) return t
# - compressCartesian (pyTree) - import Compressor.PyTree as Compressor import Generator.PyTree as G import Converter.Internal as Internal a = G.cart((0,0,0), (1,1,1), (10,10,10)) Compressor._compressCartesian(a) Internal.printTree(a)