mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-13 06:30:34 +05:00
copy mesh from py
This commit is contained in:
parent
11259d0a88
commit
2794dda996
@ -90,6 +90,7 @@ namespace netgen
|
|||||||
|
|
||||||
Mesh & Mesh :: operator= (const Mesh & mesh2)
|
Mesh & Mesh :: operator= (const Mesh & mesh2)
|
||||||
{
|
{
|
||||||
|
dimension = mesh2.dimension;
|
||||||
points = mesh2.points;
|
points = mesh2.points;
|
||||||
// eltyps = mesh2.eltyps;
|
// eltyps = mesh2.eltyps;
|
||||||
segments = mesh2.segments;
|
segments = mesh2.segments;
|
||||||
|
@ -17,6 +17,8 @@ namespace netgen
|
|||||||
{
|
{
|
||||||
extern bool netgen_executable_started;
|
extern bool netgen_executable_started;
|
||||||
extern shared_ptr<NetgenGeometry> ng_geometry;
|
extern shared_ptr<NetgenGeometry> ng_geometry;
|
||||||
|
extern void Optimize2d (Mesh & mesh, MeshingParameters & mp);
|
||||||
|
|
||||||
#ifdef PARALLEL
|
#ifdef PARALLEL
|
||||||
/** we need allreduce in python-wrapped communicators **/
|
/** we need allreduce in python-wrapped communicators **/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -865,13 +867,20 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
|||||||
},
|
},
|
||||||
py::arg("mp")=NGDummyArgument(),py::call_guard<py::gil_scoped_release>())
|
py::arg("mp")=NGDummyArgument(),py::call_guard<py::gil_scoped_release>())
|
||||||
|
|
||||||
.def ("OptimizeVolumeMesh", FunctionPointer
|
.def ("OptimizeVolumeMesh", [](Mesh & self)
|
||||||
([](Mesh & self)
|
|
||||||
{
|
{
|
||||||
MeshingParameters mp;
|
MeshingParameters mp;
|
||||||
mp.optsteps3d = 5;
|
mp.optsteps3d = 5;
|
||||||
OptimizeVolume (mp, self);
|
OptimizeVolume (mp, self);
|
||||||
}),py::call_guard<py::gil_scoped_release>())
|
},py::call_guard<py::gil_scoped_release>())
|
||||||
|
|
||||||
|
.def ("OptimizeMesh2d", [](Mesh & self)
|
||||||
|
{
|
||||||
|
self.CalcLocalH(0.5);
|
||||||
|
MeshingParameters mp;
|
||||||
|
mp.optsteps2d = 5;
|
||||||
|
Optimize2d (self, mp);
|
||||||
|
},py::call_guard<py::gil_scoped_release>())
|
||||||
|
|
||||||
.def ("Refine", FunctionPointer
|
.def ("Refine", FunctionPointer
|
||||||
([](Mesh & self)
|
([](Mesh & self)
|
||||||
@ -975,12 +984,17 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
|||||||
},
|
},
|
||||||
py::arg("name"), py::arg("set")=true)
|
py::arg("name"), py::arg("set")=true)
|
||||||
|
|
||||||
.def ("Scale", FunctionPointer([](Mesh & self, double factor)
|
.def ("Scale", [](Mesh & self, double factor)
|
||||||
{
|
{
|
||||||
for(auto i = 0; i<self.GetNP();i++)
|
for(auto i = 0; i<self.GetNP();i++)
|
||||||
self.Point(i).Scale(factor);
|
self.Point(i).Scale(factor);
|
||||||
}))
|
})
|
||||||
|
.def ("Copy", [](Mesh & self)
|
||||||
|
{
|
||||||
|
auto m2 = make_shared<Mesh> ();
|
||||||
|
*m2 = self;
|
||||||
|
return m2;
|
||||||
|
})
|
||||||
;
|
;
|
||||||
|
|
||||||
m.def("ImportMesh", [](const string& filename)
|
m.def("ImportMesh", [](const string& filename)
|
||||||
|
Loading…
Reference in New Issue
Block a user