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