mirror of
https://github.com/NGSolve/netgen.git
synced 2025-02-11 12:53:08 +05:00
Fix range exception in boundary limiter, rename npi to first_new_pi
This commit is contained in:
parent
49ecbd55ee
commit
5856001819
@ -297,7 +297,7 @@ BoundaryLayerTool::BoundaryLayerTool(Mesh& mesh_,
|
|||||||
segments = mesh.LineSegments();
|
segments = mesh.LineSegments();
|
||||||
|
|
||||||
np = mesh.GetNP();
|
np = mesh.GetNP();
|
||||||
npi = IndexBASE<PointIndex>()+np;
|
first_new_pi = IndexBASE<PointIndex>()+np;
|
||||||
ne = mesh.GetNE();
|
ne = mesh.GetNE();
|
||||||
nse = mesh.GetNSE();
|
nse = mesh.GetNSE();
|
||||||
nseg = segments.Size();
|
nseg = segments.Size();
|
||||||
|
@ -58,7 +58,7 @@ public:
|
|||||||
Array<int> new_mat_nrs;
|
Array<int> new_mat_nrs;
|
||||||
BitArray moved_surfaces;
|
BitArray moved_surfaces;
|
||||||
int np, nseg, nse, ne;
|
int np, nseg, nse, ne;
|
||||||
PointIndex npi; // IndexBASE<PointIndex>+np
|
PointIndex first_new_pi;
|
||||||
double total_height;
|
double total_height;
|
||||||
Array<POINTTYPE, PointIndex> point_types;
|
Array<POINTTYPE, PointIndex> point_types;
|
||||||
|
|
||||||
|
@ -155,8 +155,7 @@ void BoundaryLayerTool ::InterpolateGrowthVectors()
|
|||||||
{
|
{
|
||||||
for (auto* p_seg : edgenr2seg[edgenr])
|
for (auto* p_seg : edgenr2seg[edgenr])
|
||||||
for (auto pi : p_seg->PNums())
|
for (auto pi : p_seg->PNums())
|
||||||
// if (pi <= np && point_types[pi] == EDGEPOINT)
|
if (pi < first_new_pi && point_types[pi] == EDGEPOINT)
|
||||||
if (pi < npi && point_types[pi] == EDGEPOINT)
|
|
||||||
point_types[pi] = SURFACEPOINT;
|
point_types[pi] = SURFACEPOINT;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -85,16 +85,14 @@ struct GrowthVectorLimiter
|
|||||||
|
|
||||||
double GetLimit (PointIndex pi)
|
double GetLimit (PointIndex pi)
|
||||||
{
|
{
|
||||||
// if (pi <= tool.np)
|
if (pi < tool.first_new_pi)
|
||||||
if (pi < tool.npi)
|
|
||||||
return limits[pi];
|
return limits[pi];
|
||||||
return limits[map_from[pi]];
|
return limits[map_from[pi]];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SetLimit (PointIndex pi, double new_limit)
|
bool SetLimit (PointIndex pi, double new_limit)
|
||||||
{
|
{
|
||||||
// double& limit = (pi <= tool.np) ? limits[pi] : limits[map_from[pi]];
|
double& limit = (pi < tool.first_new_pi) ? limits[pi] : limits[map_from[pi]];
|
||||||
double& limit = (pi < tool.npi) ? limits[pi] : limits[map_from[pi]];
|
|
||||||
if (limit <= new_limit)
|
if (limit <= new_limit)
|
||||||
return false;
|
return false;
|
||||||
limit = new_limit;
|
limit = new_limit;
|
||||||
@ -103,8 +101,7 @@ struct GrowthVectorLimiter
|
|||||||
|
|
||||||
bool ScaleLimit (PointIndex pi, double factor)
|
bool ScaleLimit (PointIndex pi, double factor)
|
||||||
{
|
{
|
||||||
// double& limit = (pi <= tool.np) ? limits[pi] : limits[map_from[pi]];
|
double& limit = (pi < tool.first_new_pi) ? limits[pi] : limits[map_from[pi]];
|
||||||
double& limit = (pi < tool.npi) ? limits[pi] : limits[map_from[pi]];
|
|
||||||
return SetLimit(pi, limit * factor);
|
return SetLimit(pi, limit * factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,8 +115,7 @@ struct GrowthVectorLimiter
|
|||||||
|
|
||||||
Point<3> GetPoint (PointIndex pi_to, double shift = 1., bool apply_limit = false)
|
Point<3> GetPoint (PointIndex pi_to, double shift = 1., bool apply_limit = false)
|
||||||
{
|
{
|
||||||
// if (pi_to <= tool.np || tool.growth_vector_map.count(pi_to) == 0)
|
if (pi_to < tool.first_new_pi || tool.growth_vector_map.count(pi_to) == 0)
|
||||||
if (pi_to < tool.npi || tool.growth_vector_map.count(pi_to) == 0)
|
|
||||||
return mesh[pi_to];
|
return mesh[pi_to];
|
||||||
|
|
||||||
return mesh[pi_to] + GetVector(pi_to, shift, apply_limit);
|
return mesh[pi_to] + GetVector(pi_to, shift, apply_limit);
|
||||||
@ -336,8 +332,7 @@ struct GrowthVectorLimiter
|
|||||||
auto np = sel.GetNP();
|
auto np = sel.GetNP();
|
||||||
for (auto i : Range(np))
|
for (auto i : Range(np))
|
||||||
{
|
{
|
||||||
// if (sel[i] > tool.np)
|
if (sel[i] >= tool.first_new_pi)
|
||||||
if (sel[i] >= tool.npi)
|
|
||||||
return false;
|
return false;
|
||||||
if (tool.mapto[sel[i]].Size() == 0)
|
if (tool.mapto[sel[i]].Size() == 0)
|
||||||
return false;
|
return false;
|
||||||
@ -566,8 +561,7 @@ struct GrowthVectorLimiter
|
|||||||
PointIndex pi_max_limit = PointIndex::INVALID;
|
PointIndex pi_max_limit = PointIndex::INVALID;
|
||||||
for (PointIndex pi :
|
for (PointIndex pi :
|
||||||
{tri[0], tri[1], tri[2], tri2[0], tri2[1], tri2[2]})
|
{tri[0], tri[1], tri[2], tri2[0], tri2[1], tri2[2]})
|
||||||
// if (pi > tool.np && (!pi_max_limit.IsValid() || GetLimit(pi) > GetLimit(pi_max_limit)))
|
if (pi >= tool.first_new_pi && (!pi_max_limit.IsValid() || GetLimit(pi) > GetLimit(pi_max_limit)))
|
||||||
if (pi >= tool.npi && (!pi_max_limit.IsValid() || GetLimit(pi) > GetLimit(pi_max_limit)))
|
|
||||||
pi_max_limit = map_from[pi];
|
pi_max_limit = map_from[pi];
|
||||||
|
|
||||||
if (!pi_max_limit.IsValid())
|
if (!pi_max_limit.IsValid())
|
||||||
@ -656,18 +650,14 @@ struct GrowthVectorLimiter
|
|||||||
for (auto pi : sel.PNums())
|
for (auto pi : sel.PNums())
|
||||||
{
|
{
|
||||||
relevant_points_next.SetBit(pi);
|
relevant_points_next.SetBit(pi);
|
||||||
// if (pi >= tool.np) // was this correct (JS) ?
|
if (pi >= tool.first_new_pi)
|
||||||
if (pi >= tool.npi)
|
|
||||||
relevant_points_next.SetBit(map_from[pi]);
|
|
||||||
else
|
|
||||||
relevant_points_next.SetBit(map_from[pi]);
|
relevant_points_next.SetBit(map_from[pi]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto pi : sel.PNums())
|
for (auto pi : sel.PNums())
|
||||||
{
|
{
|
||||||
//if (pi >= tool.np) // was this correct (JS) ?
|
if (pi >= tool.first_new_pi)
|
||||||
if (pi >= tool.npi)
|
|
||||||
return;
|
return;
|
||||||
if (tool.mapto[pi].Size() == 0)
|
if (tool.mapto[pi].Size() == 0)
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user