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

[P|gridprovider] add make_gmsh_grid

parent 9fc11766
No related branches found
No related tags found
1 merge request!20Update bindings
......@@ -26,6 +26,7 @@ dune_pybindxi_add_module(_grid_functors_boundary_detector EXCLUDE_FROM_ALL funct
dune_pybindxi_add_module(_grid_functors_interfaces EXCLUDE_FROM_ALL functors/interfaces.cc)
# dune_pybindxi_add_module(_grid_functors_refinement EXCLUDE_FROM_ALL functors/refinement.cc)
dune_pybindxi_add_module(_grid_gridprovider_cube EXCLUDE_FROM_ALL gridprovider/cube.cc)
dune_pybindxi_add_module(_grid_gridprovider_gmsh EXCLUDE_FROM_ALL gridprovider/gmsh.cc)
dune_pybindxi_add_module(_grid_intersection EXCLUDE_FROM_ALL intersection.cc)
dune_pybindxi_add_module(_grid_gridprovider_provider EXCLUDE_FROM_ALL gridprovider/provider.cc)
dune_pybindxi_add_module(_grid_traits EXCLUDE_FROM_ALL traits.cc)
......
......@@ -30,6 +30,7 @@ for mod_name in (
'_grid_functors_interfaces',
# '_grid_functors_refinement',
'_grid_gridprovider_cube',
'_grid_gridprovider_gmsh',
'_grid_gridprovider_provider',
'_grid_intersection',
'_grid_traits',
......
// This file is part of the dune-xt project:
// https://github.com/dune-community/dune-xt
// Copyright 2009-2018 dune-xt 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 (2020)
#include "config.h"
#include <dune/pybindxi/pybind11.h>
#include <dune/pybindxi/stl.h>
#include <dune/xt/grid/gridprovider/gmsh.hh>
#include <python/dune/xt/common/bindings.hh>
#include <python/dune/xt/common/fvector.hh>
#include <python/dune/xt/grid/traits.hh>
using namespace Dune;
using namespace Dune::XT::Grid::bindings;
template <class G, class element_type>
struct make_gmsh_grid
{
static const constexpr size_t d = G::dimension;
static void bind(pybind11::module& m)
{
namespace py = pybind11;
using namespace pybind11::literals;
m.def("make_gmsh_grid",
[](const std::string& filename, const Dimension<d>&, const element_type&) {
return XT::Grid::make_gmsh_grid<G>(filename);
},
"filename"_a,
"dim"_a,
"element_type"_a);
} // ... bind(...)
}; // struct make_gmsh_grid
PYBIND11_MODULE(_grid_gridprovider_gmsh, m)
{
namespace py = pybind11;
py::module::import("dune.xt.common");
py::module::import("dune.xt.grid._grid_gridprovider_provider");
py::module::import("dune.xt.grid._grid_traits");
#if HAVE_DUNE_ALUGRID
make_gmsh_grid<ALU_2D_SIMPLEX_CONFORMING, Simplex>::bind(m);
make_gmsh_grid<ALU_2D_CUBE, Cube>::bind(m);
make_gmsh_grid<ALU_3D_SIMPLEX_CONFORMING, Simplex>::bind(m);
make_gmsh_grid<ALU_3D_CUBE, Cube>::bind(m);
#endif
}
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