(time, timeStep, grid, attributes)
| 12 | bridge.add_pipeline(filename) |
| 13 | |
| 14 | def coprocess(time, timeStep, grid, attributes): |
| 15 | from paraview import vtk |
| 16 | from paraview.modules import vtkPVCatalyst as catalyst |
| 17 | from paraview.vtk.util import numpy_support |
| 18 | |
| 19 | # access coprocessor from the bridge |
| 20 | coProcessor = bridge.coprocessor |
| 21 | |
| 22 | dataDescription = catalyst.vtkCPDataDescription() |
| 23 | dataDescription.SetTimeData(time, timeStep) |
| 24 | dataDescription.AddInput("input") |
| 25 | |
| 26 | if coProcessor.RequestDataDescription(dataDescription): |
| 27 | import fedatastructures |
| 28 | imageData = vtk.vtkImageData() |
| 29 | imageData.SetExtent(grid.XStartPoint, grid.XEndPoint, 0, grid.NumberOfYPoints-1, 0, grid.NumberOfZPoints-1) |
| 30 | imageData.SetSpacing(grid.Spacing) |
| 31 | |
| 32 | velocity = numpy_support.numpy_to_vtk(attributes.Velocity) |
| 33 | velocity.SetName("velocity") |
| 34 | imageData.GetPointData().AddArray(velocity) |
| 35 | |
| 36 | pressure = numpy_support.numpy_to_vtk(attributes.Pressure) |
| 37 | pressure.SetName("pressure") |
| 38 | imageData.GetCellData().AddArray(pressure) |
| 39 | dataDescription.GetInputDescriptionByName("input").SetGrid(imageData) |
| 40 | dataDescription.GetInputDescriptionByName("input").SetWholeExtent(0, grid.NumberOfGlobalXPoints-1, 0, grid.NumberOfYPoints-1, 0, grid.NumberOfZPoints-1) |
| 41 | coProcessor.CoProcess(dataDescription) |
nothing calls this directly
no test coverage detected