(dataType)
| 68 | pf.SetExecuteMethod(execute) |
| 69 | |
| 70 | def 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()) |
no test coverage detected