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

Method IncrementEdgeReferenceCount

Common/DataModel/vtkGenericEdgeTable.cxx:368–407  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

366
367//------------------------------------------------------------------------------
368int vtkGenericEdgeTable::IncrementEdgeReferenceCount(vtkIdType e1, vtkIdType e2, vtkIdType cellId)
369{
370 int index;
371 // reorder so that e1 < e2;
372 OrderEdge(e1, e2);
373
374 // vtkDebugMacro( << "IncrementEdgeReferenceCount:" << e1 << "," << e2 );
375
376 vtkIdType pos = this->HashFunction(e1, e2);
377 assert("check: valid range pos" && static_cast<unsigned>(pos) < this->EdgeTable->Vector.size());
378
379 // Need to check size first
380 vtkEdgeTableEdge::VectorEdgeTableType& vect = this->EdgeTable->Vector[pos];
381
382 int vectsize = static_cast<int>(vect.size());
383 for (index = 0; index < vectsize; index++)
384 {
385 EdgeEntry& ent = vect[index];
386 if ((ent.E1 == e1) && (ent.E2 == e2))
387 {
388 if (ent.CellId == cellId)
389 {
390 ent.Reference++;
391 // vtkDebugMacro( << "Incrementing: (" << e1 << "," << e2 << ") " << ent.Reference );
392 }
393 else
394 {
395 // If cellIds are different it means we pass from one cell to another
396 // therefore the first time we should not increment the ref count
397 // as it has already been taken into account.
398 ent.CellId = cellId;
399 }
400 return -1;
401 }
402 }
403
404 // We did not find any corresponding entry, warn user
405 vtkErrorMacro(<< "No entry were found in the hash table");
406 return -1;
407}
408
409//------------------------------------------------------------------------------
410int vtkGenericEdgeTable::CheckEdgeReferenceCount(vtkIdType e1, vtkIdType e2)

Callers 1

Calls 4

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

Tested by

no test coverage detected