some more

This commit is contained in:
Matthias Hochsteger 2024-02-26 09:09:42 +01:00
parent 38c45f57cb
commit 855ee34224
2 changed files with 31 additions and 22 deletions

View File

@ -547,7 +547,7 @@ struct GrowthVectorLimiter {
limits.SetSize(mesh.Points().Size()); limits.SetSize(mesh.Points().Size());
limits = 1.0; limits = 1.0;
GrowthVectorLimiter limiter(*this, mesh, params, limits, growthvectors, height); GrowthVectorLimiter limiter(*this, mesh, params, limits, growthvectors, total_height);
// limit to not intersect with other (original) surface elements // limit to not intersect with other (original) surface elements
double trig_shift = 0; double trig_shift = 0;
@ -1070,9 +1070,9 @@ struct GrowthVectorLimiter {
//for(auto & seg : mesh.LineSegments()) //for(auto & seg : mesh.LineSegments())
//seg.edgenr = seg.epgeominfo[1].edgenr; //seg.edgenr = seg.epgeominfo[1].edgenr;
height = 0.0; total_height = 0.0;
for (auto h : params.heights) for (auto h : params.heights)
height += h; total_height += h;
max_edge_nr = -1; max_edge_nr = -1;
for(const auto& seg : mesh.LineSegments()) for(const auto& seg : mesh.LineSegments())
@ -1397,13 +1397,22 @@ struct GrowthVectorLimiter {
if(seg.edgenr > new_max_edge_nr) if(seg.edgenr > new_max_edge_nr)
new_max_edge_nr = seg.edgenr; new_max_edge_nr = seg.edgenr;
auto getGW = [&] (PointIndex pi) -> Vec<3>& { auto getGW = [&] (PointIndex pi) -> Vec<3> {
static Vec<3> zero(0.,0.,0.); // static Vec<3> zero(0.,0.,0.);
if(growth_vector_map.count(pi)) if(growth_vector_map.count(pi))
return *get<0>(growth_vector_map[pi]); {
zero = {0.,0.,0.}; auto [gw, height] = growth_vector_map[pi];
return zero; return height * (*gw);
}
else
return growthvectors[pi];
// zero = {0.,0.,0.};
// return zero;
}; };
// auto setGW = [&] (PointIndex pi, Vec<3> gw, double h) {
// growthvectors[pi] = gw;
// growth_vector_map[pi] = {&growthvectors[pi], h};
// };
// cout << "edge range " << max_edge_nr << ", " << new_max_edge_nr << endl; // cout << "edge range " << max_edge_nr << ", " << new_max_edge_nr << endl;
// interpolate tangential component of growth vector along edge // interpolate tangential component of growth vector along edge
@ -1491,7 +1500,7 @@ struct GrowthVectorLimiter {
throw Exception(string("Could not find connected list of line segments for edge ") + edgenr); throw Exception(string("Could not find connected list of line segments for edge ") + edgenr);
} }
} }
// cout << "Points " << points << endl; cout << "Points " << points << endl;
if(getGW(points[0]).Length2() == 0 && if(getGW(points[0]).Length2() == 0 &&
getGW(points.Last()).Length2() == 0) getGW(points.Last()).Length2() == 0)
@ -1532,7 +1541,7 @@ struct GrowthVectorLimiter {
// } // }
cout << "add gw " << pi << " " << interpol << endl; cout << "add gw " << pi << " " << interpol << endl;
getGW(pi) += interpol; growthvectors[pi] += interpol;
} }
} }
@ -2145,7 +2154,7 @@ struct GrowthVectorLimiter {
auto p2el = mesh.CreatePoint2ElementTable(is_inner_point); auto p2el = mesh.CreatePoint2ElementTable(is_inner_point);
// smooth growth vectors to shift additional element layers to the inside and fix flipped tets // smooth growth vectors to shift additional element layers to the inside and fix flipped tets
for([[maybe_unused]] auto step : Range(10)) for([[maybe_unused]] auto step : Range(0))
{ {
for(auto pi : points) for(auto pi : points)
{ {
@ -2164,11 +2173,11 @@ struct GrowthVectorLimiter {
} }
} }
for(auto pi : points) // for(auto pi : points)
{ // {
mesh[pi] += height * growthvectors[pi]; // mesh[pi] += height * growthvectors[pi];
growthvectors[pi] = 0.0; // growthvectors[pi] = 0.0;
} // }
} }
void BoundaryLayerTool :: Perform() void BoundaryLayerTool :: Perform()
@ -2221,12 +2230,12 @@ struct GrowthVectorLimiter {
for(PointIndex pi : Range(PointIndex::BASE, this->np + PointIndex::BASE)) for(PointIndex pi : Range(PointIndex::BASE, this->np + PointIndex::BASE))
{ {
cout << "move " << pi << " by " << 1.0 << " * " << growthvectors[pi] << endl; cout << "move " << pi << "\tby " << total_height << " * " << growthvectors[pi] << endl;
mesh[pi] += growthvectors[pi]; mesh[pi] += total_height * growthvectors[pi];
} }
for (auto [pi, data] : growth_vector_map) { for (auto [pi, data] : growth_vector_map) {
auto [gw, height] = data; auto [gw, height] = data;
cout << "move " << pi << " by " << height << " * " << (*gw) << endl; cout << "move " << pi << "\tby " << height << " * " << (*gw) << endl;
mesh[pi] += height * (*gw); mesh[pi] += height * (*gw);
} }

View File

@ -72,7 +72,7 @@ class BoundaryLayerTool
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;
double height; double total_height;
bool have_single_segments; bool have_single_segments;
Array<Segment> segments, new_segments; Array<Segment> segments, new_segments;