Debian Codegraph @

packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/Operation/PhactoriResampleWithDataset.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 class PhactoriResampleWithDatasetOperation(PhactoriOperationSpecifics):
38 def __init__(self):
39 PhactoriOperationSpecifics.__init__(self)
40 self.ResampleDatasetName = None
41 self.InternalParaViewFilterPtr = None
42 return
43
44 def ParseParametersFromJson(self, inJson):
45 key1 = "sample dataset"
46 if key1 not in inJson:
47 myDebugPrint3AndException("PhactoriResampleWithDatasetOperation:ParseParametersFromJson\n"
48 "'" + key1 + "' must be in block to specify dataset as source for the resampling\n")
49 self.ResampleDatasetName = inJson[key1]
50
51 def GetListOfInputOperationNamesForThisOperationType(self):
52 """PhactoriResampleWithDatasetOperation depends on the sampling source as
53 well as the input source"""
54 retList = []
55 retList.append(self.ResampleDatasetName)
56 return retList
57
58 def DebugPrintInputPortAndOutputPortInfo(self, infoTag):
59 if PhactoriDbg(100):
60 myDebugPrint3(infoTag)
61 stcso = self.InternalParaViewFilterPtr.GetClientSideObject()
62 myDebugPrint3(str(stcso) + "\n")
63 myDebugPrint3(str(stcso.GetClassName()) + "\n")
64 stodo = stcso.GetOutputDataObject(0)
65 myDebugPrint3(str(stodo) + "\n")
66 myDebugPrint3(str(stodo.GetClassName()) + "\n")
67 stido0 = stcso.GetInputDataObject(0,0)
68 myDebugPrint3(str(stido0) + "\n")
69 myDebugPrint3(str(stido0.GetClassName()) + "\n")
70 stido1 = stcso.GetInputDataObject(1,0)
71 myDebugPrint3(str(stido1) + "\n")
72 myDebugPrint3(str(stido1.GetClassName()) + "\n")
73 # myDebugPrint3("stodo: " + str(stodo.GetClassName()) + " numcells " + str(stodo.GetNumberOfCells()) + " numpoints " + str(stodo.GetNumberOfPoints()) + "\n")
74 # myDebugPrint3("stido0: " + str(stido0.GetClassName()) + "\n")
75 # myDebugPrint3("stido1: " + str(stido1.GetClassName()) + " numcells " + str(stido1.GetNumberOfCells()) + " numpoints " + str(stido1.GetNumberOfPoints()) + "\n")
76
77 def CreateParaViewFilter2(self, inInputFilter, inPipeAndViewsState):
78 """create the clip plane filter for ParaView"""
79 if PhactoriDbg(100):
80 myDebugPrint3('PhactoriResampleWithDatasetOperation:CreateParaViewFilter entered\n', 100)
81 #info in block class should already be parsed and checked
82
83 UpdatePipelineWithCurrentTimeArgument(inInputFilter)
84
85 #get seed source operation
86 paraviewResampleDataset = inPipeAndViewsState.GetParaViewSourceByOperationName(self.ResampleDatasetName)
87 if PhactoriDbg(100):
88 myDebugPrint3("self.ResampleDatasetName: " + str(self.ResampleDatasetName) + \
89 "\nparaviewResampleDataset: " + str(paraviewResampleDataset) + "\n", 100)
90
91 UpdatePipelineWithCurrentTimeArgument(paraviewResampleDataset)
92
93 if PhactoriDbg(100):
94 psscso = paraviewResampleDataset.GetClientSideObject()
95 pssodo = psscso.GetOutputDataObject(0)
96 myDebugPrint3("pssodo: " + str(pssodo.GetClassName()) + " numcells " + str(pssodo.GetNumberOfCells()) + " numpoints " + str(pssodo.GetNumberOfPoints()) + "\n")
97
98 savedActiveSource = GetActiveSource()
99
100 #self.InternalParaViewFilterPtr = ResampleWithDataset(Input = inInputFilter, Source=paraviewResampleDataset)
101 self.InternalParaViewFilterPtr = ResampleWithDataset(SourceDataArrays = inInputFilter, DestinationMesh=paraviewResampleDataset)
102 self.InternalParaViewFilterPtr.PassCellArrays = 1
103 self.InternalParaViewFilterPtr.PassPointArrays = 1
104
105 self.InternalParaViewFilterPtr.CellLocator = 'Static Cell Locator'
106
107 self.DebugPrintInputPortAndOutputPortInfo("pre filter update 1\n")
108
109 SetActiveSource(self.InternalParaViewFilterPtr)
110 SetActiveSource(savedActiveSource)
111
112 self.DebugPrintInputPortAndOutputPortInfo("pre filter update 2\n")
113
114 #UpdatePipelineWithCurrentTimeArgument(self.InternalParaViewFilterPtr)
115
116 if PhactoriDbg(100):
117 myDebugPrint3("about to call self.InternalParaViewFilterPtr.UpdatePipeline()\n")
118
119 self.InternalParaViewFilterPtr.UpdatePipeline()
120
121 self.DebugPrintInputPortAndOutputPortInfo("post filter update 1\n")
122
123 if PhactoriDbg(100):
124 myDebugPrint3("self.InternalParaViewFilterPtr: " + str(self.InternalParaViewFilterPtr) + "\n", 100)
125
126 if PhactoriDbg(100):
127 myDebugPrint3('PhactoriResampleWithDatasetOperation.CreateParaViewFilter returning\n', 100)
128
129 return self.InternalParaViewFilterPtr
130
131 #phactori_combine_to_single_python_file_subpiece_end_1