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

Function PyDefVecBuffer

ngstd/python_ngstd.cpp:47–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45
46template<typename T, typename TSCAL, typename TCLASS>
47void PyDefVecBuffer( TCLASS & c )
48{
49 c.def_buffer([](T &self) -> py::buffer_info {
50 return py::buffer_info
51 (
52 &self[0], /* Pointer to buffer */
53 sizeof(TSCAL), /* Size of one scalar */
54 py::format_descriptor<TSCAL>::format(), /* Python struct-style format descriptor */
55 1, /* Number of dimensions */
56 { self.Size() }, /* Buffer dimensions */
57 { sizeof(TSCAL)*(self.Addr(1)-self.Addr(0)) } /* Strides (in bytes) for each index */
58 );
59 });
60}
61
62
63

Callers

nothing calls this directly

Calls 2

AddrMethod · 0.80
SizeMethod · 0.45

Tested by

no test coverage detected