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

Method RequestData

Infovis/BoostGraphAlgorithms/vtkBoostBreadthFirstSearch.cxx:166–291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164}
165
166int vtkBoostBreadthFirstSearch::RequestData(vtkInformation* vtkNotUsed(request),
167 vtkInformationVector** inputVector, vtkInformationVector* outputVector)
168{
169 // get the info objects
170 vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);
171 vtkInformation* outInfo = outputVector->GetInformationObject(0);
172
173 // get the input and output
174 vtkGraph* input = vtkGraph::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
175 vtkGraph* output = vtkGraph::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
176
177 // Send the data to output.
178 output->ShallowCopy(input);
179
180 // Sanity check
181 // The Boost BFS likes to crash on empty datasets
182 if (input->GetNumberOfVertices() == 0)
183 {
184 // vtkWarningMacro("Empty input into " << this->GetClassName());
185 return 1;
186 }
187
188 if (this->OriginFromSelection)
189 {
190 vtkSelection* selection = vtkSelection::GetData(inputVector[1], 0);
191 if (selection == nullptr)
192 {
193 vtkErrorMacro("OriginFromSelection set but selection input undefined.");
194 return 0;
195 }
196 vtkSmartPointer<vtkIdTypeArray> idArr = vtkSmartPointer<vtkIdTypeArray>::New();
197 vtkConvertSelection::GetSelectedVertices(selection, input, idArr);
198 if (idArr->GetNumberOfTuples() == 0)
199 {
200 vtkErrorMacro("Origin selection is empty.");
201 return 0;
202 }
203 this->OriginVertexIndex = idArr->GetValue(0);
204 }
205 else
206 {
207 // Now figure out the origin vertex of the
208 // breadth first search
209 if (this->InputArrayName)
210 {
211 vtkAbstractArray* abstract = input->GetVertexData()->GetAbstractArray(this->InputArrayName);
212
213 // Does the array exist at all?
214 if (abstract == nullptr)
215 {
216 vtkErrorMacro("Could not find array named " << this->InputArrayName);
217 return 0;
218 }
219
220 this->OriginVertexIndex = this->GetVertexIndex(abstract, this->OriginValue);
221 }
222 }
223

Callers

nothing calls this directly

Calls 15

GetVertexIndexMethod · 0.95
GetInformationObjectMethod · 0.80
GetNumberOfVerticesMethod · 0.80
GetAbstractArrayMethod · 0.80
GetVertexDataMethod · 0.80
SetSelectionListMethod · 0.80
DeleteMethod · 0.65
GetDataFunction · 0.50
NewFunction · 0.50
GetMethod · 0.45
ShallowCopyMethod · 0.45
GetNumberOfTuplesMethod · 0.45

Tested by

no test coverage detected