| 35 | } |
| 36 | |
| 37 | int main(int argc, char* argv[]) |
| 38 | { |
| 39 | |
| 40 | // Note that this will create a vtkMPIController if MPI |
| 41 | // is configured, vtkThreadedController otherwise. |
| 42 | vtkMultiProcessController* controller = vtkMultiProcessController::New(); |
| 43 | controller->Initialize(&argc, &argv); |
| 44 | |
| 45 | // When using MPI, the number of processes is determined |
| 46 | // by the external program which launches this application. |
| 47 | // However, when using threads, we need to set it ourselves. |
| 48 | if (controller->IsA("vtkThreadedController")) |
| 49 | { |
| 50 | // Set the number of processes to 2 for this example. |
| 51 | controller->SetNumberOfProcesses(2); |
| 52 | } |
| 53 | int numProcs = controller->GetNumberOfProcesses(); |
| 54 | |
| 55 | if (numProcs != 2) |
| 56 | { |
| 57 | std::cerr << "This example requires two processes." << endl; |
| 58 | controller->Finalize(); |
| 59 | controller->Delete(); |
| 60 | return 1; |
| 61 | } |
| 62 | |
| 63 | // Execute the function named "process" on both processes |
| 64 | controller->SetSingleMethod(process, 0); |
| 65 | controller->SingleMethodExecute(); |
| 66 | |
| 67 | // Clean-up and exit |
| 68 | controller->Finalize(); |
| 69 | controller->Delete(); |
| 70 | |
| 71 | return 0; |
| 72 | } |
nothing calls this directly
no test coverage detected