Skip to content
Snippets Groups Projects
Commit cb5f3997 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 04aba823
No related branches found
No related tags found
No related merge requests found
......@@ -8,5 +8,3 @@ add_python_targets(common
pickle
project
)
dune_add_pybind11_module(NAME _common)
......@@ -21,10 +21,10 @@ try:
except ImportError:
logger.info('mpi4py not found, MPI not initialized')
from ._common import *
from .._common import *
from .deprecated import DeprecatedObject
from ..grid._grid import CommunicationDirection, DataType, InterfaceType, Marker, OutputType, PartitionType, reader
from .._grid import CommunicationDirection, DataType, InterfaceType, Marker, OutputType, PartitionType, reader
CommunicationDirection = DeprecatedObject(CommunicationDirection, "dune.common.CommunicationDirection is deprecated, use dune.grid.CommunicationDirection instead")
DataType = DeprecatedObject(DataType, "dune.common.DataType is deprecated, use dune.grid.DataType instead")
InterfaceType = DeprecatedObject(InterfaceType, "dune.common.Interface is deprecated, use dune.grid.InterfaceType instead")
......
// -*- tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#include <config.h>
#include <utility>
#include <dune/common/hybridutilities.hh>
#include <dune/python/common/dynmatrix.hh>
#include <dune/python/common/dynvector.hh>
#include <dune/python/common/fmatrix.hh>
#include <dune/python/common/fvector.hh>
#include <dune/python/common/mpihelper.hh>
#include <dune/python/pybind11/pybind11.h>
#include <dune/python/pybind11/stl.h>
PYBIND11_MODULE( _common, module )
{
Dune::Python::addToTypeRegistry<double>(Dune::Python::GenerateTypeName("double"));
Dune::Python::addToTypeRegistry<int>(Dune::Python::GenerateTypeName("int"));
Dune::Python::addToTypeRegistry<std::size_t>(Dune::Python::GenerateTypeName("std::size_t"));
Dune::Python::registerFieldVector<double>(module, std::make_integer_sequence<int, 10>());
Dune::Hybrid::forEach( std::make_integer_sequence< int, 5 >(), [ module ] ( auto rows ) {
Dune::Hybrid::forEach( std::make_integer_sequence< int, 5 >(), [ module ] ( auto cols ) {
Dune::Python::registerFieldMatrix< double, decltype(rows)::value, cols >( module );
} );
} );
Dune::Python::registerDynamicVector<double>(module);
Dune::Python::registerDynamicMatrix<double>(module);
int argc = 0;
char **argv = NULL;
Dune::MPIHelper::instance(argc,argv);
Dune::Python::registerCollectiveCommunication(module);
}
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