MCPcopy Create free account
hub / github.com/Kitware/VTK / DoDataObjectsDiffer

Function DoDataObjectsDiffer

IO/Xdmf3/Testing/Python/VToXLoop.py:105–204  ·  view source on GitHub ↗
(dobj1, dobj2)

Source from the content-addressed store, hash-verified

103 return theyDo
104
105def DoDataObjectsDiffer(dobj1, dobj2):
106 class1 = dobj1.GetClassName()
107 class2 = dobj2.GetClassName()
108 if class1 == class2:
109 pass
110 else:
111 if (((class1 == "vtkImageData") or
112 (class1 == "vtkUniformGrid") or
113 (class1 == "vtkStructuredPoints")) and
114 ((class2 == "vtkImageData") or
115 (class2 == "vtkUniformGrid") or
116 (class2 == "vtkStructuredPoints"))):
117 pass
118 else:
119 if (((class1 == "vtkPolyData") or
120 (class1 == "vtkUnstructuredGrid")) and
121 ((class2 == "vtkPolyData") or
122 (class2 == "vtkUnstructuredGrid"))):
123 pass
124 else:
125 if (((class1 == "vtkDirectedGraph") or
126 (class1 == "vtkMutableDirectedGraph")) and
127 ((class2 == "vtkDirectedGraph") or
128 (class2 == "vtkMutableDirectedGraph"))):
129 pass
130 else:
131 message = "Error: dobj1 is a " + class1 + " and dobj2 is a " + class2
132 raiseErrorAndExit(message)
133
134 if dobj1.GetFieldData().GetNumberOfArrays() !=\
135 dobj2.GetFieldData().GetNumberOfArrays():
136 raiseErrorAndExit("Number of field arrays test failed")
137
138 if not dobj1.IsA("vtkPolyData") and\
139 not dobj2.IsA("vtkMultiBlockDataSet") and\
140 dobj1.GetActualMemorySize() != dobj2.GetActualMemorySize():
141 message = "Memory size test failed"
142 message += " M1 = " + str(dobj1.GetActualMemorySize())
143 message += " M2 = " + str(dobj2.GetActualMemorySize())
144 raiseErrorAndExit(message)
145
146 ds1 = vtkDataSet.SafeDownCast(dobj1)
147 ds2 = vtkDataSet.SafeDownCast(dobj2)
148 if ds1 and ds2:
149 if (ds1.GetNumberOfCells() != ds2.GetNumberOfCells()) or\
150 (ds1.GetNumberOfPoints() != ds2.GetNumberOfPoints()):
151 message = "Number of Cells/Points test Failed."
152 message += " C1 = " + str(ds1.GetNumberOfCells())
153 message += " C2 = " + str(ds2.GetNumberOfCells())
154 message += " P1 = " + str(ds1.GetNumberOfPoints())
155 message += " P2 = " + str(ds2.GetNumberOfPoints())
156 raiseErrorAndExit(message)
157 bds1 = ds1.GetBounds()
158 bds2 = ds2.GetBounds()
159 if (bds1[0]!=bds2[0]) or\
160 (bds1[1]!=bds2[1]) or\
161 (bds1[2]!=bds2[2]) or\
162 (bds1[3]!=bds2[3]) or\

Callers 2

TestXdmfConversionFunction · 0.70
RunTestFunction · 0.70

Calls 15

raiseErrorAndExitFunction · 0.85
strFunction · 0.85
IsAMethod · 0.80
GetNumberOfVerticesMethod · 0.80
GetVertexDataMethod · 0.80
GetEdgeDataMethod · 0.80
rangeClass · 0.50
printFunction · 0.50
GetClassNameMethod · 0.45
GetNumberOfArraysMethod · 0.45
GetFieldDataMethod · 0.45
GetActualMemorySizeMethod · 0.45

Tested by

no test coverage detected