fix GetSurfaceElementOfPoint with indices

This commit is contained in:
Christopher Lackner 2021-09-22 17:52:04 +02:00
parent 286f63f002
commit 6bbaa6bc69

View File

@ -5779,6 +5779,9 @@ namespace netgen
{ {
if(faces[i] == 0) if(faces[i] == 0)
continue; continue;
auto sel = SurfaceElement(faces[i]);
if(indices && indices->Size() != 0 && !indices->Contains(sel.GetIndex()))
continue;
auto & el = VolumeElement(velement); auto & el = VolumeElement(velement);
@ -5790,8 +5793,6 @@ namespace netgen
{ {
// found volume point very close to a face -> use barycentric coordinates directly // found volume point very close to a face -> use barycentric coordinates directly
lami[2] = 0.0; lami[2] = 0.0;
auto sel = SurfaceElement(faces[i]);
for(auto j : Range(1,3)) for(auto j : Range(1,3))
for(auto k : Range(4)) for(auto k : Range(4))
if(sel[j] == el[k]) if(sel[j] == el[k])
@ -5800,21 +5801,8 @@ namespace netgen
} }
} }
if(indices && indices->Size() != 0) if(PointContainedIn2DElement(p,lami,faces[i],true))
{ return faces[i];
if(indices->Contains(SurfaceElement(faces[i]).GetIndex()) &&
PointContainedIn2DElement(p,lami,faces[i],true))
return faces[i];
}
else
{
if(PointContainedIn2DElement(p,lami,faces[i],true))
{
//(*testout) << "found point " << p << " in sel " << faces[i]
// << ", lam " << lami[0] << ", " << lami[1] << ", " << lami[2] << endl;
return faces[i];
}
}
} }
} }