Write separate mesh with only quads on open quads error

This commit is contained in:
Matthias Hochsteger 2024-10-31 16:54:59 +01:00
parent c27dbdef30
commit 33e76840b9
3 changed files with 5 additions and 3 deletions

View File

@ -2,7 +2,7 @@
namespace netgen namespace netgen
{ {
unique_ptr<Mesh> GetOpenElements( const Mesh & m, int dom = 0 ) unique_ptr<Mesh> GetOpenElements( const Mesh & m, int dom = 0, bool only_quads = false )
{ {
static Timer t("GetOpenElements"); RegionTimer rt(t); static Timer t("GetOpenElements"); RegionTimer rt(t);
auto mesh = make_unique<Mesh>(); auto mesh = make_unique<Mesh>();
@ -40,7 +40,8 @@ namespace netgen
mesh->ClearSurfaceElements(); mesh->ClearSurfaceElements();
for (auto & el : openelements) for (auto & el : openelements)
mesh->AddSurfaceElement( el ); if(!only_quads || el.GetNP() == 4)
mesh->AddSurfaceElement( el );
mesh->Compress(); mesh->Compress();
return mesh; return mesh;

View File

@ -3,7 +3,7 @@
namespace netgen namespace netgen
{ {
unique_ptr<Mesh> GetOpenElements( const Mesh & m, int dom = 0 ); unique_ptr<Mesh> GetOpenElements( const Mesh & m, int dom = 0, bool only_quads = false );
unique_ptr<Mesh> FilterMesh( const Mesh & m, FlatArray<PointIndex> points, FlatArray<SurfaceElementIndex> sels = Array<SurfaceElementIndex>{}, FlatArray<ElementIndex> els = Array<ElementIndex>{} ); unique_ptr<Mesh> FilterMesh( const Mesh & m, FlatArray<PointIndex> points, FlatArray<SurfaceElementIndex> sels = Array<SurfaceElementIndex>{}, FlatArray<ElementIndex> els = Array<ElementIndex>{} );

View File

@ -363,6 +363,7 @@ namespace netgen
if(debugparam.write_mesh_on_error) { if(debugparam.write_mesh_on_error) {
md.mesh->Save("open_quads_starting_mesh_"+ToString(md.domain)+".vol.gz"); md.mesh->Save("open_quads_starting_mesh_"+ToString(md.domain)+".vol.gz");
GetOpenElements(*md.mesh, md.domain)->Save("open_quads_rest_" + ToString(md.domain)+".vol.gz"); GetOpenElements(*md.mesh, md.domain)->Save("open_quads_rest_" + ToString(md.domain)+".vol.gz");
GetOpenElements(*md.mesh, md.domain, true)->Save("open_quads_rest_" + ToString(md.domain)+"_only_quads.vol.gz");
} }
PrintSysError ("mesh has still open quads"); PrintSysError ("mesh has still open quads");
throw NgException ("Stop meshing since too many attempts"); throw NgException ("Stop meshing since too many attempts");