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