mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-12 14:10:34 +05:00
hash-table with optional Get
This commit is contained in:
parent
f802197576
commit
e8286776df
@ -773,6 +773,15 @@ public:
|
|||||||
return (pos != -1);
|
return (pos != -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline optional<T> GetIfUsed (const INDEX_2 & ahash) const
|
||||||
|
{
|
||||||
|
int pos = Position0 (ahash);
|
||||||
|
if (pos != -1)
|
||||||
|
return cont[pos];
|
||||||
|
else
|
||||||
|
return nullopt;
|
||||||
|
}
|
||||||
|
|
||||||
inline void SetData0 (int pos, const INDEX_2 & ahash, const T & acont)
|
inline void SetData0 (int pos, const INDEX_2 & ahash, const T & acont)
|
||||||
{
|
{
|
||||||
hash[pos] = ahash;
|
hash[pos] = ahash;
|
||||||
|
@ -3279,10 +3279,16 @@ namespace netgen
|
|||||||
edge.Sort();
|
edge.Sort();
|
||||||
|
|
||||||
PointIndex newp;
|
PointIndex newp;
|
||||||
|
/*
|
||||||
if (cutedges.Used (edge))
|
if (cutedges.Used (edge))
|
||||||
{
|
{
|
||||||
newp = cutedges.Get(edge);
|
newp = cutedges.Get(edge);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
if (auto optnewp = cutedges.GetIfUsed(edge))
|
||||||
|
{
|
||||||
|
newp = *optnewp;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Point<3> npt = Center (mesh.Point (edge.I1()),
|
Point<3> npt = Center (mesh.Point (edge.I1()),
|
||||||
@ -3296,7 +3302,6 @@ namespace netgen
|
|||||||
|
|
||||||
mtets.Elem(i) = newtet1;
|
mtets.Elem(i) = newtet1;
|
||||||
mtets.Append (newtet2);
|
mtets.Append (newtet2);
|
||||||
|
|
||||||
mesh.mlparentelement.Append (i);
|
mesh.mlparentelement.Append (i);
|
||||||
}
|
}
|
||||||
NgProfiler::StopTimer (timer_bisecttet);
|
NgProfiler::StopTimer (timer_bisecttet);
|
||||||
|
Loading…
Reference in New Issue
Block a user