| 72 | } |
| 73 | |
| 74 | int main(int argc, char* argv[]) |
| 75 | { |
| 76 | |
| 77 | // Note that this will create a vtkMPIController if MPI |
| 78 | // is configured, vtkThreadedController otherwise. |
| 79 | vtkMPIController* controller = vtkMPIController::New(); |
| 80 | controller->Initialize(&argc, &argv); |
| 81 | |
| 82 | // When using MPI, the number of processes is determined |
| 83 | // by the external program which launches this application. |
| 84 | // However, when using threads, we need to set it ourselves. |
| 85 | if (controller->IsA("vtkThreadedController")) |
| 86 | { |
| 87 | // Set the number of processes to 2 for this example. |
| 88 | controller->SetNumberOfProcesses(2); |
| 89 | } |
| 90 | int numProcs = controller->GetNumberOfProcesses(); |
| 91 | |
| 92 | if (numProcs != 2) |
| 93 | { |
| 94 | std::cerr << "This example requires two processes." << endl; |
| 95 | controller->Finalize(); |
| 96 | controller->Delete(); |
| 97 | return 1; |
| 98 | } |
| 99 | |
| 100 | // Execute the function named "process" on both processes |
| 101 | controller->SetSingleMethod(process, 0); |
| 102 | controller->SingleMethodExecute(); |
| 103 | |
| 104 | // Clean-up and exit |
| 105 | controller->Finalize(); |
| 106 | controller->Delete(); |
| 107 | |
| 108 | return 0; |
| 109 | } |
nothing calls this directly
no test coverage detected