| 18 | #include <iostream> |
| 19 | |
| 20 | int main(int argc, char* argv[]) |
| 21 | { |
| 22 | |
| 23 | // Note that this will create a vtkMPIController if MPI |
| 24 | // is configured, vtkThreadedController otherwise. |
| 25 | vtkMultiProcessController* controller = vtkMultiProcessController::New(); |
| 26 | controller->Initialize(&argc, &argv); |
| 27 | |
| 28 | // When using MPI, the number of processes is determined |
| 29 | // by the external program which launches this application. |
| 30 | // However, when using threads, we need to set it ourselves. |
| 31 | if (controller->IsA("vtkThreadedController")) |
| 32 | { |
| 33 | // Set the number of processes to 2 for this example. |
| 34 | controller->SetNumberOfProcesses(2); |
| 35 | } |
| 36 | int numProcs = controller->GetNumberOfProcesses(); |
| 37 | |
| 38 | if (numProcs != 2) |
| 39 | { |
| 40 | std::cerr << "This example requires two processes." << endl; |
| 41 | controller->Finalize(); |
| 42 | controller->Delete(); |
| 43 | return 1; |
| 44 | } |
| 45 | |
| 46 | // Assign the functions and execute them |
| 47 | controller->SetMultipleMethod(0, pipe1, 0); |
| 48 | controller->SetMultipleMethod(1, pipe2, 0); |
| 49 | controller->MultipleMethodExecute(); |
| 50 | |
| 51 | // Clean-up and exit |
| 52 | controller->Finalize(); |
| 53 | controller->Delete(); |
| 54 | |
| 55 | return 0; |
| 56 | } |
nothing calls this directly
no test coverage detected