------------------------------------------------------------------------------
| 82 | |
| 83 | //------------------------------------------------------------------------------ |
| 84 | int 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(); |
nothing calls this directly
no test coverage detected