| 11 | #include <iostream> |
| 12 | |
| 13 | int TestExtractValues(int vtkNotUsed(argc), char* argv[]) |
| 14 | { |
| 15 | vtkNew<vtkXMLPolyDataReader> reader; |
| 16 | reader->SetFileName(argv[1]); |
| 17 | |
| 18 | vtkNew<vtkSelectionSource> selection; |
| 19 | selection->SetArrayName("Solid id"); |
| 20 | selection->SetContentType(vtkSelectionNode::VALUES); |
| 21 | selection->SetFieldType(vtkSelectionNode::CELL); |
| 22 | selection->AddID(-1, 1); |
| 23 | selection->AddID(-1, 2); |
| 24 | |
| 25 | vtkNew<vtkExtractSelection> extract; |
| 26 | extract->SetInputConnection(0, reader->GetOutputPort()); |
| 27 | extract->SetInputConnection(1, selection->GetOutputPort()); |
| 28 | extract->Update(); |
| 29 | |
| 30 | vtkUnstructuredGrid* result = vtkUnstructuredGrid::SafeDownCast(extract->GetOutput()); |
| 31 | vtkIdType nbCells = result->GetNumberOfCells(); |
| 32 | |
| 33 | // We are extracting 2 cubes. Each cube has 6 faces of 4 faces, 12 polylines and 8 vertices. |
| 34 | // We are expecting 2*(6*4+12+8) = 88 cells |
| 35 | if (nbCells == 88) |
| 36 | { |
| 37 | return EXIT_SUCCESS; |
| 38 | } |
| 39 | |
| 40 | std::cerr << "There is " << nbCells << " cells instead of 88 cells." << std::endl; |
| 41 | |
| 42 | return EXIT_FAILURE; |
| 43 | } |
nothing calls this directly
no test coverage detected