visualized failed mesh after generatemesh

This commit is contained in:
Christopher Lackner 2022-08-04 10:31:33 +02:00
parent 354898498f
commit 00a1d1a496
2 changed files with 10 additions and 0 deletions

View File

@ -586,6 +586,8 @@ namespace netgen
auto md = DivideMesh(mesh3d, mp); auto md = DivideMesh(mesh3d, mp);
try
{
ParallelFor( md.Range(), [&](int i) ParallelFor( md.Range(), [&](int i)
{ {
if (mp.checkoverlappingboundary) if (mp.checkoverlappingboundary)
@ -597,6 +599,12 @@ namespace netgen
CloseOpenQuads( md[i] ); CloseOpenQuads( md[i] );
MeshDomain(md[i]); MeshDomain(md[i]);
}, md.Size()); }, md.Size());
}
catch(...)
{
MergeMeshes(mesh3d, md);
return MESHING3_GIVEUP;
}
MergeMeshes(mesh3d, md); MergeMeshes(mesh3d, md);

View File

@ -26,6 +26,7 @@ using namespace netgen;
namespace netgen namespace netgen
{ {
extern std::shared_ptr<NetgenGeometry> ng_geometry; extern std::shared_ptr<NetgenGeometry> ng_geometry;
extern std::shared_ptr<Mesh> mesh;
} }
static string occparameter_description = R"delimiter( static string occparameter_description = R"delimiter(
@ -270,6 +271,7 @@ DLL_HEADER void ExportNgOCC(py::module &m)
if (comm.Rank()==0) if (comm.Rank()==0)
{ {
SetGlobalMesh(mesh); SetGlobalMesh(mesh);
netgen::mesh = mesh;
auto result = geo->GenerateMesh(mesh, mp); auto result = geo->GenerateMesh(mesh, mp);
if(result != 0) if(result != 0)
throw Exception("Meshing failed!"); throw Exception("Meshing failed!");