mesh argument in GeneratMesh (to continue meshing from higher perfstepstart

This commit is contained in:
Christopher Lackner 2022-09-01 10:43:16 +02:00
parent 85d4874320
commit 78dfd10475
3 changed files with 17 additions and 7 deletions

View File

@ -494,7 +494,8 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
;
py::class_<Segment>(m, "Element1D")
.def(py::init([](py::list vertices, py::list surfaces, int index, int edgenr)
.def(py::init([](py::list vertices, py::list surfaces, int index, int edgenr,
py::list trignums)
{
Segment * newel = new Segment();
for (int i = 0; i < 2; i++)
@ -505,6 +506,8 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
newel -> epgeominfo[1].edgenr = edgenr;
// needed for codim2 in 3d
newel -> edgenr = index;
for(auto i : Range(len(trignums)))
newel->geominfo[i].trignum = py::cast<int>(trignums[i]);
if (len(surfaces))
{
newel->surfnr1 = py::extract<int>(surfaces[0])();
@ -516,6 +519,7 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
py::arg("surfaces")=py::list(),
py::arg("index")=1,
py::arg("edgenr")=1,
py::arg("trignums")=py::list(), // for stl
"create segment element"
)
.def("__repr__", &ToString<Segment>)

View File

@ -250,7 +250,8 @@ DLL_HEADER void ExportNgOCC(py::module &m)
return res;
}, py::call_guard<py::gil_scoped_release>())
.def("GenerateMesh", [](shared_ptr<OCCGeometry> geo,
MeshingParameters* pars, NgMPI_Comm comm, py::kwargs kwargs)
MeshingParameters* pars, NgMPI_Comm comm,
shared_ptr<Mesh>, py::kwargs kwargs)
{
MeshingParameters mp;
OCCParameters occparam;
@ -266,7 +267,8 @@ DLL_HEADER void ExportNgOCC(py::module &m)
CreateMPfromKwargs(mp, kwargs);
}
geo->SetOCCParameters(occparam);
auto mesh = make_shared<Mesh>();
if(!mesh)
mesh = make_shared<Mesh>();
mesh->SetCommunicator(comm);
mesh->SetGeometry(geo);
@ -289,7 +291,7 @@ DLL_HEADER void ExportNgOCC(py::module &m)
}
return mesh;
}, py::arg("mp") = nullptr, py::arg("comm")=NgMPI_Comm{},
py::call_guard<py::gil_scoped_release>(),
py::arg("mesh")=nullptr, py::call_guard<py::gil_scoped_release>(),
(meshingparameter_description + occparameter_description).c_str())
.def_property_readonly("shape", [](const OCCGeometry & self) { return self.GetShape(); })
;

View File

@ -183,7 +183,8 @@ NGCORE_API_EXPORT void ExportSTL(py::module & m)
return res;
}, py::call_guard<py::gil_scoped_release>())
.def("GenerateMesh", [] (shared_ptr<STLGeometry> geo,
MeshingParameters* pars, py::kwargs kwargs)
MeshingParameters* pars,
shared_ptr<Mesh> mesh, py::kwargs kwargs)
{
MeshingParameters mp;
STLParameters stlparam;
@ -198,7 +199,10 @@ NGCORE_API_EXPORT void ExportSTL(py::module & m)
CreateSTLParametersFromKwargs(stlparam, kwargs);
CreateMPfromKwargs(mp, kwargs); // this will throw if any kwargs are not passed
}
auto mesh = make_shared<Mesh>();
if(!mesh)
{
mesh = make_shared<Mesh>();
}
mesh->SetGeometry(geo);
ng_geometry = geo;
SetGlobalMesh(mesh);
@ -210,7 +214,7 @@ NGCORE_API_EXPORT void ExportSTL(py::module & m)
}
return mesh;
}, py::arg("mp") = nullptr,
}, py::arg("mp") = nullptr, py::arg("mesh") = nullptr,
py::call_guard<py::gil_scoped_release>(),
(meshingparameter_description + stlparameter_description).c_str())
.def("Draw", FunctionPointer