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

Method testStructured2D

Filters/General/Testing/Python/tableBasedClip.py:137–176  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

135 self.assertEqual(c.GetOutput().GetNumberOfCells(), 64)
136
137 def testStructured2D(self):
138 planes = ['XY', 'XZ', 'YZ']
139 expectedNCells = [42, 34, 68]
140 for plane, nCells in zip(planes,expectedNCells):
141 rt = vtkRTAnalyticSource()
142 if plane == 'XY':
143 rt.SetWholeExtent(-5, 5, -5, 5, 0, 0)
144 elif plane == 'XZ':
145 rt.SetWholeExtent(-5, 5, 0, 0, -5, 5)
146 else:
147 rt.SetWholeExtent(0, 0, -5, 5, -5, 5)
148 rt.Update()
149 i = rt.GetOutput()
150
151 st = vtkStructuredGrid()
152 st.SetDimensions(i.GetDimensions())
153
154 nps = i.GetNumberOfPoints()
155 ps = vtkPoints()
156 ps.SetNumberOfPoints(nps)
157 for idx in range(nps):
158 ps.SetPoint(idx, i.GetPoint(idx))
159
160 st.SetPoints(ps)
161
162 cyl = vtkCylinder()
163 cyl.SetRadius(2)
164 cyl.SetCenter(0,0,0)
165 transform = vtkTransform()
166 transform.RotateWXYZ(45,20,1,10)
167 cyl.SetTransform(transform)
168
169 c = vtkTableBasedClipDataSet()
170 c.SetInputData(st)
171 c.SetClipFunction(cyl)
172 c.SetInsideOut(1)
173
174 c.Update()
175
176 self.assertEqual(c.GetOutput().GetNumberOfCells(), nCells)
177
178 def testStructured(self):
179 rt = vtkRTAnalyticSource()

Callers

nothing calls this directly

Calls 15

vtkCylinderClass · 0.85
RotateWXYZMethod · 0.80
vtkStructuredGridClass · 0.50
vtkPointsClass · 0.50
rangeClass · 0.50
vtkTransformClass · 0.50
SetWholeExtentMethod · 0.45
UpdateMethod · 0.45
GetOutputMethod · 0.45
SetDimensionsMethod · 0.45
GetDimensionsMethod · 0.45
GetNumberOfPointsMethod · 0.45

Tested by

no test coverage detected