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

Function GetSource

IO/ParallelXML/Testing/Python/testParallelXMLWriters.py:70–150  ·  view source on GitHub ↗
(dataType)

Source from the content-addressed store, hash-verified

68pf.SetExecuteMethod(execute)
69
70def GetSource(dataType):
71 s = vtkRTAnalyticSource()
72
73 if dataType == 'ImageData':
74 return s
75
76 elif dataType == 'UnstructuredGrid':
77 dst = vtkDataSetTriangleFilter()
78 dst.SetInputConnection(s.GetOutputPort())
79 return dst
80
81 elif dataType == 'RectilinearGrid':
82 s.Update()
83
84 input = s.GetOutput()
85
86 rg = vtkRectilinearGrid()
87 rg.SetExtent(input.GetExtent())
88 dims = input.GetDimensions()
89 spacing = input.GetSpacing()
90
91 x = vtkFloatArray()
92 x.SetNumberOfTuples(dims[0])
93 for i in range(dims[0]):
94 x.SetValue(i, spacing[0]*i)
95
96 y = vtkFloatArray()
97 y.SetNumberOfTuples(dims[1])
98 for i in range(dims[1]):
99 y.SetValue(i, spacing[1]*i)
100
101 z = vtkFloatArray()
102 z.SetNumberOfTuples(dims[2])
103 for i in range(dims[2]):
104 z.SetValue(i, spacing[2]*i)
105
106 rg.SetXCoordinates(x)
107 rg.SetYCoordinates(y)
108 rg.SetZCoordinates(z)
109
110 rg.GetPointData().ShallowCopy(input.GetPointData())
111
112 pf.SetInputData(rg)
113 return pf
114
115 elif dataType == 'StructuredGrid':
116 s.Update()
117
118 input = s.GetOutput()
119
120 sg = vtkStructuredGrid()
121 sg.SetExtent(input.GetExtent())
122 pts = vtkPoints()
123 sg.SetPoints(pts)
124 npts = input.GetNumberOfPoints()
125 for i in range(npts):
126 pts.InsertNextPoint(input.GetPoint(i))
127 sg.GetPointData().ShallowCopy(input.GetPointData())

Callers 1

TestDataTypeFunction · 0.70

Calls 15

SetTuple1Method · 0.80
GetTuple1Method · 0.80
vtkRectilinearGridClass · 0.50
vtkFloatArrayClass · 0.50
rangeClass · 0.50
vtkStructuredGridClass · 0.50
vtkPointsClass · 0.50
vtkTableClass · 0.50
SetInputConnectionMethod · 0.45
GetOutputPortMethod · 0.45
UpdateMethod · 0.45
GetOutputMethod · 0.45

Tested by

no test coverage detected