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

[functionals.l2] refactor bindings, again, *sigh*

parent 7cb95fdf
No related branches found
No related tags found
No related merge requests found
......@@ -27,12 +27,15 @@ if(dune-pybindxi_FOUND)
dune_pybindxi_add_module(__operators_elliptic_ipdg_${_grid}_${_space_backend}_${_la_backend}
operators/elliptic-ipdg.bindings/${_grid}_${_space_backend}_${_la_backend}.cc)
list(APPEND pybindxi_modules __operators_elliptic_ipdg_${_grid}_${_space_backend}_${_la_backend})
dune_pybindxi_add_module(__functionals_l2_${_grid}_${_space_backend}_${_la_backend}
functionals/l2.bindings/${_grid}_${_space_backend}_${_la_backend}.cc)
list(APPEND pybindxi_modules __functionals_l2_${_grid}_${_space_backend}_${_la_backend})
endforeach()
endforeach()
endforeach()
dune_pybindxi_add_helper_lib(__functionals_l2_helper
functionals/l2.bindings/alu_fem_istl.cc
functionals/l2.bindings/yasp_fem_istl.cc)
dune_pybindxi_add_module(__functionals_l2 functionals/l2.bindings.cc)
target_link_libraries(__functionals_l2 __functionals_l2_helper)
list(APPEND pybindxi_modules __functionals_l2)
foreach(_target ${pybindxi_modules})
target_link_dune_default_libraries(${_target})
add_dune_alberta_flags(GRIDDIM 2 ${_target})
......
// This file is part of the dune-gdt project:
// https://github.com/dune-community/dune-gdt
// Copyright 2010-2017 dune-gdt 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 (2017)
#include "config.h"
#if HAVE_DUNE_PYBINDXI
#include <dune/pybindxi/pybind11.h>
#include <dune/gdt/functionals/l2.bindings.hh>
PYBIND11_PLUGIN(__functionals_l2)
{
namespace py = pybind11;
py::module m("__functionals_l2", "dune-gdt: l2 functionals");
py::module::import("dune.xt.common");
py::module::import("dune.xt.grid");
py::module::import("dune.xt.functions");
py::module::import("dune.xt.la");
// alu_fem_istl.cc
#if HAVE_DUNE_ALUGRID && HAVE_DUNE_FEM && HAVE_DUNE_ISTL
DUNE_GDT_FUNCTIONALS_L2_BIND_ALU(m, leaf, part, cg, fem, 1, istl_sparse);
DUNE_GDT_FUNCTIONALS_L2_BIND_ALU(m, level, part, cg, fem, 1, istl_sparse);
DUNE_GDT_FUNCTIONALS_L2_BIND_ALU(m, dd_subdomain, part, cg, fem, 1, istl_sparse);
#endif
// yasp_fem_istl.cc
#if HAVE_DUNE_FEM && HAVE_DUNE_ISTL
DUNE_GDT_FUNCTIONALS_L2_BIND_YASP(m, leaf, part, cg, fem, 1, istl_sparse);
DUNE_GDT_FUNCTIONALS_L2_BIND_YASP(m, level, part, cg, fem, 1, istl_sparse);
DUNE_GDT_FUNCTIONALS_L2_BIND_YASP(m, dd_subdomain, part, cg, fem, 1, istl_sparse);
#endif
return m.ptr();
}
#endif // HAVE_DUNE_PYBINDXI
......@@ -75,14 +75,15 @@ public:
}; // class L2VolumeVectorFunctional
template <class F, class SP, class V /*= typename XT::LA::Container<typename SP::type::RangeFieldType>::VectorType,
class GridView = typename SP::type::GridViewType,
template <class F,
class SP,
class V /*= typename XT::LA::Container<typename SP::type::RangeFieldType>::VectorType*/,
class GV /*= typename SP::type::GridViewType,
class Field = typename SP::type::RangeFieldType*/>
class L2FaceVectorFunctional
{
typedef typename SP::type S;
static_assert(is_space<S>::value, "");
typedef typename S::GridViewType GV;
public:
typedef GDT::L2FaceVectorFunctional<F, S, V> type;
......@@ -162,6 +163,90 @@ public:
} // namespace Dune
// begin: this is what we need for the lib
#define _DUNE_GDT_FUNCTIONALS_L2_BIND_LIB(_prefix, _d, _GRID, _layer, _g_backend, _s_type, _s_backend, _p, _la) \
_prefix class Dune::GDT::bindings:: \
L2VolumeVectorFunctional<Dune::XT::Functions:: \
LocalizableFunctionInterface<Dune::XT::Grid::extract_entity_t< \
typename Dune::XT::Grid:: \
Layer<_GRID, \
Dune::XT::Grid::Layers::_layer, \
Dune::XT::Grid::Backends::_g_backend, \
Dune::XT::Grid::DD:: \
SubdomainGrid<_GRID>>::type>, \
double, \
_d, \
double, \
1, \
1>, \
Dune::GDT::SpaceProvider<_GRID, \
Dune::XT::Grid::Layers::_layer, \
Dune::GDT::SpaceType::_s_type, \
Dune::GDT::ChooseSpaceBackend::_s_backend, \
_p, \
double, \
1, \
1>, \
typename Dune::XT::LA::Container<double, Dune::XT::LA::Backends::_la>::VectorType>; \
_prefix class Dune::GDT::bindings:: \
L2FaceVectorFunctional<Dune::XT::Functions:: \
LocalizableFunctionInterface<Dune::XT::Grid::extract_entity_t< \
typename Dune::XT::Grid:: \
Layer<_GRID, \
Dune::XT::Grid::Layers::_layer, \
Dune::XT::Grid::Backends::_g_backend, \
Dune::XT::Grid::DD:: \
SubdomainGrid<_GRID>>::type>, \
double, \
_d, \
double, \
1, \
1>, \
Dune::GDT::SpaceProvider<_GRID, \
Dune::XT::Grid::Layers::_layer, \
Dune::GDT::SpaceType::_s_type, \
Dune::GDT::ChooseSpaceBackend::_s_backend, \
_p, \
double, \
1, \
1>, \
typename Dune::XT::LA::Container<double, Dune::XT::LA::Backends::_la>::VectorType, \
typename Dune::XT::Grid::Layer<_GRID, \
Dune::XT::Grid::Layers::_layer, \
Dune::XT::Grid::Backends::_g_backend, \
Dune::XT::Grid::DD::SubdomainGrid<_GRID>>::type>
#if HAVE_DUNE_ALUGRID
#define DUNE_GDT_FUNCTIONALS_L2_BIND_LIB_ALU(_prefix, _layer, _g_backend, _s_type, _s_backend, _p, _la) \
_DUNE_GDT_FUNCTIONALS_L2_BIND_LIB( \
_prefix, 2, ALU_2D_SIMPLEX_CONFORMING, _layer, _g_backend, _s_type, _s_backend, _p, _la)
#else
#define DUNE_GDT_FUNCTIONALS_L2_BIND_LIB_ALU(_prefix, _layer, _g_backend, _s_type, _s_backend, _p, _la)
#endif
#define DUNE_GDT_FUNCTIONALS_L2_BIND_LIB_YASP(_prefix, _layer, _g_backend, _s_type, _s_backend, _p, _la) \
_DUNE_GDT_FUNCTIONALS_L2_BIND_LIB( \
_prefix, 2, YASP_2D_EQUIDISTANT_OFFSET, _layer, _g_backend, _s_type, _s_backend, _p, _la)
// alu_fem_istl.cc
#if HAVE_DUNE_ALUGRID && HAVE_DUNE_FEM && HAVE_DUNE_ISTL
DUNE_GDT_FUNCTIONALS_L2_BIND_LIB_ALU(extern template, leaf, part, cg, fem, 1, istl_sparse);
DUNE_GDT_FUNCTIONALS_L2_BIND_LIB_ALU(extern template, level, part, cg, fem, 1, istl_sparse);
DUNE_GDT_FUNCTIONALS_L2_BIND_LIB_ALU(extern template, dd_subdomain, part, cg, fem, 1, istl_sparse);
#endif
// yasp_fem_istl.cc
#if HAVE_DUNE_FEM && HAVE_DUNE_ISTL
DUNE_GDT_FUNCTIONALS_L2_BIND_LIB_YASP(extern template, leaf, part, cg, fem, 1, istl_sparse);
DUNE_GDT_FUNCTIONALS_L2_BIND_LIB_YASP(extern template, level, part, cg, fem, 1, istl_sparse);
DUNE_GDT_FUNCTIONALS_L2_BIND_LIB_YASP(extern template, dd_subdomain, part, cg, fem, 1, istl_sparse);
#endif
// end: this is what we need for the lib
// begin: this is what we need for the .so
#define _DUNE_GDT_FUNCTIONALS_L2_BIND(_m, _d, _GRID, _layer, _g_backend, _s_type, _s_backend, _p, _la) \
......@@ -211,8 +296,11 @@ public:
double, \
1, \
1>, \
typename Dune::XT::LA::Container<double, \
Dune::XT::LA::Backends::_la>::VectorType>::bind(_m)
typename Dune::XT::LA::Container<double, Dune::XT::LA::Backends::_la>::VectorType, \
typename Dune::XT::Grid::Layer<_GRID, \
Dune::XT::Grid::Layers::_layer, \
Dune::XT::Grid::Backends::_g_backend, \
Dune::XT::Grid::DD::SubdomainGrid<_GRID>>::type>::bind(_m)
#if HAVE_DUNE_ALUGRID
......
......@@ -11,29 +11,14 @@
#if HAVE_DUNE_PYBINDXI
#include <dune/pybindxi/pybind11.h>
#include <dune/gdt/functionals/l2.bindings.hh>
PYBIND11_PLUGIN(__functionals_l2_alu_fem_istl)
{
namespace py = pybind11;
py::module m("__functionals_l2_alu_fem_istl", "dune-gdt: l2 functionals");
py::module::import("dune.xt.common");
py::module::import("dune.xt.grid");
py::module::import("dune.xt.functions");
py::module::import("dune.xt.la");
#if HAVE_DUNE_ALUGRID && HAVE_DUNE_FEM && HAVE_DUNE_ISTL
DUNE_GDT_FUNCTIONALS_L2_BIND_ALU(m, leaf, part, cg, fem, 1, istl_sparse);
DUNE_GDT_FUNCTIONALS_L2_BIND_ALU(m, level, part, cg, fem, 1, istl_sparse);
DUNE_GDT_FUNCTIONALS_L2_BIND_ALU(m, dd_subdomain, part, cg, fem, 1, istl_sparse);
DUNE_GDT_FUNCTIONALS_L2_BIND_LIB_ALU(template, leaf, part, cg, fem, 1, istl_sparse);
DUNE_GDT_FUNCTIONALS_L2_BIND_LIB_ALU(template, level, part, cg, fem, 1, istl_sparse);
DUNE_GDT_FUNCTIONALS_L2_BIND_LIB_ALU(template, dd_subdomain, part, cg, fem, 1, istl_sparse);
#endif
return m.ptr();
}
#endif // HAVE_DUNE_PYBINDXI
......@@ -11,29 +11,14 @@
#if HAVE_DUNE_PYBINDXI
#include <dune/pybindxi/pybind11.h>
#include <dune/gdt/functionals/l2.bindings.hh>
PYBIND11_PLUGIN(__functionals_l2_yasp_fem_istl)
{
namespace py = pybind11;
py::module m("__functionals_l2_yasp_fem_istl", "dune-gdt: l2 functionals");
py::module::import("dune.xt.common");
py::module::import("dune.xt.grid");
py::module::import("dune.xt.functions");
py::module::import("dune.xt.la");
#if HAVE_DUNE_FEM && HAVE_DUNE_ISTL
DUNE_GDT_FUNCTIONALS_L2_BIND_YASP(m, leaf, part, cg, fem, 1, istl_sparse);
DUNE_GDT_FUNCTIONALS_L2_BIND_YASP(m, level, part, cg, fem, 1, istl_sparse);
DUNE_GDT_FUNCTIONALS_L2_BIND_YASP(m, dd_subdomain, part, cg, fem, 1, istl_sparse);
DUNE_GDT_FUNCTIONALS_L2_BIND_LIB_YASP(template, leaf, part, cg, fem, 1, istl_sparse);
DUNE_GDT_FUNCTIONALS_L2_BIND_LIB_YASP(template, level, part, cg, fem, 1, istl_sparse);
DUNE_GDT_FUNCTIONALS_L2_BIND_LIB_YASP(template, dd_subdomain, part, cg, fem, 1, istl_sparse);
#endif
return m.ptr();
}
#endif // HAVE_DUNE_PYBINDXI
......@@ -31,7 +31,7 @@ def init_logger(max_info_level=-1,
warning_color)
modules = ['spaces', 'assembler', 'discretefunction', 'projections']
modules = ['spaces', 'assembler', 'discretefunction', 'projections', 'functionals_l2']
#for space_backend in ('fem', 'pdelab'):
for space_backend in ('fem',):
#for la_backend in ('common', 'eigen', 'istl'):
......@@ -40,7 +40,6 @@ for space_backend in ('fem',):
#for grid in ('alberta', 'alu', 'ug', 'yasp'):
for grid in ('alu', 'yasp'):
modules.append('operators_elliptic_ipdg_{}_{}_{}'.format(grid, space_backend, la_backend))
modules.append('functionals_l2_{}_{}_{}'.format(grid, space_backend, la_backend))
modules.append('bindings')
for module_name in modules:
......
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