MCPcopy Create free account
hub / github.com/NGSolve/ngsolve / MoveToNumpyArray

Function MoveToNumpyArray

ngstd/python_ngstd.hpp:143–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141
142template<typename T>
143py::array_t<T> MoveToNumpyArray( Array<T> &a )
144{
145 if(a.Size()) {
146 py::capsule free_when_done(&a[0], [](void *f) {
147 delete [] reinterpret_cast<T *>(f);
148 });
149 a.NothingToDelete();
150 return py::array_t<T>(a.Size(), &a[0], free_when_done);
151 }
152 else
153 return py::array_t<T>(0, nullptr);
154}
155
156
157template<typename ... Args>

Callers 4

ExportNgcompMeshFunction · 0.85
ExportVisFunctionsFunction · 0.85

Calls 1

SizeMethod · 0.45

Tested by

no test coverage detected