mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-25 05:20:34 +05:00
return mesh.Coordinates returns py::array
This commit is contained in:
parent
c29e93dd2b
commit
9f9ad8fa2e
@ -855,23 +855,14 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
|||||||
py::return_value_policy::reference)
|
py::return_value_policy::reference)
|
||||||
|
|
||||||
.def("Coordinates", [](Mesh & self) {
|
.def("Coordinates", [](Mesh & self) {
|
||||||
size_t shape[2] = { self.Points().Size(), size_t(self.GetDimension()) };
|
return py::array
|
||||||
size_t stride[2] = { sizeof(self.Points()[0]), sizeof(double) };
|
(
|
||||||
|
py::memoryview::from_buffer
|
||||||
return py::memoryview::from_buffer
|
|
||||||
(&self.Points()[PointIndex::BASE](0), sizeof(double),
|
(&self.Points()[PointIndex::BASE](0), sizeof(double),
|
||||||
py::format_descriptor<double>::value,
|
py::format_descriptor<double>::value,
|
||||||
{ self.Points().Size(), size_t(self.GetDimension()) },
|
{ self.Points().Size(), size_t(self.GetDimension()) },
|
||||||
{ sizeof(self.Points()[1]), sizeof(double) } );
|
{ sizeof(self.Points()[PointIndex::BASE]), sizeof(double) } )
|
||||||
|
|
||||||
/*
|
|
||||||
// how to avoid copying array ?
|
|
||||||
return py::array
|
|
||||||
(
|
|
||||||
shape, stride,
|
|
||||||
&self.Points()[PointIndex::BASE](0) // , borrowed_t{} // how to use borrow ?
|
|
||||||
);
|
);
|
||||||
*/
|
|
||||||
})
|
})
|
||||||
|
|
||||||
.def("FaceDescriptor", static_cast<FaceDescriptor&(Mesh::*)(int)> (&Mesh::GetFaceDescriptor),
|
.def("FaceDescriptor", static_cast<FaceDescriptor&(Mesh::*)(int)> (&Mesh::GetFaceDescriptor),
|
||||||
|
Loading…
Reference in New Issue
Block a user