@@ -523,6 +523,7 @@ def printStats(t, useCom='match', mode='nodes'):
523
523
# Efficient distribute
524
524
#==================================================================================
525
525
def _checkNcellsNptsPerProc (ts , NP , isAtCenter = False ):
526
+ ## Calculate and prints the number of cells & points for each proc. Provides a human-readable summary of the MPI distribution.
526
527
import Converter .Mpi as Cmpi
527
528
NPTS = numpy .zeros (NP , dtype = Internal .E_NpyInt )
528
529
NCELLS = numpy .zeros (NP , dtype = Internal .E_NpyInt )
@@ -552,6 +553,7 @@ def _checkNcellsNptsPerProc(ts, NP, isAtCenter=False):
552
553
553
554
554
555
def _write2pathLocal__ (tsLocal , tLocal ):
556
+ ##Modifies the .Solver#Param/proc only in the files
555
557
import Converter .Mpi as Cmpi
556
558
import Converter .Filter as Filter
557
559
paths = []; ns = []
@@ -564,31 +566,18 @@ def _write2pathLocal__(tsLocal, tLocal):
564
566
p = 'CGNSTree/%s/%s/.Solver#Param/proc' % (b [0 ],z [0 ])
565
567
paths .append (p ); ns .append (n )
566
568
Filter .writeNodesFromPaths (tLocal , paths , ns , maxDepth = 0 , mode = 1 )
567
-
568
-
569
- def _distributeSkeletonTree (tIn , tcIn , NP , algorithm = 'graph' , tc2In = None , useCom = 'ID' ):
570
- """Distribute t and tc PyTrees over NP processors. If t & tc are the file names this function efficient loads, distributes, and write the new distributed files. This approach is the recommended one.
571
- Usage: _distributeSkeletonTree(t, tc, NP, algorithm='graph', tc2In=None, useCom='all')"""
572
- import Converter .Mpi as Cmpi
573
-
574
- if isinstance (tcIn , str ): tcs = Cmpi .convertFile2SkeletonTree (tcIn , maxDepth = 3 )
575
- else : tcs = tcIn
576
-
577
- if isinstance (tIn , str ): ts = Cmpi .convertFile2SkeletonTree (tIn , maxDepth = 3 )
578
- else : ts = tIn
579
-
580
- stats = _distribute (tcs , NP , algorithm = algorithm , useCom = useCom )
581
- _copyDistribution (ts , tcs )
582
-
583
- if isinstance (tcIn , str ): _write2pathLocal__ (tcs , tcIn )
584
- if isinstance (tIn , str ): _write2pathLocal__ (ts , tIn )
585
-
586
- if tc2In is not None :
587
- if isinstance (tc2In , str ): tc2s = Cmpi .convertFile2SkeletonTree (tc2In , maxDepth = 3 )
588
- else : tc2s = tc2In
589
- _copyDistribution (tc2s , tcs )
590
-
591
- if isinstance (tc2In , str ): _write2pathLocal__ (tc2s , tc2In )
592
-
593
- _checkNcellsNptsPerProc (ts ,NP )
569
+
570
+
571
+ def _distributeSkeletonTree (tIn , NP , algorithm = 'graph' , useCom = 'ID' ):
572
+ """Distribute PyTrees over NP processors. t is a list with the file names.
573
+ Usage: _distributeSkeletonTree(t=[], NP, algorithm='graph', useCom='all')"""
574
+ import Converter .Mpi as Cmpi
575
+ fileNameLength = len (tIn )
576
+ for fileName in tIn :
577
+ ts = Cmpi .convertFile2SkeletonTree (fileName , maxDepth = 3 )
578
+ stats = _distribute (ts , NP , algorithm = algorithm , useCom = useCom )
579
+ _write2pathLocal__ (ts , fileName )
580
+ if fileName == tIn [0 ]: tcs = Internal .copyTree (ts )
581
+ if fileNameLength > 1 and fileName != tIn [0 ]: _copyDistribution (ts , tcs )
582
+ _checkNcellsNptsPerProc (tcs ,NP )
594
583
return None
0 commit comments