| 1 |
from phactori import * |
| 2 |
|
| 3 |
def PrintMultiBlockStatsOneBlock(inCsdata, inMetaData, ioFlatIndexCounter): |
| 4 |
icsdClassname = inCsdata.GetClassName() |
| 5 |
myDebugPrint3("leaf block " + str(icsdClassname) + " index " + str(ioFlatIndexCounter[0]) + "\n") |
| 6 |
if icsdClassname == "vtkStructuredGrid": |
| 7 |
wholeExtent = inMetaData.Get(vtk.vtkStreamingDemandDrivenPipeline.WHOLE_EXTENT()) |
| 8 |
myDebugPrint3("this leaf is structured grid: " + str(ioFlatIndexCounter[0]) + "\n" |
| 9 |
"vtk.vtkStreamingDemandDrivenPipeline.WHOLE_EXTENT(): " + str(wholeExtent) + "\n" |
| 10 |
"B inCsdata.GetExtent(): " + str(inCsdata.GetExtent()) + "\n") |
| 11 |
|
| 12 |
def PrintMultiBlockStatsRecurse1(inCsdata, inMetaData, recursionLevel, ioFlatIndexCounter): |
| 13 |
myDebugPrint3("PrintMultiBlockStatsRecurse1 entered recursionLevel " + str(recursionLevel) + "\n") |
| 14 |
|
| 15 |
icsdClassname = inCsdata.GetClassName() |
| 16 |
myDebugPrint3("inCsdata.GetClassName() " + str(icsdClassname) + " ioFlatIndexCounter[0] " + str(ioFlatIndexCounter[0]) + "\n") |
| 17 |
myDebugPrint3("numpoints: " + str(inCsdata.GetNumberOfPoints()) + " numcells: " + str(inCsdata.GetNumberOfCells()) + "\n") |
| 18 |
vtkInfo1 = inCsdata.GetInformation() |
| 19 |
myDebugPrint3("vtkInfo1 (inCsdata.Getinformation()): " + str(vtkInfo1) + "\n") |
| 20 |
|
| 21 |
|
| 22 |
ioFlatIndexCounter[0] += 1 |
| 23 |
|
| 24 |
if icsdClassname == "vtkMultiBlockDataSet": |
| 25 |
thisIsLeaf = False |
| 26 |
nonLeafType = 0 |
| 27 |
elif icsdClassname == "vtkExodusIIMultiBlockDataSet": |
| 28 |
thisIsLeaf = False |
| 29 |
nonLeafType = 1 |
| 30 |
elif icsdClassname == "vtkMultiPieceDataSet": |
| 31 |
thisIsLeaf = False |
| 32 |
nonLeafType = 2 |
| 33 |
elif icsdClassname == "vtkPartitionedDataSet": |
| 34 |
thisIsLeaf = False |
| 35 |
nonLeafType = 3 |
| 36 |
else: |
| 37 |
thisIsLeaf = True |
| 38 |
nonLeafType = -1 |
| 39 |
|
| 40 |
myDebugPrint3("thisIsLeaf " + str(thisIsLeaf) + " nonLeafType " + str(nonLeafType) + "\n") |
| 41 |
if not thisIsLeaf: |
| 42 |
if nonLeafType == 2: |
| 43 |
numBlocks = inCsdata.GetNumberOfPieces() |
| 44 |
elif nonLeafType == 3: |
| 45 |
numBlocks = inCsdata.GetNumberOfPartitions() |
| 46 |
else: |
| 47 |
numBlocks = inCsdata.GetNumberOfBlocks() |
| 48 |
|
| 49 |
myDebugPrint3("recursing, flat index: " + \ |
| 50 |
str(ioFlatIndexCounter[0]) + \ |
| 51 |
" num blocks: " + \ |
| 52 |
str(numBlocks) + "\n") |
| 53 |
for ii in range(0, numBlocks): |
| 54 |
myDebugPrint3("doing sub block " + str(ii) + " of " + str(numBlocks) + "\n") |
| 55 |
if nonLeafType == 2: |
| 56 |
oneBlock = inCsdata.GetPiece(ii) |
| 57 |
elif nonLeafType == 3: |
| 58 |
oneBlock = inCsdata.GetPartition(ii) |
| 59 |
else: |
| 60 |
oneBlock = inCsdata.GetBlock(ii) |
| 61 |
oneBlockMetaData = inCsdata.GetMetaData(ii) |
| 62 |
myDebugPrint3("oneBlockMetaData: " + str(oneBlockMetaData) + "\n") |
| 63 |
#myDebugPrint3("name: " + \ |
| 64 |
# oneBlockMetaData.Get(vtk.vtkCompositeDataSet.NAME()) + "\n") |
| 65 |
if oneBlock != None: |
| 66 |
PrintMultiBlockStatsRecurse1(oneBlock, oneBlockMetaData, recursionLevel + 1, ioFlatIndexCounter) |
| 67 |
else: |
| 68 |
myDebugPrint3("this sub block is None, index " + str(ioFlatIndexCounter[0]) + "\n") |
| 69 |
ioFlatIndexCounter[0] += 1 |
| 70 |
else: |
| 71 |
PrintMultiBlockStatsOneBlock(inCsdata, inMetaData, ioFlatIndexCounter) |
| 72 |
|
| 73 |
myDebugPrint3("PrintMultiBlockStatsRecurse1 returning recursionLevel " + str(recursionLevel) + "\n") |
| 74 |
|
| 75 |
def RecursivelyPrintMultiBlockStats(inFilter): |
| 76 |
if PhactoriDbg(100) == False: |
| 77 |
return |
| 78 |
|
| 79 |
myDebugPrint3("RecursivelyPrintMultiBlockStats entered\n") |
| 80 |
csdata = inFilter.GetClientSideObject().GetOutputDataObject(0) |
| 81 |
|
| 82 |
vtkInfo1 = csdata.GetInformation() |
| 83 |
myDebugPrint3("top level vtkInfo1 (inCsdata.Getinformation()): " + str(vtkInfo1) + "\n") |
| 84 |
#csdata.CopyInformationToPipeline(vtkInfo1) |
| 85 |
#csdata.CopyInformationFromPipeline(vtkInfo1) |
| 86 |
|
| 87 |
flatIndexCounter = [0] |
| 88 |
recursionLevel = 0 |
| 89 |
PrintMultiBlockStatsRecurse1(csdata, None, recursionLevel, flatIndexCounter) |
| 90 |
|
| 91 |
myDebugPrint3("RecursivelyPrintMultiBlockStats returning\n") |
| 92 |
|