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

Method FindPath

Common/DataModel/vtkReebGraph.cxx:986–1125  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

984
985//------------------------------------------------------------------------------
986vtkReebGraph::Implementation::vtkReebPath vtkReebGraph::Implementation::FindPath(
987 vtkIdType arcId, double simplificationThreshold, vtkReebGraphSimplificationMetric* metric)
988{
989 vtkReebPath entry;
990 std::priority_queue<vtkReebPath> pq;
991 int size;
992
993 vtkIdType N0 = this->GetArc(arcId)->NodeId0;
994 vtkIdType N1 = this->GetArc(arcId)->NodeId1;
995
996 char* Ntouch = nullptr;
997 char* Atouch = nullptr;
998
999 // double simplificationValue = 0;
1000 if ((!inputMesh) || (!metric))
1001 {
1002 double f0 = this->GetNode(N0)->Value;
1003 double f1 = this->GetNode(N1)->Value;
1004 entry.SimplificationValue = (f1 - f0) / (this->MaximumScalarValue - this->MinimumScalarValue);
1005 }
1006 else
1007 {
1008 entry.SimplificationValue = ComputeCustomMetric(metric, this->GetArc(arcId));
1009 }
1010
1011 // the arc itself has a good persistence
1012 if (simplificationThreshold && entry.SimplificationValue >= simplificationThreshold)
1013 {
1014 NOT_FOUND:
1015 if (Ntouch)
1016 free(Ntouch);
1017 if (Atouch)
1018 free(Atouch);
1019 vtkReebPath fake;
1020 memset(&fake, 0, sizeof(vtkReebPath));
1021 fake.SimplificationValue = 1;
1022 return fake;
1023 }
1024
1025 Atouch = (char*)malloc(sizeof(char) * this->MainArcTable.Size);
1026 Ntouch = (char*)malloc(sizeof(char) * this->MainNodeTable.Size);
1027 memset(Atouch, 0, sizeof(char) * this->MainArcTable.Size);
1028 memset(Ntouch, 0, sizeof(char) * this->MainNodeTable.Size);
1029
1030 Ntouch[N0] = 1;
1031
1032 // I don't want to use the arc given by the user
1033 Atouch[arcId] = 1;
1034
1035 entry.NodeNumber = 1;
1036 entry.NodeTable = new vtkIdType[1];
1037 entry.NodeTable[0] = N0;
1038 entry.ArcNumber = 0;
1039 entry.ArcTable = nullptr;
1040 pq.push(entry);
1041
1042 while ((size = static_cast<int>(pq.size())))
1043 {

Callers 1

SimplifyLoopsMethod · 0.95

Calls 6

GetArcMethod · 0.95
GetNodeMethod · 0.95
popMethod · 0.80
pushMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected