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

Method InsertTriInHash

Filters/Geometry/vtkDataSetRegionSurfaceFilter.cxx:963–1034  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

961
962//------------------------------------------------------------------------------
963void vtkDataSetRegionSurfaceFilter::InsertTriInHash(
964 vtkIdType a, vtkIdType b, vtkIdType c, vtkIdType sourceId, vtkIdType faceId)
965{
966 int tmp;
967 vtkFastGeomQuad *quad, **end;
968
969 // Reorder to get smallest id in a.
970 if (b < a && b < c)
971 {
972 tmp = a;
973 a = b;
974 b = c;
975 c = tmp;
976 }
977 else if (c < a && c < b)
978 {
979 tmp = a;
980 a = c;
981 c = b;
982 b = tmp;
983 }
984 // We can't put the second smnallest in b because it might change the order
985 // of the vertices in the final triangle.
986
987 // Look for existing tri in the hash;
988 end = this->QuadHash + a;
989 quad = *end;
990 vtkIdType regionId = -1;
991 if (this->RegionArray)
992 {
993 regionId = this->RegionArray->GetValue(sourceId);
994 }
995 while (quad)
996 {
997 end = &(quad->Next);
998 const vtkIdType* quadsRegionId = (quad->ptArray + quad->numPts);
999 // a has to match in this bin.
1000 if (quad->numPts == 3)
1001 {
1002 if (((b == quad->ptArray[1] && c == quad->ptArray[2]) ||
1003 (b == quad->ptArray[2] && c == quad->ptArray[1])) &&
1004 (regionId == -1 ||
1005 regionId == *quadsRegionId)) // internal cells, but on a material interface
1006 {
1007 // We have a match.
1008 quad->SourceId = -1;
1009 // That is all we need to do. Hide any tri shared by two or more cells (that also are from
1010 // same region)
1011 return;
1012 }
1013 }
1014 quad = *end;
1015 }
1016
1017 // Create a new quad and add it to the hash.
1018 quad = this->NewFastGeomQuad(5);
1019 quad->Next = nullptr;
1020 quad->SourceId = sourceId;

Callers 1

Calls 2

NewFastGeomQuadMethod · 0.80
GetValueMethod · 0.45

Tested by

no test coverage detected