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

Function pipe2

Examples/ParallelProcessing/Generic/Cxx/pipe2.cxx:16–79  ·  view source on GitHub ↗

Pipe 2 for PipelineParallelism. See PipelineParallelism.cxx for more information.

Source from the content-addressed store, hash-verified

14// Pipe 2 for PipelineParallelism.
15// See PipelineParallelism.cxx for more information.
16void pipe2(vtkMultiProcessController* vtkNotUsed(controller), void* vtkNotUsed(arg))
17{
18 // Input port
19 vtkInputPort* ip = vtkInputPort::New();
20 ip->SetRemoteProcessId(0);
21 ip->SetTag(11);
22
23 // Iso-surface
24 vtkContourFilter* cf = vtkContourFilter::New();
25 cf->SetInput(ip->GetImageDataOutput());
26 cf->SetNumberOfContours(1);
27 cf->SetValue(0, 220);
28
29 // Rendering objects
30 vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();
31 mapper->SetInputConnection(cf->GetOutputPort());
32
33 vtkActor* actor = vtkActor::New();
34 actor->SetMapper(mapper);
35
36 vtkRenderer* ren = vtkRenderer::New();
37 ren->AddActor(actor);
38
39 vtkRenderWindow* renWin = vtkRenderWindow::New();
40 renWin->AddRenderer(ren);
41
42 // Normally, the Render() call on a RenderWindow() calls
43 // update on it's actors two times. This is not appropriate
44 // for this example because with each Update(), the data
45 // changes. For this reason, we will use a separate PolyData
46 // object and (shallow) copy the data to it.
47 vtkPolyData* pd = vtkPolyData::New();
48 mapper->SetInput(pd);
49
50 // Prime the pipeline. Tell the producer to start computing.
51 ip->Update();
52
53 // Get the first data, adjust camera appropriately
54 cf->GetOutput()->Update();
55 pd->ShallowCopy(cf->GetOutput());
56 ren->ResetCamera();
57 // Display data
58 renWin->Render();
59
60 // Get more data. With every update the XFreq of the rtSource
61 // is increased.
62 for (int i = 0; i < 17; i++)
63 {
64 cf->GetOutput()->Update();
65 pd->ShallowCopy(cf->GetOutput());
66 // Display
67 renWin->Render();
68 }
69 // Tell the producer that we are done.
70 ip->GetController()->TriggerRMI(0, vtkMultiProcessController::BREAK_RMI_TAG);
71
72 pd->Delete();
73 ip->Delete();

Callers

nothing calls this directly

Calls 15

TriggerRMIMethod · 0.80
RenderMethod · 0.65
DeleteMethod · 0.65
NewFunction · 0.50
SetInputMethod · 0.45
GetImageDataOutputMethod · 0.45
SetNumberOfContoursMethod · 0.45
SetValueMethod · 0.45
SetInputConnectionMethod · 0.45
GetOutputPortMethod · 0.45
SetMapperMethod · 0.45
AddActorMethod · 0.45

Tested by

no test coverage detected