mirror of
https://github.com/NGSolve/netgen.git
synced 2025-04-25 16:02:04 +05:00
Throw error earlier in intersection-check, utility function to write mesh on error
This commit is contained in:
parent
aa2e0ace99
commit
7f294a582c
@ -48,6 +48,20 @@ struct GrowthVectorLimiter
|
|||||||
|
|
||||||
auto SurfaceElementsRange () { return Range(tool.nse + tool.new_sels.Size()); }
|
auto SurfaceElementsRange () { return Range(tool.nse + tool.new_sels.Size()); }
|
||||||
|
|
||||||
|
void WriteErrorMesh (string name)
|
||||||
|
{
|
||||||
|
if (!debugparam.write_mesh_on_error)
|
||||||
|
return;
|
||||||
|
Mesh out_mesh;
|
||||||
|
out_mesh = mesh;
|
||||||
|
for (auto [pi, data] : tool.growth_vector_map)
|
||||||
|
{
|
||||||
|
auto [gw, height] = data;
|
||||||
|
out_mesh[pi] += limits[pi] * height * (*gw);
|
||||||
|
}
|
||||||
|
out_mesh.Save(name);
|
||||||
|
}
|
||||||
|
|
||||||
const auto& Get (SurfaceElementIndex sei)
|
const auto& Get (SurfaceElementIndex sei)
|
||||||
{
|
{
|
||||||
if (sei < tool.nse)
|
if (sei < tool.nse)
|
||||||
@ -525,6 +539,11 @@ struct GrowthVectorLimiter
|
|||||||
cerr << "Limit intersecting surface elements: too many "
|
cerr << "Limit intersecting surface elements: too many "
|
||||||
"limitation steps, sels: "
|
"limitation steps, sels: "
|
||||||
<< Get(sei) << '\t' << Get(sej) << endl;
|
<< Get(sei) << '\t' << Get(sej) << endl;
|
||||||
|
if (GetLimit(pi_max_limit) < 1e-10)
|
||||||
|
{
|
||||||
|
WriteErrorMesh("error_blayer_self_intersection_pi" + ToString(pi_max_limit) + ".vol.gz");
|
||||||
|
throw NgException("Stop meshing in boundary layer thickness limitation: overlapping regions detected at elements " + ToString(tri) + " and " + ToString(tri2));
|
||||||
|
}
|
||||||
for (auto si : {sei, sej})
|
for (auto si : {sei, sej})
|
||||||
{
|
{
|
||||||
auto sel = Get(si);
|
auto sel = Get(si);
|
||||||
@ -619,9 +638,12 @@ struct GrowthVectorLimiter
|
|||||||
|
|
||||||
void CheckLimits ()
|
void CheckLimits ()
|
||||||
{
|
{
|
||||||
for (auto i : Range(growthvectors))
|
for (auto [pi, data] : tool.growth_vector_map)
|
||||||
if (limits[i] < 1e-10)
|
if (limits[pi] < 1e-10)
|
||||||
throw NgException("Stop meshing in boundary layer thickness limitation: overlapping regions detected");
|
{
|
||||||
|
WriteErrorMesh("error_blayer_intersection_pi" + ToString(pi) + ".vol.gz");
|
||||||
|
throw NgException("Stop meshing in boundary layer thickness limitation: overlapping regions detected at point " + ToString(pi));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Perform ()
|
void Perform ()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user