| 4 | ts = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19) |
| 5 | |
| 6 | class PointSource(VTKPythonAlgorithmBase): |
| 7 | def __init__(self): |
| 8 | VTKPythonAlgorithmBase.__init__(self, nInputPorts=0, |
| 9 | nOutputPorts=1, outputType='vtkUnstructuredGrid') |
| 10 | self.Scale = 1.0 |
| 11 | self.FirstIteration = True |
| 12 | |
| 13 | def RequestInformation(self, request, inInfo, outInfo): |
| 14 | info = outInfo.GetInformationObject(0) |
| 15 | info.Set(vtk.vtkStreamingDemandDrivenPipeline.TIME_STEPS(), |
| 16 | ts, len(ts)) |
| 17 | info.Set(vtk.vtkStreamingDemandDrivenPipeline.TIME_RANGE(), |
| 18 | [ts[0], ts[-1]], 2) |
| 19 | return 1 |
| 20 | def RequestData(self, request, inInfo, outInfo): |
| 21 | info = outInfo.GetInformationObject(0) |
| 22 | output = vtk.vtkUnstructuredGrid.GetData(info) |
| 23 | # The time step requested |
| 24 | t = info.Get(vtk.vtkStreamingDemandDrivenPipeline.UPDATE_TIME_STEP()) |
| 25 | if info.Has(vtk.vtkStreamingDemandDrivenPipeline.NO_PRIOR_TEMPORAL_ACCESS()): |
| 26 | assert(self.FirstIteration != |
| 27 | (info.Get(vtk.vtkStreamingDemandDrivenPipeline.NO_PRIOR_TEMPORAL_ACCESS()) == |
| 28 | vtk.vtkStreamingDemandDrivenPipeline.NO_PRIOR_TEMPORAL_ACCESS_CONTINUE)) |
| 29 | pts = vtk.vtkPoints() |
| 30 | pts.SetNumberOfPoints(1) |
| 31 | pts.SetPoint(0, 0, 0, 0) |
| 32 | output.SetPoints(pts) |
| 33 | a = vtk.vtkFloatArray() |
| 34 | a.SetName("scalar") |
| 35 | a.SetNumberOfTuples(1) |
| 36 | a.SetValue(0, t) |
| 37 | output.GetPointData().AddArray(a) |
| 38 | self.FirstIteration = False |
| 39 | return 1 |
| 40 | |
| 41 | ps = PointSource() |
| 42 |
no outgoing calls
no test coverage detected