MCPcopy Create free account
hub / github.com/Kitware/VTK / TestExtractValues

Function TestExtractValues

Filters/Extraction/Testing/Cxx/TestExtractValues.cxx:13–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11#include <iostream>
12
13int 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}

Callers

nothing calls this directly

Calls 10

AddIDMethod · 0.80
SetFileNameMethod · 0.45
SetArrayNameMethod · 0.45
SetContentTypeMethod · 0.45
SetFieldTypeMethod · 0.45
SetInputConnectionMethod · 0.45
GetOutputPortMethod · 0.45
UpdateMethod · 0.45
GetOutputMethod · 0.45
GetNumberOfCellsMethod · 0.45

Tested by

no test coverage detected