set global shared ptr only if meshing fails

This commit is contained in:
Christopher Lackner 2022-08-04 14:14:39 +02:00
parent 00a1d1a496
commit 4e860f4ca2

View File

@ -271,10 +271,12 @@ 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!"); {
netgen::mesh = mesh;
throw Exception("Meshing failed!");
}
ng_geometry = geo; ng_geometry = geo;
if (comm.Size() > 1) if (comm.Size() > 1)
mesh->Distribute(); mesh->Distribute();