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

Method testSixth

IO/Fides/Testing/Python/TestFidesBasic.py:181–271  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

179 return
180
181 def testSixth(self):
182 # This test reads a uniform grid with 4 blocks. It tests the ability of fides to
183 # bridge gaps between partitions.
184 r = vtkIOFides.vtkFidesReader()
185 r.SetFileName(VTK_DATA_ROOT + "/Data/gs.bp")
186 r.UpdateInformation()
187 self.assertTrue(r.GetOutputInformation(0).Has(
188 vtkStreamingDemandDrivenPipeline.TIME_STEPS()))
189 nsteps = r.GetOutputInformation(0).Length(vtkStreamingDemandDrivenPipeline.TIME_STEPS())
190 self.assertEqual(nsteps, 100)
191 for i in range(nsteps):
192 self.assertEqual(r.GetOutputInformation(0).Get(
193 vtkStreamingDemandDrivenPipeline.TIME_STEPS(),i), i)
194 r.CreateSharedPointsOff()
195 r.Update()
196
197 pdsc = r.GetOutputDataObject(0)
198 self.assertTrue(isinstance(pdsc, vtkPartitionedDataSetCollection))
199 self.assertEqual(pdsc.GetNumberOfPartitionedDataSets(), 1)
200 pds = pdsc.GetPartitionedDataSet(0)
201 nParts = pds.GetNumberOfPartitions()
202 self.assertEqual(nParts, 4) # gray-scott example has 4 partitions
203
204 ds = pds.GetPartition(0)
205 self.assertEqual(ds.GetExtent(), (0, 31, 0, 31, 0, 63))
206 self.assertEqual(ds.GetPointData().GetNumberOfArrays(), 2)
207 self.assertEqual(ds.GetPointData().GetArray(0).GetName(), "U")
208 self.assertEqual(ds.GetPointData().GetArray(1).GetName(), "V")
209 self.assertEqual(ds.GetPointData().GetNumberOfTuples(), 65536)
210
211 ds = pds.GetPartition(1)
212 self.assertEqual(ds.GetExtent(), (0, 31, 32, 63, 0, 63))
213 self.assertEqual(ds.GetPointData().GetNumberOfArrays(), 2)
214 self.assertEqual(ds.GetPointData().GetArray(0).GetName(), "U")
215 self.assertEqual(ds.GetPointData().GetArray(1).GetName(), "V")
216 self.assertEqual(ds.GetPointData().GetNumberOfTuples(), 65536)
217
218 ds = pds.GetPartition(2)
219 self.assertEqual(ds.GetExtent(), (32, 63, 0, 31, 0, 63))
220 self.assertEqual(ds.GetPointData().GetNumberOfArrays(), 2)
221 self.assertEqual(ds.GetPointData().GetArray(0).GetName(), "U")
222 self.assertEqual(ds.GetPointData().GetArray(1).GetName(), "V")
223 self.assertEqual(ds.GetPointData().GetNumberOfTuples(), 65536)
224
225 ds = pds.GetPartition(3)
226 self.assertEqual(ds.GetExtent(), (32, 63, 32, 63, 0, 63))
227 self.assertEqual(ds.GetPointData().GetNumberOfArrays(), 2)
228 self.assertEqual(ds.GetPointData().GetArray(0).GetName(), "U")
229 self.assertEqual(ds.GetPointData().GetArray(1).GetName(), "V")
230 self.assertEqual(ds.GetPointData().GetNumberOfTuples(), 65536)
231
232 # Create shared points. vtkFidesReader will bridge the gaps between blocks.
233 r.CreateSharedPointsOn()
234 r.Update()
235
236 pdsc = r.GetOutputDataObject(0)
237 self.assertTrue(isinstance(pdsc, vtkPartitionedDataSetCollection))
238 self.assertEqual(pdsc.GetNumberOfPartitionedDataSets(), 1)

Callers

nothing calls this directly

Calls 15

vtkFidesReaderMethod · 0.80
GetPartitionedDataSetMethod · 0.80
rangeClass · 0.50
SetFileNameMethod · 0.45
UpdateInformationMethod · 0.45
HasMethod · 0.45
GetOutputInformationMethod · 0.45
LengthMethod · 0.45
GetMethod · 0.45
UpdateMethod · 0.45
GetOutputDataObjectMethod · 0.45

Tested by

no test coverage detected