Skip to content
Snippets Groups Projects
Commit e5bac69b authored by Dr. Felix Tobias Schindler's avatar Dr. Felix Tobias Schindler
Browse files

[python] move to grid/ subdir and update

parent 13bdeee2
No related branches found
No related tags found
No related merge requests found
......@@ -9,14 +9,5 @@
# René Fritze (2018)
# ~~~
dune_pybindxi_add_module(_grid EXCLUDE_FROM_ALL bindings.cc)
dune_pybindxi_add_module(_boundaryinfo EXCLUDE_FROM_ALL boundaryinfo.cc)
dune_pybindxi_add_module(_types EXCLUDE_FROM_ALL types.cc)
dune_pybindxi_add_module(_walker EXCLUDE_FROM_ALL walker.cc)
dune_pybindxi_add_module(_provider EXCLUDE_FROM_ALL provider.cc)
add_subdirectory(grid)
add_dune_alberta_flags(GRIDDIM 2 _grid)
add_dune_alberta_flags(GRIDDIM 2 _boundaryinfo)
add_dune_alberta_flags(GRIDDIM 2 _types)
add_dune_alberta_flags(GRIDDIM 2 _walker)
add_dune_alberta_flags(GRIDDIM 2 _provider)
// This file is part of the dune-xt-grid project:
// https://github.com/dune-community/dune-xt-grid
// Copyright 2009-2018 dune-xt-grid developers and contributors. All rights reserved.
// License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
// or GPL-2.0+ (http://opensource.org/licenses/gpl-license)
// with "runtime exception" (http://www.dune-project.org/license.html)
// Authors:
// Felix Schindler (2016 - 2017)
// René Fritze (2018)
#include "config.h"
#include <string>
#include <vector>
#include <dune/common/parallel/mpihelper.hh>
#include <dune/pybindxi/pybind11.h>
#include <python/dune/xt/common/exceptions.bindings.hh>
#include <python/dune/xt/common/bindings.hh>
PYBIND11_MODULE(_grid, m)
{
namespace py = pybind11;
using namespace pybind11::literals;
py::module::import("dune.xt.common");
Dune::XT::Common::bindings::add_initialization(m, "dune.xt.grid");
}
# ~~~
# This file is part of the dune-xt-grid project:
# https://github.com/dune-community/dune-xt-grid
# Copyright 2009-2018 dune-xt-grid developers and contributors. All rights reserved.
# License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
# or GPL-2.0+ (http://opensource.org/licenses/gpl-license)
# with "runtime exception" (http://www.dune-project.org/license.html)
# Authors:
# René Fritze (2018)
# ~~~
dune_pybindxi_add_module(_boundaryinfo EXCLUDE_FROM_ALL boundaryinfo.cc)
dune_pybindxi_add_module(_types EXCLUDE_FROM_ALL types.cc)
dune_pybindxi_add_module(_walker EXCLUDE_FROM_ALL walker.cc)
dune_pybindxi_add_module(_provider EXCLUDE_FROM_ALL provider.cc)
......@@ -10,4 +10,13 @@
# René Fritze (2018)
# ~~~
import dune.xt
from dune.xt import guarded_import
for mod_name in (
'_boundaryinfo',
'_types',
'_walker',
'_provider',
):
guarded_import(globals(), 'dune.xt.grid', mod_name)
// This file is part of the dune-xt-grid project:
// https://github.com/dune-community/dune-xt-grid
// Copyright 2009-2018 dune-xt-grid developers and contributors. All rights reserved.
// License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
// Copyright 2009-2018 dune-xt-grid developers and contributors. All rights
// reserved. License: Dual licensed as BSD 2-Clause License
// (http://opensource.org/licenses/BSD-2-Clause)
// or GPL-2.0+ (http://opensource.org/licenses/gpl-license)
// with "runtime exception" (http://www.dune-project.org/license.html)
// Authors:
// René Fritze (2018)
#ifndef PYTHON_DUNE_XT_GRID_TYPES_HH
#define PYTHON_DUNE_XT_GRID_TYPES_HH
#warning This header is deprecated, include <dune/xt/grid/grids.hh> instead (31.07.2019)!
#include <dune/xt/grid/grids.hh>
#ifndef PYTHON_DUNE_XT_GRID_TYPES_HH
# define PYTHON_DUNE_XT_GRID_TYPES_HH
#include <boost/tuple/tuple.hpp>
# include <dune/xt/common/deprecated.hh>
# include <dune/xt/grid/grids.hh>
namespace Dune {
namespace XT {
namespace Grid {
namespace bindings {
using AvailableTypes = boost::tuple<Dune::YaspGrid<1, Dune::EquidistantOffsetCoordinates<double, 1>>,
Dune::YaspGrid<2, Dune::EquidistantOffsetCoordinates<double, 2>>
#if HAVE_DUNE_ALUGRID
,
Dune::ALUGrid<2, 2, Dune::simplex, Dune::conforming>
#endif
#if HAVE_DUNE_UGGRID || HAVE_UG
,
Dune::UGGrid<2>
#endif
#if HAVE_ALBERTA
,
Dune::AlbertaGrid<2, 2>
#endif
>;
using AvailableTypes
DXT_DEPRECATED_MSG("Use XT::Grid::AvailableGridTypes instead (31.07.2019)!") = Dune::XT::Grid::AvailableGridTypes;
} // namespace bindings
} // namespace Grid
} // namespace XT
} // namespace Dune
#endif // PYTHON_DUNE_XT_GRID_TYPES_HH
\ No newline at end of file
#endif // PYTHON_DUNE_XT_GRID_TYPES_HH
......@@ -79,6 +79,7 @@ void bind_grid_layer(pybind11::module& m, std::integral_constant<size_t, counter
bind_grid_layer<Grid>(m, std::integral_constant<size_t, counter - 1>());
}
template <class GridTuple = Dune::XT::Grid::bindings::AvailableTypes>
void bind_grid(pybind11::module& m)
{
......@@ -91,9 +92,14 @@ template <>
void bind_grid<boost::tuples::null_type>(pybind11::module&)
{}
PYBIND11_MODULE(_boundaryinfo, m)
{
namespace py = pybind11;
using namespace pybind11::literals;
py::module::import("dune.xt.common");
Dune::XT::Common::bindings::add_initialization(m, "dune.xt.grid", "_boundaryinfo");
bind_grid(m);
}
......@@ -27,6 +27,7 @@
#include <python/dune/xt/grid/gridprovider.hh>
#include <python/dune/xt/grid/available_types.hh>
template <class Tuple = Dune::XT::Grid::bindings::AvailableTypes>
void addbind_for_Grid(pybind11::module& m)
{
......@@ -38,9 +39,6 @@ void addbind_for_Grid(pybind11::module& m)
// bind_GridProvider<G>(m, grid_id);
bind_make_cube_grid<G>(m, grid_id);
// bind_DdSubdomainsGridProvider<G>(m, grid_id);
bind_make_cube_dd_subdomains_grid<G>(m, grid_id);
addbind_for_Grid<typename Tuple::tail_type>(m);
} // ... addbind_for_Grid(...)
......@@ -48,10 +46,14 @@ template <>
void addbind_for_Grid<boost::tuples::null_type>(pybind11::module&)
{}
PYBIND11_MODULE(_provider, m)
{
namespace py = pybind11;
using namespace pybind11::literals;
py::module::import("dune.xt.common");
Dune::XT::Common::bindings::add_initialization(m, "dune.xt.grid", "_provider");
addbind_for_Grid(m);
}
......@@ -19,9 +19,11 @@
#include <dune/pybindxi/pybind11.h>
#include <dune/pybindxi/stl.h>
#include <python/dune/xt/common/bindings.hh>
#include <python/dune/xt/grid/available_types.hh>
#include <python/dune/xt/grid/grids.bindings.hh>
template <class Tuple = Dune::XT::Grid::bindings::AvailableTypes>
void addbind_for_Grid(pybind11::module& m, std::vector<std::string>& available_types)
{
......@@ -41,6 +43,9 @@ PYBIND11_MODULE(_types, m)
namespace py = pybind11;
py::module::import("dune.xt.common");
Dune::XT::Common::bindings::add_initialization(m, "dune.xt.grid", "_types");
std::vector<std::string> available_types;
addbind_for_Grid(m, available_types);
m.attr("available_types") = available_types;
......
......@@ -65,7 +65,11 @@ void addbind_for_Grid<boost::tuples::null_type>(pybind11::module&)
PYBIND11_MODULE(_walker, m)
{
namespace py = pybind11;
using namespace pybind11::literals;
py::module::import("dune.xt.common");
Dune::XT::Common::bindings::add_initialization(m, "dune.xt.grid", "_walker");
addbind_for_Grid(m);
DUNE_XT_GRID_WALKER_APPLYON_BIND(m);
}
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