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

Class PointSource

Filters/General/Testing/Python/TestTemporalStatistics.py:6–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4ts = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19)
5
6class 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
41ps = PointSource()
42

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected