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

Function process

Examples/ParallelProcessing/Generic/Cxx/TaskParallelism.cxx:22–72  ·  view source on GitHub ↗

This function sets up properties common to both processes and executes the task corresponding to the current process

Source from the content-addressed store, hash-verified

20// This function sets up properties common to both processes
21// and executes the task corresponding to the current process
22void process(vtkMultiProcessController* controller, void* vtkNotUsed(arg))
23{
24 taskFunction task;
25 int myId = controller->GetLocalProcessId();
26
27 // Chose the appropriate task (see task1.cxx and task2.cxx)
28 if (myId == 0)
29 {
30 task = task1;
31 }
32 else
33 {
34 task = task2;
35 }
36
37 // Setup camera
38 vtkCamera* cam = vtkCamera::New();
39 cam->SetPosition(-0.6105, 1.467, -6.879);
40 cam->SetFocalPoint(-0.0617558, 0.127043, 0);
41 cam->SetViewUp(-0.02, 0.98, 0.193);
42 cam->SetClippingRange(3.36, 11.67);
43 cam->Dolly(0.8);
44
45 // Create the render objects
46 vtkRenderWindow* renWin = vtkRenderWindow::New();
47 renWin->SetSize(WINDOW_WIDTH, WINDOW_HEIGHT);
48
49 vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();
50 iren->SetRenderWindow(renWin);
51
52 // This class allows all processes to composite their images.
53 // The root process then displays it in it's render window.
54 vtkCompositeRenderManager* tc = vtkCompositeRenderManager::New();
55 tc->SetRenderWindow(renWin);
56
57 // Generate the pipeline see task1.cxx and task2.cxx)
58 vtkPolyDataMapper* mapper = (*task)(renWin, EXTENT, cam);
59
60 // Only the root process will have an active interactor. All
61 // the other render windows will be slaved to the root.
62 tc->StartInteractor();
63
64 // Clean-up
65 iren->Delete();
66 if (mapper)
67 {
68 mapper->Delete();
69 }
70 renWin->Delete();
71 cam->Delete();
72}
73
74int main(int argc, char* argv[])
75{

Callers

nothing calls this directly

Calls 11

SetViewUpMethod · 0.80
StartInteractorMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
GetLocalProcessIdMethod · 0.45
SetPositionMethod · 0.45
SetFocalPointMethod · 0.45
SetClippingRangeMethod · 0.45
DollyMethod · 0.45
SetSizeMethod · 0.45
SetRenderWindowMethod · 0.45

Tested by

no test coverage detected