MCPcopy Create free account
hub / github.com/Kitware/ParaView / coprocess

Function coprocess

Examples/Catalyst/PythonFullExample/coprocessor.py:14–41  ·  view source on GitHub ↗
(time, timeStep, grid, attributes)

Source from the content-addressed store, hash-verified

12 bridge.add_pipeline(filename)
13
14def 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)

Callers

nothing calls this directly

Calls 10

vtkCPDataDescriptionMethod · 0.80
SetTimeDataMethod · 0.80
SetExtentMethod · 0.80
AddArrayMethod · 0.80
AddInputMethod · 0.45
SetNameMethod · 0.45
SetWholeExtentMethod · 0.45
CoProcessMethod · 0.45

Tested by

no test coverage detected