if only 1 locahl tree is set use the global one on all layers

This commit is contained in:
Christopher Lackner 2022-03-14 14:20:31 +01:00
parent 154302605f
commit 842780feec
2 changed files with 12 additions and 5 deletions

View File

@ -3345,10 +3345,11 @@ namespace netgen
double Mesh :: GetH (const Point3d & p, int layer) const double Mesh :: GetH (const Point3d & p, int layer) const
{ {
const auto& lh = GetLocalH(layer);
double hmin = hglob; double hmin = hglob;
if (lochfunc[layer-1]) if (lh)
{ {
double hl = lochfunc[layer-1]->GetH (p); double hl = lh->GetH (p);
if (hl < hglob) if (hl < hglob)
hmin = hl; hmin = hl;
} }
@ -3357,10 +3358,11 @@ namespace netgen
double Mesh :: GetMinH (const Point3d & pmin, const Point3d & pmax, int layer) double Mesh :: GetMinH (const Point3d & pmin, const Point3d & pmax, int layer)
{ {
const auto& lh = GetLocalH(layer);
double hmin = hglob; double hmin = hglob;
if (lochfunc[layer-1]) if (lh)
{ {
double hl = lochfunc[layer-1]->GetMinH (pmin, pmax); double hl = lh->GetMinH (pmin, pmax);
if (hl < hmin) if (hl < hmin)
hmin = hl; hmin = hl;
} }

View File

@ -469,7 +469,12 @@ namespace netgen
/// ///
LocalH & LocalHFunction (int layer=1) { return * lochfunc[layer-1]; } LocalH & LocalHFunction (int layer=1) { return * lochfunc[layer-1]; }
shared_ptr<LocalH> GetLocalH(int layer=1) const { return lochfunc[layer-1]; } shared_ptr<LocalH> GetLocalH(int layer=1) const
{
if(lochfunc.Size() == 1)
return lochfunc[0];
return lochfunc[layer-1];
}
void SetLocalH(shared_ptr<LocalH> loch, int layer=1); void SetLocalH(shared_ptr<LocalH> loch, int layer=1);
/// ///