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

Method RequestData

Filters/ReebGraph/vtkReebGraphToJoinSplitTreeFilter.cxx:84–421  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

82
83//------------------------------------------------------------------------------
84int vtkReebGraphToJoinSplitTreeFilter::RequestData(vtkInformation* vtkNotUsed(request),
85 vtkInformationVector** inputVector, vtkInformationVector* outputVector)
86{
87
88 vtkInformation *inInfoMesh = inputVector[0]->GetInformationObject(0),
89 *inInfoGraph = inputVector[1]->GetInformationObject(0);
90
91 if ((!inInfoMesh) || (!inInfoGraph))
92 return 0;
93
94 vtkPointSet* inputMesh = vtkPointSet::SafeDownCast(inInfoMesh->Get(vtkPointSet::DATA_OBJECT()));
95
96 vtkReebGraph* inputGraph =
97 vtkReebGraph::SafeDownCast(inInfoGraph->Get(vtkReebGraph::DATA_OBJECT()));
98
99 if ((inputMesh) && (inputGraph))
100 {
101 vtkInformation* outInfo = outputVector->GetInformationObject(0);
102 vtkReebGraph* output = vtkReebGraph::SafeDownCast(outInfo->Get(vtkReebGraph::DATA_OBJECT()));
103
104 if (output)
105 {
106 output->DeepCopy(inputGraph);
107
108 // Retrieve the information regarding the critical nodes
109 vtkDataArray* vertexInfo =
110 vtkArrayDownCast<vtkDataArray>(inputGraph->GetVertexData()->GetAbstractArray("Vertex Ids"));
111 if (!vertexInfo)
112 // invalid Reeb graph (no information associated to the vertices)
113 return 0;
114
115 vtkVariantArray* edgeInfo = vtkArrayDownCast<vtkVariantArray>(
116 inputGraph->GetEdgeData()->GetAbstractArray("Vertex Ids"));
117 if (!edgeInfo)
118 // invalid Reeb graph (no information associated to the edges)
119 return 0;
120
121 vtkDataArray* scalarField = inputMesh->GetPointData()->GetArray(FieldId);
122 if (!scalarField)
123 // invalid input mesh (no scalar field associated to it)
124 return 0;
125
126 // first, uncompress the input Reeb graph.
127 vtkMutableDirectedGraph* unCompressedGraph = vtkMutableDirectedGraph::New();
128 std::vector<std::pair<int, double>> vertexList;
129 for (int i = 0; i < vertexInfo->GetNumberOfTuples(); i++)
130 {
131 int vertexId = (int)*(vertexInfo->GetTuple(i));
132 double scalarValue = scalarField->GetComponent(vertexId, 0);
133 vertexList.emplace_back(vertexId, scalarValue);
134 }
135
136 vtkEdgeListIterator* eIt = vtkEdgeListIterator::New();
137 inputGraph->GetEdges(eIt);
138 do
139 {
140 vtkEdgeType e = eIt->Next();
141 vtkAbstractArray* deg2NodeList = edgeInfo->GetPointer(e.Id)->ToArray();

Callers

nothing calls this directly

Calls 15

GetInformationObjectMethod · 0.80
GetAbstractArrayMethod · 0.80
GetVertexDataMethod · 0.80
GetEdgeDataMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
sortFunction · 0.50
GetMethod · 0.45
DeepCopyMethod · 0.45
GetArrayMethod · 0.45
GetPointDataMethod · 0.45
GetNumberOfTuplesMethod · 0.45

Tested by

no test coverage detected