?? programme.cpp
字號:
#include "programme.h"
void process(vtkMultiProcessController* controller, void* vtkNotUsed(arg))
{
taskFunction task;
int myId = controller->GetLocalProcessId();
// Chose the appropriate task (see task3.cxx and task4.cxx)
if ( myId == 0 )
{
task = task1;
}
else
{
task = task2;
}
// Run the tasks (see task3.cxx and task4.cxx)
(*task)();
}
int main( int argc, char* argv[] )
{
// Note that this will create a vtkMPIController if MPI
// is configured, vtkThreadedController otherwise.
vtkMultiProcessController* controller = vtkMultiProcessController::New();
controller->Initialize(&argc, &argv);
// When using MPI, the number of processes is determined
// by the external program which launches this application.
// However, when using threads, we need to set it ourselves.
if (controller->IsA("vtkThreadedController"))
{
// Set the number of processes to 2 for this example.
controller->SetNumberOfProcesses(2);
}
int numProcs = controller->GetNumberOfProcesses();
if (numProcs != 2)
{
cerr << "This example requires two processes." << endl;
controller->Finalize();
controller->Delete();
return 1;
}
// Execute the function named "process" on both processes
controller->SetSingleMethod(process, 0);
controller->SingleMethodExecute();
// Clean-up and exit
controller->Finalize();
controller->Delete();
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -