Skip to content
Snippets Groups Projects
Commit 536473bb authored by Martin Nolte's avatar Martin Nolte
Browse files

[istl] export preconditioners and solvers to Python

parent cef80a04
No related branches found
No related tags found
1 merge request!369Feature/add python bindings
......@@ -9,6 +9,9 @@
#include <dune/corepy/istl/bcrsmatrix.hh>
#include <dune/corepy/istl/bvector.hh>
#include <dune/corepy/istl/operators.hh>
#include <dune/corepy/istl/preconditioners.hh>
#include <dune/corepy/istl/solvers.hh>
#include <dune/corepy/pybind11/pybind11.h>
......@@ -16,14 +19,28 @@ PYBIND11_PLUGIN(_istl)
{
pybind11::module module( "_istl" );
Dune::CorePy::registerBCRSMatrix< Dune::BCRSMatrix< Dune::FieldMatrix< double, 1, 1 > > >( module );
Dune::CorePy::registerBlockVector< Dune::BlockVector< Dune::FieldVector< double, 1 > > >( module );
// export solver category
pybind11::enum_< Dune::SolverCategory::Category > solverCategory( module, "SolverCategory" );
solverCategory.value( "sequential", Dune::SolverCategory::sequential );
solverCategory.value( "nonoverlapping", Dune::SolverCategory::nonoverlapping );
solverCategory.value( "overlapping", Dune::SolverCategory::overlapping );
// export block vector with block size 1
typedef Dune::BlockVector< Dune::FieldVector< double, 1 > > Vector;
Dune::CorePy::registerBlockVector< Vector >( module );
// export linear operator, preconditioners, and solvers for blockvectors with block size 1
pybind11::class_< Dune::LinearOperator< Vector, Vector > > clsLinearOperator( module, "LinearOperator" );
Dune::CorePy::registerLinearOperator( clsLinearOperator );
Dune::CorePy::registerPreconditioners( module, clsLinearOperator );
Dune::CorePy::registerSolvers( module, clsLinearOperator );
// export BCRS matrix with block size 1x1
typedef Dune::BCRSMatrix< Dune::FieldMatrix< double, 1, 1 > > Matrix;
Dune::CorePy::registerBCRSMatrix< Matrix >( module );
// export matrix-based preconditioners for BCRS matrix with block size 1x1
Dune::CorePy::registerMatrixPreconditioners< Matrix >( module, clsLinearOperator );
return module.ptr();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment