| 20 | #include "vtkViewTheme.h" |
| 21 | |
| 22 | int main(int argc, char** argv) |
| 23 | { |
| 24 | MPI_Init(&argc, &argv); |
| 25 | |
| 26 | vtkSmartPointer<vtkPBGLRandomGraphSource> source = |
| 27 | vtkSmartPointer<vtkPBGLRandomGraphSource>::New(); |
| 28 | source->DirectedOff(); |
| 29 | source->SetNumberOfVertices(100000); |
| 30 | source->SetNumberOfEdges(10000); |
| 31 | source->StartWithTreeOn(); |
| 32 | vtkSmartPointer<vtkPBGLBreadthFirstSearch> bfs = |
| 33 | vtkSmartPointer<vtkPBGLBreadthFirstSearch>::New(); |
| 34 | bfs->SetInputConnection(source->GetOutputPort()); |
| 35 | vtkSmartPointer<vtkPBGLCollectGraph> collect = vtkSmartPointer<vtkPBGLCollectGraph>::New(); |
| 36 | collect->SetInputConnection(bfs->GetOutputPort()); |
| 37 | |
| 38 | // Setup pipeline request |
| 39 | vtkSmartPointer<vtkMPIController> controller = vtkSmartPointer<vtkMPIController>::New(); |
| 40 | controller->Initialize(&argc, &argv, 1); |
| 41 | int rank = controller->GetLocalProcessId(); |
| 42 | int procs = controller->GetNumberOfProcesses(); |
| 43 | collect->Update(rank, procs, 0); |
| 44 | |
| 45 | if (rank == 0) |
| 46 | { |
| 47 | vtkSmartPointer<vtkUndirectedGraph> g = vtkSmartPointer<vtkUndirectedGraph>::New(); |
| 48 | g->ShallowCopy(collect->GetOutput()); |
| 49 | vtkSmartPointer<vtkGraphLayoutView> view = vtkSmartPointer<vtkGraphLayoutView>::New(); |
| 50 | vtkSmartPointer<vtkViewTheme> theme; |
| 51 | theme.TakeReference(vtkViewTheme::CreateMellowTheme()); |
| 52 | view->ApplyViewTheme(theme); |
| 53 | view->SetRepresentationFromInput(g); |
| 54 | view->SetVertexColorArrayName("BFS"); |
| 55 | view->ColorVerticesOn(); |
| 56 | vtkRenderWindow* win = view->GetRenderWindow(); |
| 57 | view->Update(); |
| 58 | view->GetRenderer()->ResetCamera(); |
| 59 | win->GetInteractor()->Initialize(); |
| 60 | win->GetInteractor()->Start(); |
| 61 | } |
| 62 | |
| 63 | controller->Finalize(); |
| 64 | return 0; |
| 65 | } |
nothing calls this directly
no test coverage detected