diff --git a/libsrc/csg/python_csg.cpp b/libsrc/csg/python_csg.cpp index a53c8590..6376abd4 100644 --- a/libsrc/csg/python_csg.cpp +++ b/libsrc/csg/python_csg.cpp @@ -756,10 +756,8 @@ However, when r = 0, the top part becomes a point(tip) and meshing fails! { MeshingParameters mp; if(pars) mp = *pars; - { - py::gil_scoped_acquire aq; - CreateMPfromKwargs(mp, kwargs); - } + CreateMPfromKwargs(mp, kwargs); + py::gil_scoped_release gil_rel; auto mesh = make_shared(); SetGlobalMesh (mesh); mesh->SetGeometry(geo); @@ -770,8 +768,7 @@ However, when r = 0, the top part becomes a point(tip) and meshing fails! throw Exception("Meshing failed!"); return mesh; }, py::arg("mp") = nullptr, - meshingparameter_description.c_str(), - py::call_guard()) + meshingparameter_description.c_str()) ; m.def("Save", FunctionPointer diff --git a/libsrc/geom2d/python_geom2d.cpp b/libsrc/geom2d/python_geom2d.cpp index ab232f13..dc6ae29c 100644 --- a/libsrc/geom2d/python_geom2d.cpp +++ b/libsrc/geom2d/python_geom2d.cpp @@ -401,10 +401,8 @@ NGCORE_API_EXPORT void ExportGeom2d(py::module &m) { MeshingParameters mp; if(pars) mp = *pars; - { - py::gil_scoped_acquire aq; - CreateMPfromKwargs(mp, kwargs); - } + CreateMPfromKwargs(mp, kwargs); + py::gil_scoped_release gil_release; auto mesh = make_shared(); mesh->SetGeometry(self); SetGlobalMesh (mesh); @@ -414,7 +412,6 @@ NGCORE_API_EXPORT void ExportGeom2d(py::module &m) throw Exception("Meshing failed!"); return mesh; }, py::arg("mp") = nullopt, - py::call_guard(), meshingparameter_description.c_str()) .def("_SetDomainTensorMeshing", &SplineGeometry2d::SetDomainTensorMeshing) ; @@ -466,10 +463,8 @@ NGCORE_API_EXPORT void ExportGeom2d(py::module &m) { MeshingParameters mp; if(pars) mp = *pars; - { - py::gil_scoped_acquire aq; CreateMPfromKwargs(mp, kwargs); - } + py::gil_scoped_release gil_release; auto mesh = make_shared(); auto geo = self.GenerateSplineGeometry(); mesh->SetGeometry(geo); @@ -480,7 +475,6 @@ NGCORE_API_EXPORT void ExportGeom2d(py::module &m) throw Exception("Meshing failed!"); return mesh; }, py::arg("mp") = nullopt, - py::call_guard(), meshingparameter_description.c_str()) ; diff --git a/libsrc/occ/python_occ.cpp b/libsrc/occ/python_occ.cpp index 8f95f0e2..5d7521ed 100644 --- a/libsrc/occ/python_occ.cpp +++ b/libsrc/occ/python_occ.cpp @@ -243,17 +243,15 @@ DLL_HEADER void ExportNgOCC(py::module &m) { MeshingParameters mp; OCCParameters occparam; - { - py::gil_scoped_acquire aq; - if(pars) - { - auto mp_kwargs = CreateDictFromFlags(pars->geometrySpecificParameters); - CreateOCCParametersFromKwargs(occparam, mp_kwargs); - mp = *pars; - } - CreateOCCParametersFromKwargs(occparam, kwargs); - CreateMPfromKwargs(mp, kwargs); - } + if(pars) + { + auto mp_kwargs = CreateDictFromFlags(pars->geometrySpecificParameters); + CreateOCCParametersFromKwargs(occparam, mp_kwargs); + mp = *pars; + } + CreateOCCParametersFromKwargs(occparam, kwargs); + CreateMPfromKwargs(mp, kwargs); + py::gil_scoped_release gil_release; geo->SetOCCParameters(occparam); if(!mesh) mesh = make_shared(); @@ -279,7 +277,7 @@ DLL_HEADER void ExportNgOCC(py::module &m) } return mesh; }, py::arg("mp") = nullptr, py::arg("comm")=NgMPI_Comm{}, - py::arg("mesh")=nullptr, py::call_guard(), + py::arg("mesh")=nullptr, (meshingparameter_description + occparameter_description).c_str()) .def_property_readonly("shape", [](const OCCGeometry & self) { return self.GetShape(); }) ;