(dataType)
| 33 | rank = contr.GetLocalProcessId() |
| 34 | |
| 35 | def GetSource(dataType): |
| 36 | s = vtkRTAnalyticSource() |
| 37 | # Fake serial source |
| 38 | if rank == 0: |
| 39 | s.Update() |
| 40 | |
| 41 | if dataType == 'ImageData': |
| 42 | return s.GetOutput() |
| 43 | |
| 44 | elif dataType == 'UnstructuredGrid': |
| 45 | dst = vtkDataSetTriangleFilter() |
| 46 | dst.SetInputData(s.GetOutput()) |
| 47 | dst.Update() |
| 48 | return dst.GetOutput() |
| 49 | |
| 50 | elif dataType == 'RectilinearGrid': |
| 51 | |
| 52 | input = s.GetOutput() |
| 53 | |
| 54 | rg = vtkRectilinearGrid() |
| 55 | rg.SetExtent(input.GetExtent()) |
| 56 | dims = input.GetDimensions() |
| 57 | spacing = input.GetSpacing() |
| 58 | |
| 59 | x = vtkFloatArray() |
| 60 | x.SetNumberOfTuples(dims[0]) |
| 61 | for i in range(dims[0]): |
| 62 | x.SetValue(i, spacing[0]*i) |
| 63 | |
| 64 | y = vtkFloatArray() |
| 65 | y.SetNumberOfTuples(dims[1]) |
| 66 | for i in range(dims[1]): |
| 67 | y.SetValue(i, spacing[1]*i) |
| 68 | |
| 69 | z = vtkFloatArray() |
| 70 | z.SetNumberOfTuples(dims[2]) |
| 71 | for i in range(dims[2]): |
| 72 | z.SetValue(i, spacing[2]*i) |
| 73 | |
| 74 | rg.SetXCoordinates(x) |
| 75 | rg.SetYCoordinates(y) |
| 76 | rg.SetZCoordinates(z) |
| 77 | |
| 78 | rg.GetPointData().ShallowCopy(input.GetPointData()) |
| 79 | |
| 80 | return rg |
| 81 | |
| 82 | elif dataType == 'StructuredGrid': |
| 83 | |
| 84 | input = s.GetOutput() |
| 85 | |
| 86 | sg = vtkStructuredGrid() |
| 87 | sg.SetExtent(input.GetExtent()) |
| 88 | pts = vtkPoints() |
| 89 | sg.SetPoints(pts) |
| 90 | npts = input.GetNumberOfPoints() |
| 91 | for i in range(npts): |
| 92 | pts.InsertNextPoint(input.GetPoint(i)) |
no test coverage detected