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

Method ComputeCustomMetric

Common/DataModel/vtkReebGraph.cxx:1231–1266  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1229
1230//------------------------------------------------------------------------------
1231double vtkReebGraph::Implementation::ComputeCustomMetric(
1232 vtkReebGraphSimplificationMetric* simplificationMetric, vtkReebArc* a)
1233{
1234 int edgeId = -1, start = -1, end = -1;
1235
1236 vtkDataArray* vertexInfo =
1237 vtkArrayDownCast<vtkDataArray>(this->Parent->GetVertexData()->GetAbstractArray("Vertex Ids"));
1238 if (!vertexInfo)
1239 return vtkReebGraphGetArcPersistence(this, a);
1240
1241 vtkVariantArray* edgeInfo =
1242 vtkArrayDownCast<vtkVariantArray>(this->Parent->GetEdgeData()->GetAbstractArray("Vertex Ids"));
1243 if (!edgeInfo)
1244 return vtkReebGraphGetArcPersistence(this, a);
1245
1246 vtkEdgeListIterator* eIt = vtkEdgeListIterator::New();
1247 this->Parent->GetEdges(eIt);
1248
1249 do
1250 {
1251 vtkEdgeType e = eIt->Next();
1252 if (((*(vertexInfo->GetTuple(e.Source))) == GetNodeVertexId(a->NodeId0)) &&
1253 ((*(vertexInfo->GetTuple(e.Target))) == GetNodeVertexId(a->NodeId1)))
1254 {
1255 edgeId = e.Id;
1256 start = static_cast<int>(*(vertexInfo->GetTuple(e.Source)));
1257 end = static_cast<int>(*(vertexInfo->GetTuple(e.Target)));
1258 break;
1259 }
1260 } while (eIt->HasNext());
1261 eIt->Delete();
1262
1263 vtkAbstractArray* vertexList = edgeInfo->GetPointer(edgeId)->ToArray();
1264
1265 return simplificationMetric->ComputeMetric(inputMesh, inputScalarField, start, vertexList, end);
1266}
1267
1268//------------------------------------------------------------------------------
1269int vtkReebGraph::Implementation::SimplifyBranches(

Callers 1

SimplifyBranchesMethod · 0.95

Calls 12

GetAbstractArrayMethod · 0.80
GetVertexDataMethod · 0.80
GetEdgeDataMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
GetEdgesMethod · 0.45
NextMethod · 0.45
GetTupleMethod · 0.45
HasNextMethod · 0.45
ToArrayMethod · 0.45
GetPointerMethod · 0.45
ComputeMetricMethod · 0.45

Tested by

no test coverage detected