// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root // SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception #ifndef DUNE_PYTHON_ISTL_BCRSMATRIX_HH #define DUNE_PYTHON_ISTL_BCRSMATRIX_HH #include #include #include #include #include #include #include #include #include #include namespace Dune { namespace Python { // registermatrixindexset // ------------------ template void registerMatrixIndexSet(pybind11::handle scope, pybind11::class_ cls) { using size_type = Dune::MatrixIndexSet::size_type; // two different possible constructors cls.def( pybind11::init( [] () { return new MatrixIndexSet(); } ) ); cls.def( pybind11::init( [] (size_type rows, size_type cols) { return new MatrixIndexSet(rows,cols); } ) ); cls.def ( "add", [] (MatrixIndexSet &self, size_type i, size_type j) {self.add(i,j); } ); cls.def( "exportIdx", [] (MatrixIndexSet &self) { } ); } template< class MatrixIndexSet > pybind11::class_< MatrixIndexSet > registerMatrixIndexSet ( pybind11::handle scope, const char *clsName = "MatrixIndexSet" ) { pybind11::class_< MatrixIndexSet > cls( scope, clsName ); registerMatrixIndexSet( scope, cls ); return cls; } } // namespace Python } // namespace Dune #endif // #ifndef DUNE_PYTHON_ISTL_BCRSMATRIX_HH