42#if PY_MAJOR_VERSION == 2
45 std::shared_ptr<NekMatrix<T, F>> *mat =
46 (std::shared_ptr<NekMatrix<T, F>> *)ptr;
52 std::shared_ptr<NekMatrix<T, F>> *mat =
53 (std::shared_ptr<NekMatrix<T, F>> *)PyCapsule_GetPointer(ptr,
nullptr);
66#if PY_MAJOR_VERSION == 2
67 py::object capsule(py::handle<>(PyCObject_FromVoidPtr(
69 NekMatrixCapsuleDestructor<T, StandardMatrixTag>)));
71 py::object capsule(py::handle<>(PyCapsule_New(
75 T, StandardMatrixTag>)));
78 int nRows = mat->GetRows(), nCols = mat->GetColumns();
82 "Only full storage matrices are currently supported.");
85 np::from_data(mat->GetRawPtr(), np::dtype::get_builtin<T>(),
86 py::make_tuple(nRows, nCols),
87 py::make_tuple(
sizeof(T), nRows *
sizeof(T)), capsule)
94 py::to_python_converter<std::shared_ptr<NekMatrix<T, StandardMatrixTag>>,
#define ASSERTL0(condition, msg)
void NekMatrixCapsuleDestructor(PyObject *ptr)
template void export_NekMatrix< double >()
static PyObject * convert(std::shared_ptr< NekMatrix< T, StandardMatrixTag > > const &mat)