throw on meshing failure

This commit is contained in:
Christopher Lackner 2019-11-26 17:08:21 +01:00
parent de1932227b
commit 303aebc27e
4 changed files with 13 additions and 4 deletions

View File

@ -707,7 +707,9 @@ However, when r = 0, the top part becomes a point(tip) and meshing fails!
mesh->SetGeometry(geo); mesh->SetGeometry(geo);
ng_geometry = geo; ng_geometry = geo;
geo->FindIdenticSurfaces(1e-8 * geo->MaxSize()); geo->FindIdenticSurfaces(1e-8 * geo->MaxSize());
geo->GenerateMesh (mesh, mp); auto result = geo->GenerateMesh (mesh, mp);
if(result != 0)
throw Exception("Meshing failed!");
return mesh; return mesh;
}, py::arg("mp") = nullptr, }, py::arg("mp") = nullptr,
meshingparameter_description.c_str(), meshingparameter_description.c_str(),

View File

@ -377,7 +377,9 @@ DLL_HEADER void ExportGeom2d(py::module &m)
mesh->SetGeometry(self); mesh->SetGeometry(self);
SetGlobalMesh (mesh); SetGlobalMesh (mesh);
ng_geometry = self; ng_geometry = self;
self->GenerateMesh(mesh, mp); auto result = self->GenerateMesh(mesh, mp);
if(result != 0)
throw Exception("Meshing failed!");
return mesh; return mesh;
}, py::arg("mp") = nullptr, }, py::arg("mp") = nullptr,
py::call_guard<py::gil_scoped_release>(), py::call_guard<py::gil_scoped_release>(),

View File

@ -177,7 +177,9 @@ DLL_HEADER void ExportNgOCC(py::module &m)
geo->SetOCCParameters(occparam); geo->SetOCCParameters(occparam);
auto mesh = make_shared<Mesh>(); auto mesh = make_shared<Mesh>();
mesh->SetGeometry(geo); mesh->SetGeometry(geo);
geo->GenerateMesh(mesh, mp); auto result = geo->GenerateMesh(mesh, mp);
if(result != 0)
throw Exception("Meshing failed!");
SetGlobalMesh(mesh); SetGlobalMesh(mesh);
ng_geometry = geo; ng_geometry = geo;
return mesh; return mesh;

View File

@ -205,7 +205,10 @@ DLL_HEADER void ExportSTL(py::module & m)
mesh->SetGeometry(geo); mesh->SetGeometry(geo);
ng_geometry = geo; ng_geometry = geo;
SetGlobalMesh(mesh); SetGlobalMesh(mesh);
STLMeshingDummy(geo.get(), mesh, mp, stlparam); auto result = STLMeshingDummy(geo.get(), mesh, mp, stlparam);
if(result != 0)
throw Exception("Meshing failed!");
return mesh; return mesh;
}, py::arg("mp") = nullptr, }, py::arg("mp") = nullptr,
py::call_guard<py::gil_scoped_release>(), py::call_guard<py::gil_scoped_release>(),