Handle triangles correctly in BuildEdgeList()

This commit is contained in:
Matthias Hochsteger 2020-01-10 17:58:37 +01:00
parent a9520e6dd7
commit e26f0f38f4

View File

@ -26,13 +26,28 @@ void BuildEdgeList( const Mesh & mesh, const Table<TINDEX, PointIndex> & element
const auto & elem = mesh[ei]; const auto & elem = mesh[ei];
if (elem.IsDeleted()) continue; if (elem.IsDeleted()) continue;
for (int j = 0; j < 6; j++) static_assert(is_same_v<TINDEX, ElementIndex>||is_same_v<TINDEX,SurfaceElementIndex>, "Invalid type for TINDEX");
if constexpr(is_same_v<TINDEX, SurfaceElementIndex>)
{ {
PointIndex pi0 = elem[tetedges[j][0]]; for (int j = 0; j < 3; j++)
PointIndex pi1 = elem[tetedges[j][1]]; {
if (pi1 < pi0) Swap(pi0, pi1); PointIndex pi0 = elem[j];
if(pi0==pi) PointIndex pi1 = elem[(j+1)%3];
local_edges.Append(std::make_tuple(pi0, pi1)); if (pi1 < pi0) Swap(pi0, pi1);
if(pi0==pi)
local_edges.Append(std::make_tuple(pi0, pi1));
}
}
else if constexpr(is_same_v<TINDEX, ElementIndex>)
{
for (int j = 0; j < 6; j++)
{
PointIndex pi0 = elem[tetedges[j][0]];
PointIndex pi1 = elem[tetedges[j][1]];
if (pi1 < pi0) Swap(pi0, pi1);
if(pi0==pi)
local_edges.Append(std::make_tuple(pi0, pi1));
}
} }
} }
QuickSort(local_edges); QuickSort(local_edges);