Debian Codegraph @

packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriExtractStructuredMultiBlock.py

raw
1 # Copyright(C) 1999-2020, 2024 National Technology & Engineering Solutions
2 # of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
3 # NTESS, the U.S. Government retains certain rights in this software.
4 #
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are
7 # met:
8 #
9 # * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 #
12 # * Redistributions in binary form must reproduce the above
13 # copyright notice, this list of conditions and the following
14 # disclaimer in the documentation and/or other materials provided
15 # with the distribution.
16 #
17 # * Neither the name of NTESS nor the names of its
18 # contributors may be used to endorse or promote products derived
19 # from this software without specific prior written permission.
20 #
21 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
33 from phactori import *
34 from paraview.simple import *
35
36 #phactori_combine_to_single_python_file_subpiece_begin_1
37
38 global gStructuredGridFound
39 gStructuredGridFound = None
40 global gStructuredGridFoundExtent
41 gStructuredGridFoundExtent = None
42
43 def FigureBlockIndicesFromBlockListOneBlock(includeIndexList, includeBlockList,
44 inMetaData, ioFlatIndexCounter, inCsdata, inForceSetting):
45 """determine if this one block should have it's flat index tripped on for
46 the extract block filter (leaf item of recursion)"""
47 if PhactoriDbg(100):
48 myDebugPrint3("FigureBlockIndicesFromBlockListOneBlock entered\n"
49 "ioFlatIndexCounter " + str(ioFlatIndexCounter,) + " inForceSetting " + str(inForceSetting) + "\n"
50 "2 inMetaData: " + str(inMetaData) + "\n")
51
52 if inMetaData == None:
53 thisBlockName = None
54 else:
55 thisBlockName = inMetaData.Get(vtk.vtkCompositeDataSet.NAME())
56
57 if (thisBlockName == None) and (inForceSetting != 1):
58 if PhactoriDbg(100):
59 myDebugPrint3("block with no name " + \
60 " not in include list, not + to mBlockIndices (flat index " + \
61 str(ioFlatIndexCounter[0] - 1) + ")\n")
62 elif (inForceSetting == 1) or (thisBlockName in includeBlockList):
63 includeIndexList.append(int(ioFlatIndexCounter[0]) - 1)
64 blockClassName = inCsdata.GetClassName()
65 if blockClassName == "vtkStructuredGrid":
66 global gStructuredGridFound
67 gStructuredGridFound = inCsdata
68 global gStructuredGridFoundExtent
69 gStructuredGridFoundExtent = inMetaData.Get(vtk.vtkStreamingDemandDrivenPipeline.WHOLE_EXTENT())
70 if PhactoriDbg(100):
71 myDebugPrint3("this leaf is structured grid: " + str(thisBlockName) + "\n"
72 "vtk.vtkStreamingDemandDrivenPipeline.WHOLE_EXTENT(): " + str(gStructuredGridFoundExtent) + "\n"
73 "A inCsdata.GetExtent(): " + str(inCsdata.GetExtent()) + "\n")
74 #global gDuplicateNameCounter
75 #if thisBlockName in gDuplicateNameCounter:
76 # oldCount = gDuplicateNameCounter[thisBlockName]
77 # gDuplicateNameCounter[thisBlockName] = oldCount+1
78 #else:
79 # gDuplicateNameCounter[thisBlockName] = 1
80 if PhactoriDbg(100):
81 myDebugPrint3("block " + str(thisBlockName) + \
82 " in include list, + to mBlockIndices (flat index " + \
83 str(ioFlatIndexCounter[0] - 1) + ")\n")
84 else:
85 if PhactoriDbg(100):
86 myDebugPrint3("block " + str(thisBlockName) + \
87 " not in include list, not + to mBlockIndices (flat index " + \
88 str(ioFlatIndexCounter[0] - 1) + ")\n")
89
90 if PhactoriDbg(100):
91 myDebugPrint3("FigureBlockIndicesFromBlockListOneBlock returning\n")
92
93 def FigureBlockIndicesFromBlockListRecurse1(includeIndexList, includeBlockList,
94 inCsdata, inMetaData, ioFlatIndexCounter, inForceSetting):
95 """recursively go through multiblock dataset to determine flat indices
96 of blocks to be included; we are assuming only leaf blocks are
97 actually named"""
98
99 icsdClassname = inCsdata.GetClassName()
100
101 if PhactoriDbg(100):
102 if inMetaData == None:
103 thisBlockName = None
104 else:
105 thisBlockName = inMetaData.Get(vtk.vtkCompositeDataSet.NAME())
106 myDebugPrint3("FigureBlockIndicesFromBlockListRecurse1 " + \
107 str(thisBlockName) + " index: " + str(int(ioFlatIndexCounter[0])) + \
108 " inForceSetting: " + str(inForceSetting) + " classname: " + \
109 str(icsdClassname) + "\n")
110
111 ioFlatIndexCounter[0] += 1
112
113 if icsdClassname == "vtkMultiBlockDataSet":
114 thisIsLeaf = False
115 nonLeafType = 0
116 elif icsdClassname == "vtkExodusIIMultiBlockDataSet":
117 thisIsLeaf = False
118 nonLeafType = 1
119 elif icsdClassname == "vtkMultiPieceDataSet":
120 thisIsLeaf = False
121 nonLeafType = 2
122 elif icsdClassname == "vtkPartitionedDataSet":
123 thisIsLeaf = False
124 nonLeafType = 3
125 else:
126 thisIsLeaf = True
127 nonLeafType = -1
128
129 if not thisIsLeaf:
130 if inForceSetting == 1:
131 includeIndexList.append(int(ioFlatIndexCounter[0]) - 1)
132 includeOrExcludeAllSubBlocks = 1
133 if PhactoriDbg(100):
134 myDebugPrint3("this non-leaf block added inForceSetting == 1\n")
135 elif inForceSetting == -1:
136 includeOrExcludeAllSubBlocks = -1
137 if PhactoriDbg(100):
138 myDebugPrint3("this non-leaf block not added inForceSetting == -1\n")
139 else:
140 includeOrExcludeAllSubBlocks = 0
141 #this is a non-leaf node, but we want to add it (or not) depending on
142 #the filter settings
143 if inMetaData == None:
144 thisBlockName = None
145 else:
146 thisBlockName = inMetaData.Get(vtk.vtkCompositeDataSet.NAME())
147
148 if (thisBlockName != None) and (thisBlockName in includeBlockList):
149 if PhactoriDbg(100):
150 myDebugPrint3("include list, append nonleaf " + str(thisBlockName) + \
151 " ndx " + str(int(ioFlatIndexCounter[0]) - 1) + "\n")
152 includeIndexList.append(int(ioFlatIndexCounter[0]) - 1)
153 includeOrExcludeAllSubBlocks = 1
154 if PhactoriDbg(100):
155 myDebugPrint3("includeOrExcludeAllSubBlocks set to 1\n")
156 else:
157 if PhactoriDbg(100):
158 myDebugPrint3("include list, exclude nonleaf " + str(thisBlockName) + \
159 " ndx " + str(int(ioFlatIndexCounter[0]) - 1) + "\n")
160
161 if nonLeafType == 2:
162 numBlocks = inCsdata.GetNumberOfPieces()
163 elif nonLeafType == 3:
164 numBlocks = inCsdata.GetNumberOfPartitions()
165 else:
166 numBlocks = inCsdata.GetNumberOfBlocks()
167
168 if PhactoriDbg(100):
169 myDebugPrint3("recursing, flat index: " + \
170 str(ioFlatIndexCounter[0]) + \
171 " num blocks: " + \
172 str(numBlocks) + "\n")
173 for ii in range(0, numBlocks):
174 if nonLeafType == 2:
175 oneBlock = inCsdata.GetPiece(ii)
176 elif nonLeafType == 3:
177 oneBlock = inCsdata.GetPartition(ii)
178 else:
179 oneBlock = inCsdata.GetBlock(ii)
180 oneBlockMetaData = inCsdata.GetMetaData(ii)
181 if PhactoriDbg(100):
182 myDebugPrint3("oneBlockMetaData: " + str(oneBlockMetaData) + "\n")
183 #myDebugPrint3("name: " + \
184 # oneBlockMetaData.Get(vtk.vtkCompositeDataSet.NAME()) + "\n")
185 if oneBlock != None:
186 if oneBlockMetaData != None:
187 theBlockName = oneBlockMetaData.Get(vtk.vtkCompositeDataSet.NAME())
188 if PhactoriDbg(100):
189 myDebugPrint3("name for block " + str(ii) + ": " + \
190 str(theBlockName) + "\n")
191 else:
192 if PhactoriDbg(100):
193 myDebugPrint3("block " + str(ii) + " meta data was None\n")
194 FigureBlockIndicesFromBlockListRecurse1(includeIndexList, includeBlockList,
195 oneBlock, oneBlockMetaData, ioFlatIndexCounter,
196 includeOrExcludeAllSubBlocks)
197 else:
198 #I think we need to count here to be okay with pruned stuff; maybe
199 #we need to set extract block to no pruning (?)
200 ioFlatIndexCounter[0] += 1
201 if includeOrExcludeAllSubBlocks == 1:
202 if PhactoriDbg(100):
203 myDebugPrint3("leaf block None index " + \
204 str(int(ioFlatIndexCounter[0]) - 1) + \
205 " appended due to includeOrExcludeAllSubBlocks == 1\n\n")
206 includeIndexList.append(int(ioFlatIndexCounter[0]) - 1)
207 else:
208 if PhactoriDbg(100):
209 myDebugPrint3("force include is not on, so check include list\n")
210 includeThisBlock = False
211 if (includeBlockList != None) and (oneBlockMetaData != None):
212 thisBlockName = oneBlockMetaData.Get(vtk.vtkCompositeDataSet.NAME())
213 if PhactoriDbg(100):
214 myDebugPrint3("include list not None, thisBlockName " + str(thisBlockName) + "\n"
215 "includeBlockList " + str(includeBlockList) + "\n")
216 if (thisBlockName != None) and (thisBlockName in includeBlockList):
217 includeThisBlock = True
218 if PhactoriDbg(100):
219 myDebugPrint3("leaf block None index " + \
220 str(int(ioFlatIndexCounter[0]) - 1) + \
221 " included due to name being in includeBlockList\n")
222 includeIndexList.append(int(ioFlatIndexCounter[0]) - 1)
223 if includeThisBlock == False:
224 if PhactoriDbg(100):
225 myDebugPrint3("leaf block None index " + \
226 str(int(ioFlatIndexCounter[0]) - 1) + \
227 " excluded due to includeOrExcludeAllSubBlocks != 1\n")
228 else:
229 if inForceSetting != -1:
230 if inForceSetting == 1:
231 if PhactoriDbg(100):
232 myDebugPrint3("this leaf block will be added inForceSetting == 1\n")
233 FigureBlockIndicesFromBlockListOneBlock(includeIndexList,
234 includeBlockList, inMetaData, ioFlatIndexCounter, inCsdata, inForceSetting)
235 else:
236 if PhactoriDbg(100):
237 myDebugPrint3("this leaf block not added inForceSetting == -1\n")
238 #if icsdClassname == "vtkMultiPieceDataSet":
239 # numpieces = inCsdata.GetNumberOfPieces()
240 # # ioFlatIndexCounter[0] += numpieces - 1
241 # ioFlatIndexCounter[0] += numpieces
242
243
244 def FigureBlockIndicesFromBlockList(includeBlockList, inInputFilter):
245 """from the includeBlockList create a indices list
246 of blocks to put in filter"""
247 if PhactoriDbg(100):
248 myDebugPrint3("FigureBlockIndicesFromBlockList entered"
249 "\nincludeBlockList: " + str(includeBlockList) + "\n")
250
251 #global gDuplicateNameCounter
252 #gDuplicateNameCounter = {}
253 csdata = inInputFilter.GetClientSideObject().GetOutputDataObject(0)
254 flatIndexCounter = [0]
255 listOfBlockIndicesToInclude = []
256 FigureBlockIndicesFromBlockListRecurse1(listOfBlockIndicesToInclude,
257 includeBlockList, csdata, None, flatIndexCounter, 0)
258
259 #if PhactoriDbg(100):
260 # myDebugPrint3("number of times existing block names found:\n")
261 # for blknm, count in gDuplicateNameCounter.items():
262 # myDebugPrint3(blknm + ": " + str(count) + "\n");
263 if PhactoriDbg(100):
264 myDebugPrint3("FigureBlockIndicesFromBlockList final indices list:\n" \
265 + str(listOfBlockIndicesToInclude) + \
266 "\nFigureBlockIndicesFromBlockList returning\n")
267
268 return listOfBlockIndicesToInclude
269
270 def PrintMultiBlockStatsOneBlock(inCsdata, inMetaData, ioFlatIndexCounter):
271 icsdClassname = inCsdata.GetClassName()
272 myDebugPrint3("leaf block " + str(icsdClassname) + " index " + str(ioFlatIndexCounter[0]) + "\n")
273 if icsdClassname == "vtkStructuredGrid":
274 wholeExtent = inMetaData.Get(vtk.vtkStreamingDemandDrivenPipeline.WHOLE_EXTENT())
275 myDebugPrint3("this leaf is structured grid: " + str(ioFlatIndexCounter[0]) + "\n"
276 "vtk.vtkStreamingDemandDrivenPipeline.WHOLE_EXTENT(): " + str(wholeExtent) + "\n"
277 "B inCsdata.GetExtent(): " + str(inCsdata.GetExtent()) + "\n")
278
279 def PrintMultiBlockStatsRecurse1(inCsdata, inMetaData, recursionLevel, ioFlatIndexCounter):
280 myDebugPrint3("PrintMultiBlockStatsRecurse1 entered recursionLevel " + str(recursionLevel) + "\n")
281
282 icsdClassname = inCsdata.GetClassName()
283 myDebugPrint3("inCsdata.GetClassName() " + str(icsdClassname) + " ioFlatIndexCounter[0] " + str(ioFlatIndexCounter[0]) + "\n")
284
285 ioFlatIndexCounter[0] += 1
286
287 if icsdClassname == "vtkMultiBlockDataSet":
288 thisIsLeaf = False
289 nonLeafType = 0
290 elif icsdClassname == "vtkExodusIIMultiBlockDataSet":
291 thisIsLeaf = False
292 nonLeafType = 1
293 elif icsdClassname == "vtkMultiPieceDataSet":
294 thisIsLeaf = False
295 nonLeafType = 2
296 elif icsdClassname == "vtkPartitionedDataSet":
297 thisIsLeaf = False
298 nonLeafType = 3
299 else:
300 thisIsLeaf = True
301 nonLeafType = -1
302
303 myDebugPrint3("thisIsLeaf " + str(thisIsLeaf) + " nonLeafType " + str(nonLeafType) + "\n")
304 if not thisIsLeaf:
305 if nonLeafType == 2:
306 numBlocks = inCsdata.GetNumberOfPieces()
307 elif nonLeafType == 3:
308 numBlocks = inCsdata.GetNumberOfPartitions()
309 else:
310 numBlocks = inCsdata.GetNumberOfBlocks()
311
312 myDebugPrint3("recursing, flat index: " + \
313 str(ioFlatIndexCounter[0]) + \
314 " num blocks: " + \
315 str(numBlocks) + "\n")
316 for ii in range(0, numBlocks):
317 myDebugPrint3("doing sub block " + str(ii) + " of " + str(numBlocks) + "\n")
318 if nonLeafType == 2:
319 oneBlock = inCsdata.GetPiece(ii)
320 elif nonLeafType == 3:
321 oneBlock = inCsdata.GetPartition(ii)
322 else:
323 oneBlock = inCsdata.GetBlock(ii)
324 oneBlockMetaData = inCsdata.GetMetaData(ii)
325 myDebugPrint3("oneBlockMetaData: " + str(oneBlockMetaData) + "\n")
326 #myDebugPrint3("name: " + \
327 # oneBlockMetaData.Get(vtk.vtkCompositeDataSet.NAME()) + "\n")
328 if oneBlock != None:
329 PrintMultiBlockStatsRecurse1(oneBlock, oneBlockMetaData, recursionLevel + 1, ioFlatIndexCounter)
330 else:
331 myDebugPrint3("this sub block is None, index " + str(ioFlatIndexCounter[0]) + "\n")
332 ioFlatIndexCounter[0] += 1
333 else:
334 PrintMultiBlockStatsOneBlock(inCsdata, inMetaData, ioFlatIndexCounter)
335
336 myDebugPrint3("PrintMultiBlockStatsRecurse1 returning recursionLevel " + str(recursionLevel) + "\n")
337
338 def RecursivelyPrintMultiBlockStats(inFilter):
339 if PhactoriDbg(100) == False:
340 return
341
342 myDebugPrint3("RecursivelyPrintMultiBlockStats entered\n")
343 csdata = inFilter.GetClientSideObject().GetOutputDataObject(0)
344 flatIndexCounter = [0]
345 recursionLevel = 0
346 PrintMultiBlockStatsRecurse1(csdata, None, recursionLevel, flatIndexCounter)
347
348 myDebugPrint3("RecursivelyPrintMultiBlockStats returning\n")
349
350 class PhactoriExtractStructuredMultiBlock(PhactoriOperationSpecifics):
351 """manages PhactoriExtractStructuredMultiBlock filter"""
352 def __init__(self):
353 PhactoriOperationSpecifics.__init__(self)
354 self.ControlJson = None
355 self.SavedIncludeBlockIndexList = None
356 self.ExtractBlockFilters = []
357 self.ExtractSubsetFilters = []
358 self.FinalGroupFilter = None
359 self.mStructuredGridsIncluded = []
360 self.mStructuredGridsIncludedExtent = []
361
362 def ParseParametersFromJson(self, inJson):
363 #["blk-4":{"ijkrange":[imin,imax,jmin,jmax,kmin,kmax]]
364 #["blk-5":{"ijkrange":[imin,imax,jmin,jmax,kmin,kmax],"ijkrangefunction":[-1,0,0,1,0,1]}]
365 #["blk-6":{"ijkrange":[imin,imax,jmin,jmax,kmin,kmax],"ijkrangefunction":[-1,0,-1,0,0,1]}]
366 if "ExtractSubsetSettingsByBlock" not in inJson:
367 myDebugPrint3AndException("PhactoriExtractStructuredMultiBlock.ParseParametersFromJson\n"
368 "missing key 'ExtractSubsetSettingsByBlock'\n")
369
370 self.ControlJson = inJson["ExtractSubsetSettingsByBlock"]
371 dummy = 0
372
373 def MakeExtractBlockFilter(self, inInputFilter, blockName):
374 if PhactoriDbg(100):
375 myDebugPrint3("MakeExtractBlockFilter entered: " + str(blockName) + "\n")
376 newPvExtractBlockFilter = ExtractBlock(inInputFilter)
377 #newParaViewFilter.PruneOutput = 1
378 #newParaViewFilter.MaintainStructure = 0
379 #newParaViewFilter.MaintainStructure = 1
380 global gStructuredGridFound
381 gStructuredGridFound = None
382 self.SavedIncludeBlockIndexList = FigureBlockIndicesFromBlockList([blockName], inInputFilter)
383 self.mStructuredGridsIncluded.append(gStructuredGridFound)
384 self.mStructuredGridsIncludedExtent.append(gStructuredGridFoundExtent)
385
386 if PhactoriDbg(100):
387 myDebugPrint3("self.SavedIncludeBlockIndexList:\n" + str(self.SavedIncludeBlockIndexList) + "\n")
388 newPvExtractBlockFilter.BlockIndices = self.SavedIncludeBlockIndexList
389 if PhactoriDbg(100):
390 myDebugPrint3("MakeExtractBlockFilter returning: " + str(blockName) + "\n")
391 return newPvExtractBlockFilter
392
393 def CreateIjkRangeFromSettingsForThisBlock(self, ijkJson, blockExtent):
394
395 rngFuncAllAbsolute = True
396 if "ijkrangefunction" in ijkJson:
397 rngFunc = ijkJson["ijkrangefunction"]
398 for ijksetting in rngFunc:
399 if ijksetting != 0:
400 rngFuncAllAbsolute = False
401 break
402 else:
403 #rngFuncAllAbsolute = True
404 rngFunc = [0,0,0,0,0,0]
405
406 if rngFuncAllAbsolute:
407 retIjkRange = ijkJson["ijkrange"]
408 if PhactoriDbg(100):
409 myDebugPrint3("rngFunc is [0,0,0,0,0,0], all absolute, "
410 "so just return explicit ijkrange:\nretIjkRange: \n" + \
411 str(retIjkRange) + "\n")
412 return retIjkRange
413
414 #return ijkJson["ijkrange"]
415 if blockExtent == None:
416 if rngFuncAllAbsolute == False:
417 return [0,-1,0,-1,0,-1]
418
419 if "ijkrange" in ijkJson:
420 ijkRangeFromJson = ijkJson["ijkrange"]
421 else:
422 ijkRangeFromJson = [0,0,0,0,0,0]
423
424 if PhactoriDbg(100):
425 myDebugPrint3("ijkrange: " + str(ijkRangeFromJson) + "\n" + \
426 "ijkrangefunction: " + str(rngFunc) + "\n" + \
427 "blockExtent: " + str(blockExtent) + "\n")
428
429 retIjkRange = [0,0,0,0,0,0]
430 minIndex = [0,0,2,2,4,4]
431 maxIndex = [1,1,3,3,5,5]
432 for ii in range(0,6):
433 if rngFunc[ii] == 0:
434 retIjkRange[ii] = ijkRangeFromJson[ii]
435 elif rngFunc[ii] < 0:
436 retIjkRange[ii] = blockExtent[minIndex[ii]] + ijkRangeFromJson[ii]
437 else:
438 retIjkRange[ii] = blockExtent[maxIndex[ii]] - ijkRangeFromJson[ii]
439
440 #validate/fix (with warning) extraction extents
441 hadToCorrect = False
442 uncorrectedIjkRange = list(retIjkRange)
443 for ii in range(0,6):
444 extentMin = blockExtent[minIndex[ii]]
445 extentMax = blockExtent[maxIndex[ii]]
446 if retIjkRange[ii] < extentMin:
447 hadToCorrect = True
448 retIjkRange[ii] = extentMin
449 if retIjkRange[ii] > extentMax:
450 hadToCorrect = True
451 retIjkRange[ii] = extentMax
452 for ii in range(0,3):
453 ndx1 = ii * 2
454 ndx2 = ndx1 + 1
455 if retIjkRange[ndx1] > retIjkRange[ndx2]:
456 hadToCorrect = True
457 retIjkRange[ndx1] = retIjkRange[ndx2]
458 if hadToCorrect:
459 if PhactoriDbg(100):
460 myDebugPrint3("return ijkrange had to be corrected because it was outside block extent"
461 "\nblockExtent: " + str(blockExtent) +
462 "\nijkRangeFromJson: " + str(retIjkRange) +
463 "\nrngFunc (from json): " + str(rngFunc) +
464 "\nuncorrectedIjkRange: " + str(uncorrectedIjkRange) +
465 "\nretIjkRange: " + str(retIjkRange) + "\n")
466 else:
467 if PhactoriDbg(100):
468 myDebugPrint3("return ijkrange did not need correction"
469 "\nblockExtent: " + str(blockExtent) +
470 "\nijkRangeFromJson: " + str(retIjkRange) +
471 "\nrngFunc (from json): " + str(rngFunc) +
472 "\nretIjkRange: " + str(retIjkRange) + "\n")
473
474 return retIjkRange
475
476
477 def MakeExtractSubsetFilter(self, extractBlockFilter, oneBlockExtractSubsetJson, oneBlockExtents):
478 if PhactoriDbg(100):
479 myDebugPrint3("MakeOneExtractBlockExtractSubsetFilter entered\n")
480
481 #ijkrange = oneBlockExtractSubsetJson["ijkrange"]
482 ijkrange = self.CreateIjkRangeFromSettingsForThisBlock(oneBlockExtractSubsetJson, oneBlockExtents)
483 UpdatePipelineWithCurrentTimeArgument(extractBlockFilter)
484 extractSubset1 = ExtractSubset(Input=extractBlockFilter)
485 extractSubset1.VOI = ijkrange
486 UpdatePipelineWithCurrentTimeArgument(extractSubset1)
487 if PhactoriDbg(100):
488 myDebugPrint3("MakeOneExtractBlockExtractSubsetFilter returning\n")
489 return extractSubset1
490
491 def MakeOneExtractBlockExtractSubsetFilterPair(self, inInputFilter, blockName, oneBlockExtractSubsetJson):
492 if PhactoriDbg(100):
493 myDebugPrint3("MakeOneExtractBlockExtractSubsetFilterPair entered: " + str(blockName) + "\n")
494 UpdatePipelineWithCurrentTimeArgument(inInputFilter)
495 newExtractBlockPvFilter = self.MakeExtractBlockFilter(inInputFilter, blockName)
496 UpdatePipelineWithCurrentTimeArgument(newExtractBlockPvFilter)
497 self.ExtractBlockFilters.append(newExtractBlockPvFilter)
498
499 if PhactoriDbg(100):
500 myDebugPrint3("pesmb one extract block structure begin: " + blockName + "\n")
501 RecursivelyPrintMultiBlockStats(newExtractBlockPvFilter)
502 myDebugPrint3("pesmb one extract block structure end: " + blockName + "\n")
503
504 oneBlockExtent = self.mStructuredGridsIncludedExtent[-1]
505 newExtractSubsetPvFilter = self.MakeExtractSubsetFilter(newExtractBlockPvFilter, oneBlockExtractSubsetJson, oneBlockExtent)
506 UpdatePipelineWithCurrentTimeArgument(newExtractSubsetPvFilter)
507 self.ExtractSubsetFilters.append(newExtractSubsetPvFilter)
508
509 if PhactoriDbg(100):
510 myDebugPrint3("pesmb one extract subset structure begin: " + blockName + "\n")
511 RecursivelyPrintMultiBlockStats(newExtractSubsetPvFilter)
512 myDebugPrint3("pesmb one extract subset structure end: " + blockName + "\n")
513
514 if PhactoriDbg(100):
515 myDebugPrint3("MakeOneExtractBlockExtractSubsetFilterPair returning: " + str(blockName) + "\n")
516
517 def MakeGroupAllExtractSubsetsFilter(self):
518 if PhactoriDbg(100):
519 myDebugPrint3("MakeGroupAllExtractSubsetsFilter entered\n")
520 self.FinalGroupFilter = GroupDatasets(Input = self.ExtractSubsetFilters)
521
522 UpdatePipelineWithCurrentTimeArgument(self.FinalGroupFilter)
523
524 if PhactoriDbg(100):
525 myDebugPrint3("MakeGroupAllExtractSubsetsFilter returning\n")
526
527 def CreateParaViewFilter(self, inInputFilter):
528 """create the PhactoriExtractStructuredMultiBlock filter for ParaView"""
529 if PhactoriDbg(100):
530 myDebugPrint3("PhactoriExtractStructuredMultiBlock.CreateParaViewFilter "
531 "entered\n", 100)
532
533 savedActiveSource = GetActiveSource()
534
535 UpdatePipelineWithCurrentTimeArgument(inInputFilter)
536
537 if PhactoriDbg(100):
538 myDebugPrint3("pesmb incoming multiblock structure begin\n")
539 RecursivelyPrintMultiBlockStats(inInputFilter)
540 myDebugPrint3("pesmb incoming multiblock structure end\n")
541
542 for blockName, oneBlockExtractSubsetJson in self.ControlJson.items():
543 self.MakeOneExtractBlockExtractSubsetFilterPair(inInputFilter, blockName, oneBlockExtractSubsetJson)
544
545 self.MakeGroupAllExtractSubsetsFilter()
546 #newParaViewFilter = PhactoriExtractStructuredMultiBlock(inInputFilter)
547
548 if PhactoriDbg(100):
549 myDebugPrint3("pesmb outgoing group multiblock structure begin\n")
550 RecursivelyPrintMultiBlockStats(self.FinalGroupFilter)
551 myDebugPrint3("pesmb outgoing group multiblock structure end\n")
552
553
554 SetActiveSource(self.FinalGroupFilter)
555 UpdatePipelineWithCurrentTimeArgument(self.FinalGroupFilter)
556 SetActiveSource(savedActiveSource)
557
558 if PhactoriDbg(100):
559 myDebugPrint3("PhactoriExtractStructuredMultiBlock.CreateParaViewFilter "
560 "returning\n", 100)
561
562 return self.FinalGroupFilter
563
564 def DoUpdateDueToChangeInData(self, inIncomingPvFilter, outOutgoingPvFilter):
565 UpdatePipelineWithCurrentTimeArgument(self.FinalGroupFilter)
566
567 if PhactoriDbg(100):
568 myDebugPrint3("PhactoriExtractStructuredMultiBlock printing out multiblock this callback:\n")
569 myDebugPrint3("pesmb outgoing group multiblock structure begin (per frame callback)\n")
570 RecursivelyPrintMultiBlockStats(self.FinalGroupFilter)
571 myDebugPrint3("pesmb outgoing group multiblock structure end (per frame callback)\n")
572
573 #phactori_combine_to_single_python_file_subpiece_end_1