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

Method RequestData

Filters/Selection/vtkCellDistanceSelector.cxx:79–363  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

77
78//------------------------------------------------------------------------------
79int vtkCellDistanceSelector::RequestData(vtkInformation* vtkNotUsed(request),
80 vtkInformationVector** inputVector, vtkInformationVector* outputVector)
81{
82
83 // Retrieve input mesh as composite object
84 vtkInformation* inDataObjectInfo = inputVector[INPUT_MESH]->GetInformationObject(0);
85 vtkCompositeDataSet* compositeInput =
86 vtkCompositeDataSet::SafeDownCast(inDataObjectInfo->Get(vtkDataObject::DATA_OBJECT()));
87
88 // Retrieve input selection
89 vtkInformation* inSelectionInfo = inputVector[INPUT_SELECTION]->GetInformationObject(0);
90 vtkSelection* inputSelection =
91 vtkSelection::SafeDownCast(inSelectionInfo->Get(vtkDataObject::DATA_OBJECT()));
92
93 // Retrieve output selection
94 vtkInformation* outInfo = outputVector->GetInformationObject(0);
95 vtkSelection* output = vtkSelection::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
96
97 if (!compositeInput)
98 {
99 vtkErrorMacro(<< "Missing input data object");
100 return 0;
101 }
102
103 if (!inputSelection)
104 {
105 vtkErrorMacro(<< "Missing input selection");
106 return 0;
107 }
108
109 std::map<int, std::vector<vtkSelectionNode*>> partSelections;
110 int nSelNodes = inputSelection->GetNumberOfNodes();
111 for (int i = 0; i < nSelNodes; ++i)
112 {
113 vtkSelectionNode* sn = inputSelection->GetNode(i);
114 int composite_index = sn->GetProperties()->Get(vtkSelectionNode::COMPOSITE_INDEX());
115 partSelections[composite_index].push_back(sn);
116 }
117
118 vtkCompositeDataIterator* inputIterator = compositeInput->NewIterator();
119 inputIterator->SkipEmptyNodesOn();
120 inputIterator->InitTraversal();
121 inputIterator->GoToFirstItem();
122 while (!inputIterator->IsDoneWithTraversal())
123 {
124 vtkDataSet* input = vtkDataSet::SafeDownCast(inputIterator->GetCurrentDataObject());
125 // NB: composite indices start at 1
126 int composite_index = inputIterator->GetCurrentFlatIndex();
127 inputIterator->GoToNextItem();
128
129 std::vector<vtkSelectionNode*>::iterator selNodeIt = partSelections[composite_index].begin();
130 while (selNodeIt != partSelections[composite_index].end())
131 {
132 vtkSelectionNode* selectionNode = *selNodeIt;
133 ++selNodeIt;
134
135 vtkDataArray* selectionList =
136 vtkArrayDownCast<vtkDataArray>(selectionNode->GetSelectionList());

Callers

nothing calls this directly

Calls 15

GetInformationObjectMethod · 0.80
GetCurrentFlatIndexMethod · 0.80
GetSelectionListMethod · 0.80
GetTuple1Method · 0.80
SetTuple1Method · 0.80
InsertNextTuple1Method · 0.80
SetSelectionListMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
GetMethod · 0.45
GetNumberOfNodesMethod · 0.45
GetNodeMethod · 0.45

Tested by

no test coverage detected