diff --git a/ng/ngpkg.cpp b/ng/ngpkg.cpp index 17a8d589..38c65986 100644 --- a/ng/ngpkg.cpp +++ b/ng/ngpkg.cpp @@ -1350,10 +1350,15 @@ namespace netgen #endif if (ng_geometry) { - mesh = make_shared (); - // vsmesh.SetMesh (mesh); - SetGlobalMesh (mesh); - mesh -> SetGeometry(ng_geometry); + if (perfstepsstart == 1) + { + mesh = make_shared (); + // vsmesh.SetMesh (mesh); + SetGlobalMesh (mesh); + mesh -> SetGeometry(ng_geometry); + } + if(!mesh) + throw Exception("Need existing global mesh"); mparam.perfstepsstart = perfstepsstart; mparam.perfstepsend = perfstepsend; int res = ng_geometry -> GenerateMesh (mesh, mparam);