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

Method CheckEdgeReferenceCount

Common/DataModel/vtkGenericEdgeTable.cxx:410–437  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

408
409//------------------------------------------------------------------------------
410int vtkGenericEdgeTable::CheckEdgeReferenceCount(vtkIdType e1, vtkIdType e2)
411{
412 int index;
413 OrderEdge(e1, e2); // reorder so that e1 < e2;
414
415 // vtkDebugMacro( << "CheckEdgeReferenceCount:" << e1 << "," << e2 );
416
417 vtkIdType pos = this->HashFunction(e1, e2);
418 assert("check: valid range pos" && static_cast<unsigned>(pos) < this->EdgeTable->Vector.size());
419
420 // Need to check size first
421 vtkEdgeTableEdge::VectorEdgeTableType& vect = this->EdgeTable->Vector[pos];
422
423 int vectsize = static_cast<int>(vect.size());
424 for (index = 0; index < vectsize; index++)
425 {
426 EdgeEntry& ent = vect[index];
427 if ((ent.E1 == e1) && (ent.E2 == e2))
428 {
429 assert("check: positive reference" && ent.Reference >= 0);
430 return ent.Reference;
431 }
432 }
433
434 // We did not find any corresponding entry, warn user
435 vtkErrorMacro(<< "No entry were found in the hash table");
436 return -1;
437}
438
439//------------------------------------------------------------------------------
440vtkIdType vtkGenericEdgeTable::HashFunction(vtkIdType e1, vtkIdType e2)

Callers

nothing calls this directly

Calls 4

HashFunctionMethod · 0.95
OrderEdgeFunction · 0.85
assertFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected