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

migrate the C++ _<name> modules directly into the dune namespace

This allows them to be loaded without loading the corresponding Python
mdoule, avoiding circular dependencies.
parent 36533188
No related branches found
No related tags found
No related merge requests found
add_python_targets(istl
__init__
)
dune_add_pybind11_module(NAME _istl CMAKE_GUARD dune-istl_FOUND)
from .. import common
from ._istl import *
from .._istl import *
// -*- tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#include <config.h>
#include <dune/common/fmatrix.hh>
#include <dune/istl/bcrsmatrix.hh>
#include <dune/istl/bvector.hh>
#include <dune/python/common/fvector.hh>
#include <dune/python/istl/bcrsmatrix.hh>
#include <dune/python/istl/bvector.hh>
#include <dune/python/istl/operators.hh>
#include <dune/python/istl/preconditioners.hh>
#include <dune/python/istl/solvers.hh>
#include <dune/python/pybind11/pybind11.h>
PYBIND11_MODULE( _istl, 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::Python::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::Python::registerLinearOperator( clsLinearOperator );
Dune::Python::registerPreconditioners( module, clsLinearOperator );
Dune::Python::registerSolvers( module, clsLinearOperator );
// export BCRS matrix with block size 1x1
typedef Dune::BCRSMatrix< Dune::FieldMatrix< double, 1, 1 > > Matrix;
Dune::Python::registerBCRSMatrix< Matrix >( module );
// export matrix-based preconditioners for BCRS matrix with block size 1x1
Dune::Python::registerMatrixPreconditioners< Matrix >( module, clsLinearOperator );
}
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