diff --git a/README.md b/README.md index d7577c2f8d44cc5294845192c73655ebe0cca5c7..339cb96c19a51a67934194c4d5d1f5e1775126be 100644 --- a/README.md +++ b/README.md @@ -14,12 +14,8 @@ dune-gdt is a [DUNE](http://www.dune-project.org/) module which provides a generic discretization toolbox for grid-based numerical methods. It contains building blocks - like -local operators, local evaluations, local assemblers - for discretization methods as well as -generic interfaces for objects like discrete function spaces and basefunction sets. -Implementations are provided using the main DUNE discretization modules, like -[dune-fem](https://www.dune-project.org/modules/dune-fem/), -[dune-functions](https://www.dune-project.org/modules/dune-functions/) and -[dune-pdelab](https://gitlab.dune-project.org/pdelab/dune-pdelab). +local operators, local evaluations, local assemblers - for discretization methods and suitable +discrete function spaces. New users may best try out this module by using the git supermodule [dune-gdt-super](https://github.com/dune-community/dune-gdt-super). Experienced DUNE users diff --git a/dune.module b/dune.module index 73693c665ee10d1e1051c8f0032b4cec74fec6b1..b60d2e24d15bde0f9496df099d9f296e0feab87b 100644 --- a/dune.module +++ b/dune.module @@ -13,5 +13,5 @@ Module: dune-gdt Version: 0.3-dev Maintainer: felix.schindler@wwu.de -Depends: dune-common (>= 2.4) dune-xt-grid dune-xt-la dune-xt-functions -Suggests: dune-fem (>= 1.3) dune-pdelab +Depends: dune-common (>= 2.4) dune-localfunctions dune-xt-grid dune-xt-la dune-xt-functions +Suggests: dune-fem (>= 1.3) diff --git a/dune/gdt/CMakeLists.txt b/dune/gdt/CMakeLists.txt index a54603ed96d101a186b28d4e87d861c54a24166c..3daa2951eaed33af243f3ffe82ce20fd1e840502 100644 --- a/dune/gdt/CMakeLists.txt +++ b/dune/gdt/CMakeLists.txt @@ -11,26 +11,18 @@ if(DUNE_XT_WITH_PYTHON_BINDINGS) set(dunegdt_sources - assembler/system.lib/fem_alu_2d_simplex_conforming.cc - assembler/system.lib/fem_yasp_1d_equidistant_offset.cc - assembler/system.lib/fem_yasp_2d_equidistant_offset.cc - assembler/system.lib/fem_yasp_3d_equidistant_offset.cc - spaces/cg/dune-fem-wrapper.lib/alu_2d_simplex_conforming.cc - spaces/cg/dune-fem-wrapper.lib/yasp_1d_equidistant_offset.cc - spaces/cg/dune-fem-wrapper.lib/yasp_2d_equidistant_offset.cc - spaces/cg/dune-fem-wrapper.lib/yasp_3d_equidistant_offset.cc - spaces/cg.lib/fem_alu_2d_simplex_conforming.cc - spaces/cg.lib/fem_yasp_1d_equidistant_offset.cc - spaces/cg.lib/fem_yasp_2d_equidistant_offset.cc - spaces/cg.lib/fem_yasp_3d_equidistant_offset.cc - spaces/dg/dune-fem-wrapper.lib/alu_2d_simplex_conforming.cc - spaces/dg/dune-fem-wrapper.lib/yasp_1d_equidistant_offset.cc - spaces/dg/dune-fem-wrapper.lib/yasp_2d_equidistant_offset.cc - spaces/dg/dune-fem-wrapper.lib/yasp_3d_equidistant_offset.cc - spaces/dg.lib/fem_alu_2d_simplex_conforming.cc - spaces/dg.lib/fem_yasp_1d_equidistant_offset.cc - spaces/dg.lib/fem_yasp_2d_equidistant_offset.cc - spaces/dg.lib/fem_yasp_3d_equidistant_offset.cc) + assembler/system.lib/alu_2d_simplex_conforming.cc + assembler/system.lib/yasp_1d_equidistant_offset.cc + assembler/system.lib/yasp_2d_equidistant_offset.cc + assembler/system.lib/yasp_3d_equidistant_offset.cc + spaces/cg.lib/alu_2d_simplex_conforming.cc + spaces/cg.lib/yasp_1d_equidistant_offset.cc + spaces/cg.lib/yasp_2d_equidistant_offset.cc + spaces/cg.lib/yasp_3d_equidistant_offset.cc + spaces/dg.lib/alu_2d_simplex_conforming.cc + spaces/dg.lib/yasp_1d_equidistant_offset.cc + spaces/dg.lib/yasp_2d_equidistant_offset.cc + spaces/dg.lib/yasp_3d_equidistant_offset.cc) dune_library_add_sources(dunegdt SOURCES ${dunegdt_sources}) endif() @@ -42,10 +34,8 @@ if(dune-pybindxi_FOUND) list(APPEND pybindxi_modules __${_target}) endforeach() dune_pybindxi_add_helper_lib(__assembler_helper EXCLUDE_FROM_ALL - assembler/system.bindings/alu_fem.cc - assembler/system.bindings/alu_gdt.cc - assembler/system.bindings/yasp_fem.cc - assembler/system.bindings/yasp_gdt.cc) + assembler/system.bindings/alu.cc + assembler/system.bindings/yasp.cc) target_link_libraries(__assembler __assembler_helper) dune_pybindxi_add_module(__spaces_block EXCLUDE_FROM_ALL playground/spaces/block.bindings.cc) list(APPEND pybindxi_modules __spaces_block) @@ -59,14 +49,14 @@ if(dune-pybindxi_FOUND) # the operators # * elliptic dune_pybindxi_add_helper_lib(__operators_elliptic_helper EXCLUDE_FROM_ALL - operators/elliptic.bindings/fem_istl.cc) + operators/elliptic.bindings/istl.cc) dune_pybindxi_add_module(__operators_elliptic EXCLUDE_FROM_ALL operators/elliptic.bindings.cc) target_link_libraries(__operators_elliptic __operators_elliptic_helper) list(APPEND pybindxi_modules __operators_elliptic) # * elliptic-ipdg dune_pybindxi_add_helper_lib(__operators_elliptic_ipdg_helper EXCLUDE_FROM_ALL - operators/elliptic-ipdg.bindings/alu_fem_istl.cc - operators/elliptic-ipdg.bindings/yasp_fem_istl.cc) + operators/elliptic-ipdg.bindings/alu_istl.cc + operators/elliptic-ipdg.bindings/yasp_istl.cc) dune_pybindxi_add_module(__operators_elliptic_ipdg EXCLUDE_FROM_ALL operators/elliptic-ipdg.bindings.cc) target_link_libraries(__operators_elliptic_ipdg __operators_elliptic_ipdg_helper) list(APPEND pybindxi_modules __operators_elliptic_ipdg) @@ -93,14 +83,14 @@ if(dune-pybindxi_FOUND) dune_pybindxi_add_module(__operators_RS2017 EXCLUDE_FROM_ALL playground/operators/RS2017.bindings.cc) list(APPEND pybindxi_modules __operators_RS2017) dune_pybindxi_add_helper_lib(__functionals_elliptic_ipdg_helper EXCLUDE_FROM_ALL - functionals/elliptic-ipdg.bindings/alu_fem_istl.cc - functionals/elliptic-ipdg.bindings/yasp_fem_istl.cc) + functionals/elliptic-ipdg.bindings/alu_istl.cc + functionals/elliptic-ipdg.bindings/yasp_istl.cc) dune_pybindxi_add_module(__functionals_elliptic_ipdg EXCLUDE_FROM_ALL functionals/elliptic-ipdg.bindings.cc) target_link_libraries(__functionals_elliptic_ipdg __functionals_elliptic_ipdg_helper) list(APPEND pybindxi_modules __functionals_elliptic_ipdg) dune_pybindxi_add_helper_lib(__functionals_l2_helper EXCLUDE_FROM_ALL - functionals/l2.bindings/alu_fem_istl.cc - functionals/l2.bindings/yasp_fem_istl.cc) + functionals/l2.bindings/alu_istl.cc + functionals/l2.bindings/yasp_istl.cc) dune_pybindxi_add_module(__functionals_l2 EXCLUDE_FROM_ALL functionals/l2.bindings.cc) target_link_libraries(__functionals_l2 __functionals_l2_helper) list(APPEND pybindxi_modules __functionals_l2) diff --git a/dune/gdt/assembler/local-accumulators.hh b/dune/gdt/assembler/local-accumulators.hh index 957a907aa3983c5deb667fea42cf1e9d6728a4a3..e6280b488d085032b0c9eee753050b5bb245936d 100644 --- a/dune/gdt/assembler/local-accumulators.hh +++ b/dune/gdt/assembler/local-accumulators.hh @@ -94,8 +94,7 @@ public: FieldType result() const override final { - if (!finalized_) - DUNE_THROW(XT::Common::Exceptions::you_are_using_this_wrong, "Call finalize() first!"); + DUNE_THROW_IF(!finalized_, XT::Common::Exceptions::you_are_using_this_wrong, "Call finalize() first!"); return final_result_; } diff --git a/dune/gdt/assembler/local-assemblers.hh b/dune/gdt/assembler/local-assemblers.hh index 74df2d2c19480a114c8cb1901c236074501ef8d6..026a2a035d62570cd25ae84a717cb66abe7f40fa 100644 --- a/dune/gdt/assembler/local-assemblers.hh +++ b/dune/gdt/assembler/local-assemblers.hh @@ -54,16 +54,17 @@ public: const EntityType& entity, MatrixType& global_matrix) { - if (global_matrix.rows() != test_space.mapper().size()) - DUNE_THROW(XT::Common::Exceptions::shapes_do_not_match, - "global_matrix.rows() = " << global_matrix.rows() << "\n " - << "test_space.mapper().size()" - << test_space.mapper().size()); - if (global_matrix.cols() != ansatz_space.mapper().size()) - DUNE_THROW(XT::Common::Exceptions::shapes_do_not_match, - "global_matrix.cols() = " << global_matrix.cols() << "\n " - << "ansatz_space.mapper().size()" - << ansatz_space.mapper().size()); + + DUNE_THROW_IF(global_matrix.rows() != test_space.mapper().size(), + XT::Common::Exceptions::shapes_do_not_match, + "global_matrix.rows() = " << global_matrix.rows() << "\n " + << "test_space.mapper().size()" + << test_space.mapper().size()); + DUNE_THROW_IF(global_matrix.cols() != ansatz_space.mapper().size(), + XT::Common::Exceptions::shapes_do_not_match, + "global_matrix.cols() = " << global_matrix.cols() << "\n " + << "ansatz_space.mapper().size()" + << ansatz_space.mapper().size()); // prepare const size_t rows = test_space.mapper().numDofs(entity); const size_t cols = ansatz_space.mapper().numDofs(entity); @@ -166,46 +167,46 @@ public: MatrixType& global_matrix_in_out, MatrixType& global_matrix_out_in) { - if (global_matrix_in_in.rows() != inner_test_space.mapper().size()) - DUNE_THROW(XT::Common::Exceptions::shapes_do_not_match, - "global_matrix_in_in.rows() = " << global_matrix_in_in.rows() << "\n " - << "inner_test_space.mapper().size()" - << inner_test_space.mapper().size()); - if (global_matrix_in_in.cols() != inner_ansatz_space.mapper().size()) - DUNE_THROW(XT::Common::Exceptions::shapes_do_not_match, - "global_matrix_in_in.cols() = " << global_matrix_in_in.cols() << "\n " - << "inner_ansatz_space.mapper().size()" - << inner_ansatz_space.mapper().size()); - if (global_matrix_out_out.rows() != outer_test_space.mapper().size()) - DUNE_THROW(XT::Common::Exceptions::shapes_do_not_match, - "global_matrix_out_out.rows() = " << global_matrix_out_out.rows() << "\n " - << "outer_test_space.mapper().size()" - << outer_test_space.mapper().size()); - if (global_matrix_out_out.cols() != outer_ansatz_space.mapper().size()) - DUNE_THROW(XT::Common::Exceptions::shapes_do_not_match, - "global_matrix_out_out.cols() = " << global_matrix_out_out.cols() << "\n " - << "outer_ansatz_space.mapper().size()" - << outer_ansatz_space.mapper().size()); - if (global_matrix_in_out.rows() != inner_test_space.mapper().size()) - DUNE_THROW(XT::Common::Exceptions::shapes_do_not_match, - "global_matrix_in_out.rows() = " << global_matrix_in_out.rows() << "\n " + DUNE_THROW_IF(global_matrix_in_in.rows() != inner_test_space.mapper().size(), + XT::Common::Exceptions::shapes_do_not_match, + "global_matrix_in_in.rows() = " << global_matrix_in_in.rows() << "\n " << "inner_test_space.mapper().size()" << inner_test_space.mapper().size()); - if (global_matrix_in_out.cols() != outer_ansatz_space.mapper().size()) - DUNE_THROW(XT::Common::Exceptions::shapes_do_not_match, - "global_matrix_in_out.cols() = " << global_matrix_in_out.cols() << "\n " - << "outer_ansatz_space.mapper().size()" - << outer_ansatz_space.mapper().size()); - if (global_matrix_out_in.rows() != outer_test_space.mapper().size()) - DUNE_THROW(XT::Common::Exceptions::shapes_do_not_match, - "global_matrix_out_in.rows() = " << global_matrix_out_in.rows() << "\n " - << "outer_test_space.mapper().size()" - << outer_test_space.mapper().size()); - if (global_matrix_out_in.cols() != inner_ansatz_space.mapper().size()) - DUNE_THROW(XT::Common::Exceptions::shapes_do_not_match, - "global_matrix_out_in.cols() = " << global_matrix_out_in.cols() << "\n " + DUNE_THROW_IF(global_matrix_in_in.cols() != inner_ansatz_space.mapper().size(), + XT::Common::Exceptions::shapes_do_not_match, + "global_matrix_in_in.cols() = " << global_matrix_in_in.cols() << "\n " << "inner_ansatz_space.mapper().size()" << inner_ansatz_space.mapper().size()); + DUNE_THROW_IF(global_matrix_out_out.rows() != outer_test_space.mapper().size(), + XT::Common::Exceptions::shapes_do_not_match, + "global_matrix_out_out.rows() = " << global_matrix_out_out.rows() << "\n " + << "outer_test_space.mapper().size()" + << outer_test_space.mapper().size()); + DUNE_THROW_IF(global_matrix_out_out.cols() != outer_ansatz_space.mapper().size(), + XT::Common::Exceptions::shapes_do_not_match, + "global_matrix_out_out.cols() = " << global_matrix_out_out.cols() << "\n " + << "outer_ansatz_space.mapper().size()" + << outer_ansatz_space.mapper().size()); + DUNE_THROW_IF(global_matrix_in_out.rows() != inner_test_space.mapper().size(), + XT::Common::Exceptions::shapes_do_not_match, + "global_matrix_in_out.rows() = " << global_matrix_in_out.rows() << "\n " + << "inner_test_space.mapper().size()" + << inner_test_space.mapper().size()); + DUNE_THROW_IF(global_matrix_in_out.cols() != outer_ansatz_space.mapper().size(), + XT::Common::Exceptions::shapes_do_not_match, + "global_matrix_in_out.cols() = " << global_matrix_in_out.cols() << "\n " + << "outer_ansatz_space.mapper().size()" + << outer_ansatz_space.mapper().size()); + DUNE_THROW_IF(global_matrix_out_in.rows() != outer_test_space.mapper().size(), + XT::Common::Exceptions::shapes_do_not_match, + "global_matrix_out_in.rows() = " << global_matrix_out_in.rows() << "\n " + << "outer_test_space.mapper().size()" + << outer_test_space.mapper().size()); + DUNE_THROW_IF(global_matrix_out_in.cols() != inner_ansatz_space.mapper().size(), + XT::Common::Exceptions::shapes_do_not_match, + "global_matrix_out_in.cols() = " << global_matrix_out_in.cols() << "\n " + << "inner_ansatz_space.mapper().size()" + << inner_ansatz_space.mapper().size()); // prepare const auto entity = intersection.inside(); const auto neighbor = intersection.outside(); @@ -447,16 +448,16 @@ public: const LocalBoundaryTwoFormType& local_boundary_two_form, MatrixType& global_matrix) { - if (global_matrix.rows() != test_space.mapper().size()) - DUNE_THROW(XT::Common::Exceptions::shapes_do_not_match, - "global_matrix.rows() = " << global_matrix.rows() << "\n " - << "test_space.mapper().size()" - << test_space.mapper().size()); - if (global_matrix.cols() != ansatz_space.mapper().size()) - DUNE_THROW(XT::Common::Exceptions::shapes_do_not_match, - "global_matrix.cols() = " << global_matrix.cols() << "\n " - << "ansatz_space.mapper().size()" - << ansatz_space.mapper().size()); + DUNE_THROW_IF(global_matrix.rows() != test_space.mapper().size(), + XT::Common::Exceptions::shapes_do_not_match, + "global_matrix.rows() = " << global_matrix.rows() << "\n " + << "test_space.mapper().size()" + << test_space.mapper().size()); + DUNE_THROW_IF(global_matrix.cols() != ansatz_space.mapper().size(), + XT::Common::Exceptions::shapes_do_not_match, + "global_matrix.cols() = " << global_matrix.cols() << "\n " + << "ansatz_space.mapper().size()" + << ansatz_space.mapper().size()); // prepare const auto entity = intersection.inside(); const size_t rows = test_space.mapper().numDofs(entity); @@ -542,11 +543,11 @@ public: const EntityType& entity, VectorType& global_vector) { - if (global_vector.size() != test_space.mapper().size()) - DUNE_THROW(XT::Common::Exceptions::shapes_do_not_match, - "global_vector.size() = " << global_vector.size() << "\n " - << "test_space.mapper().size()" - << test_space.mapper().size()); + DUNE_THROW_IF(global_vector.size() != test_space.mapper().size(), + XT::Common::Exceptions::shapes_do_not_match, + "global_vector.size() = " << global_vector.size() << "\n " + << "test_space.mapper().size()" + << test_space.mapper().size()); // prepare const size_t size = test_space.mapper().numDofs(entity); Dune::DynamicVector<FieldType> local_vector(size, 0.); // \todo: make mutable member, after SMP refactor diff --git a/dune/gdt/assembler/system.bindings.hh b/dune/gdt/assembler/system.bindings.hh index aba0262aa386c43eb8c4ff9ad9c9842e734bcf1f..bbc5d0dd6293148843023cfc8eec2b5e8fc58a94 100644 --- a/dune/gdt/assembler/system.bindings.hh +++ b/dune/gdt/assembler/system.bindings.hh @@ -15,6 +15,7 @@ #include <dune/xt/common/memory.hh> #include <dune/xt/la/container.hh> +#include <dune/xt/grid/grids.hh> #include <dune/xt/grid/grids.bindings.hh> #include <dune/xt/grid/layers.bindings.hh> #include <dune/xt/grid/walker.hh> @@ -146,7 +147,7 @@ private: }; template <XT::LA::Backends la> - static void addbind_matrix(bound_type& c) + static void addaddbind_matrixatrix(bound_type& c) { namespace py = pybind11; using namespace pybind11::literals; @@ -206,7 +207,7 @@ private: py::keep_alive<0, 3>(), py::keep_alive<0, 4>(), py::keep_alive<0, 5>()); - } // ... addbind_matrix(...) + } // ... addaddbind_matrixatrix(...) public: static bound_type bind(pybind11::module& m) @@ -247,7 +248,7 @@ public: XT::Grid::extract_grid_t<typename type::GridLayerType>>::addbind(c); #if HAVE_DUNE_ISTL - addbind_matrix<XT::LA::Backends::istl_sparse>(c); + addaddbind_matrixatrix<XT::LA::Backends::istl_sparse>(c); #endif c.def("append", @@ -298,69 +299,41 @@ public: Dune::XT::Grid::Backends::_g_backend> #if HAVE_DUNE_ALUGRID -#define _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_ALU( \ +#define _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_ALU_SPACE( \ _pre, _g_layer, _g_backend, _s_type, _s_backend, _s_grid_layer, _p, _r, _rC) \ _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB( \ _pre, ALU_2D_SIMPLEX_CONFORMING, _g_layer, _g_backend, _s_type, _s_backend, _s_grid_layer, _p, _r, _rC) #else -#define _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_ALU( \ +#define _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_ALU_SPACE( \ _pre, _g_layer, _g_backend, _s_type, _s_backend, _s_grid_layer, _p, _r, _rC) #endif -#define _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_YASP( \ +#define _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_YASP_SPACE( \ _pre, _g_layer, _g_backend, _s_type, _s_backend, _s_grid_layer, _p, _r, _rC) \ _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB( \ _pre, YASP_1D_EQUIDISTANT_OFFSET, _g_layer, _g_backend, _s_type, _s_backend, _s_grid_layer, _p, _r, _rC); \ _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB( \ _pre, YASP_2D_EQUIDISTANT_OFFSET, _g_layer, _g_backend, _s_type, _s_backend, _s_grid_layer, _p, _r, _rC) -#if HAVE_DUNE_FEM - -#define _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_ALU_FEM(_pre, _s_type, _p, _r, _rC) \ - _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_ALU(_pre, leaf, part, _s_type, fem, leaf, _p, 1, 1); \ - _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_ALU(_pre, level, part, _s_type, fem, level, _p, 1, 1); \ - _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_ALU(_pre, dd_subdomain, part, _s_type, fem, dd_subdomain, _p, 1, 1) - -#define _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_YASP_FEM(_pre, _s_type, _p, _r, _rC) \ - _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_YASP(_pre, leaf, part, _s_type, fem, leaf, _p, 1, 1); \ - _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_YASP(_pre, level, part, _s_type, fem, level, _p, 1, 1); \ - _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_YASP(_pre, dd_subdomain, part, _s_type, fem, dd_subdomain, _p, 1, 1) - -#define DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_ALU_FEM(_pre) \ - _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_ALU_FEM(_pre, cg, 1, 1, 1); \ - _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_ALU_FEM(_pre, dg, 1, 1, 1); \ - _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_ALU(_pre, dd_subdomain_boundary, part, dg, fem, dd_subdomain, 1, 1, 1); \ - _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_ALU(_pre, dd_subdomain_coupling, part, dg, fem, dd_subdomain, 1, 1, 1) - -#define DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_YASP_FEM(_pre) \ - _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_YASP_FEM(_pre, cg, 1, 1, 1); \ - _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_YASP_FEM(_pre, dg, 1, 1, 1); \ - _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_YASP(_pre, dd_subdomain_boundary, part, dg, fem, dd_subdomain, 1, 1, 1); \ - _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_YASP(_pre, dd_subdomain_coupling, part, dg, fem, dd_subdomain, 1, 1, 1) - -#else // HAVE_DUNE_FEM -#define DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_ALU_FEM(_pre) -#define DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_YASP_FEM(_pre) -#endif - -#define _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_ALU_GDT(_pre, _s_type, _p, _r, _rC) \ - _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_ALU(_pre, leaf, view, _s_type, gdt, leaf, _p, 1, 1); \ - _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_ALU(_pre, level, view, _s_type, gdt, level, _p, 1, 1) +#define _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_ALU(_pre, _s_type, _p, _r, _rC) \ + _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_ALU_SPACE(_pre, leaf, view, _s_type, gdt, leaf, _p, 1, 1); \ + _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_ALU_SPACE(_pre, level, view, _s_type, gdt, level, _p, 1, 1) -#define _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_YASP_GDT(_pre, _s_type, _p, _r, _rC) \ - _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_YASP(_pre, leaf, view, _s_type, gdt, leaf, _p, 1, 1); \ - _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_YASP(_pre, level, view, _s_type, gdt, level, _p, 1, 1) +#define _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_YASP(_pre, _s_type, _p, _r, _rC) \ + _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_YASP_SPACE(_pre, leaf, view, _s_type, gdt, leaf, _p, 1, 1); \ + _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_YASP_SPACE(_pre, level, view, _s_type, gdt, level, _p, 1, 1) -#define DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_ALU_GDT(_pre) _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_ALU_GDT(_pre, fv, 0, 1, 1) +#define DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_ALU(_pre) \ + _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_ALU(_pre, fv, 0, 1, 1); \ + _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_ALU(_pre, cg, 1, 1, 1) -#define DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_YASP_GDT(_pre) \ - _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_YASP_GDT(_pre, fv, 0, 1, 1) +#define DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_YASP(_pre) \ + _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_YASP(_pre, fv, 0, 1, 1); \ + _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_YASP(_pre, cg, 1, 1, 1) #define DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB(_pre) \ - DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_ALU_FEM(_pre); \ - DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_YASP_FEM(_pre); \ - DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_ALU_GDT(_pre); \ - DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_YASP_GDT(_pre) + DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_ALU(_pre); \ + DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_YASP(_pre) DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB(extern template); @@ -400,26 +373,14 @@ DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB(extern template); _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_YASP(_m, _g_layer, _g_backend, _s_type, _s_backend, _s_grid_layer, _p, _r, _rC); \ _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_ALU(_m, _g_layer, _g_backend, _s_type, _s_backend, _s_grid_layer, _p, _r, _rC) -#if HAVE_DUNE_FEM -#define _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_FEM(_m, _s_type, _p, _r, _rC) \ - _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_ALL_GRIDS(_m, leaf, part, _s_type, fem, leaf, _p, 1, 1); \ - _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_ALL_GRIDS(_m, level, part, _s_type, fem, level, _p, 1, 1); \ - _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_ALL_GRIDS(_m, dd_subdomain, part, _s_type, fem, dd_subdomain, _p, 1, 1) -#else -#define _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_FEM(_m, _s_type, _p, _r, _rC) -#endif - -#define _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_GDT(_m, _s_type, _p, _r, _rC) \ - _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_ALL_GRIDS(_m, leaf, view, _s_type, gdt, leaf, _p, 1, 1); \ - _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_ALL_GRIDS(_m, level, view, _s_type, gdt, level, _p, 1, 1) #define DUNE_GDT_ASSEMBLER_SYSTEM_BIND(_m) \ - _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_FEM(_m, cg, 1, 1, 1); \ - _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_FEM(_m, dg, 1, 1, 1); \ - _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_ALL_GRIDS(_m, dd_subdomain_boundary, part, dg, fem, dd_subdomain, 1, 1, 1); \ - _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_ALL_GRIDS(_m, dd_subdomain_coupling, part, dg, fem, dd_subdomain, 1, 1, 1); \ - _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_GDT(_m, fv, 0, 1, 1) - + _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_ALL_GRIDS(_m, dd_subdomain_boundary, view, dg, gdt, dd_subdomain, 1, 1, 1); \ + _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_ALL_GRIDS(_m, dd_subdomain_coupling, view, dg, gdt, dd_subdomain, 1, 1, 1); \ + _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_ALL_GRIDS(_m, leaf, view, cg, gdt, leaf, 1, 1, 1); \ + _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_ALL_GRIDS(_m, level, view, cg, gdt, level, 1, 1, 1); \ + _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_ALL_GRIDS(_m, leaf, view, fv, gdt, leaf, 0, 1, 1); \ + _DUNE_GDT_ASSEMBLER_SYSTEM_BIND_ALL_GRIDS(_m, level, view, fv, gdt, level, 0, 1, 1) // end: this is what we need for the .so diff --git a/dune/gdt/assembler/system.bindings/alu_gdt.cc b/dune/gdt/assembler/system.bindings/alu.cc similarity index 93% rename from dune/gdt/assembler/system.bindings/alu_gdt.cc rename to dune/gdt/assembler/system.bindings/alu.cc index 258294b62d274cc927a4de51ce14ac2701795f65..997f093316271f9cbab408cae35a98c9f861b7d1 100644 --- a/dune/gdt/assembler/system.bindings/alu_gdt.cc +++ b/dune/gdt/assembler/system.bindings/alu.cc @@ -19,7 +19,7 @@ namespace GDT { namespace bindings { -DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_ALU_GDT(template); +DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_ALU(template); } // namespace bindings diff --git a/dune/gdt/assembler/system.bindings/alu_fem.cc b/dune/gdt/assembler/system.bindings/alu_fem.cc deleted file mode 100644 index 5adda5fb5869d1c9448568a3d6b5c08a55b9a5fc..0000000000000000000000000000000000000000 --- a/dune/gdt/assembler/system.bindings/alu_fem.cc +++ /dev/null @@ -1,29 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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 && HAVE_DUNE_ALUGRID && HAVE_DUNE_FEM - -#include "../system.bindings.hh" - - -namespace Dune { -namespace GDT { -namespace bindings { - - -DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_ALU_FEM(template); - - -} // namespace bindings -} // namespace GDT -} // namespace Dune - -#endif // HAVE_DUNE_PYBINDXI && HAVE_DUNE_ALUGRID && HAVE_DUNE_FEM diff --git a/dune/gdt/assembler/system.bindings/yasp_gdt.cc b/dune/gdt/assembler/system.bindings/yasp.cc similarity index 92% rename from dune/gdt/assembler/system.bindings/yasp_gdt.cc rename to dune/gdt/assembler/system.bindings/yasp.cc index ccf33ec999d46a164294518c8be0804313b06c65..eeed2e62620c4311673ff7c79559612223bb9cf0 100644 --- a/dune/gdt/assembler/system.bindings/yasp_gdt.cc +++ b/dune/gdt/assembler/system.bindings/yasp.cc @@ -19,7 +19,7 @@ namespace GDT { namespace bindings { -DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_YASP_GDT(template); +DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_YASP(template); } // namespace bindings diff --git a/dune/gdt/assembler/system.bindings/yasp_fem.cc b/dune/gdt/assembler/system.bindings/yasp_fem.cc deleted file mode 100644 index e9a5ee505e53ac72d083725531935aef5f182f86..0000000000000000000000000000000000000000 --- a/dune/gdt/assembler/system.bindings/yasp_fem.cc +++ /dev/null @@ -1,29 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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 && HAVE_DUNE_FEM - -#include "../system.bindings.hh" - - -namespace Dune { -namespace GDT { -namespace bindings { - - -DUNE_GDT_ASSEMBLER_SYSTEM_BIND_LIB_YASP_FEM(template); - - -} // namespace bindings -} // namespace GDT -} // namespace Dune - -#endif // HAVE_DUNE_PYBINDXI && HAVE_DUNE_FEM diff --git a/dune/gdt/assembler/system.lib.hh b/dune/gdt/assembler/system.lib.hh index 46a09510a72e4e71e3b5466ec5fb73815bd7c481..eacbd6f153eb30b327080c80b608780ef94466e7 100644 --- a/dune/gdt/assembler/system.lib.hh +++ b/dune/gdt/assembler/system.lib.hh @@ -25,7 +25,6 @@ // everything related to dd subdomain -#if HAVE_DUNE_FEM #define _DUNE_GDT_ASSEMBLER_SYSTEM_LIB_APPEND_DD_SUBDOMAIN( \ _pre, _G, _g_layer, _g_backend, _s_type, _s_backend, _s_grid_layer, _p, _r, _rC, _la) \ typedef typename Dune::GDT::SpaceProvider<_G, \ @@ -188,10 +187,6 @@ Dune::XT::Grid::DD::SubdomainGrid<_G>>::type>; \ _DUNE_GDT_ASSEMBLER_SYSTEM_LIB_APPEND_DD_SUBDOMAIN_ISTL( \ _pre, _G, _g_layer, _g_backend, _s_type, _s_backend, _s_grid_layer, _p, _r, _rC) -#else -#define _DUNE_GDT_ASSEMBLER_SYSTEM_LIB_DD_SUBDOMAIN( \ - _pre, _G, _g_layer, _g_backend, _s_type, _s_backend, _s_grid_layer, _p, _r, _rC) -#endif // everything not related to dd subdomain #define _DUNE_GDT_ASSEMBLER_SYSTEM_LIB_APPEND( \ @@ -360,26 +355,22 @@ #define DUNE_GDT_ASSEMBLER_SYSTEM_LIB_DD_SUBDOMAIN(_pre, _G, _s_type, _s_backend, _p, _r, _rC) \ DUNE_GDT_ASSEMBLER_SYSTEM_LIB(_pre, _G, _s_type, _s_backend, _p, _r, _rC); \ + _DUNE_GDT_ASSEMBLER_SYSTEM_LIB_DD_SUBDOMAIN(_pre, _G, leaf, view, _s_type, _s_backend, leaf, _p, _r, _rC); \ + _DUNE_GDT_ASSEMBLER_SYSTEM_LIB_DD_SUBDOMAIN(_pre, _G, level, view, _s_type, _s_backend, level, _p, _r, _rC); \ _DUNE_GDT_ASSEMBLER_SYSTEM_LIB_DD_SUBDOMAIN( \ - _pre, _G, adaptive_leaf, part, _s_type, _s_backend, adaptive_leaf, _p, _r, _rC); \ - _DUNE_GDT_ASSEMBLER_SYSTEM_LIB_DD_SUBDOMAIN(_pre, _G, leaf, part, _s_type, _s_backend, leaf, _p, _r, _rC); \ - _DUNE_GDT_ASSEMBLER_SYSTEM_LIB_DD_SUBDOMAIN(_pre, _G, level, part, _s_type, _s_backend, level, _p, _r, _rC); \ - _DUNE_GDT_ASSEMBLER_SYSTEM_LIB_DD_SUBDOMAIN( \ - _pre, _G, dd_subdomain, part, _s_type, _s_backend, dd_subdomain, _p, _r, _rC); \ + _pre, _G, dd_subdomain, view, _s_type, _s_backend, dd_subdomain, _p, _r, _rC); \ _DUNE_GDT_ASSEMBLER_SYSTEM_LIB_DD_SUBDOMAIN( \ - _pre, _G, dd_subdomain_boundary, part, _s_type, _s_backend, dd_subdomain, _p, _r, _rC); \ + _pre, _G, dd_subdomain_boundary, view, _s_type, _s_backend, dd_subdomain, _p, _r, _rC); \ _DUNE_GDT_ASSEMBLER_SYSTEM_LIB_DD_SUBDOMAIN( \ - _pre, _G, dd_subdomain_coupling, part, _s_type, _s_backend, dd_subdomain, _p, _r, _rC) + _pre, _G, dd_subdomain_coupling, view, _s_type, _s_backend, dd_subdomain, _p, _r, _rC) -#if HAVE_DUNE_FEM #if HAVE_DUNE_ALUGRID -DUNE_GDT_ASSEMBLER_SYSTEM_LIB_DD_SUBDOMAIN(extern template, ALU_2D_SIMPLEX_CONFORMING, cg, fem, 1, 1, 1); -#endif -DUNE_GDT_ASSEMBLER_SYSTEM_LIB_DD_SUBDOMAIN(extern template, YASP_1D_EQUIDISTANT_OFFSET, cg, fem, 1, 1, 1); -DUNE_GDT_ASSEMBLER_SYSTEM_LIB_DD_SUBDOMAIN(extern template, YASP_2D_EQUIDISTANT_OFFSET, cg, fem, 1, 1, 1); -DUNE_GDT_ASSEMBLER_SYSTEM_LIB_DD_SUBDOMAIN(extern template, YASP_3D_EQUIDISTANT_OFFSET, cg, fem, 1, 1, 1); +DUNE_GDT_ASSEMBLER_SYSTEM_LIB_DD_SUBDOMAIN(extern template, ALU_2D_SIMPLEX_CONFORMING, cg, gdt, 1, 1, 1); #endif +DUNE_GDT_ASSEMBLER_SYSTEM_LIB_DD_SUBDOMAIN(extern template, YASP_1D_EQUIDISTANT_OFFSET, cg, gdt, 1, 1, 1); +DUNE_GDT_ASSEMBLER_SYSTEM_LIB_DD_SUBDOMAIN(extern template, YASP_2D_EQUIDISTANT_OFFSET, cg, gdt, 1, 1, 1); +DUNE_GDT_ASSEMBLER_SYSTEM_LIB_DD_SUBDOMAIN(extern template, YASP_3D_EQUIDISTANT_OFFSET, cg, gdt, 1, 1, 1); #endif // DUNE_XT_WITH_PYTHON_BINDINGS diff --git a/dune/gdt/assembler/system.lib/fem_alu_2d_simplex_conforming.cc b/dune/gdt/assembler/system.lib/alu_2d_simplex_conforming.cc similarity index 82% rename from dune/gdt/assembler/system.lib/fem_alu_2d_simplex_conforming.cc rename to dune/gdt/assembler/system.lib/alu_2d_simplex_conforming.cc index 0eb1e38972912410f8407d2ed76bb37f8fb03361..d0353f4961f60ac0437bbc713faa25c596411775 100644 --- a/dune/gdt/assembler/system.lib/fem_alu_2d_simplex_conforming.cc +++ b/dune/gdt/assembler/system.lib/alu_2d_simplex_conforming.cc @@ -9,12 +9,12 @@ #include <config.h> -#if HAVE_DUNE_ALUGRID && HAVE_DUNE_FEM +#if HAVE_DUNE_ALUGRID #include "../system.lib.hh" -DUNE_GDT_ASSEMBLER_SYSTEM_LIB_DD_SUBDOMAIN(template, ALU_2D_SIMPLEX_CONFORMING, cg, fem, 1, 1, 1); +DUNE_GDT_ASSEMBLER_SYSTEM_LIB_DD_SUBDOMAIN(template, ALU_2D_SIMPLEX_CONFORMING, cg, gdt, 1, 1, 1); -#endif // HAVE_DUNE_ALUGRID && HAVE_DUNE_FEM +#endif // HAVE_DUNE_ALUGRID diff --git a/dune/gdt/assembler/system.lib/fem_alu_2d_simplex_conforming_istl.cc b/dune/gdt/assembler/system.lib/fem_alu_2d_simplex_conforming_istl.cc deleted file mode 100644 index f337116e8d16c9bba456c3f7a249c85f2bb6cbf8..0000000000000000000000000000000000000000 --- a/dune/gdt/assembler/system.lib/fem_alu_2d_simplex_conforming_istl.cc +++ /dev/null @@ -1,20 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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_ALUGRID && HAVE_DUNE_FEM - -#include "../system.lib.hh" - - -DUNE_GDT_ASSEMBLER_SYSTEM_LIB_PARTS(template, ALU_2D_SIMPLEX_CONFORMING, cg, fem, 1, 1, 1); - - -#endif // HAVE_DUNE_ALUGRID && HAVE_DUNE_FEM diff --git a/dune/gdt/assembler/system.lib/fem_yasp_1d_equidistant_offset.cc b/dune/gdt/assembler/system.lib/yasp_1d_equidistant_offset.cc similarity index 87% rename from dune/gdt/assembler/system.lib/fem_yasp_1d_equidistant_offset.cc rename to dune/gdt/assembler/system.lib/yasp_1d_equidistant_offset.cc index 75ed61a2db1f29c6e5605300a714ea48abe00df7..71948c42d607456882b11a4affe2c782fd2508a2 100644 --- a/dune/gdt/assembler/system.lib/fem_yasp_1d_equidistant_offset.cc +++ b/dune/gdt/assembler/system.lib/yasp_1d_equidistant_offset.cc @@ -9,12 +9,7 @@ #include <config.h> -#if HAVE_DUNE_FEM - #include "../system.lib.hh" -DUNE_GDT_ASSEMBLER_SYSTEM_LIB_DD_SUBDOMAIN(template, YASP_1D_EQUIDISTANT_OFFSET, cg, fem, 1, 1, 1); - - -#endif // HAVE_DUNE_FEM +DUNE_GDT_ASSEMBLER_SYSTEM_LIB_DD_SUBDOMAIN(template, YASP_1D_EQUIDISTANT_OFFSET, cg, gdt, 1, 1, 1); diff --git a/dune/gdt/assembler/system.lib/fem_yasp_2d_equidistant_offset.cc b/dune/gdt/assembler/system.lib/yasp_2d_equidistant_offset.cc similarity index 87% rename from dune/gdt/assembler/system.lib/fem_yasp_2d_equidistant_offset.cc rename to dune/gdt/assembler/system.lib/yasp_2d_equidistant_offset.cc index 49c1edcfb167806c05352782d1c18a2eef6046af..455d8bbb4c777fcfe3acc57ff9b5b0cb78703c24 100644 --- a/dune/gdt/assembler/system.lib/fem_yasp_2d_equidistant_offset.cc +++ b/dune/gdt/assembler/system.lib/yasp_2d_equidistant_offset.cc @@ -9,12 +9,7 @@ #include <config.h> -#if HAVE_DUNE_FEM - #include "../system.lib.hh" -DUNE_GDT_ASSEMBLER_SYSTEM_LIB_DD_SUBDOMAIN(template, YASP_2D_EQUIDISTANT_OFFSET, cg, fem, 1, 1, 1); - - -#endif // HAVE_DUNE_FEM +DUNE_GDT_ASSEMBLER_SYSTEM_LIB_DD_SUBDOMAIN(template, YASP_2D_EQUIDISTANT_OFFSET, cg, gdt, 1, 1, 1); diff --git a/dune/gdt/assembler/system.lib/fem_yasp_3d_equidistant_offset.cc b/dune/gdt/assembler/system.lib/yasp_3d_equidistant_offset.cc similarity index 87% rename from dune/gdt/assembler/system.lib/fem_yasp_3d_equidistant_offset.cc rename to dune/gdt/assembler/system.lib/yasp_3d_equidistant_offset.cc index 23fd002a4e06e03829bf3649cbfd3fee6936a258..740e659d40b22aa88d5502d0293410e68105e20c 100644 --- a/dune/gdt/assembler/system.lib/fem_yasp_3d_equidistant_offset.cc +++ b/dune/gdt/assembler/system.lib/yasp_3d_equidistant_offset.cc @@ -9,12 +9,7 @@ #include <config.h> -#if HAVE_DUNE_FEM - #include "../system.lib.hh" -DUNE_GDT_ASSEMBLER_SYSTEM_LIB_DD_SUBDOMAIN(template, YASP_3D_EQUIDISTANT_OFFSET, cg, fem, 1, 1, 1); - - -#endif // HAVE_DUNE_FEM +DUNE_GDT_ASSEMBLER_SYSTEM_LIB_DD_SUBDOMAIN(template, YASP_3D_EQUIDISTANT_OFFSET, cg, gdt, 1, 1, 1); diff --git a/dune/gdt/discretefunction/default.bindings.cc b/dune/gdt/discretefunction/default.bindings.cc deleted file mode 100644 index 14e48192654f74c6f46b92ffb31fb927fea33e7e..0000000000000000000000000000000000000000 --- a/dune/gdt/discretefunction/default.bindings.cc +++ /dev/null @@ -1,81 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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 "default.bindings.hh" - -namespace Dune { -namespace GDT { -namespace bindings { - - -// these lines have to match the corresponding ones in the .hh header file -DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_GDT(template, YASP_2D_EQUIDISTANT_OFFSET, COMMON_DENSE_VECTOR); -#if HAVE_EIGEN -DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_GDT(template, YASP_2D_EQUIDISTANT_OFFSET, EIGEN_DENSE_VECTOR); -#endif -#if HAVE_DUNE_ISTL -DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_GDT(template, YASP_2D_EQUIDISTANT_OFFSET, ISTL_DENSE_VECTOR); -#endif -#if HAVE_DUNE_FEM -DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_FEM(template, YASP_2D_EQUIDISTANT_OFFSET, COMMON_DENSE_VECTOR); -#if HAVE_EIGEN -DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_FEM(template, YASP_2D_EQUIDISTANT_OFFSET, EIGEN_DENSE_VECTOR); -#endif -#if HAVE_DUNE_ISTL -DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_FEM(template, YASP_2D_EQUIDISTANT_OFFSET, ISTL_DENSE_VECTOR); -#endif -#endif // HAVE_DUNE_FEM -#if HAVE_DUNE_PDELAB -DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_PDELAB(template, YASP_2D_EQUIDISTANT_OFFSET, COMMON_DENSE_VECTOR); -#if HAVE_EIGEN -DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_PDELAB(template, YASP_2D_EQUIDISTANT_OFFSET, EIGEN_DENSE_VECTOR); -#endif -#if HAVE_DUNE_ISTL -DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_PDELAB(template, YASP_2D_EQUIDISTANT_OFFSET, ISTL_DENSE_VECTOR); -#endif -#endif // HAVE_DUNE_PDELAB - -#if HAVE_DUNE_ALUGRID -DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_GDT(template, ALU_2D_SIMPLEX_CONFORMING, COMMON_DENSE_VECTOR); -#if HAVE_EIGEN -DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_GDT(template, ALU_2D_SIMPLEX_CONFORMING, EIGEN_DENSE_VECTOR); -#endif -#if HAVE_DUNE_ISTL -DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_GDT(template, ALU_2D_SIMPLEX_CONFORMING, ISTL_DENSE_VECTOR); -#endif -#if HAVE_DUNE_FEM -DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_FEM(template, ALU_2D_SIMPLEX_CONFORMING, COMMON_DENSE_VECTOR); -#if HAVE_EIGEN -DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_FEM(template, ALU_2D_SIMPLEX_CONFORMING, EIGEN_DENSE_VECTOR); -#endif -#if HAVE_DUNE_ISTL -DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_FEM(template, ALU_2D_SIMPLEX_CONFORMING, ISTL_DENSE_VECTOR); -#endif -#endif // HAVE_DUNE_FEM -#if HAVE_DUNE_PDELAB -DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_PDELAB(template, ALU_2D_SIMPLEX_CONFORMING, COMMON_DENSE_VECTOR); -#if HAVE_EIGEN -DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_PDELAB(template, ALU_2D_SIMPLEX_CONFORMING, EIGEN_DENSE_VECTOR); -#endif -#if HAVE_DUNE_ISTL -DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_PDELAB(template, ALU_2D_SIMPLEX_CONFORMING, ISTL_DENSE_VECTOR); -#endif -#endif // HAVE_DUNE_PDELAB -#endif // HAVE_DUNE_ALUGRID - - -} // namespace bindings -} // namespace GDT -} // namespace Dune - -#endif // HAVE_DUNE_PYBINDXI diff --git a/dune/gdt/discretefunction/default.bindings.hh b/dune/gdt/discretefunction/default.bindings.hh index 5e25db0725b999e7b8ad663b7db8bc101fba0d06..8b64af469f349b9e1a14a4ed5a923c622e90096f 100644 --- a/dune/gdt/discretefunction/default.bindings.hh +++ b/dune/gdt/discretefunction/default.bindings.hh @@ -102,7 +102,6 @@ public: "level"_a = -1, "path"_a, "subsampling"_a = true); -#if HAVE_DUNE_FEM c.def("visualize", [](const type& self, const XT::Grid::GridProvider<G, XT::Grid::DD::SubdomainGrid<G>>& dd_grid_provider, @@ -119,13 +118,13 @@ public: path, subsampling); else if (layer == "dd_subdomain") - self.visualize(dd_grid_provider.template layer<XT::Grid::Layers::dd_subdomain, XT::Grid::Backends::part>( + self.visualize(dd_grid_provider.template layer<XT::Grid::Layers::dd_subdomain, XT::Grid::Backends::view>( level_or_subdomain), path, subsampling); else if (layer == "dd_subdomain_oversampled") self.visualize( - dd_grid_provider.template layer<XT::Grid::Layers::dd_subdomain_oversampled, XT::Grid::Backends::part>( + dd_grid_provider.template layer<XT::Grid::Layers::dd_subdomain_oversampled, XT::Grid::Backends::view>( level_or_subdomain), path, subsampling); @@ -141,7 +140,6 @@ public: "level_or_subdomain"_a = -1, "path"_a, "subsampling"_a = true); -#endif // HAVE_DUNE_FEM return c; } // ... bind(...) }; // class ConstDiscreteFunction @@ -236,14 +234,9 @@ public: const auto sp_name = space_name<SP>::value(); auto c = internal::DiscreteFunction<S, V>::bind(m, sp_name); - addbind_restricted<XT::Grid::Backends::part, XT::Grid::Layers::adaptive_leaf>(m, sp_name); - addbind_restricted<XT::Grid::Backends::part, XT::Grid::Layers::dd_subdomain>(m, sp_name); - addbind_restricted<XT::Grid::Backends::part, XT::Grid::Layers::dd_subdomain_boundary>(m, sp_name); - addbind_restricted<XT::Grid::Backends::part, XT::Grid::Layers::dd_subdomain_coupling>(m, sp_name); - addbind_restricted<XT::Grid::Backends::part, XT::Grid::Layers::dd_subdomain_oversampled>(m, sp_name); - addbind_restricted<XT::Grid::Backends::part, XT::Grid::Layers::leaf>(m, sp_name); - addbind_restricted<XT::Grid::Backends::part, XT::Grid::Layers::level>(m, sp_name); addbind_restricted<XT::Grid::Backends::view, XT::Grid::Layers::dd_subdomain>(m, sp_name); + addbind_restricted<XT::Grid::Backends::view, XT::Grid::Layers::dd_subdomain_boundary>(m, sp_name); + addbind_restricted<XT::Grid::Backends::view, XT::Grid::Layers::dd_subdomain_coupling>(m, sp_name); addbind_restricted<XT::Grid::Backends::view, XT::Grid::Layers::dd_subdomain_oversampled>(m, sp_name); addbind_restricted<XT::Grid::Backends::view, XT::Grid::Layers::leaf>(m, sp_name); addbind_restricted<XT::Grid::Backends::view, XT::Grid::Layers::level>(m, sp_name); @@ -313,36 +306,19 @@ public: _DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_YASP(_m, _g_layer, _s_type, _s_backend, _p, _r, _rC); \ _DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_ALU(_m, _g_layer, _s_type, _s_backend, _p, _r, _rC) -#if HAVE_DUNE_FEM -#define _DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_FEM(_m) \ - _DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_ALL_GRIDS(_m, leaf, cg, fem, 1, 1, 1); \ - _DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_ALL_GRIDS(_m, level, cg, fem, 1, 1, 1); \ - _DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_ALL_GRIDS(_m, dd_subdomain, cg, fem, 1, 1, 1); \ - _DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_ALL_GRIDS(_m, dd_subdomain, block_cg, fem, 1, 1, 1); \ - _DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_ALL_GRIDS(_m, leaf, dg, fem, 1, 1, 1); \ - _DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_ALL_GRIDS(_m, level, dg, fem, 1, 1, 1); \ - _DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_ALL_GRIDS(_m, dd_subdomain, dg, fem, 1, 1, 1); \ - _DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_ALL_GRIDS(_m, dd_subdomain, block_dg, fem, 1, 1, 1) -#else -#define _DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_FEM(_m) -#endif - -#define _DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_GDT(_m) \ - _DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_ALL_GRIDS(_m, leaf, fv, gdt, 0, 1, 1); \ - _DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_ALL_GRIDS(_m, level, fv, gdt, 0, 1, 1) - -#if HAVE_DUNE_PDELAB -#define _DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_PDELAB(_m) \ - _DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_ALU(_m, leaf, rt, pdelab, 0, 2, 1); \ - _DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_ALU(_m, level, rt, pdelab, 0, 2, 1) -#else -#define _DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_PDELAB(_m) -#endif - #define DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND(_m) \ - _DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_FEM(_m); \ - _DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_GDT(_m); \ - _DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_PDELAB(_m) + _DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_ALL_GRIDS(_m, leaf, dg, gdt, 1, 1, 1); \ + _DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_ALL_GRIDS(_m, level, dg, gdt, 1, 1, 1); \ + _DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_ALL_GRIDS(_m, leaf, fv, gdt, 0, 1, 1); \ + _DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_ALL_GRIDS(_m, level, fv, gdt, 0, 1, 1); \ + _DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_ALL_GRIDS(_m, leaf, cg, gdt, 1, 1, 1); \ + _DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_ALL_GRIDS(_m, level, cg, gdt, 1, 1, 1); + +#define DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_DD(_m) \ + _DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_ALL_GRIDS(_m, dd_subdomain, dg, gdt, 1, 1, 1); \ + _DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_ALL_GRIDS(_m, dd_subdomain, block_dg, gdt, 1, 1, 1); \ + _DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_ALL_GRIDS(_m, dd_subdomain, cg, gdt, 1, 1, 1); \ + _DUNE_GDT_DISCRETEFUNCTION_DEFAULT_BIND_ALL_GRIDS(_m, dd_subdomain, block_cg, gdt, 1, 1, 1); // end: this is what we need for the .so diff --git a/dune/gdt/discretefunction/default.hh b/dune/gdt/discretefunction/default.hh index 31993dc2dc23da09a9fd57e158785e1bea7a9cfc..c618543385bd6df419b7a4ef65c4e9aa2dd69c9e 100644 --- a/dune/gdt/discretefunction/default.hh +++ b/dune/gdt/discretefunction/default.hh @@ -173,8 +173,8 @@ public: typedef SpaceImp SpaceType; typedef typename SpaceType::Traits SpaceTraits; typedef VectorImp VectorType; - using typename BaseType::EntityType; - using typename BaseType::LocalfunctionType; + using EntityType = typename BaseType::EntityType; + using LocalfunctionType = typename BaseType::LocalfunctionType; typedef ConstLocalDiscreteFunction<SpaceType, VectorType> ConstLocalDiscreteFunctionType; diff --git a/dune/gdt/exceptions.hh b/dune/gdt/exceptions.hh index 16483bf000f967b9ff7c36d7c30df3f858d69f05..98de9178fea67f77bcb3a01d74d2a513f1af01be 100644 --- a/dune/gdt/exceptions.hh +++ b/dune/gdt/exceptions.hh @@ -37,6 +37,10 @@ class restricted_space_error : public space_error { }; +class mapper_error : public space_error +{ +}; + } // namespace GDT } // namespace Dune diff --git a/dune/gdt/functionals/elliptic-ipdg.bindings.cc b/dune/gdt/functionals/elliptic-ipdg.bindings.cc index 2730b0738dd92a355da80c3c3921fa5f3eff1673..a4f348a248842911da32e5daad9240f62691e84c 100644 --- a/dune/gdt/functionals/elliptic-ipdg.bindings.cc +++ b/dune/gdt/functionals/elliptic-ipdg.bindings.cc @@ -40,18 +40,18 @@ PYBIND11_PLUGIN(__functionals_elliptic_ipdg) py::module::import("dune.xt.la"); py::module::import("dune.gdt.__spaces"); -// alu_fem_istl.cc -#if HAVE_DUNE_ALUGRID && HAVE_DUNE_FEM && HAVE_DUNE_ISTL - DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_ALU(m, leaf, part, dg, fem, 1, istl_dense); - DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_ALU(m, level, part, dg, fem, 1, istl_dense); - DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_ALU(m, dd_subdomain, part, dg, fem, 1, istl_dense); +// alu_istl.cc +#if HAVE_DUNE_ALUGRID && HAVE_DUNE_ISTL + DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_ALU(m, leaf, view, dg, gdt, 1, istl_dense); + DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_ALU(m, level, view, dg, gdt, 1, istl_dense); + DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_ALU(m, dd_subdomain, view, dg, gdt, 1, istl_dense); #endif -// yasp_fem_istl.cc -#if HAVE_DUNE_FEM && HAVE_DUNE_ISTL - DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_YASP(m, leaf, part, dg, fem, 1, istl_dense); - DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_YASP(m, level, part, dg, fem, 1, istl_dense); - DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_YASP(m, dd_subdomain, part, dg, fem, 1, istl_dense); +// yasp_istl.cc +#if HAVE_DUNE_ISTL + DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_YASP(m, leaf, view, dg, gdt, 1, istl_dense); + DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_YASP(m, level, view, dg, gdt, 1, istl_dense); + DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_YASP(m, dd_subdomain, view, dg, gdt, 1, istl_dense); #endif m.def("_init_mpi", diff --git a/dune/gdt/functionals/elliptic-ipdg.bindings.hh b/dune/gdt/functionals/elliptic-ipdg.bindings.hh index 6c8e5645cc116fd03c39f3e650150292cafe153a..ea291ec574386dabd5a9b02817c2db592e8c0d6e 100644 --- a/dune/gdt/functionals/elliptic-ipdg.bindings.hh +++ b/dune/gdt/functionals/elliptic-ipdg.bindings.hh @@ -536,18 +536,18 @@ public: _DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_LIB_METHODS_D( \ _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_ELLIPTIC_IPDG_BIND_LIB_ALU(extern template, leaf, part, cg, fem, 1, istl_dense); -DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_LIB_ALU(extern template, level, part, cg, fem, 1, istl_dense); -DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_LIB_ALU(extern template, dd_subdomain, part, cg, fem, 1, istl_dense); +// alu_istl.cc +#if HAVE_DUNE_ALUGRID && HAVE_DUNE_ISTL +DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_LIB_ALU(extern template, leaf, view, cg, gdt, 1, istl_dense); +DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_LIB_ALU(extern template, level, view, cg, gdt, 1, istl_dense); +// DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_LIB_ALU(extern template, dd_subdomain, part, cg, gdt, 1, istl_dense); #endif -// yasp_fem_istl.cc -#if HAVE_DUNE_FEM && HAVE_DUNE_ISTL -DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_LIB_YASP(extern template, leaf, part, cg, fem, 1, istl_dense); -DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_LIB_YASP(extern template, level, part, cg, fem, 1, istl_dense); -DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_LIB_YASP(extern template, dd_subdomain, part, cg, fem, 1, istl_dense); +// yasp_istl.cc +#if HAVE_DUNE_ISTL +DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_LIB_YASP(extern template, leaf, view, cg, gdt, 1, istl_dense); +DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_LIB_YASP(extern template, level, view, cg, gdt, 1, istl_dense); +// DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_LIB_YASP(extern template, dd_subdomain, part, cg, gdt, 1, istl_dense); #endif // end: this is what we need for the lib diff --git a/dune/gdt/functionals/elliptic-ipdg.bindings/alu_fem_istl.cc b/dune/gdt/functionals/elliptic-ipdg.bindings/alu_istl.cc similarity index 83% rename from dune/gdt/functionals/elliptic-ipdg.bindings/alu_fem_istl.cc rename to dune/gdt/functionals/elliptic-ipdg.bindings/alu_istl.cc index 3c9c8e18e114feb9507ca5a6d689cb37327c40b2..454e8761db71841582d33c7dbf34ecf01f706e80 100644 --- a/dune/gdt/functionals/elliptic-ipdg.bindings/alu_fem_istl.cc +++ b/dune/gdt/functionals/elliptic-ipdg.bindings/alu_istl.cc @@ -14,10 +14,10 @@ #include <dune/gdt/functionals/elliptic-ipdg.bindings.hh> -#if HAVE_DUNE_ALUGRID && HAVE_DUNE_FEM && HAVE_DUNE_ISTL -DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_LIB_ALU(template, leaf, part, dg, fem, 1, istl_sparse); -DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_LIB_ALU(template, level, part, dg, fem, 1, istl_sparse); -DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_LIB_ALU(template, dd_subdomain, part, dg, fem, 1, istl_sparse); +#if HAVE_DUNE_ALUGRID && HAVE_DUNE_ISTL +DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_LIB_ALU(template, leaf, view, dg, gdt, 1, istl_sparse); +DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_LIB_ALU(template, level, view, dg, gdt, 1, istl_sparse); +DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_LIB_ALU(template, dd_subdomain, view, dg, gdt, 1, istl_sparse); #endif diff --git a/dune/gdt/functionals/elliptic-ipdg.bindings/yasp_fem_istl.cc b/dune/gdt/functionals/elliptic-ipdg.bindings/yasp_istl.cc similarity index 84% rename from dune/gdt/functionals/elliptic-ipdg.bindings/yasp_fem_istl.cc rename to dune/gdt/functionals/elliptic-ipdg.bindings/yasp_istl.cc index 22aef532f2a916be558a6138e30528e8893c72f3..801b628ead33dd2f250945a0bd87eabc8a5feba8 100644 --- a/dune/gdt/functionals/elliptic-ipdg.bindings/yasp_fem_istl.cc +++ b/dune/gdt/functionals/elliptic-ipdg.bindings/yasp_istl.cc @@ -14,10 +14,10 @@ #include <dune/gdt/functionals/elliptic-ipdg.bindings.hh> -#if HAVE_DUNE_FEM && HAVE_DUNE_ISTL -DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_LIB_YASP(template, leaf, part, dg, fem, 1, istl_sparse); -DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_LIB_YASP(template, level, part, dg, fem, 1, istl_sparse); -DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_LIB_YASP(template, dd_subdomain, part, dg, fem, 1, istl_sparse); +#if HAVE_DUNE_ISTL +DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_LIB_YASP(template, leaf, view, dg, gdt, 1, istl_sparse); +DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_LIB_YASP(template, level, view, dg, gdt, 1, istl_sparse); +DUNE_GDT_FUNCTIONALS_ELLIPTIC_IPDG_BIND_LIB_YASP(template, dd_subdomain, view, dg, gdt, 1, istl_sparse); #endif diff --git a/dune/gdt/functionals/l2.bindings.cc b/dune/gdt/functionals/l2.bindings.cc index 4ac20821f16bd015b5b2c7749796316d80a27f36..8fcd6f0bd9ecf127b5c299077f1cdb4d98cacf8c 100644 --- a/dune/gdt/functionals/l2.bindings.cc +++ b/dune/gdt/functionals/l2.bindings.cc @@ -40,24 +40,24 @@ PYBIND11_PLUGIN(__functionals_l2) py::module::import("dune.xt.la"); py::module::import("dune.gdt.__spaces"); -// 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); - DUNE_GDT_FUNCTIONALS_L2_BIND_ALU(m, leaf, part, dg, fem, 1, istl_sparse); - DUNE_GDT_FUNCTIONALS_L2_BIND_ALU(m, level, part, dg, fem, 1, istl_sparse); - DUNE_GDT_FUNCTIONALS_L2_BIND_ALU(m, dd_subdomain, part, dg, fem, 1, istl_sparse); + // alu_istl.cc + DUNE_GDT_FUNCTIONALS_L2_BIND_ALU(m, leaf, view, dg, gdt, 1, istl_sparse); + DUNE_GDT_FUNCTIONALS_L2_BIND_ALU(m, level, view, dg, gdt, 1, istl_sparse); + DUNE_GDT_FUNCTIONALS_L2_BIND_ALU(m, dd_subdomain, view, dg, gdt, 1, istl_sparse); +#if HAVE_DUNE_ALUGRID && HAVE_DUNE_ISTL + DUNE_GDT_FUNCTIONALS_L2_BIND_ALU(m, leaf, view, cg, gdt, 1, istl_sparse); + DUNE_GDT_FUNCTIONALS_L2_BIND_ALU(m, level, view, cg, gdt, 1, istl_sparse); + DUNE_GDT_FUNCTIONALS_L2_BIND_ALU(m, dd_subdomain, view, cg, gdt, 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); - DUNE_GDT_FUNCTIONALS_L2_BIND_YASP(m, leaf, part, dg, fem, 1, istl_sparse); - DUNE_GDT_FUNCTIONALS_L2_BIND_YASP(m, level, part, dg, fem, 1, istl_sparse); - DUNE_GDT_FUNCTIONALS_L2_BIND_YASP(m, dd_subdomain, part, dg, fem, 1, istl_sparse); +// yasp_istl.cc +#if HAVE_DUNE_ISTL + DUNE_GDT_FUNCTIONALS_L2_BIND_YASP(m, leaf, view, dg, gdt, 1, istl_sparse); + DUNE_GDT_FUNCTIONALS_L2_BIND_YASP(m, level, view, dg, gdt, 1, istl_sparse); + DUNE_GDT_FUNCTIONALS_L2_BIND_YASP(m, dd_subdomain, view, dg, gdt, 1, istl_sparse); + DUNE_GDT_FUNCTIONALS_L2_BIND_YASP(m, leaf, view, cg, gdt, 1, istl_sparse); + DUNE_GDT_FUNCTIONALS_L2_BIND_YASP(m, level, view, cg, gdt, 1, istl_sparse); + DUNE_GDT_FUNCTIONALS_L2_BIND_YASP(m, dd_subdomain, view, cg, gdt, 1, istl_sparse); #endif m.def("_init_mpi", diff --git a/dune/gdt/functionals/l2.bindings.hh b/dune/gdt/functionals/l2.bindings.hh index a6f786f12de575b6ec0e57207c48ef2ed85a418f..742fd4d9ec442ed6959b30241185b3e63c641303 100644 --- a/dune/gdt/functionals/l2.bindings.hh +++ b/dune/gdt/functionals/l2.bindings.hh @@ -233,18 +233,18 @@ public: _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); +// alu_istl.cc +#if HAVE_DUNE_ALUGRID && HAVE_DUNE_ISTL +DUNE_GDT_FUNCTIONALS_L2_BIND_LIB_ALU(extern template, leaf, view, cg, gdt, 1, istl_sparse); +DUNE_GDT_FUNCTIONALS_L2_BIND_LIB_ALU(extern template, level, view, cg, gdt, 1, istl_sparse); +DUNE_GDT_FUNCTIONALS_L2_BIND_LIB_ALU(extern template, dd_subdomain, view, cg, gdt, 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); +// yasp_istl.cc +#if HAVE_DUNE_ISTL +DUNE_GDT_FUNCTIONALS_L2_BIND_LIB_YASP(extern template, leaf, view, cg, gdt, 1, istl_sparse); +DUNE_GDT_FUNCTIONALS_L2_BIND_LIB_YASP(extern template, level, view, cg, gdt, 1, istl_sparse); +DUNE_GDT_FUNCTIONALS_L2_BIND_LIB_YASP(extern template, dd_subdomain, view, cg, gdt, 1, istl_sparse); #endif // end: this is what we need for the lib diff --git a/dune/gdt/functionals/l2.bindings/alu_fem_istl.cc b/dune/gdt/functionals/l2.bindings/alu_istl.cc similarity index 64% rename from dune/gdt/functionals/l2.bindings/alu_fem_istl.cc rename to dune/gdt/functionals/l2.bindings/alu_istl.cc index d949c479905842d98006c7f99a3926c72c58b977..b4d75d57e9fde77337bf0442a2102a65459f76a2 100644 --- a/dune/gdt/functionals/l2.bindings/alu_fem_istl.cc +++ b/dune/gdt/functionals/l2.bindings/alu_istl.cc @@ -14,11 +14,10 @@ #include <dune/gdt/functionals/l2.bindings.hh> -#if HAVE_DUNE_ALUGRID && HAVE_DUNE_FEM && HAVE_DUNE_ISTL -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); +#if HAVE_DUNE_ALUGRID && HAVE_DUNE_ISTL +DUNE_GDT_FUNCTIONALS_L2_BIND_LIB_ALU(template, leaf, view, cg, gdt, 1, istl_sparse); +DUNE_GDT_FUNCTIONALS_L2_BIND_LIB_ALU(template, level, view, cg, gdt, 1, istl_sparse); +DUNE_GDT_FUNCTIONALS_L2_BIND_LIB_ALU(template, dd_subdomain, view, cg, gdt, 1, istl_sparse); #endif - #endif // HAVE_DUNE_PYBINDXI diff --git a/dune/gdt/functionals/l2.bindings/yasp_fem_istl.cc b/dune/gdt/functionals/l2.bindings/yasp_istl.cc similarity index 66% rename from dune/gdt/functionals/l2.bindings/yasp_fem_istl.cc rename to dune/gdt/functionals/l2.bindings/yasp_istl.cc index f90afb8df173b4e74238d74de47f10debe91463b..3a4e275065b63187752126db9b99cdae7e9c98a3 100644 --- a/dune/gdt/functionals/l2.bindings/yasp_fem_istl.cc +++ b/dune/gdt/functionals/l2.bindings/yasp_istl.cc @@ -14,10 +14,10 @@ #include <dune/gdt/functionals/l2.bindings.hh> -#if HAVE_DUNE_FEM && HAVE_DUNE_ISTL -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); +#if HAVE_DUNE_ISTL +DUNE_GDT_FUNCTIONALS_L2_BIND_LIB_YASP(template, leaf, view, cg, gdt, 1, istl_sparse); +DUNE_GDT_FUNCTIONALS_L2_BIND_LIB_YASP(template, level, view, cg, gdt, 1, istl_sparse); +DUNE_GDT_FUNCTIONALS_L2_BIND_LIB_YASP(template, dd_subdomain, view, cg, gdt, 1, istl_sparse); #endif diff --git a/dune/gdt/local/elliptic-ipdg-operators.bindings.hh b/dune/gdt/local/elliptic-ipdg-operators.bindings.hh index c742003502bf67091ad51899ea1ab0bb54c88b2b..d2b9ae8460cdc8ad03d5b6f20a6a5c212aac1469 100644 --- a/dune/gdt/local/elliptic-ipdg-operators.bindings.hh +++ b/dune/gdt/local/elliptic-ipdg-operators.bindings.hh @@ -40,14 +40,8 @@ class LocalEllipticIpdgInnerIntegralOperator static_assert(is_space<S>::value, ""); typedef XT::Grid::extract_grid_t<typename S::GridLayerType> G; typedef typename S::BaseFunctionSetType B; - typedef XT::Grid::extract_intersection_t<typename XT::Grid::Layer<G, - layer, - S::layer_backend -#if HAVE_DUNE_FEM - , - XT::Grid::DD::SubdomainGrid<G> -#endif - >::type> + typedef XT::Grid::extract_intersection_t< + typename XT::Grid::Layer<G, layer, S::layer_backend, XT::Grid::DD::SubdomainGrid<G>>::type> I; public: @@ -213,14 +207,8 @@ class LocalEllipticIpdgBoundaryIntegralOperator static_assert(is_space<S>::value, ""); typedef XT::Grid::extract_grid_t<typename S::GridLayerType> G; typedef typename S::BaseFunctionSetType B; - typedef XT::Grid::extract_intersection_t<typename XT::Grid::Layer<G, - layer, - S::layer_backend -#if HAVE_DUNE_FEM - , - XT::Grid::DD::SubdomainGrid<G> -#endif - >::type> + typedef XT::Grid::extract_intersection_t< + typename XT::Grid::Layer<G, layer, S::layer_backend, XT::Grid::DD::SubdomainGrid<G>>::type> I; public: @@ -741,22 +729,9 @@ public: //_DUNE_GDT_LOCAL_ELLIPTIC_IPDG_OPERATORS_BIND_YASP( \ // _m, dd_subdomain, part, _s_type, _s_backend, dd_subdomain_coupling, _p, _R, _r, _rC, "_dd_subdomain_") -#if HAVE_DUNE_FEM -#define _DUNE_GDT_LOCAL_ELLIPTIC_IPDG_OPERATORS_BIND_PARTS(_m, _s_type, _s_backend, _p, _R, _r, _rC) \ +#define DUNE_GDT_LOCAL_ELLIPTIC_IPDG_OPERATORS_BIND(_m) \ _DUNE_GDT_LOCAL_ELLIPTIC_IPDG_OPERATORS_BIND_ALU( \ - _m, dd_subdomain, part, _s_type, _s_backend, dd_subdomain_coupling, _p, _R, _r, _rC, "_dd_subdomain_") -#else -#define _DUNE_GDT_LOCAL_ELLIPTIC_IPDG_OPERATORS_BIND_PARTS(_m, _s_type, _s_backend, _p, _R, _r, _rC) -#endif - -#if HAVE_DUNE_FEM -#define DUNE_GDT_LOCAL_ELLIPTIC_IPDG_OPERATORS_BIND_FEM(_m) \ - _DUNE_GDT_LOCAL_ELLIPTIC_IPDG_OPERATORS_BIND_PARTS(_m, dg, fem, 1, double, 1, 1) -#else -#define DUNE_GDT_LOCAL_ELLIPTIC_IPDG_OPERATORS_BIND_FEM(_m) -#endif - -#define DUNE_GDT_LOCAL_ELLIPTIC_IPDG_OPERATORS_BIND(_m) DUNE_GDT_LOCAL_ELLIPTIC_IPDG_OPERATORS_BIND_FEM(_m) + _m, dd_subdomain, view, dg, gdt, dd_subdomain_coupling, 1, double, 1, 1, "_dd_subdomain_") // end: this is what we need for the .so diff --git a/dune/gdt/local/integrands/ESV2007.hh b/dune/gdt/local/integrands/ESV2007.hh index bfe11ca3c14db2fd44d24fe87ed026ce3e87a3f5..d4238ef11114335724b64d9bb8f7f358bfa78523 100644 --- a/dune/gdt/local/integrands/ESV2007.hh +++ b/dune/gdt/local/integrands/ESV2007.hh @@ -350,6 +350,7 @@ public: /// \name Actual implementation of evalaute. /// \{ + /// \todo Use MatrixInverter from dune-xt-la template <class R> void evaluate( const XT::Functions::LocalfunctionInterface<EntityType, DomainFieldType, dimDomain, R, 1>& local_diffusion_factor, diff --git a/dune/gdt/operators/base.hh b/dune/gdt/operators/base.hh index c2b64eb27b4e9b8499cb3f833ebd9f8ab01d5860..57ed97d510e817e2ec8da82a5919498a6f5dd637 100644 --- a/dune/gdt/operators/base.hh +++ b/dune/gdt/operators/base.hh @@ -546,7 +546,7 @@ public: const Dune::XT::Common::Parameter& param = {}) const { auto ret = apply2(range.vector(), source.vector(), param); - return range.space().grid_view().grid().comm().sum(ret); + return range.space().grid_layer().grid().comm().sum(ret); } template <class SourceType> diff --git a/dune/gdt/operators/elliptic-ipdg.bindings.cc b/dune/gdt/operators/elliptic-ipdg.bindings.cc index de191be810a742b6175a4c8be8541b178f9010bf..68b0b9ec5d2795829f92a6a2069c63a834ee551d 100644 --- a/dune/gdt/operators/elliptic-ipdg.bindings.cc +++ b/dune/gdt/operators/elliptic-ipdg.bindings.cc @@ -41,18 +41,18 @@ PYBIND11_PLUGIN(__operators_elliptic_ipdg) py::module::import("dune.gdt.__spaces"); py::module::import("dune.gdt.__discretefunction"); -// alu_fem_istl.cc -#if HAVE_DUNE_ALUGRID && HAVE_DUNE_FEM && HAVE_DUNE_ISTL - DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_ALU(m, leaf, part, dg, fem, 1, istl_sparse); - DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_ALU(m, level, part, dg, fem, 1, istl_sparse); - DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_ALU(m, dd_subdomain, part, dg, fem, 1, istl_sparse); +// alu_istl.cc +#if HAVE_DUNE_ALUGRID && HAVE_DUNE_ISTL + DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_ALU(m, leaf, view, dg, gdt, 1, istl_sparse); + DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_ALU(m, level, view, dg, gdt, 1, istl_sparse); + DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_ALU(m, dd_subdomain, view, dg, gdt, 1, istl_sparse); #endif -// yasp_fem_istl.cc -#if HAVE_DUNE_FEM && HAVE_DUNE_ISTL - DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_YASP(m, leaf, part, dg, fem, 1, istl_sparse); - DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_YASP(m, level, part, dg, fem, 1, istl_sparse); - DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_YASP(m, dd_subdomain, part, dg, fem, 1, istl_sparse); +// yasp_istl.cc +#if HAVE_DUNE_ISTL + DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_YASP(m, leaf, view, dg, gdt, 1, istl_sparse); + DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_YASP(m, level, view, dg, gdt, 1, istl_sparse); + DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_YASP(m, dd_subdomain, view, dg, gdt, 1, istl_sparse); #endif m.def("_init_mpi", diff --git a/dune/gdt/operators/elliptic-ipdg.bindings.hh b/dune/gdt/operators/elliptic-ipdg.bindings.hh index 6406507e146989c23922590a4049cb5b2192508d..204a834ffc3d23ab6efccbce190822de29935d61 100644 --- a/dune/gdt/operators/elliptic-ipdg.bindings.hh +++ b/dune/gdt/operators/elliptic-ipdg.bindings.hh @@ -419,18 +419,18 @@ public: _DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_LIB_METHODS_D( \ _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_OPERATORS_ELLIPTIC_IPDG_BIND_LIB_ALU(extern template, leaf, part, cg, fem, 1, istl_sparse); -DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_LIB_ALU(extern template, level, part, cg, fem, 1, istl_sparse); -DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_LIB_ALU(extern template, dd_subdomain, part, cg, fem, 1, istl_sparse); +// alu_istl.cc +#if HAVE_DUNE_ALUGRID && HAVE_DUNE_ISTL +DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_LIB_ALU(extern template, leaf, view, cg, gdt, 1, istl_sparse); +DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_LIB_ALU(extern template, level, view, cg, gdt, 1, istl_sparse); +// DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_LIB_ALU(extern template, dd_subdomain, view, cg, gdt, 1, istl_sparse); #endif -// yasp_fem_istl.cc -#if HAVE_DUNE_FEM && HAVE_DUNE_ISTL -DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_LIB_YASP(extern template, leaf, part, cg, fem, 1, istl_sparse); -DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_LIB_YASP(extern template, level, part, cg, fem, 1, istl_sparse); -DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_LIB_YASP(extern template, dd_subdomain, part, cg, fem, 1, istl_sparse); +// yasp_istl.cc +#if HAVE_DUNE_ISTL +DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_LIB_YASP(extern template, leaf, view, cg, gdt, 1, istl_sparse); +DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_LIB_YASP(extern template, level, view, cg, gdt, 1, istl_sparse); +// DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_LIB_YASP(extern template, dd_subdomain, view, cg, gdt, 1, istl_sparse); #endif // end: this is what we need for the lib diff --git a/dune/gdt/operators/elliptic-ipdg.bindings/alberta_fem_common.cc b/dune/gdt/operators/elliptic-ipdg.bindings/alberta_fem_common.cc deleted file mode 100644 index ea5dbd201cfd1b32d9fad3e8336261eb5ecb0390..0000000000000000000000000000000000000000 --- a/dune/gdt/operators/elliptic-ipdg.bindings/alberta_fem_common.cc +++ /dev/null @@ -1,35 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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/operators/elliptic-ipdg.bindings.hh> - - -PYBIND11_PLUGIN(__operators_elliptic_ipdg_alberta_fem_common) -{ - namespace py = pybind11; - - py::module m("__operators_elliptic_ipdg_alberta_fem_common", "dune-gdt: EllipticIpdgMatrixOperator"); - - py::module::import("dune.xt.common"); - py::module::import("dune.xt.grid"); - py::module::import("dune.xt.functions"); - py::module::import("dune.xt.la"); - - // DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_FEM_COMMON(m); - - return m.ptr(); -} - -#endif // HAVE_DUNE_PYBINDXI diff --git a/dune/gdt/operators/elliptic-ipdg.bindings/alberta_fem_eigen.cc b/dune/gdt/operators/elliptic-ipdg.bindings/alberta_fem_eigen.cc deleted file mode 100644 index 3b9843279ec3a911b80e5f0bbacecce29c9f0e01..0000000000000000000000000000000000000000 --- a/dune/gdt/operators/elliptic-ipdg.bindings/alberta_fem_eigen.cc +++ /dev/null @@ -1,35 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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/operators/elliptic-ipdg.bindings.hh> - - -PYBIND11_PLUGIN(__operators_elliptic_ipdg_alberta_fem_eigen) -{ - namespace py = pybind11; - - py::module m("__operators_elliptic_ipdg_alberta_fem_eigen", "dune-gdt: EllipticMatrixOperator"); - - py::module::import("dune.xt.common"); - py::module::import("dune.xt.grid"); - py::module::import("dune.xt.functions"); - py::module::import("dune.xt.la"); - - // DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_FEM_EIGEN(m); - - return m.ptr(); -} - -#endif // HAVE_DUNE_PYBINDXI diff --git a/dune/gdt/operators/elliptic-ipdg.bindings/alberta_fem_istl.cc b/dune/gdt/operators/elliptic-ipdg.bindings/alberta_fem_istl.cc deleted file mode 100644 index 0d6ef9ed26b49834ac3fefb48fac983048da9918..0000000000000000000000000000000000000000 --- a/dune/gdt/operators/elliptic-ipdg.bindings/alberta_fem_istl.cc +++ /dev/null @@ -1,35 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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/operators/elliptic-ipdg.bindings.hh> - - -PYBIND11_PLUGIN(__operators_elliptic_ipdg_alberta_fem_istl) -{ - namespace py = pybind11; - - py::module m("__operators_elliptic_ipdg_alberta_fem_istl", "dune-gdt: EllipticMatrixOperator"); - - py::module::import("dune.xt.common"); - py::module::import("dune.xt.grid"); - py::module::import("dune.xt.functions"); - py::module::import("dune.xt.la"); - - // DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_FEM_ISTL(m); - - return m.ptr(); -} - -#endif // HAVE_DUNE_PYBINDXI diff --git a/dune/gdt/operators/elliptic-ipdg.bindings/alberta_pdelab_common.cc b/dune/gdt/operators/elliptic-ipdg.bindings/alberta_pdelab_common.cc deleted file mode 100644 index dd9281626a9b3f95c009835fa7328506222582bd..0000000000000000000000000000000000000000 --- a/dune/gdt/operators/elliptic-ipdg.bindings/alberta_pdelab_common.cc +++ /dev/null @@ -1,35 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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/operators/elliptic-ipdg.bindings.hh> - - -PYBIND11_PLUGIN(__operators_elliptic_ipdg_alberta_pdelab_common) -{ - namespace py = pybind11; - - py::module m("__operators_elliptic_ipdg_alberta_pdelab_common", "dune-gdt: EllipticMatrixOperator"); - - py::module::import("dune.xt.common"); - py::module::import("dune.xt.grid"); - py::module::import("dune.xt.functions"); - py::module::import("dune.xt.la"); - - // DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_PDELAB_COMMON(m); - - return m.ptr(); -} - -#endif // HAVE_DUNE_PYBINDXI diff --git a/dune/gdt/operators/elliptic-ipdg.bindings/alberta_pdelab_eigen.cc b/dune/gdt/operators/elliptic-ipdg.bindings/alberta_pdelab_eigen.cc deleted file mode 100644 index c56d5dd676b602ffb5ab469b016b0abe60adaaa7..0000000000000000000000000000000000000000 --- a/dune/gdt/operators/elliptic-ipdg.bindings/alberta_pdelab_eigen.cc +++ /dev/null @@ -1,35 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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/operators/elliptic-ipdg.bindings.hh> - - -PYBIND11_PLUGIN(__operators_elliptic_ipdg_alberta_pdelab_eigen) -{ - namespace py = pybind11; - - py::module m("__operators_elliptic_ipdg_alberta_pdelab_eigen", "dune-gdt: EllipticMatrixOperator"); - - py::module::import("dune.xt.common"); - py::module::import("dune.xt.grid"); - py::module::import("dune.xt.functions"); - py::module::import("dune.xt.la"); - - // DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_PDELAB_EIGEN(m); - - return m.ptr(); -} - -#endif // HAVE_DUNE_PYBINDXI diff --git a/dune/gdt/operators/elliptic-ipdg.bindings/alberta_pdelab_istl.cc b/dune/gdt/operators/elliptic-ipdg.bindings/alberta_pdelab_istl.cc deleted file mode 100644 index 2a76e02cb90be8242d42d6eadacccb129fb33ebb..0000000000000000000000000000000000000000 --- a/dune/gdt/operators/elliptic-ipdg.bindings/alberta_pdelab_istl.cc +++ /dev/null @@ -1,35 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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/operators/elliptic-ipdg.bindings.hh> - - -PYBIND11_PLUGIN(__operators_elliptic_ipdg_alberta_pdelab_istl) -{ - namespace py = pybind11; - - py::module m("__operators_elliptic_ipdg_alberta_pdelab_istl", "dune-gdt: EllipticMatrixOperator"); - - py::module::import("dune.xt.common"); - py::module::import("dune.xt.grid"); - py::module::import("dune.xt.functions"); - py::module::import("dune.xt.la"); - - // DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_PDELAB_ISTL(m); - - return m.ptr(); -} - -#endif // HAVE_DUNE_PYBINDXI diff --git a/dune/gdt/operators/elliptic-ipdg.bindings/alu_fem_common.cc b/dune/gdt/operators/elliptic-ipdg.bindings/alu_fem_common.cc deleted file mode 100644 index abec86c732e78042430940c181f1e4e709a3d95b..0000000000000000000000000000000000000000 --- a/dune/gdt/operators/elliptic-ipdg.bindings/alu_fem_common.cc +++ /dev/null @@ -1,35 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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/operators/elliptic-ipdg.bindings.hh> - - -PYBIND11_PLUGIN(__operators_elliptic_ipdg_alu_fem_common) -{ - namespace py = pybind11; - - py::module m("__operators_elliptic_ipdg_alu_fem_common", "dune-gdt: EllipticMatrixOperator"); - - py::module::import("dune.xt.common"); - py::module::import("dune.xt.grid"); - py::module::import("dune.xt.functions"); - py::module::import("dune.xt.la"); - - // DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_FEM_COMMON(m); - - return m.ptr(); -} - -#endif // HAVE_DUNE_PYBINDXI diff --git a/dune/gdt/operators/elliptic-ipdg.bindings/alu_fem_eigen.cc b/dune/gdt/operators/elliptic-ipdg.bindings/alu_fem_eigen.cc deleted file mode 100644 index 0c536bf2aaf20f4d5d50df040128787ee067ffbb..0000000000000000000000000000000000000000 --- a/dune/gdt/operators/elliptic-ipdg.bindings/alu_fem_eigen.cc +++ /dev/null @@ -1,35 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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/operators/elliptic-ipdg.bindings.hh> - - -PYBIND11_PLUGIN(__operators_elliptic_ipdg_alu_fem_eigen) -{ - namespace py = pybind11; - - py::module m("__operators_elliptic_ipdg_alu_fem_eigen", "dune-gdt: EllipticMatrixOperator"); - - py::module::import("dune.xt.common"); - py::module::import("dune.xt.grid"); - py::module::import("dune.xt.functions"); - py::module::import("dune.xt.la"); - - // DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_FEM_EIGEN(m); - - return m.ptr(); -} - -#endif // HAVE_DUNE_PYBINDXI diff --git a/dune/gdt/operators/elliptic-ipdg.bindings/alu_fem_istl.cc b/dune/gdt/operators/elliptic-ipdg.bindings/alu_istl.cc similarity index 70% rename from dune/gdt/operators/elliptic-ipdg.bindings/alu_fem_istl.cc rename to dune/gdt/operators/elliptic-ipdg.bindings/alu_istl.cc index b8b2e782399696c16529c7190ffad76e3a074d29..b547af815c61797386e8a9c42f9a4216d3dd8a10 100644 --- a/dune/gdt/operators/elliptic-ipdg.bindings/alu_fem_istl.cc +++ b/dune/gdt/operators/elliptic-ipdg.bindings/alu_istl.cc @@ -14,10 +14,10 @@ #include <dune/gdt/operators/elliptic-ipdg.bindings.hh> -#if HAVE_DUNE_ALUGRID && HAVE_DUNE_FEM && HAVE_DUNE_ISTL -DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_LIB_ALU(template, leaf, part, dg, fem, 1, istl_sparse); -DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_LIB_ALU(template, level, part, dg, fem, 1, istl_sparse); -DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_LIB_ALU(template, dd_subdomain, part, dg, fem, 1, istl_sparse); +#if HAVE_DUNE_ALUGRID && HAVE_DUNE_ISTL +DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_LIB_ALU(template, leaf, view, dg, gdt, 1, istl_sparse); +DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_LIB_ALU(template, level, view, dg, gdt, 1, istl_sparse); +DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_LIB_ALU(template, dd_subdomain, view, dg, gdt, 1, istl_sparse); #endif diff --git a/dune/gdt/operators/elliptic-ipdg.bindings/alu_pdelab_common.cc b/dune/gdt/operators/elliptic-ipdg.bindings/alu_pdelab_common.cc deleted file mode 100644 index 571a9900eb24d78ce7fb6cc0a217a6c4ac2fdd4b..0000000000000000000000000000000000000000 --- a/dune/gdt/operators/elliptic-ipdg.bindings/alu_pdelab_common.cc +++ /dev/null @@ -1,35 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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/operators/elliptic-ipdg.bindings.hh> - - -PYBIND11_PLUGIN(__operators_elliptic_ipdg_alu_pdelab_common) -{ - namespace py = pybind11; - - py::module m("__operators_elliptic_ipdg_alu_pdelab_common", "dune-gdt: EllipticMatrixOperator"); - - py::module::import("dune.xt.common"); - py::module::import("dune.xt.grid"); - py::module::import("dune.xt.functions"); - py::module::import("dune.xt.la"); - - // DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_PDELAB_COMMON(m); - - return m.ptr(); -} - -#endif // HAVE_DUNE_PYBINDXI diff --git a/dune/gdt/operators/elliptic-ipdg.bindings/alu_pdelab_eigen.cc b/dune/gdt/operators/elliptic-ipdg.bindings/alu_pdelab_eigen.cc deleted file mode 100644 index eeefa1f12c03c241e2df19d32a1bfdca05edbd64..0000000000000000000000000000000000000000 --- a/dune/gdt/operators/elliptic-ipdg.bindings/alu_pdelab_eigen.cc +++ /dev/null @@ -1,35 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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/operators/elliptic-ipdg.bindings.hh> - - -PYBIND11_PLUGIN(__operators_elliptic_ipdg_alu_pdelab_eigen) -{ - namespace py = pybind11; - - py::module m("__operators_elliptic_ipdg_alu_pdelab_eigen", "dune-gdt: EllipticMatrixOperator"); - - py::module::import("dune.xt.common"); - py::module::import("dune.xt.grid"); - py::module::import("dune.xt.functions"); - py::module::import("dune.xt.la"); - - // DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_PDELAB_EIGEN(m); - - return m.ptr(); -} - -#endif // HAVE_DUNE_PYBINDXI diff --git a/dune/gdt/operators/elliptic-ipdg.bindings/alu_pdelab_istl.cc b/dune/gdt/operators/elliptic-ipdg.bindings/alu_pdelab_istl.cc deleted file mode 100644 index 1c8e6639994f57f352bb4b737b7b0716663c35ab..0000000000000000000000000000000000000000 --- a/dune/gdt/operators/elliptic-ipdg.bindings/alu_pdelab_istl.cc +++ /dev/null @@ -1,35 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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/operators/elliptic-ipdg.bindings.hh> - - -PYBIND11_PLUGIN(__operators_elliptic_ipdg_alu_pdelab_istl) -{ - namespace py = pybind11; - - py::module m("__operators_elliptic_ipdg_alu_pdelab_istl", "dune-gdt: EllipticMatrixOperator"); - - py::module::import("dune.xt.common"); - py::module::import("dune.xt.grid"); - py::module::import("dune.xt.functions"); - py::module::import("dune.xt.la"); - - // DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_PDELAB_ISTL(m); - - return m.ptr(); -} - -#endif // HAVE_DUNE_PYBINDXI diff --git a/dune/gdt/operators/elliptic-ipdg.bindings/ug_fem_common.cc b/dune/gdt/operators/elliptic-ipdg.bindings/ug_fem_common.cc deleted file mode 100644 index d4b25fd03609ebeed3cdc3a9f0c2c0c3f83cbf27..0000000000000000000000000000000000000000 --- a/dune/gdt/operators/elliptic-ipdg.bindings/ug_fem_common.cc +++ /dev/null @@ -1,35 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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/operators/elliptic-ipdg.bindings.hh> - - -PYBIND11_PLUGIN(__operators_elliptic_ipdg_ug_fem_common) -{ - namespace py = pybind11; - - py::module m("__operators_elliptic_ipdg_ug_fem_common", "dune-gdt: EllipticMatrixOperator"); - - py::module::import("dune.xt.common"); - py::module::import("dune.xt.grid"); - py::module::import("dune.xt.functions"); - py::module::import("dune.xt.la"); - - // DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_FEM_COMMON(m); - - return m.ptr(); -} - -#endif // HAVE_DUNE_PYBINDXI diff --git a/dune/gdt/operators/elliptic-ipdg.bindings/ug_fem_eigen.cc b/dune/gdt/operators/elliptic-ipdg.bindings/ug_fem_eigen.cc deleted file mode 100644 index 947a14097b2c7f2d85a71259aa5a8c9b254a3087..0000000000000000000000000000000000000000 --- a/dune/gdt/operators/elliptic-ipdg.bindings/ug_fem_eigen.cc +++ /dev/null @@ -1,35 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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/operators/elliptic-ipdg.bindings.hh> - - -PYBIND11_PLUGIN(__operators_elliptic_ipdg_ug_fem_eigen) -{ - namespace py = pybind11; - - py::module m("__operators_elliptic_ipdg_ug_fem_eigen", "dune-gdt: EllipticMatrixOperator"); - - py::module::import("dune.xt.common"); - py::module::import("dune.xt.grid"); - py::module::import("dune.xt.functions"); - py::module::import("dune.xt.la"); - - // DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_FEM_EIGEN(m); - - return m.ptr(); -} - -#endif // HAVE_DUNE_PYBINDXI diff --git a/dune/gdt/operators/elliptic-ipdg.bindings/ug_fem_istl.cc b/dune/gdt/operators/elliptic-ipdg.bindings/ug_fem_istl.cc deleted file mode 100644 index d9d34a0db645dde48bfdb283e23bcc113cb34e9b..0000000000000000000000000000000000000000 --- a/dune/gdt/operators/elliptic-ipdg.bindings/ug_fem_istl.cc +++ /dev/null @@ -1,35 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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/operators/elliptic-ipdg.bindings.hh> - - -PYBIND11_PLUGIN(__operators_elliptic_ipdg_ug_fem_istl) -{ - namespace py = pybind11; - - py::module m("__operators_elliptic_ipdg_ug_fem_istl", "dune-gdt: EllipticMatrixOperator"); - - py::module::import("dune.xt.common"); - py::module::import("dune.xt.grid"); - py::module::import("dune.xt.functions"); - py::module::import("dune.xt.la"); - - // DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_FEM_ISTL(m); - - return m.ptr(); -} - -#endif // HAVE_DUNE_PYBINDXI diff --git a/dune/gdt/operators/elliptic-ipdg.bindings/ug_pdelab_common.cc b/dune/gdt/operators/elliptic-ipdg.bindings/ug_pdelab_common.cc deleted file mode 100644 index c87c4dabcc686dacc9a0fb4ae50b917a31330992..0000000000000000000000000000000000000000 --- a/dune/gdt/operators/elliptic-ipdg.bindings/ug_pdelab_common.cc +++ /dev/null @@ -1,35 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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/operators/elliptic-ipdg.bindings.hh> - - -PYBIND11_PLUGIN(__operators_elliptic_ipdg_ug_pdelab_common) -{ - namespace py = pybind11; - - py::module m("__operators_elliptic_ipdg_ug_pdelab_common", "dune-gdt: EllipticMatrixOperator"); - - py::module::import("dune.xt.common"); - py::module::import("dune.xt.grid"); - py::module::import("dune.xt.functions"); - py::module::import("dune.xt.la"); - - // DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_PDELAB_COMMON(m); - - return m.ptr(); -} - -#endif // HAVE_DUNE_PYBINDXI diff --git a/dune/gdt/operators/elliptic-ipdg.bindings/ug_pdelab_eigen.cc b/dune/gdt/operators/elliptic-ipdg.bindings/ug_pdelab_eigen.cc deleted file mode 100644 index d112e61724cca781f2e31b46dd990f1f918ecb5a..0000000000000000000000000000000000000000 --- a/dune/gdt/operators/elliptic-ipdg.bindings/ug_pdelab_eigen.cc +++ /dev/null @@ -1,35 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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/operators/elliptic-ipdg.bindings.hh> - - -PYBIND11_PLUGIN(__operators_elliptic_ipdg_ug_pdelab_eigen) -{ - namespace py = pybind11; - - py::module m("__operators_elliptic_ipdg_ug_pdelab_eigen", "dune-gdt: EllipticMatrixOperator"); - - py::module::import("dune.xt.common"); - py::module::import("dune.xt.grid"); - py::module::import("dune.xt.functions"); - py::module::import("dune.xt.la"); - - // DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_PDELAB_EIGEN(m); - - return m.ptr(); -} - -#endif // HAVE_DUNE_PYBINDXI diff --git a/dune/gdt/operators/elliptic-ipdg.bindings/ug_pdelab_istl.cc b/dune/gdt/operators/elliptic-ipdg.bindings/ug_pdelab_istl.cc deleted file mode 100644 index 2cb6e6d82d4ab83252bea7ee16f1b5def599158d..0000000000000000000000000000000000000000 --- a/dune/gdt/operators/elliptic-ipdg.bindings/ug_pdelab_istl.cc +++ /dev/null @@ -1,35 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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/operators/elliptic-ipdg.bindings.hh> - - -PYBIND11_PLUGIN(__operators_elliptic_ipdg_ug_pdelab_istl) -{ - namespace py = pybind11; - - py::module m("__operators_elliptic_ipdg_ug_pdelab_istl", "dune-gdt: EllipticMatrixOperator"); - - py::module::import("dune.xt.common"); - py::module::import("dune.xt.grid"); - py::module::import("dune.xt.functions"); - py::module::import("dune.xt.la"); - - // DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_PDELAB_ISTL(m); - - return m.ptr(); -} - -#endif // HAVE_DUNE_PYBINDXI diff --git a/dune/gdt/operators/elliptic-ipdg.bindings/yasp_fem_common.cc b/dune/gdt/operators/elliptic-ipdg.bindings/yasp_fem_common.cc deleted file mode 100644 index c5c1a800565e99f6b43fd2be93e364eb08a46710..0000000000000000000000000000000000000000 --- a/dune/gdt/operators/elliptic-ipdg.bindings/yasp_fem_common.cc +++ /dev/null @@ -1,35 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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/operators/elliptic-ipdg.bindings.hh> - - -PYBIND11_PLUGIN(__operators_elliptic_ipdg_yasp_fem_common) -{ - namespace py = pybind11; - - py::module m("__operators_elliptic_ipdg_yasp_fem_common", "dune-gdt: EllipticMatrixOperator"); - - py::module::import("dune.xt.common"); - py::module::import("dune.xt.grid"); - py::module::import("dune.xt.functions"); - py::module::import("dune.xt.la"); - - // DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_FEM_COMMON(m); - - return m.ptr(); -} - -#endif // HAVE_DUNE_PYBINDXI diff --git a/dune/gdt/operators/elliptic-ipdg.bindings/yasp_fem_eigen.cc b/dune/gdt/operators/elliptic-ipdg.bindings/yasp_fem_eigen.cc deleted file mode 100644 index 4a811c04c8b1b623714df41f891970c9f454cd3e..0000000000000000000000000000000000000000 --- a/dune/gdt/operators/elliptic-ipdg.bindings/yasp_fem_eigen.cc +++ /dev/null @@ -1,35 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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/operators/elliptic-ipdg.bindings.hh> - - -PYBIND11_PLUGIN(__operators_elliptic_ipdg_yasp_fem_eigen) -{ - namespace py = pybind11; - - py::module m("__operators_elliptic_ipdg_yasp_fem_eigen", "dune-gdt: EllipticMatrixOperator"); - - py::module::import("dune.xt.common"); - py::module::import("dune.xt.grid"); - py::module::import("dune.xt.functions"); - py::module::import("dune.xt.la"); - - // DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_FEM_EIGEN(m); - - return m.ptr(); -} - -#endif // HAVE_DUNE_PYBINDXI diff --git a/dune/gdt/operators/elliptic-ipdg.bindings/yasp_fem_istl.cc b/dune/gdt/operators/elliptic-ipdg.bindings/yasp_istl.cc similarity index 78% rename from dune/gdt/operators/elliptic-ipdg.bindings/yasp_fem_istl.cc rename to dune/gdt/operators/elliptic-ipdg.bindings/yasp_istl.cc index c1ff0c512e324c281f8b158c1ccafd362b3672e9..d6caef7f26f198865ab7d415f98c6a5426eeaaa1 100644 --- a/dune/gdt/operators/elliptic-ipdg.bindings/yasp_fem_istl.cc +++ b/dune/gdt/operators/elliptic-ipdg.bindings/yasp_istl.cc @@ -14,10 +14,10 @@ #include <dune/gdt/operators/elliptic-ipdg.bindings.hh> -#if HAVE_DUNE_FEM && HAVE_DUNE_ISTL -DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_LIB_YASP(template, leaf, part, dg, fem, 1, istl_sparse); -DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_LIB_YASP(template, level, part, dg, fem, 1, istl_sparse); -DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_LIB_YASP(template, dd_subdomain, part, dg, fem, 1, istl_sparse); +#if HAVE_DUNE_ISTL +DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_LIB_YASP(template, leaf, view, dg, gdt, 1, istl_sparse); +DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_LIB_YASP(template, level, view, dg, gdt, 1, istl_sparse); +DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_LIB_YASP(template, dd_subdomain, view, dg, gdt, 1, istl_sparse); #endif diff --git a/dune/gdt/operators/elliptic-ipdg.bindings/yasp_pdelab_common.cc b/dune/gdt/operators/elliptic-ipdg.bindings/yasp_pdelab_common.cc deleted file mode 100644 index e5d27fcc9132f24da33b10e3f7c5a4fb96ae974c..0000000000000000000000000000000000000000 --- a/dune/gdt/operators/elliptic-ipdg.bindings/yasp_pdelab_common.cc +++ /dev/null @@ -1,35 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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/operators/elliptic-ipdg.bindings.hh> - - -PYBIND11_PLUGIN(__operators_elliptic_ipdg_yasp_pdelab_common) -{ - namespace py = pybind11; - - py::module m("__operators_elliptic_ipdg_yasp_pdelab_common", "dune-gdt: EllipticMatrixOperator"); - - py::module::import("dune.xt.common"); - py::module::import("dune.xt.grid"); - py::module::import("dune.xt.functions"); - py::module::import("dune.xt.la"); - - // DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_PDELAB_COMMON(m); - - return m.ptr(); -} - -#endif // HAVE_DUNE_PYBINDXI diff --git a/dune/gdt/operators/elliptic-ipdg.bindings/yasp_pdelab_eigen.cc b/dune/gdt/operators/elliptic-ipdg.bindings/yasp_pdelab_eigen.cc deleted file mode 100644 index 13decd59de3e6910090041a4c84a1fbf4f03311b..0000000000000000000000000000000000000000 --- a/dune/gdt/operators/elliptic-ipdg.bindings/yasp_pdelab_eigen.cc +++ /dev/null @@ -1,35 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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/operators/elliptic-ipdg.bindings.hh> - - -PYBIND11_PLUGIN(__operators_elliptic_ipdg_yasp_pdelab_eigen) -{ - namespace py = pybind11; - - py::module m("__operators_elliptic_ipdg_yasp_pdelab_eigen", "dune-gdt: EllipticMatrixOperator"); - - py::module::import("dune.xt.common"); - py::module::import("dune.xt.grid"); - py::module::import("dune.xt.functions"); - py::module::import("dune.xt.la"); - - // DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_PDELAB_EIGEN(m); - - return m.ptr(); -} - -#endif // HAVE_DUNE_PYBINDXI diff --git a/dune/gdt/operators/elliptic-ipdg.bindings/yasp_pdelab_istl.cc b/dune/gdt/operators/elliptic-ipdg.bindings/yasp_pdelab_istl.cc deleted file mode 100644 index a7d33c0d5fabe2b25aa05bea48771a3290f4486b..0000000000000000000000000000000000000000 --- a/dune/gdt/operators/elliptic-ipdg.bindings/yasp_pdelab_istl.cc +++ /dev/null @@ -1,35 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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/operators/elliptic-ipdg.bindings.hh> - - -PYBIND11_PLUGIN(__operators_elliptic_ipdg_yasp_pdelab_istl) -{ - namespace py = pybind11; - - py::module m("__operators_elliptic_ipdg_yasp_pdelab_istl", "dune-gdt: EllipticMatrixOperator"); - - py::module::import("dune.xt.common"); - py::module::import("dune.xt.grid"); - py::module::import("dune.xt.functions"); - py::module::import("dune.xt.la"); - - // DUNE_GDT_OPERATORS_ELLIPTIC_IPDG_BIND_PDELAB_ISTL(m); - - return m.ptr(); -} - -#endif // HAVE_DUNE_PYBINDXI diff --git a/dune/gdt/operators/elliptic.bindings.cc b/dune/gdt/operators/elliptic.bindings.cc index 283cf21964beb5235f6ddf370c5784c4fae1761a..e1be69552c55b7353035c3fd1b560eb3c18956cf 100644 --- a/dune/gdt/operators/elliptic.bindings.cc +++ b/dune/gdt/operators/elliptic.bindings.cc @@ -41,7 +41,7 @@ PYBIND11_PLUGIN(__operators_elliptic) py::module::import("dune.gdt.__spaces"); py::module::import("dune.gdt.__discretefunction"); - DUNE_GDT_OPERATORS_ELLIPTIC_BIND_FEM_ISTL(m); + DUNE_GDT_OPERATORS_ELLIPTIC_BIND_ISTL(m); m.def("_init_mpi", [](const std::vector<std::string>& args) { diff --git a/dune/gdt/operators/elliptic.bindings.hh b/dune/gdt/operators/elliptic.bindings.hh index d46e0d13c89bd38169e86f5f71eec983eff75690..089b9098aa028c2a81ca72af4747ba35096ccbe0 100644 --- a/dune/gdt/operators/elliptic.bindings.hh +++ b/dune/gdt/operators/elliptic.bindings.hh @@ -300,66 +300,21 @@ public: _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_UG(_prefix, _layer, _g_backend, _s_type, _s_backend, _p, _la); \ _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_YASP(_prefix, _layer, _g_backend, _s_type, _s_backend, _p, _la) -#if HAVE_DUNE_FEM -#define _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_FEM(_prefix, _la) \ - _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_GRIDS(_prefix, leaf, part, cg, fem, 1, _la); \ - _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_GRIDS(_prefix, level, part, cg, fem, 1, _la); \ - _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_GRIDS(_prefix, dd_subdomain, part, cg, fem, 1, _la); \ - _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_GRIDS(_prefix, leaf, part, dg, fem, 1, _la); \ - _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_GRIDS(_prefix, level, part, dg, fem, 1, _la); \ - _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_GRIDS(_prefix, dd_subdomain, part, dg, fem, 1, _la) -#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_FEM_COMMON(_prefix) -//_DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_FEM(_prefix, common_dense) -//#if HAVE_EIGEN -//#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_FEM_EIGEN(_prefix) \ -// _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_FEM(_prefix, eigen_dense); \ -// _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_FEM(_prefix, eigen_sparse) -//#else -#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_FEM_EIGEN(_prefix) -//#endif + +#define _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB(_prefix, _la) \ + _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_GRIDS(_prefix, leaf, view, dg, gdt, 1, _la); \ + _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_GRIDS(_prefix, level, view, dg, gdt, 1, _la); \ + _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_GRIDS(_prefix, dd_subdomain, view, dg, gdt, 1, _la); \ + _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_GRIDS(_prefix, dd_subdomain, view, cg, gdt, 1, _la) + #if HAVE_DUNE_ISTL -#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_FEM_ISTL(_prefix) \ - _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_FEM(_prefix, istl_sparse) -#else -#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_FEM_ISTL(_prefix) -#endif +#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_ISTL(_prefix) _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB(_prefix, istl_sparse) #else -#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_FEM_COMMON(_prefix) -#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_FEM_EIGEN(_prefix) -#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_FEM_ISTL(_prefix) +#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_ISTL(_prefix) #endif -//#if HAVE_DUNE_PDELAB -//#define _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_PDELAB(_prefix, _la) \ -// _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_ALBERTA(_prefix, leaf, view, cg, pdelab, 1, _la); \ -// _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_ALU(_prefix, leaf, view, cg, pdelab, 1, _la); \ -// _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_YASP(_prefix, leaf, view, cg, pdelab, 1, _la); \ -// _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_ALBERTA(_prefix, level, view, cg, pdelab, 1, _la); \ -// _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_ALU(_prefix, level, view, cg, pdelab, 1, _la); \ -// _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_YASP(_prefix, level, view, cg, pdelab, 1, _la) -//#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_PDELAB_COMMON(_prefix) -//_DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_PDELAB(_prefix, common_dense) -//#if HAVE_EIGEN -//#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_PDELAB_EIGEN(_prefix) \ -// _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_PDELAB(_prefix, eigen_dense); \ -// _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_PDELAB(_prefix, eigen_sparse) -//#else -//#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_PDELAB_EIGEN(_prefix) -//#endif -//#if HAVE_DUNE_ISTL -//#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_PDELAB_ISTL(_prefix) -//_DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_PDELAB(_prefix, istl_sparse) -//#else -//#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_PDELAB_ISTL(_prefix) -//#endif -//#else -#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_PDELAB_COMMON(_prefix) -#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_PDELAB_EIGEN(_prefix) -#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_PDELAB_ISTL(_prefix) -//#endif - -// fem_istl.cc -DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_FEM_ISTL(extern template); +// istl.cc +DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_ISTL(extern template); // end: this is what we need for the lib @@ -492,61 +447,28 @@ DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_FEM_ISTL(extern template); _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_UG(_m, _layer, _g_backend, _s_type, _s_backend, _p, _la); \ _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_YASP(_m, _layer, _g_backend, _s_type, _s_backend, _p, _la) -#if HAVE_DUNE_FEM -#define _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_FEM(_m, _la) \ - _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_GRIDS(_m, leaf, part, cg, fem, 1, _la); \ - _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_GRIDS(_m, level, part, cg, fem, 1, _la); \ - _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_GRIDS(_m, dd_subdomain, part, cg, fem, 1, _la); \ - _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_GRIDS(_m, leaf, part, dg, fem, 1, _la); \ - _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_GRIDS(_m, level, part, dg, fem, 1, _la); \ - _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_GRIDS(_m, dd_subdomain, part, dg, fem, 1, _la) -#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_FEM_COMMON(_m) -//_DUNE_GDT_OPERATORS_ELLIPTIC_BIND_FEM(_m, common_dense) +#define _DUNE_GDT_OPERATORS_ELLIPTIC_BIND(_m, _la) \ + _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_GRIDS(_m, leaf, view, cg, gdt, 1, _la); \ + _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_GRIDS(_m, level, view, cg, gdt, 1, _la); \ + _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_GRIDS(_m, leaf, view, dg, gdt, 1, _la); \ + _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_GRIDS(_m, level, view, dg, gdt, 1, _la); \ + _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_GRIDS(_m, dd_subdomain, view, dg, gdt, 1, _la); \ + _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_GRIDS(_m, dd_subdomain, view, dg, gdt, 1, _la) +#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_COMMON(_m) +//_DUNE_GDT_OPERATORS_ELLIPTIC_BIND(_m, common_dense) //#if HAVE_EIGEN -//#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_FEM_EIGEN(_m) \ -// _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_FEM(_m, eigen_dense); \ -// _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_FEM(_m, eigen_sparse) +//#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_EIGEN(_m) \ +// _DUNE_GDT_OPERATORS_ELLIPTIC_BIND(_m, eigen_dense); \ +// _DUNE_GDT_OPERATORS_ELLIPTIC_BIND(_m, eigen_sparse) //#else -#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_FEM_EIGEN(_m) +#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_EIGEN(_m) //#endif #if HAVE_DUNE_ISTL -#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_FEM_ISTL(_m) _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_FEM(_m, istl_sparse) -#else -#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_FEM_ISTL(_m) -#endif +#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_ISTL(_m) _DUNE_GDT_OPERATORS_ELLIPTIC_BIND(_m, istl_sparse) #else -#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_FEM_COMMON(_m) -#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_FEM_EIGEN(_m) -#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_FEM_ISTL(_m) +#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_ISTL(_m) #endif -//#if HAVE_DUNE_PDELAB -//#define _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_PDELAB(_m, _la) \ -// _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_ALBERTA(_m, leaf, view, cg, pdelab, 1, _la); \ -// _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_ALU(_m, leaf, view, cg, pdelab, 1, _la); \ -// _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_YASP(_m, leaf, view, cg, pdelab, 1, _la); \ -// _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_ALBERTA(_m, level, view, cg, pdelab, 1, _la); \ -// _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_ALU(_m, level, view, cg, pdelab, 1, _la); \ -// _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_YASP(_m, level, view, cg, pdelab, 1, _la) -//#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_PDELAB_COMMON(_m) _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_PDELAB(_m, common_dense) -//#if HAVE_EIGEN -//#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_PDELAB_EIGEN(_m) \ -// _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_PDELAB(_m, eigen_dense); \ -// _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_PDELAB(_m, eigen_sparse) -//#else -//#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_PDELAB_EIGEN(_m) -//#endif -//#if HAVE_DUNE_ISTL -//#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_PDELAB_ISTL(_m) _DUNE_GDT_OPERATORS_ELLIPTIC_BIND_PDELAB(_m, istl_sparse) -//#else -//#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_PDELAB_ISTL(_m) -//#endif -//#else -#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_PDELAB_COMMON(_m) -#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_PDELAB_EIGEN(_m) -#define DUNE_GDT_OPERATORS_ELLIPTIC_BIND_PDELAB_ISTL(_m) -//#endif - // end: this is what we need for the .so diff --git a/dune/gdt/operators/elliptic.bindings/fem_common.cc b/dune/gdt/operators/elliptic.bindings/fem_common.cc deleted file mode 100644 index 8d71b2105d246aecd75cad45aaf5811dd69765af..0000000000000000000000000000000000000000 --- a/dune/gdt/operators/elliptic.bindings/fem_common.cc +++ /dev/null @@ -1,36 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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/operators/elliptic.bindings.hh> - - -PYBIND11_PLUGIN(__operators_elliptic_fem_common) -{ - namespace py = pybind11; - - py::module m("__operators_elliptic_fem_common", - "dune-gdt: EllipticMatrixOperator (fem space backend, common la backend)"); - - py::module::import("dune.xt.common"); - py::module::import("dune.xt.grid"); - py::module::import("dune.xt.functions"); - py::module::import("dune.xt.la"); - - DUNE_GDT_OPERATORS_ELLIPTIC_BIND_FEM_COMMON(m); - - return m.ptr(); -} - -#endif // HAVE_DUNE_PYBINDXI diff --git a/dune/gdt/operators/elliptic.bindings/fem_eigen.cc b/dune/gdt/operators/elliptic.bindings/fem_eigen.cc deleted file mode 100644 index 5233c3a743328f0dc4d490722ce37ab69afee5a1..0000000000000000000000000000000000000000 --- a/dune/gdt/operators/elliptic.bindings/fem_eigen.cc +++ /dev/null @@ -1,36 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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/operators/elliptic.bindings.hh> - - -PYBIND11_PLUGIN(__operators_elliptic_fem_eigen) -{ - namespace py = pybind11; - - py::module m("__operators_elliptic_fem_eigen", - "dune-gdt: EllipticMatrixOperator (fem space backend, eigen la backend)"); - - py::module::import("dune.xt.common"); - py::module::import("dune.xt.grid"); - py::module::import("dune.xt.functions"); - py::module::import("dune.xt.la"); - - DUNE_GDT_OPERATORS_ELLIPTIC_BIND_FEM_EIGEN(m); - - return m.ptr(); -} - -#endif // HAVE_DUNE_PYBINDXI diff --git a/dune/gdt/operators/elliptic.bindings/fem_istl.cc b/dune/gdt/operators/elliptic.bindings/istl.cc similarity index 91% rename from dune/gdt/operators/elliptic.bindings/fem_istl.cc rename to dune/gdt/operators/elliptic.bindings/istl.cc index a9f5a466e07576acdc0367e041496f68864ffa06..554074f0d0c92e12494a9456b3c27ed54e38c0c3 100644 --- a/dune/gdt/operators/elliptic.bindings/fem_istl.cc +++ b/dune/gdt/operators/elliptic.bindings/istl.cc @@ -14,7 +14,7 @@ #include <dune/gdt/operators/elliptic.bindings.hh> -DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_FEM_ISTL(template); +DUNE_GDT_OPERATORS_ELLIPTIC_BIND_LIB_ISTL(template); #endif // HAVE_DUNE_PYBINDXI diff --git a/dune/gdt/operators/elliptic.bindings/pdelab_common.cc b/dune/gdt/operators/elliptic.bindings/pdelab_common.cc deleted file mode 100644 index e0da55c4c5511d5fd6c7a020aa5bcaf168e6875a..0000000000000000000000000000000000000000 --- a/dune/gdt/operators/elliptic.bindings/pdelab_common.cc +++ /dev/null @@ -1,36 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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/operators/elliptic.bindings.hh> - - -PYBIND11_PLUGIN(__operators_elliptic_pdelab_common) -{ - namespace py = pybind11; - - py::module m("__operators_elliptic_pdelab_common", - "dune-gdt: EllipticMatrixOperator (pdelab space backend, common la backend)"); - - py::module::import("dune.xt.common"); - py::module::import("dune.xt.grid"); - py::module::import("dune.xt.functions"); - py::module::import("dune.xt.la"); - - DUNE_GDT_OPERATORS_ELLIPTIC_BIND_PDELAB_COMMON(m); - - return m.ptr(); -} - -#endif // HAVE_DUNE_PYBINDXI diff --git a/dune/gdt/operators/elliptic.bindings/pdelab_eigen.cc b/dune/gdt/operators/elliptic.bindings/pdelab_eigen.cc deleted file mode 100644 index f079bf79234401a400a6e2b8f12351dd0b0d6fda..0000000000000000000000000000000000000000 --- a/dune/gdt/operators/elliptic.bindings/pdelab_eigen.cc +++ /dev/null @@ -1,36 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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/operators/elliptic.bindings.hh> - - -PYBIND11_PLUGIN(__operators_elliptic_pdelab_eigen) -{ - namespace py = pybind11; - - py::module m("__operators_elliptic_pdelab_eigen", - "dune-gdt: EllipticMatrixOperator (pdelab space backend, eigen la backend)"); - - py::module::import("dune.xt.common"); - py::module::import("dune.xt.grid"); - py::module::import("dune.xt.functions"); - py::module::import("dune.xt.la"); - - DUNE_GDT_OPERATORS_ELLIPTIC_BIND_PDELAB_EIGEN(m); - - return m.ptr(); -} - -#endif // HAVE_DUNE_PYBINDXI diff --git a/dune/gdt/operators/elliptic.bindings/pdelab_istl.cc b/dune/gdt/operators/elliptic.bindings/pdelab_istl.cc deleted file mode 100644 index 3ae4eae042aa15e255b24189c4559f950c33072f..0000000000000000000000000000000000000000 --- a/dune/gdt/operators/elliptic.bindings/pdelab_istl.cc +++ /dev/null @@ -1,36 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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/operators/elliptic.bindings.hh> - - -PYBIND11_PLUGIN(__operators_elliptic_pdelab_istl) -{ - namespace py = pybind11; - - py::module m("__operators_elliptic_pdelab_istl", - "dune-gdt: EllipticMatrixOperator (pdelab space backend, istl la backend)"); - - py::module::import("dune.xt.common"); - py::module::import("dune.xt.grid"); - py::module::import("dune.xt.functions"); - py::module::import("dune.xt.la"); - - DUNE_GDT_OPERATORS_ELLIPTIC_BIND_PDELAB_ISTL(m); - - return m.ptr(); -} - -#endif // HAVE_DUNE_PYBINDXI diff --git a/dune/gdt/operators/fluxreconstruction.bindings.cc b/dune/gdt/operators/fluxreconstruction.bindings.cc index 52487c4afe6ac70d3aa7f8ca2cc0e8da4115d5f8..2092e65fdcf22f96264ec4381d53209686a6ff71 100644 --- a/dune/gdt/operators/fluxreconstruction.bindings.cc +++ b/dune/gdt/operators/fluxreconstruction.bindings.cc @@ -44,16 +44,16 @@ PYBIND11_PLUGIN(__operators_fluxreconstruction) py::module::import("dune.gdt.__spaces"); py::module::import("dune.gdt.__discretefunction"); -#if HAVE_DUNE_ALUGRID && HAVE_DUNE_FEM && HAVE_DUNE_ISTL +#if HAVE_DUNE_ALUGRID && HAVE_DUNE_ISTL Dune::GDT::bindings::DiffusiveFluxReconstructionOperator<ALU_2D_SIMPLEX_CONFORMING, Dune::GDT::SpaceType::rt, - Dune::GDT::Backends::pdelab, + Dune::GDT::Backends::gdt, Dune::XT::Grid::Layers::leaf, 0, double, 2, Dune::XT::LA::Backends::istl_dense>::bind(m); -#endif // HAVE_DUNE_ALUGRID && HAVE_DUNE_FEM && HAVE_DUNE_ISTL +#endif // HAVE_DUNE_ALUGRID && HAVE_DUNE_ISTL m.def("_init_mpi", [](const std::vector<std::string>& args) { diff --git a/dune/gdt/operators/fluxreconstruction.hh b/dune/gdt/operators/fluxreconstruction.hh index 304c6b4ac15e3a46544c8a4543861221e3d7ec8e..f7e6498c31e3087997b3a4065486322641ab55d1 100644 --- a/dune/gdt/operators/fluxreconstruction.hh +++ b/dune/gdt/operators/fluxreconstruction.hh @@ -31,7 +31,7 @@ #include <dune/gdt/local/integrands/elliptic-ipdg.hh> #include <dune/gdt/local/operators/lambda.hh> #include <dune/gdt/operators/base.hh> -#include <dune/gdt/spaces/rt/dune-pdelab-wrapper.hh> +#include <dune/gdt/spaces/rt/default.hh> namespace Dune { namespace GDT { @@ -274,7 +274,14 @@ public: template <class GL, class V> void apply(const XT::Functions::LocalizableFunctionInterface<EntityType, DomainFieldType, dimDomain, FieldType, 1>& source, - DiscreteFunction<DunePdelabRtSpaceWrapper<GL, 0, FieldType, dimDomain>, V>& range) const + DiscreteFunction<RaviartThomasSpace<GL, 0, FieldType>, V>& range) const + { + apply_rt0_simplex(source, range); + } + +private: + template <class SourceType, class RangeType> + void apply_rt0_simplex(const SourceType& source, RangeType& range) const { const auto& rtn0_space = range.space(); auto& range_vector = range.vector(); @@ -291,9 +298,8 @@ public: DynamicMatrix<FieldType> tmp_matrix(1, 1, 0); DynamicMatrix<FieldType> tmp_matrix_en_en(1, 1, 0); DynamicMatrix<FieldType> tmp_matrix_en_ne(1, 1, 0); - std::vector<typename DunePdelabRtSpaceWrapper<GL, 0, FieldType, dimDomain>::BaseFunctionSetType::RangeType> - basis_values(rtn0_space.mapper().maxNumDofs(), - typename DunePdelabRtSpaceWrapper<GL, 0, FieldType, dimDomain>::BaseFunctionSetType::RangeType(0)); + std::vector<typename RangeType::SpaceType::BaseFunctionSetType::RangeType> basis_values( + rtn0_space.mapper().maxNumDofs()); // walk the grid const auto entity_it_end = grid_layer_.template end<0>(); for (auto entity_it = grid_layer_.template begin<0>(); entity_it != entity_it_end; ++entity_it) { @@ -422,9 +428,8 @@ public: DUNE_THROW(XT::Common::Exceptions::internal_error, "Unknown intersection type!"); } // walk the intersections } // walk the grid - } // ... apply(...) + } // ... apply_rt0_simplex(...) -private: const GridLayerType& grid_layer_; const DiffusionFactorType& diffusion_factor_; const DiffusionTensorType& diffusion_tensor_; @@ -466,7 +471,7 @@ public: template <class GL, class V> void apply(const XT::Functions::LocalizableFunctionInterface<EntityType, DomainFieldType, dimDomain, FieldType, 1>& source, - DiscreteFunction<DunePdelabRtSpaceWrapper<GL, 0, FieldType, dimDomain>, V>& range) const + DiscreteFunction<RaviartThomasSpace<GL, 0, FieldType>, V>& range) const { const auto& rtn0_space = range.space(); auto& range_vector = range.vector(); @@ -482,9 +487,9 @@ public: DynamicMatrix<FieldType> tmp_matrix(1, 1, 0); DynamicMatrix<FieldType> tmp_matrix_en_en(1, 1, 0); DynamicMatrix<FieldType> tmp_matrix_en_ne(1, 1, 0); - std::vector<typename DunePdelabRtSpaceWrapper<GL, 0, FieldType, dimDomain>::BaseFunctionSetType::RangeType> - basis_values(rtn0_space.mapper().maxNumDofs(), - typename DunePdelabRtSpaceWrapper<GL, 0, FieldType, dimDomain>::BaseFunctionSetType::RangeType(0)); + std::vector<typename RaviartThomasSpace<GL, 0, FieldType>::BaseFunctionSetType::RangeType> basis_values( + rtn0_space.mapper().maxNumDofs(), + typename RaviartThomasSpace<GL, 0, FieldType>::BaseFunctionSetType::RangeType(0)); // walk the grid const auto entity_it_end = grid_layer_.template end<0>(); for (auto entity_it = grid_layer_.template begin<0>(); entity_it != entity_it_end; ++entity_it) { diff --git a/dune/gdt/operators/l2.bindings.cc b/dune/gdt/operators/l2.bindings.cc index 0d7ddb5579bce0f24308a89c23f195797dae266b..e594f1d4252e6b45123062d89ef60911a2222a13 100644 --- a/dune/gdt/operators/l2.bindings.cc +++ b/dune/gdt/operators/l2.bindings.cc @@ -65,26 +65,26 @@ PYBIND11_PLUGIN(__operators_l2) py::module::import("dune.gdt.__discretefunction"); #if HAVE_DUNE_ALUGRID - bind_l2_localizable_product<ALU_2D_SIMPLEX_CONFORMING, Layers::dd_subdomain, XT::Grid::Backends::part>(m); -#if HAVE_DUNE_FEM + bind_l2_localizable_product<ALU_2D_SIMPLEX_CONFORMING, Layers::dd_subdomain, XT::Grid::Backends::view>(m); + Dune::GDT::bindings::L2MatrixOperator<ALU_2D_SIMPLEX_CONFORMING, Layers::dd_subdomain, SpaceType::dg, - GDT::Backends::fem, + GDT::Backends::gdt, 1, 1, LA::Backends::istl_sparse>::bind(m); Dune::GDT::bindings::L2MatrixOperator<ALU_2D_SIMPLEX_CONFORMING, Layers::leaf, SpaceType::dg, - GDT::Backends::fem, + GDT::Backends::gdt, 1, 1, LA::Backends::istl_sparse>::bind(m); Dune::GDT::bindings::L2MatrixOperator<ALU_2D_SIMPLEX_CONFORMING, Layers::level, SpaceType::dg, - GDT::Backends::fem, + GDT::Backends::gdt, 1, 1, LA::Backends::istl_sparse>::bind(m); @@ -93,17 +93,18 @@ PYBIND11_PLUGIN(__operators_l2) typename GDT::SpaceProvider<ALU_2D_SIMPLEX_CONFORMING, Layers::leaf, GDT::SpaceType::rt, - GDT::Backends::pdelab, + GDT::Backends::gdt, 0, double, 2>::type, typename XT::Grid::Layer<ALU_2D_SIMPLEX_CONFORMING, Layers::dd_subdomain, - XT::Grid::Backends::part, + XT::Grid::Backends::view, XT::Grid::DD::SubdomainGrid<ALU_2D_SIMPLEX_CONFORMING>>::type>, - XT::LA::IstlRowMajorSparseMatrix<double>>:: - bind(m, "RtPdelabAlu2dSimplexLeafRestrictedSubdomainPartSpace", "istl_row_major_sparse_matrix_double"); -#endif // HAVE_DUNE_FEM + XT::LA::IstlRowMajorSparseMatrix<double>>::bind(m, + "RtAlu2dSimplexLeafRestrictedSubdomainPartSpace", + "istl_row_major_sparse_matrix_double"); + #endif // HAVE_DUNE_ALUGRID m.def("_init_mpi", @@ -111,12 +112,10 @@ PYBIND11_PLUGIN(__operators_l2) int argc = Dune::XT::Common::numeric_cast<int>(args.size()); char** argv = Dune::XT::Common::vector_to_main_args(args); Dune::MPIHelper::instance(argc, argv); -#if HAVE_DUNE_FEM - Dune::Fem::MPIManager::initialize(argc, argv); -#endif }, "args"_a = std::vector<std::string>()); + m.def("_init_logger", [](const ssize_t max_info_level, const ssize_t max_debug_level, diff --git a/dune/gdt/operators/oswaldinterpolation.bindings.cc b/dune/gdt/operators/oswaldinterpolation.bindings.cc index c53d351e06598eb9bf38a54366fab917e1c2fa29..3f382723b4eae7c43f311027c0cca06120c11788 100644 --- a/dune/gdt/operators/oswaldinterpolation.bindings.cc +++ b/dune/gdt/operators/oswaldinterpolation.bindings.cc @@ -44,17 +44,17 @@ PYBIND11_PLUGIN(__operators_oswaldinterpolation) py::module::import("dune.gdt.__spaces"); py::module::import("dune.gdt.__discretefunction"); -#if HAVE_DUNE_ALUGRID && HAVE_DUNE_FEM && HAVE_DUNE_ISTL +#if HAVE_DUNE_ALUGRID && HAVE_DUNE_ISTL Dune::GDT::bindings::OswaldInterpolationOperator<ALU_2D_SIMPLEX_CONFORMING, Dune::GDT::SpaceType::block_dg, - Dune::GDT::Backends::fem, + Dune::GDT::Backends::gdt, Dune::XT::Grid::Layers::dd_subdomain, 1, double, 1, Dune::XT::LA::Backends::istl_dense, Dune::XT::Grid::Layers::dd_subdomain_oversampled>::bind(m); -#endif // HAVE_DUNE_ALUGRID && HAVE_DUNE_FEM && HAVE_DUNE_ISTL +#endif // HAVE_DUNE_ALUGRID && HAVE_DUNE_ISTL m.def("_init_mpi", [](const std::vector<std::string>& args) { diff --git a/dune/gdt/operators/oswaldinterpolation.hh b/dune/gdt/operators/oswaldinterpolation.hh index a51b850445b28f6b9e510fb890278720b9fa43f5..7bd91b71a9e41a469d124d6af31138958566141b 100644 --- a/dune/gdt/operators/oswaldinterpolation.hh +++ b/dune/gdt/operators/oswaldinterpolation.hh @@ -28,9 +28,8 @@ #include <dune/xt/functions/interfaces/localizable-function.hh> #include <dune/gdt/discretefunction/default.hh> -#include <dune/gdt/spaces/dg/dune-fem-wrapper.hh> +#include <dune/gdt/spaces/dg/default.hh> #include <dune/gdt/playground/spaces/block.hh> -#include <dune/gdt/playground/spaces/dg/dune-functions-wrapper.hh> #include "interfaces.hh" @@ -86,28 +85,14 @@ public: template <class GL, class V> void apply(const XT::Functions::LocalizableFunctionInterface<E, D, d, FieldType, 1>& source, - DiscreteFunction<DuneFemDgSpaceWrapper<GL, 1, FieldType, 1, 1>, V>& range) const + DiscreteFunction<DiscontinuousLagrangeSpace<GL, 1, FieldType>, V>& range) const { apply_p1_dg(source, range); } template <class GL, class V> void apply(const XT::Functions::LocalizableFunctionInterface<E, D, d, FieldType, 1>& source, - DiscreteFunction<DuneFunctionsDgSpaceWrapper<GL, 1, FieldType, 1, 1>, V>& range) const - { - apply_p1_dg(source, range); - } - - template <class GL, class V> - void apply(const XT::Functions::LocalizableFunctionInterface<E, D, d, FieldType, 1>& source, - DiscreteFunction<BlockSpace<DuneFemDgSpaceWrapper<GL, 1, FieldType, 1, 1>>, V>& range) const - { - apply_p1_dg(source, range); - } - - template <class GL, class V> - void apply(const XT::Functions::LocalizableFunctionInterface<E, D, d, FieldType, 1>& source, - DiscreteFunction<BlockSpace<DuneFunctionsDgSpaceWrapper<GL, 1, FieldType, 1, 1>>, V>& range) const + DiscreteFunction<BlockSpace<DiscontinuousLagrangeSpace<GL, 1, FieldType>>, V>& range) const { apply_p1_dg(source, range); } diff --git a/dune/gdt/operators/weighted-l2.bindings.cc b/dune/gdt/operators/weighted-l2.bindings.cc index d6c46d8387bfc33e04eed1c02b326cc6238f68aa..30840e49382acf61afff50a8a4b27241e446656c 100644 --- a/dune/gdt/operators/weighted-l2.bindings.cc +++ b/dune/gdt/operators/weighted-l2.bindings.cc @@ -50,12 +50,8 @@ PYBIND11_PLUGIN(__operators_weighted_l2) #if HAVE_DUNE_ALUGRID Dune::GDT::bindings::WeightedL2LocalizableProduct<ALU_2D_SIMPLEX_CONFORMING, Layers::leaf, Backends::view>::bind(m); Dune::GDT::bindings::WeightedL2LocalizableProduct<ALU_2D_SIMPLEX_CONFORMING, Layers::level, Backends::view>::bind(m); -#if HAVE_DUNE_FEM - Dune::GDT::bindings::WeightedL2LocalizableProduct<ALU_2D_SIMPLEX_CONFORMING, Layers::leaf, Backends::part>::bind(m); - Dune::GDT::bindings::WeightedL2LocalizableProduct<ALU_2D_SIMPLEX_CONFORMING, Layers::level, Backends::part>::bind(m); - Dune::GDT::bindings::WeightedL2LocalizableProduct<ALU_2D_SIMPLEX_CONFORMING, Layers::dd_subdomain, Backends::part>:: + Dune::GDT::bindings::WeightedL2LocalizableProduct<ALU_2D_SIMPLEX_CONFORMING, Layers::dd_subdomain, Backends::view>:: bind(m); -#endif // HAVE_DUNE_FEM #endif // HAVE_DUNE_ALUGRID m.def("_init_mpi", diff --git a/dune/gdt/operators/weighted-l2.bindings.hh b/dune/gdt/operators/weighted-l2.bindings.hh index 187cbac78445aad00247239399d348a93d766e24..c0afc8794372f463bb4e9d3f79866e6c099fa163 100644 --- a/dune/gdt/operators/weighted-l2.bindings.hh +++ b/dune/gdt/operators/weighted-l2.bindings.hh @@ -31,14 +31,7 @@ template <class G, XT::Grid::Layers layer_type, XT::Grid::Backends layer_backend class WeightedL2LocalizableProduct { static_assert(XT::Grid::is_grid<G>::value, ""); - typedef typename XT::Grid::Layer<G, - layer_type, - layer_backend -#if HAVE_DUNE_FEM - , - XT::Grid::DD::SubdomainGrid<G> -#endif - >::type GL; + typedef typename XT::Grid::Layer<G, layer_type, layer_backend, XT::Grid::DD::SubdomainGrid<G>>::type GL; typedef XT::Grid::extract_entity_t<GL> E; typedef typename G::ctype D; @@ -56,7 +49,6 @@ class WeightedL2LocalizableProduct namespace py = pybind11; using namespace pybind11::literals; -#if HAVE_DUNE_FEM m.def(std::string("apply_weighted_l2_product_" + XT::Grid::bindings::layer_name<layer_type>::value() + "_" + XT::Grid::bindings::backend_name<layer_backend>::value()) .c_str(), @@ -80,7 +72,6 @@ class WeightedL2LocalizableProduct "grid"_a, "level_or_subdomain"_a = -1, "over_integrate"_a = 0); -#endif // HAVE_DUNE_FEM } // ... bind(...) }; // struct helper<true, ...> @@ -111,7 +102,6 @@ class WeightedL2LocalizableProduct "grid"_a, "level"_a = -1, "over_integrate"_a = 0); -#if HAVE_DUNE_FEM m.def(std::string("apply_weighted_l2_product_" + XT::Grid::bindings::layer_name<layer_type>::value() + "_" + XT::Grid::bindings::backend_name<layer_backend>::value()) .c_str(), @@ -131,7 +121,6 @@ class WeightedL2LocalizableProduct "grid"_a, "layer"_a = -1, "over_integrate"_a = 0); -#endif // HAVE_DUNE_FEM } // ... bind(...) }; // struct helper<false, ...> diff --git a/dune/gdt/playground/operators/ESV2007.bindings.cc b/dune/gdt/playground/operators/ESV2007.bindings.cc index b74634cdf0348918f1f8db18b306e2d9688654ed..e894fe64331a22915c3bd76fab10da4b5cc4c419 100644 --- a/dune/gdt/playground/operators/ESV2007.bindings.cc +++ b/dune/gdt/playground/operators/ESV2007.bindings.cc @@ -45,12 +45,12 @@ struct NonconformityProduct static_assert(XT::Grid::is_grid<G>::value, ""); typedef typename XT::Grid::Layer<G, layer_type, layer_backend, XT::Grid::DD::SubdomainGrid<G>>::type GL; typedef - typename XT::Grid::Layer<G, interpolation_layer_type, Backends::part, XT::Grid::DD::SubdomainGrid<G>>::type IGL; + typename XT::Grid::Layer<G, interpolation_layer_type, Backends::view, XT::Grid::DD::SubdomainGrid<G>>::type IGL; typedef GDT::ESV2007::NonconformityProduct<GL, IGL> type; typedef py::class_<type, XT::Grid::Walker<GL>> bound_type; - template <bool is_same = (interpolation_layer_type == layer_type) && (layer_backend == Backends::part), + template <bool is_same = (interpolation_layer_type == layer_type) && (layer_backend == Backends::view), bool anything = true> struct interpolation_layer_suffix { @@ -66,7 +66,7 @@ struct NonconformityProduct static std::string value() { return "_" + XT::Grid::bindings::layer_name<interpolation_layer_type>::value() + "_" - + XT::Grid::bindings::backend_name<Backends::part>::value(); + + XT::Grid::bindings::backend_name<Backends::view>::value(); } }; // struct interpolation_layer_suffix<false, ...> @@ -107,7 +107,7 @@ struct NonconformityProduct const ssize_t over_integrate) { return new type(dd_grid_provider.template layer<layer_type, layer_backend>( XT::Common::numeric_cast<int>(layer_level_or_subdomain)), - dd_grid_provider.template layer<interpolation_layer_type, Backends::part>( + dd_grid_provider.template layer<interpolation_layer_type, Backends::view>( XT::Common::numeric_cast<int>(interpolation_layer_level_or_subdomain)), interpolation_boundary_info, lambda, @@ -147,7 +147,7 @@ struct NonconformityProduct const ssize_t over_integrate) { return new type( grid_provider.template layer<layer_type, layer_backend>(XT::Common::numeric_cast<int>(layer_level)), - grid_provider.template layer<interpolation_layer_type, Backends::part>( + grid_provider.template layer<interpolation_layer_type, Backends::view>( XT::Common::numeric_cast<int>(interpolation_layer_level)), interpolation_boundary_info, lambda, @@ -505,24 +505,22 @@ PYBIND11_PLUGIN(__operators_ESV2007) py::module::import("dune.xt.functions"); py::module::import("dune.xt.la"); -#if HAVE_DUNE_ALUGRID && HAVE_DUNE_FEM +#if HAVE_DUNE_ALUGRID NonconformityProduct<ALU_2D_SIMPLEX_CONFORMING, Layers::leaf, Backends::view>::bind(m); - NonconformityProduct<ALU_2D_SIMPLEX_CONFORMING, Layers::leaf, Backends::part>::bind(m); - NonconformityProduct<ALU_2D_SIMPLEX_CONFORMING, Layers::dd_subdomain, Backends::part>::bind(m); + NonconformityProduct<ALU_2D_SIMPLEX_CONFORMING, Layers::dd_subdomain, Backends::view>::bind(m); NonconformityProduct<ALU_2D_SIMPLEX_CONFORMING, Layers::dd_subdomain, - Backends::part, + Backends::view, Layers::dd_subdomain_oversampled>::bind(m); ResidualProduct<ALU_2D_SIMPLEX_CONFORMING, Layers::leaf, Backends::view>::bind(m); - ResidualProduct<ALU_2D_SIMPLEX_CONFORMING, Layers::leaf, Backends::part>::bind(m); - // This is not efficient: we reconstruct on the whole leaf instead of only the neighborhood, but the rt pdelab space - // on a dd_subdomain_oversampled grid view (which is a wrapped part) is broken, if based on + ResidualProduct<ALU_2D_SIMPLEX_CONFORMING, Layers::leaf, Backends::view>::bind(m); + // on a dd_subdomain_oversampled grid view is broken, if based on // a 2d simplex alugrid. - ResidualProduct<ALU_2D_SIMPLEX_CONFORMING, Layers::dd_subdomain, Backends::part, Layers::leaf>::bind(m); + ResidualProduct<ALU_2D_SIMPLEX_CONFORMING, Layers::dd_subdomain, Backends::view, Layers::leaf>::bind(m); + DiffusiveFluxProduct<ALU_2D_SIMPLEX_CONFORMING, Layers::leaf, Backends::view>::bind(m); DiffusiveFluxProduct<ALU_2D_SIMPLEX_CONFORMING, Layers::leaf, Backends::view>::bind(m); - DiffusiveFluxProduct<ALU_2D_SIMPLEX_CONFORMING, Layers::leaf, Backends::part>::bind(m); // s.a. - DiffusiveFluxProduct<ALU_2D_SIMPLEX_CONFORMING, Layers::dd_subdomain, Backends::part, Layers::leaf>::bind(m); + DiffusiveFluxProduct<ALU_2D_SIMPLEX_CONFORMING, Layers::dd_subdomain, Backends::view, Layers::leaf>::bind(m); #endif m.def("_init_mpi", diff --git a/dune/gdt/playground/operators/ESV2007.hh b/dune/gdt/playground/operators/ESV2007.hh index 1ba6128b486ce4658e59edbe729f00967f4ae786..79de1a98bc7abbf84a669148ec2f17b548205e43 100644 --- a/dune/gdt/playground/operators/ESV2007.hh +++ b/dune/gdt/playground/operators/ESV2007.hh @@ -13,7 +13,6 @@ #include <dune/common/typetraits.hh> #include <dune/xt/common/fmatrix.hh> -#include <dune/xt/la/container/eigen.hh> #include <dune/xt/la/eigen-solver.hh> #include <dune/xt/grid/boundaryinfo/interfaces.hh> #include <dune/xt/grid/entity.hh> @@ -27,15 +26,13 @@ #include <dune/gdt/operators/base.hh> #include <dune/gdt/operators/fluxreconstruction.hh> #include <dune/gdt/operators/oswaldinterpolation.hh> -#include <dune/gdt/spaces/dg/dune-fem-wrapper.hh> -#include <dune/gdt/spaces/rt/dune-pdelab-wrapper.hh> +#include <dune/gdt/spaces/dg/default.hh> +#include <dune/gdt/spaces/rt/default.hh> namespace Dune { namespace GDT { namespace ESV2007 { -#if HAVE_DUNE_FEM - template <class ProductGridLayer, class InterpolationGridLayerType> class NonconformityProduct @@ -65,7 +62,7 @@ private: typedef LocalVolumeIntegralOperator<LocalLambdaBinaryVolumeIntegrand<E>, typename ScalarFunctionType::LocalfunctionType> LocalProductType; - typedef DuneFemDgSpaceWrapper<InterpolationGridLayerType, 1, R, 1> DgSpaceType; + typedef DiscontinuousLagrangeSpace<InterpolationGridLayerType, 1, R> DgSpaceType; typedef DiscreteFunction<DgSpaceType> DiscreteFunctionType; public: @@ -133,20 +130,6 @@ private: }; // class NonconformityProduct -#else // HAVE_DUNE_FEM - - -template <class ProductGridLayer, class InterpolationGridLayerType> -class NonconformityProduct -{ - static_assert(AlwaysFalse<ProductGridLayer>::value, "You are missing dune-fem!"); -}; - - -#endif // HAVE_DUNE_FEM -#if HAVE_DUNE_PDELAB -#if HAVE_EIGEN - namespace internal { @@ -171,7 +154,7 @@ public: typedef XT::Functions::LocalizableFunctionInterface<E, D, d, R, d, d> TensorFunctionType; private: - typedef DunePdelabRtSpaceWrapper<ReconstructionGridLayer, 0, R, d> RtSpaceType; + typedef RaviartThomasSpace<ReconstructionGridLayer, 0, R> RtSpaceType; typedef DiscreteFunction<RtSpaceType> FluxReconstructionType; typedef XT::Functions::DivergenceFunction<FluxReconstructionType> DivergenceOfFluxReconstructionType; typedef typename ScalarFunctionType::DifferenceType DifferenceType; @@ -281,9 +264,12 @@ public: const auto& entity = local_f_minus_divergence_of_reconstructed_u.entity(); // we need the min_ev for this entity, so we just evaluate in one point const auto center = entity.geometry().local(entity.geometry().center()); - XT::LA::EigenDenseMatrix<R> diffusion = kappa_.local_function(entity)->evaluate(center); + auto diffusion = kappa_.local_function(entity)->evaluate(center); diffusion *= lambda_.local_function(entity)->evaluate(center); - const auto min_ev = XT::LA::make_eigen_solver(diffusion).min_eigenvalues(1).at(0); + const auto min_ev = XT::LA::make_eigen_solver( + diffusion, XT::Common::Configuration{{"assert_positive_eigenvalues"}, {1e-15}}) + .min_eigenvalues(1) + .at(0); const auto h = XT::Grid::entity_diameter(entity); ret[0][0] = (poincare_constant_ / min_ev) * h * h * local_f_minus_divergence_of_reconstructed_u.evaluate(local_point).at(0)[0] @@ -302,19 +288,6 @@ private: }; // class ResidualProduct -#else // HAVE_EIGEN - - -template <class ProductGridLayer, class ReconstructionGridLayer> -class ResidualProduct -{ - static_assert(AlwaysFalse<ProductGridLayer>::value, "You are missing eigen!"); -}; - - -#endif // HAVE_EIGEN - - template <class ProductGridLayer, class ReconstructionGridLayer> class DiffusiveFluxProduct : public LocalizableProductBase<ProductGridLayer, @@ -339,7 +312,7 @@ public: typedef XT::Functions::LocalizableFunctionInterface<E, D, d, R, d, d> TensorFunctionType; private: - typedef DunePdelabRtSpaceWrapper<ReconstructionGridLayer, 0, R, d> RtSpaceType; + typedef RaviartThomasSpace<ReconstructionGridLayer, 0, R> RtSpaceType; typedef DiscreteFunction<RtSpaceType> FluxReconstructionType; typedef LocalizableProductBase<ProductGridLayer, XT::Functions::LocalizableFunctionInterface<E, D, d, R, 1>> BaseType; typedef LocalVolumeIntegralOperator<LocalLambdaBinaryVolumeIntegrand<E>, @@ -406,25 +379,6 @@ private: }; // class DiffusiveFluxProduct -#else // HAVE_DUNE_PDELAB - - -template <class ProductGridLayer, class ReconstructionGridLayer> -class ResidualProduct -{ - static_assert(AlwaysFalse<ProductGridLayer>::value, "You are missing dune-pdelab!"); -}; - - -template <class ProductGridLayer, class ReconstructionGridLayer> -class DiffusiveFluxProduct -{ - static_assert(AlwaysFalse<ProductGridLayer>::value, "You are missing dune-pdelab!"); -}; - - -#endif // HAVE_DUNE_PDELAB - } // namespace ESV2007 } // namespace GDT } // namespace Dune diff --git a/dune/gdt/playground/operators/OS2015.bindings.cc b/dune/gdt/playground/operators/OS2015.bindings.cc index 9b6935c37179a58421b3f2f3807ff040f0423069..cf694ddce55f1d9ad8e6e5bb9ba4cce89a364379 100644 --- a/dune/gdt/playground/operators/OS2015.bindings.cc +++ b/dune/gdt/playground/operators/OS2015.bindings.cc @@ -366,15 +366,15 @@ PYBIND11_PLUGIN(__operators_OS2015) py::module::import("dune.xt.functions"); py::module::import("dune.xt.la"); -#if HAVE_DUNE_ALUGRID && HAVE_DUNE_FEM - // This is not efficient: we reconstruct on the whole leaf instead of only the neighborhood, but the rt pdelab space +#if HAVE_DUNE_ALUGRID + // This is not efficient: we reconstruct on the whole leaf instead of only the neighborhood, but the rt space // on a dd_subdomain_oversampled grid view (which is a wrapped part) is broken, if based on // a 2d simplex alugrid. - ResidualProduct<ALU_2D_SIMPLEX_CONFORMING, Layers::dd_subdomain, Backends::part, Layers::leaf>::bind(m); + ResidualProduct<ALU_2D_SIMPLEX_CONFORMING, Layers::dd_subdomain, Backends::view, Layers::leaf>::bind(m); + DiffusiveFluxProduct<ALU_2D_SIMPLEX_CONFORMING, Layers::leaf, Backends::view>::bind(m); DiffusiveFluxProduct<ALU_2D_SIMPLEX_CONFORMING, Layers::leaf, Backends::view>::bind(m); - DiffusiveFluxProduct<ALU_2D_SIMPLEX_CONFORMING, Layers::leaf, Backends::part>::bind(m); // s.a. - DiffusiveFluxProduct<ALU_2D_SIMPLEX_CONFORMING, Layers::dd_subdomain, Backends::part, Layers::leaf>::bind(m); + DiffusiveFluxProduct<ALU_2D_SIMPLEX_CONFORMING, Layers::dd_subdomain, Backends::view, Layers::leaf>::bind(m); #endif m.def("_init_mpi", diff --git a/dune/gdt/playground/operators/OS2015.hh b/dune/gdt/playground/operators/OS2015.hh index 3b22fd95d46d57f8634b9806662e259f157c44ee..570fc7906bba19c828b4f2d32a695c492064a42a 100644 --- a/dune/gdt/playground/operators/OS2015.hh +++ b/dune/gdt/playground/operators/OS2015.hh @@ -29,15 +29,11 @@ #include <dune/gdt/local/integrands/lambda.hh> #include <dune/gdt/operators/base.hh> #include <dune/gdt/operators/fluxreconstruction.hh> -#include <dune/gdt/spaces/rt/dune-pdelab-wrapper.hh> +#include <dune/gdt/spaces/rt/default.hh> namespace Dune { namespace GDT { namespace OS2015 { - -#if HAVE_DUNE_PDELAB -#if HAVE_EIGEN - namespace internal { @@ -62,7 +58,7 @@ public: typedef XT::Functions::LocalizableFunctionInterface<E, D, d, R, d, d> TensorFunctionType; private: - typedef DunePdelabRtSpaceWrapper<ReconstructionGridLayer, 0, R, d> RtSpaceType; + typedef RaviartThomasSpace<ReconstructionGridLayer, 0, R> RtSpaceType; typedef DiscreteFunction<RtSpaceType> FluxReconstructionType; typedef XT::Functions::DivergenceFunction<FluxReconstructionType> DivergenceOfFluxReconstructionType; typedef typename ScalarFunctionType::DifferenceType DifferenceType; @@ -199,17 +195,25 @@ public: for (const auto& quadrature_point : QuadratureRules<D, d>::rule(entity.type(), local_lambda->order() + local_kappa->order() + over_integrate_)) { const auto xx = quadrature_point.position(); - XT::LA::EigenDenseMatrix<R> diffusion = local_kappa->evaluate(xx); + auto diffusion = local_kappa->evaluate(xx); diffusion *= local_lambda->evaluate(xx); - min_diffusion_ev_ = std::min(min_diffusion_ev_, XT::LA::make_eigen_solver(diffusion).min_eigenvalues(1).at(0)); + min_diffusion_ev_ = std::min( + min_diffusion_ev_, + XT::LA::make_eigen_solver(diffusion, XT::Common::Configuration{{"assert_positive_eigenvalues"}, {1e-15}}) + .min_eigenvalues(1) + .at(0)); } // * and in the corners of the gigen entity. const auto& reference_element = ReferenceElements<D, d>::general(entity.type()); for (int ii = 0; ii < reference_element.size(d); ++ii) { const auto xx = reference_element.position(ii, d); - XT::LA::EigenDenseMatrix<R> diffusion = local_kappa->evaluate(xx); + auto diffusion = local_kappa->evaluate(xx); diffusion *= local_lambda->evaluate(xx); - min_diffusion_ev_ = std::min(min_diffusion_ev_, XT::LA::make_eigen_solver(diffusion).min_eigenvalues(1).at(0)); + min_diffusion_ev_ = std::min( + min_diffusion_ev_, + XT::LA::make_eigen_solver(diffusion, XT::Common::Configuration{{"assert_positive_eigenvalues"}, {1e-15}}) + .min_eigenvalues(1) + .at(0)); } }); } // ResidualProduct(...) @@ -239,19 +243,6 @@ private: }; // class ResidualProduct -#else // HAVE_EIGEN - - -template <class ProductGridLayer, class ReconstructionGridLayer> -class ResidualProduct -{ - static_assert(AlwaysFalse<ProductGridLayer>::value, "You are missing eigen!"); -}; - - -#endif // HAVE_EIGEN - - template <class ProductGridLayer, class ReconstructionGridLayer> class DiffusiveFluxProduct : public LocalizableProductBase<ProductGridLayer, @@ -276,7 +267,7 @@ public: typedef XT::Functions::LocalizableFunctionInterface<E, D, d, R, d, d> TensorFunctionType; private: - typedef DunePdelabRtSpaceWrapper<ReconstructionGridLayer, 0, R, d> RtSpaceType; + typedef RaviartThomasSpace<ReconstructionGridLayer, 0, R> RtSpaceType; typedef DiscreteFunction<RtSpaceType> FluxReconstructionType; typedef LocalizableProductBase<ProductGridLayer, XT::Functions::LocalizableFunctionInterface<E, D, d, R, 1>> BaseType; typedef LocalVolumeIntegralOperator<LocalLambdaBinaryVolumeIntegrand<E>, @@ -350,25 +341,6 @@ private: }; // class DiffusiveFluxProduct -#else // HAVE_DUNE_PDELAB - - -template <class ProductGridLayer, class ReconstructionGridLayer> -class ResidualProduct -{ - static_assert(AlwaysFalse<ProductGridLayer>::value, "You are missing dune-pdelab!"); -}; - - -template <class ProductGridLayer, class ReconstructionGridLayer> -class DiffusiveFluxProduct -{ - static_assert(AlwaysFalse<ProductGridLayer>::value, "You are missing dune-pdelab!"); -}; - - -#endif // HAVE_DUNE_PDELAB - } // namespace OS2015 } // namespace GDT } // namespace Dune diff --git a/dune/gdt/playground/operators/RS2017.bindings.cc b/dune/gdt/playground/operators/RS2017.bindings.cc index cecfb6a7e8c05e9d3769d460cc924dad282e8cf9..b803a79d2c1d0dfc75e730bd4b1c3e4e8ed42ac9 100644 --- a/dune/gdt/playground/operators/RS2017.bindings.cc +++ b/dune/gdt/playground/operators/RS2017.bindings.cc @@ -9,11 +9,13 @@ #include "config.h" -#if HAVE_EIGEN && HAVE_DUNE_ALUGRID && HAVE_DUNE_FEM && HAVE_DUNE_PDELAB && HAVE_DUNE_PYBINDXI +#if HAVE_DUNE_ALUGRID && HAVE_DUNE_PYBINDXI #include <dune/common/parallel/mpihelper.hh> +#if HAVE_DUNE_FEM #include <dune/fem/misc/mpimanager.hh> +#endif #include <dune/pybindxi/pybind11.h> #include <dune/pybindxi/stl.h> @@ -72,7 +74,7 @@ PYBIND11_PLUGIN(__operators_RS2017) const ssize_t over_int) { py::gil_scoped_release DUNE_UNUSED(release); const auto over_integrate = XT::Common::numeric_cast<size_t>(over_int); - auto subdomain_layer = dd_grid_provider.template layer<Layers::dd_subdomain, Backends::part>( + auto subdomain_layer = dd_grid_provider.template layer<Layers::dd_subdomain, Backends::view>( XT::Common::numeric_cast<size_t>(subdomain)); typedef decltype(subdomain_layer) GL; XT::Grid::Walker<GL> walker(subdomain_layer); @@ -85,17 +87,25 @@ PYBIND11_PLUGIN(__operators_RS2017) for (const auto& quadrature_point : QuadratureRules<D, d>::rule( entity.type(), local_lambda->order() + local_kappa->order() + over_integrate)) { const auto xx = quadrature_point.position(); - XT::LA::EigenDenseMatrix<R> diffusion = local_kappa->evaluate(xx); + auto diffusion = local_kappa->evaluate(xx); diffusion *= local_lambda->evaluate(xx); - min_ev = std::min(min_ev, XT::LA::make_eigen_solver(diffusion).min_eigenvalues(1).at(0)); + min_ev = std::min(min_ev, + XT::LA::make_eigen_solver( + diffusion, XT::Common::Configuration{{"assert_positive_eigenvalues"}, {1e-15}}) + .min_eigenvalues(1) + .at(0)); } // * and in the corners of the gigen entity. const auto& reference_element = ReferenceElements<D, d>::general(entity.type()); for (int ii = 0; ii < reference_element.size(d); ++ii) { const auto xx = reference_element.position(ii, d); - XT::LA::EigenDenseMatrix<R> diffusion = local_kappa->evaluate(xx); + auto diffusion = local_kappa->evaluate(xx); diffusion *= local_lambda->evaluate(xx); - min_ev = std::min(min_ev, XT::LA::make_eigen_solver(diffusion).min_eigenvalues(1).at(0)); + min_ev = std::min(min_ev, + XT::LA::make_eigen_solver( + diffusion, XT::Common::Configuration{{"assert_positive_eigenvalues"}, {1e-15}}) + .min_eigenvalues(1) + .at(0)); } }); walker.walk(); @@ -111,7 +121,7 @@ PYBIND11_PLUGIN(__operators_RS2017) dd_grid_provider, const ssize_t subdomain) { py::gil_scoped_release DUNE_UNUSED(release); - auto subdomain_layer = dd_grid_provider.template layer<Layers::dd_subdomain, Backends::part>( + auto subdomain_layer = dd_grid_provider.template layer<Layers::dd_subdomain, Backends::view>( XT::Common::numeric_cast<size_t>(subdomain)); typedef decltype(subdomain_layer) GL; XT::Grid::Walker<GL> walker(subdomain_layer); @@ -137,7 +147,7 @@ PYBIND11_PLUGIN(__operators_RS2017) const XT::Functions::LocalizableFunctionInterface<E, D, d, R, 1>& v, const ssize_t over_integrate) { py::gil_scoped_release DUNE_UNUSED(release); - return GDT::make_l2_operator(dd_grid_provider.template layer<Layers::dd_subdomain, Backends::part>( + return GDT::make_l2_operator(dd_grid_provider.template layer<Layers::dd_subdomain, Backends::view>( XT::Common::numeric_cast<size_t>(subdomain)), XT::Common::numeric_cast<size_t>(over_integrate)) ->apply2(u, v); @@ -153,13 +163,13 @@ PYBIND11_PLUGIN(__operators_RS2017) typename GDT::SpaceProvider<ALU_2D_SIMPLEX_CONFORMING, Layers::dd_subdomain, GDT::SpaceType::dg, - GDT::Backends::fem, + GDT::Backends::gdt, 1, double, 1>::type, XT::LA::IstlRowMajorSparseMatrix<double>, typename XT::Grid:: - Layer<ALU_2D_SIMPLEX_CONFORMING, Layers::dd_subdomain, Backends::part>::type> + Layer<ALU_2D_SIMPLEX_CONFORMING, Layers::dd_subdomain, Backends::view>::type> EllipticMatrixOperatorType; try { // we might not be the first to add this py::class_<EllipticMatrixOperatorType, @@ -181,7 +191,7 @@ PYBIND11_PLUGIN(__operators_RS2017) lambda, kappa, space, - dd_grid_provider.template layer<Layers::dd_subdomain, Backends::part>( + dd_grid_provider.template layer<Layers::dd_subdomain, Backends::view>( XT::Common::numeric_cast<int>(subdomain))); }, "dd_grid_provider"_a, @@ -238,4 +248,4 @@ PYBIND11_PLUGIN(__operators_RS2017) return m.ptr(); } -#endif // HAVE_EIGEN && HAVE_DUNE_FEM && HAVE_DEUN_PDELAB && HAVE_DUNE_PYBINDXI +#endif // HAVE_DUNE_ALUGRID && HAVE_DUNE_PYBINDXI diff --git a/dune/gdt/playground/operators/RS2017.hh b/dune/gdt/playground/operators/RS2017.hh index de26eabe6bc0ccf4758549b486e548fab1c341df..79734a769f69128d637d78b2c4103700f5b1375b 100644 --- a/dune/gdt/playground/operators/RS2017.hh +++ b/dune/gdt/playground/operators/RS2017.hh @@ -43,7 +43,7 @@ namespace Dune { namespace GDT { namespace RS2017 { -#if HAVE_DUNE_FEM && HAVE_DUNE_ISTL && HAVE_DUNE_PDELAB +#if HAVE_DUNE_ISTL template <class G> @@ -52,24 +52,24 @@ class DiffusiveFluxAaProduct typename GDT::SpaceProvider<G, XT::Grid::Layers::dd_subdomain, GDT::SpaceType::dg, - GDT::Backends::fem, + GDT::Backends::gdt, 1, double, 1>::type, typename XT::Grid::Layer<G, XT::Grid::Layers::dd_subdomain, - XT::Grid::Backends::part, + XT::Grid::Backends::view, XT::Grid::DD::SubdomainGrid<G>>::type> { static_assert(XT::Grid::is_grid<G>::value, ""); typedef typename GDT:: - SpaceProvider<G, XT::Grid::Layers::dd_subdomain, GDT::SpaceType::dg, GDT::Backends::fem, 1, double, 1> + SpaceProvider<G, XT::Grid::Layers::dd_subdomain, GDT::SpaceType::dg, GDT::Backends::gdt, 1, double, 1> SP; typedef GDT::MatrixOperatorBase<XT::LA::IstlRowMajorSparseMatrix<double>, typename SP::type, typename XT::Grid::Layer<G, XT::Grid::Layers::dd_subdomain, - XT::Grid::Backends::part, + XT::Grid::Backends::view, XT::Grid::DD::SubdomainGrid<G>>::type> BaseType; typedef DiffusiveFluxAaProduct<G> ThisType; @@ -109,7 +109,7 @@ public: const size_t over_integrate) { return new ThisType( space, - dd_grid_provider.template layer<XT::Grid::Layers::dd_subdomain, XT::Grid::Backends::part>( + dd_grid_provider.template layer<XT::Grid::Layers::dd_subdomain, XT::Grid::Backends::view>( XT::Common::numeric_cast<size_t>(subdomain)), lambda_hat, lambda_u, @@ -210,24 +210,24 @@ class DiffusiveFluxAbProduct typename GDT::SpaceProvider<G, XT::Grid::Layers::dd_subdomain, GDT::SpaceType::dg, - GDT::Backends::fem, + GDT::Backends::gdt, 1, double, 1>::type, typename XT::Grid::Layer<G, XT::Grid::Layers::dd_subdomain, - XT::Grid::Backends::part, + XT::Grid::Backends::view, XT::Grid::DD::SubdomainGrid<G>>::type, GDT::RestrictedSpace<typename GDT::SpaceProvider<G, XT::Grid::Layers::leaf, GDT::SpaceType::rt, - GDT::Backends::pdelab, + GDT::Backends::gdt, 0, double, G::dimension>::type, typename XT::Grid::Layer<G, XT::Grid::Layers::dd_subdomain, - XT::Grid::Backends::part, + XT::Grid::Backends::view, XT::Grid::DD::SubdomainGrid<G>>::type>> { static_assert(XT::Grid::is_grid<G>::value, ""); @@ -235,24 +235,24 @@ class DiffusiveFluxAbProduct typename GDT::SpaceProvider<G, XT::Grid::Layers::dd_subdomain, GDT::SpaceType::dg, - GDT::Backends::fem, + GDT::Backends::gdt, 1, double, 1>::type, typename XT::Grid::Layer<G, XT::Grid::Layers::dd_subdomain, - XT::Grid::Backends::part, + XT::Grid::Backends::view, XT::Grid::DD::SubdomainGrid<G>>::type, GDT::RestrictedSpace<typename GDT::SpaceProvider<G, XT::Grid::Layers::leaf, GDT::SpaceType::rt, - GDT::Backends::pdelab, + GDT::Backends::gdt, 0, double, G::dimension>::type, typename XT::Grid::Layer<G, XT::Grid::Layers::dd_subdomain, - XT::Grid::Backends::part, + XT::Grid::Backends::view, XT::Grid::DD::SubdomainGrid<G>>::type>> BaseType; typedef DiffusiveFluxAbProduct<G> ThisType; @@ -297,7 +297,7 @@ public: return new ThisType( range_space, source_space, - dd_grid_provider.template layer<XT::Grid::Layers::dd_subdomain, XT::Grid::Backends::part>( + dd_grid_provider.template layer<XT::Grid::Layers::dd_subdomain, XT::Grid::Backends::view>( XT::Common::numeric_cast<size_t>(subdomain)), lambda_hat, lambda_range, @@ -394,17 +394,17 @@ class DiffusiveFluxBbProduct GDT::RestrictedSpace<typename GDT::SpaceProvider<G, XT::Grid::Layers::leaf, GDT::SpaceType::rt, - GDT::Backends::pdelab, + GDT::Backends::gdt, 0, double, G::dimension>::type, typename XT::Grid::Layer<G, XT::Grid::Layers::dd_subdomain, - XT::Grid::Backends::part, + XT::Grid::Backends::view, XT::Grid::DD::SubdomainGrid<G>>::type>, typename XT::Grid::Layer<G, XT::Grid::Layers::dd_subdomain, - XT::Grid::Backends::part, + XT::Grid::Backends::view, XT::Grid::DD::SubdomainGrid<G>>::type> { static_assert(XT::Grid::is_grid<G>::value, ""); @@ -412,17 +412,17 @@ class DiffusiveFluxBbProduct GDT::RestrictedSpace<typename GDT::SpaceProvider<G, XT::Grid::Layers::leaf, GDT::SpaceType::rt, - GDT::Backends::pdelab, + GDT::Backends::gdt, 0, double, G::dimension>::type, typename XT::Grid::Layer<G, XT::Grid::Layers::dd_subdomain, - XT::Grid::Backends::part, + XT::Grid::Backends::view, XT::Grid::DD::SubdomainGrid<G>>::type>, typename XT::Grid::Layer<G, XT::Grid::Layers::dd_subdomain, - XT::Grid::Backends::part, + XT::Grid::Backends::view, XT::Grid::DD::SubdomainGrid<G>>::type> BaseType; typedef DiffusiveFluxBbProduct<G> ThisType; @@ -462,7 +462,7 @@ public: const size_t over_integrate) { return new ThisType( space, - dd_grid_provider.template layer<XT::Grid::Layers::dd_subdomain, XT::Grid::Backends::part>( + dd_grid_provider.template layer<XT::Grid::Layers::dd_subdomain, XT::Grid::Backends::view>( XT::Common::numeric_cast<size_t>(subdomain)), lambda_hat, kappa, @@ -546,23 +546,23 @@ class SwipdgPenaltySubdomainProduct typename GDT::SpaceProvider<G, XT::Grid::Layers::dd_subdomain, GDT::SpaceType::dg, - GDT::Backends::fem, + GDT::Backends::gdt, 1, double, 1>::type, typename XT::Grid::Layer<G, XT::Grid::Layers::dd_subdomain, - XT::Grid::Backends::part, + XT::Grid::Backends::view, XT::Grid::DD::SubdomainGrid<G>>::type> { static_assert(XT::Grid::is_grid<G>::value, ""); - typedef GDT::SpaceProvider<G, XT::Grid::Layers::dd_subdomain, GDT::SpaceType::dg, GDT::Backends::fem, 1, double, 1> + typedef GDT::SpaceProvider<G, XT::Grid::Layers::dd_subdomain, GDT::SpaceType::dg, GDT::Backends::gdt, 1, double, 1> SP; typedef GDT::MatrixOperatorBase<XT::LA::IstlRowMajorSparseMatrix<double>, typename SP::type, typename XT::Grid::Layer<G, XT::Grid::Layers::dd_subdomain, - XT::Grid::Backends::part, + XT::Grid::Backends::view, XT::Grid::DD::SubdomainGrid<G>>::type> BaseType; typedef SwipdgPenaltySubdomainProduct<G> ThisType; @@ -601,7 +601,7 @@ public: const size_t over_integrate) { return new ThisType( space, - dd_grid_provider.template layer<XT::Grid::Layers::dd_subdomain, XT::Grid::Backends::part>( + dd_grid_provider.template layer<XT::Grid::Layers::dd_subdomain, XT::Grid::Backends::view>( XT::Common::numeric_cast<size_t>(subdomain)), boundary_info, lambda, @@ -791,17 +791,17 @@ void bind_neighborhood_discretization(pybind11::module& m) typedef typename XT::Grid::Layer<G, XT::Grid::Layers::dd_subdomain_oversampled, - XT::Grid::Backends::part, + XT::Grid::Backends::view, XT::Grid::DD::SubdomainGrid<G>>::type NGL; typedef GDT:: - SpaceProvider<G, XT::Grid::Layers::dd_subdomain, GDT::SpaceType::block_dg, GDT::Backends::fem, 1, double, 1> + SpaceProvider<G, XT::Grid::Layers::dd_subdomain, GDT::SpaceType::block_dg, GDT::Backends::gdt, 1, double, 1> SP; typedef typename SP::type S; typedef XT::LA::IstlDenseVector<R> V; typedef XT::LA::IstlRowMajorSparseMatrix<R> M; try { // we might not be the first to add this SystemAssembler - GDT::bindings::SystemAssembler<SP, XT::Grid::Layers::dd_subdomain_oversampled, XT::Grid::Backends::part>::bind(m); + GDT::bindings::SystemAssembler<SP, XT::Grid::Layers::dd_subdomain_oversampled, XT::Grid::Backends::view>::bind(m); } catch (std::runtime_error&) { } @@ -811,7 +811,7 @@ void bind_neighborhood_discretization(pybind11::module& m) const S& neighborhood_space) { return new GDT::SystemAssembler<S, NGL>( neighborhood_space, - dd_grid_provider.template layer<XT::Grid::Layers::dd_subdomain_oversampled, XT::Grid::Backends::part>( + dd_grid_provider.template layer<XT::Grid::Layers::dd_subdomain_oversampled, XT::Grid::Backends::view>( XT::Common::numeric_cast<size_t>(subdomain))); }); @@ -836,7 +836,7 @@ void bind_neighborhood_discretization(pybind11::module& m) lambda, kappa, neighborhood_space, - dd_grid_provider.template layer<XT::Grid::Layers::dd_subdomain_oversampled, XT::Grid::Backends::part>( + dd_grid_provider.template layer<XT::Grid::Layers::dd_subdomain_oversampled, XT::Grid::Backends::view>( XT::Common::numeric_cast<size_t>(subdomain))); }, "dd_grid_provider"_a, @@ -875,7 +875,7 @@ void bind_neighborhood_discretization(pybind11::module& m) lambda, kappa, neighborhood_space, - dd_grid_provider.template layer<XT::Grid::Layers::dd_subdomain_oversampled, XT::Grid::Backends::part>( + dd_grid_provider.template layer<XT::Grid::Layers::dd_subdomain_oversampled, XT::Grid::Backends::view>( XT::Common::numeric_cast<size_t>(subdomain))); }, "dd_grid_provider"_a, @@ -902,7 +902,7 @@ void bind_neighborhood_discretization(pybind11::module& m) over_integrate, f, neighborhood_space, - dd_grid_provider.template layer<XT::Grid::Layers::dd_subdomain_oversampled, XT::Grid::Backends::part>( + dd_grid_provider.template layer<XT::Grid::Layers::dd_subdomain_oversampled, XT::Grid::Backends::view>( XT::Common::numeric_cast<size_t>(subdomain))); }, "dd_grid_provider"_a, @@ -920,17 +920,17 @@ class HdivSemiProduct GDT::RestrictedSpace<typename GDT::SpaceProvider<G, XT::Grid::Layers::leaf, GDT::SpaceType::rt, - GDT::Backends::pdelab, + GDT::Backends::gdt, 0, double, G::dimension>::type, typename XT::Grid::Layer<G, XT::Grid::Layers::dd_subdomain, - XT::Grid::Backends::part, + XT::Grid::Backends::view, XT::Grid::DD::SubdomainGrid<G>>::type>, typename XT::Grid::Layer<G, XT::Grid::Layers::dd_subdomain, - XT::Grid::Backends::part, + XT::Grid::Backends::view, XT::Grid::DD::SubdomainGrid<G>>::type> { static_assert(XT::Grid::is_grid<G>::value, ""); @@ -938,17 +938,17 @@ class HdivSemiProduct GDT::RestrictedSpace<typename GDT::SpaceProvider<G, XT::Grid::Layers::leaf, GDT::SpaceType::rt, - GDT::Backends::pdelab, + GDT::Backends::gdt, 0, double, G::dimension>::type, typename XT::Grid::Layer<G, XT::Grid::Layers::dd_subdomain, - XT::Grid::Backends::part, + XT::Grid::Backends::view, XT::Grid::DD::SubdomainGrid<G>>::type>, typename XT::Grid::Layer<G, XT::Grid::Layers::dd_subdomain, - XT::Grid::Backends::part, + XT::Grid::Backends::view, XT::Grid::DD::SubdomainGrid<G>>::type> BaseType; typedef HdivSemiProduct<G> ThisType; @@ -984,7 +984,7 @@ public: const size_t over_integrate) { return new ThisType( space, - dd_grid_provider.template layer<XT::Grid::Layers::dd_subdomain, XT::Grid::Backends::part>( + dd_grid_provider.template layer<XT::Grid::Layers::dd_subdomain, XT::Grid::Backends::view>( XT::Common::numeric_cast<size_t>(subdomain)), over_integrate); }, @@ -1037,32 +1037,32 @@ class ResidualPartFunctional GDT::RestrictedSpace<typename GDT::SpaceProvider<G, XT::Grid::Layers::leaf, GDT::SpaceType::rt, - GDT::Backends::pdelab, + GDT::Backends::gdt, 0, double, G::dimension>::type, typename XT::Grid::Layer<G, XT::Grid::Layers::dd_subdomain, - XT::Grid::Backends::part, + XT::Grid::Backends::view, XT::Grid::DD::SubdomainGrid<G>>::type>, typename XT::Grid::Layer<G, XT::Grid::Layers::dd_subdomain, - XT::Grid::Backends::part, + XT::Grid::Backends::view, XT::Grid::DD::SubdomainGrid<G>>::type> { static_assert(XT::Grid::is_grid<G>::value, ""); typedef GDT::RestrictedSpace< typename GDT:: - SpaceProvider<G, XT::Grid::Layers::leaf, GDT::SpaceType::rt, GDT::Backends::pdelab, 0, double, G::dimension>:: + SpaceProvider<G, XT::Grid::Layers::leaf, GDT::SpaceType::rt, GDT::Backends::gdt, 0, double, G::dimension>:: type, typename XT::Grid:: - Layer<G, XT::Grid::Layers::dd_subdomain, XT::Grid::Backends::part, XT::Grid::DD::SubdomainGrid<G>>::type> + Layer<G, XT::Grid::Layers::dd_subdomain, XT::Grid::Backends::view, XT::Grid::DD::SubdomainGrid<G>>::type> RtSpaceType; typedef GDT::VectorFunctionalBase<XT::LA::IstlDenseVector<double>, RtSpaceType, typename XT::Grid::Layer<G, XT::Grid::Layers::dd_subdomain, - XT::Grid::Backends::part, + XT::Grid::Backends::view, XT::Grid::DD::SubdomainGrid<G>>::type> BaseType; typedef ResidualPartFunctional<G> ThisType; @@ -1100,7 +1100,7 @@ public: const size_t over_integrate) { return new ThisType( space, - dd_grid_provider.template layer<XT::Grid::Layers::dd_subdomain, XT::Grid::Backends::part>( + dd_grid_provider.template layer<XT::Grid::Layers::dd_subdomain, XT::Grid::Backends::view>( XT::Common::numeric_cast<size_t>(subdomain)), f, over_integrate); @@ -1161,10 +1161,10 @@ void bind_neighborhood_reconstruction(pybind11::module& m) static const constexpr size_t d = 2; typedef double R; typedef typename XT::Grid::Layer<G, XT::Grid::Layers::leaf, XT::Grid::Backends::view>::type LeafViewType; - typedef GDT::DunePdelabRtSpaceWrapper<LeafViewType, 0, double, d> RtSpaceType; + typedef GDT::RaviartThomasSpace<LeafViewType, 0> RtSpaceType; typedef typename XT::Grid::Layer<G, XT::Grid::Layers::dd_subdomain_oversampled, - XT::Grid::Backends::part, + XT::Grid::Backends::view, XT::Grid::DD::SubdomainGrid<G>>::type NeighborHoodGridLayer; typedef GDT::RestrictedSpace<RtSpaceType, NeighborHoodGridLayer> NeighborhoodRtSpaceType; typedef XT::LA::IstlDenseVector<R> VectorType; @@ -1185,7 +1185,7 @@ void bind_neighborhood_reconstruction(pybind11::module& m) const ssize_t over_integrate) { py::gil_scoped_release DUNE_UNUSED(release); LocalizableDiffusiveFluxReconstructionOperatorForRestrictedSpaceType( - dd_grid_provider.template layer<XT::Grid::Layers::dd_subdomain_oversampled, XT::Grid::Backends::part>( + dd_grid_provider.template layer<XT::Grid::Layers::dd_subdomain_oversampled, XT::Grid::Backends::view>( XT::Common::numeric_cast<size_t>(subdomain)), lambda, kappa, @@ -1219,7 +1219,7 @@ void bind_neighborhood_reconstruction(pybind11::module& m) const ssize_t over_integrate) { py::gil_scoped_release DUNE_UNUSED(release); LocalizableDiffusiveFluxReconstructionOperatorForLeafSpaceType( - dd_grid_provider.template layer<XT::Grid::Layers::dd_subdomain_oversampled, XT::Grid::Backends::part>( + dd_grid_provider.template layer<XT::Grid::Layers::dd_subdomain_oversampled, XT::Grid::Backends::view>( XT::Common::numeric_cast<size_t>(subdomain)), lambda, kappa, @@ -1238,66 +1238,66 @@ void bind_neighborhood_reconstruction(pybind11::module& m) } // ... bind_neighborhood_reconstruction(...) -#else // HAVE_DUNE_FEM && HAVE_DUNE_ISTL && HAVE_DUNE_PDELAB +#else // HAVE_DUNE_ISTL template <class G> class DiffusiveFluxAaProduct { - static_assert(AlwaysFalse<G>::value, "You are missing dune-fem, dune-pdelab or dune-istl!"); + static_assert(AlwaysFalse<G>::value, "You are missing dune-istl!"); }; template <class G> class DiffusiveFluxAbProduct { - static_assert(AlwaysFalse<G>::value, "You are missing dune-fem, dune-pdelab or dune-istl!"); + static_assert(AlwaysFalse<G>::value, "You are missing dune-istl!"); }; template <class G> class DiffusiveFluxBbProduct { - static_assert(AlwaysFalse<G>::value, "You are missing dune-fem, dune-pdelab or dune-istl!"); + static_assert(AlwaysFalse<G>::value, "You are missing dune-istl!"); }; template <class G> class SwipdgPenaltySubdomainProduct { - static_assert(AlwaysFalse<G>::value, "You are missing dune-fem, dune-pdelab or dune-istl!"); + static_assert(AlwaysFalse<G>::value, "You are missing dune-istl!"); }; template <class G> void bind_neighborhood_discretization(pybind11::module& /*m*/) { - static_assert(AlwaysFalse<G>::value, "You are missing dune-fem, dune-pdelab or dune-istl!"); + static_assert(AlwaysFalse<G>::value, "You are missing dune-istl!"); } template <class G> class HdivSemiProduct { - static_assert(AlwaysFalse<G>::value, "You are missing dune-fem, dune-pdelab or dune-istl!"); + static_assert(AlwaysFalse<G>::value, "You are missing dune-istl!"); }; template <class G> class ResidualPartFunctional { - static_assert(AlwaysFalse<G>::value, "You are missing dune-fem, dune-pdelab or dune-istl!"); + static_assert(AlwaysFalse<G>::value, "You are missing dune-istl!"); }; template <class G> void bind_neighborhood_reconstruction(pybind11::module& /*m*/) { - static_assert(AlwaysFalse<G>::value, "You are missing dune-fem, dune-pdelab or dune-istl!"); + static_assert(AlwaysFalse<G>::value, "You are missing dune-istl!"); } -#endif // HAVE_DUNE_FEM && HAVE_DUNE_ISTL && HAVE_DUNE_PDELAB +#endif // HAVE_DUNE_ISTL } // namespace RS2017 } // namespace GDT diff --git a/dune/gdt/playground/spaces/basefunctionset/dune-functions-wrapper.hh b/dune/gdt/playground/spaces/basefunctionset/dune-functions-wrapper.hh deleted file mode 100644 index 832dd08b22b163c8c158ee1beecc0a6cf7c5f93a..0000000000000000000000000000000000000000 --- a/dune/gdt/playground/spaces/basefunctionset/dune-functions-wrapper.hh +++ /dev/null @@ -1,167 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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) -// Rene Milk (2018) -// Tobias Leibner (2017) - -#ifndef DUNE_GDT_PLAYGROUND_SPACES_BASEFUNCTIONSET_DUNE_FUNCTIONS_WRAPPER_HH -#define DUNE_GDT_PLAYGROUND_SPACES_BASEFUNCTIONSET_DUNE_FUNCTIONS_WRAPPER_HH - -#include <dune/common/typetraits.hh> - -#if HAVE_DUNE_FUNCTIONS -#include <dune/functions/functionspacebases/lagrangedgbasis.hh> -#endif - -#include <dune/xt/grid/type_traits.hh> - -#include <dune/gdt/spaces/basefunctionset/interface.hh> - -namespace Dune { -namespace GDT { - -#if HAVE_DUNE_FUNCTIONS - - -// forward, to be used in the traits and to allow for specialization -template <class GL, int p, class R, size_t r, size_t rC> -class DuneFunctionsBaseFunctionSetWrapper -{ - static_assert(Dune::AlwaysFalse<GL>::value, "Untested for these dimensions!"); -}; - - -namespace internal { - - -template <class GL, int p, class R, size_t r, size_t rC> -class DuneFunctionsBaseFunctionSetWrapperTraits -{ - static_assert(XT::Grid::is_view<GL>::value, "We Probably need to use TemporaryGridView from dune-xt-grid!"); - -public: - typedef DuneFunctionsBaseFunctionSetWrapper<GL, p, R, r, rC> derived_type; - typedef Functions::LagrangeDGBasis<GL, p> BackendType; - typedef typename XT::Grid::extract_entity<GL>::type EntityType; -}; - - -} // namespace internal - - -template <class GL, int p, class R> -class DuneFunctionsBaseFunctionSetWrapper<GL, p, R, 1, 1> - : public BaseFunctionSetInterface<internal::DuneFunctionsBaseFunctionSetWrapperTraits<GL, p, R, 1, 1>, - typename GL::ctype, - GL::dimension, - R, - 1, - 1> -{ - typedef DuneFunctionsBaseFunctionSetWrapper<GL, p, R, 1, 1> ThisType; - typedef BaseFunctionSetInterface<internal::DuneFunctionsBaseFunctionSetWrapperTraits<GL, p, R, 1, 1>, - typename GL::ctype, - GL::dimension, - R, - 1, - 1> - BaseType; - -public: - typedef internal::DuneFunctionsBaseFunctionSetWrapperTraits<GL, p, R, 1, 1> Traits; - - using typename BaseType::BackendType; - using typename BaseType::EntityType; - using typename BaseType::DomainType; - using typename BaseType::RangeType; - using typename BaseType::JacobianRangeType; - -private: - typedef typename BackendType::LocalView LocalViewType; - -public: - DuneFunctionsBaseFunctionSetWrapper(std::shared_ptr<const BackendType> bcknd, const EntityType& ent) - : BaseType(ent) - , backend_(bcknd) - , local_view_(backend_->localView()) - , tmp_gradients_(local_view_.size(), JacobianRangeType(0.)) - { - local_view_.bind(this->entity()); - } - - DuneFunctionsBaseFunctionSetWrapper(const ThisType& other) = default; - DuneFunctionsBaseFunctionSetWrapper(ThisType&& source) = default; - - ThisType& operator=(const ThisType& other) = delete; - ThisType& operator=(ThisType&& source) = delete; - - const BackendType& backend() const - { - return *backend_; - } - - virtual size_t size() const override final - { - return local_view_.size(); - } - - virtual size_t order(const XT::Common::Parameter& /*mu*/ = {}) const override final - { - return local_view_.tree().finiteElement().localBasis().order(); - } - - using BaseType::evaluate; - - void evaluate(const DomainType& xx, - std::vector<RangeType>& ret, - const XT::Common::Parameter& /*mu*/ = {}) const override final - { - assert(this->is_a_valid_point(xx)); - assert(ret.size() >= size()); - const auto& local_basis = local_view_.tree().finiteElement().localBasis(); - local_basis.evaluateFunction(xx, ret); - } - - using BaseType::jacobian; - - void jacobian(const DomainType& xx, - std::vector<JacobianRangeType>& ret, - const XT::Common::Parameter& /*mu*/ = {}) const override final - { - assert(this->is_a_valid_point(xx)); - assert(ret.size() >= size()); - const auto& local_basis = local_view_.tree().finiteElement().localBasis(); - local_basis.evaluateJacobian(xx, tmp_gradients_); - auto jacobian_inv = this->entity().geometry().jacobianInverseTransposed(xx); - for (size_t ii = 0; ii < size(); ++ii) - jacobian_inv.mv(tmp_gradients_[ii][0], ret[ii]); - } // ... jacobian(...) - -private: - const std::shared_ptr<const BackendType> backend_; - LocalViewType local_view_; - mutable std::vector<JacobianRangeType> tmp_gradients_; -}; // class DuneFunctionsBaseFunctionSetWrapper - - -#else // HAVE_DUNE_FUNCTIONS - - -template <class GL, int p, class R, size_t r, size_t rC = 1> -class DuneFunctionsBaseFunctionSetWrapper -{ - static_assert(Dune::AlwaysFalse<GL>::value, "You are missing dune-functions!"); -}; - - -#endif // HAVE_DUNE_FUNCTIONS - -} // namespace GDT -} // namespace Dune - -#endif // DUNE_GDT_PLAYGROUND_SPACES_BASEFUNCTIONSET_DUNE_FUNCTIONS_WRAPPER_HH diff --git a/dune/gdt/playground/spaces/block.bindings.hh b/dune/gdt/playground/spaces/block.bindings.hh index f4bff367968a2106147dc2369f4c9eea1c82be64..9b8bcf207aa7de0bb839b30ac3f1379a49f5c47e 100644 --- a/dune/gdt/playground/spaces/block.bindings.hh +++ b/dune/gdt/playground/spaces/block.bindings.hh @@ -318,11 +318,11 @@ public: [](const type& self, const ssize_t block, const std::string tp) { auto bb = XT::Common::numeric_cast<size_t>(block); if (tp == "volume") - return self.local_space(bb).compute_volume_pattern(self.dd_grid().boundaryGridPart(bb)); + return self.local_space(bb).compute_volume_pattern(self.dd_grid().boundary_grid_view(bb)); else if (tp == "face") - return self.local_space(bb).compute_face_pattern(self.dd_grid().boundaryGridPart(bb)); + return self.local_space(bb).compute_face_pattern(self.dd_grid().boundary_grid_view(bb)); else if (tp == "face_and_volume") - return self.local_space(bb).compute_face_and_volume_pattern(self.dd_grid().boundaryGridPart(bb)); + return self.local_space(bb).compute_face_and_volume_pattern(self.dd_grid().boundary_grid_view(bb)); else DUNE_THROW(XT::Common::Exceptions::wrong_input_given, " type has to be one of ('volume', 'face', 'face_and_volume'), is '" << tp << "'!"); @@ -336,13 +336,13 @@ public: auto ss = XT::Common::numeric_cast<size_t>(subdomain); auto nn = XT::Common::numeric_cast<size_t>(neighbor); if (tp == "volume") - return self.local_space(ss).compute_volume_pattern(self.dd_grid().couplingGridPart(ss, nn), + return self.local_space(ss).compute_volume_pattern(self.dd_grid().coupling_grid_view(ss, nn), self.local_space(nn)); else if (tp == "face") - return self.local_space(ss).compute_face_pattern(self.dd_grid().couplingGridPart(ss, nn), + return self.local_space(ss).compute_face_pattern(self.dd_grid().coupling_grid_view(ss, nn), self.local_space(nn)); else if (tp == "face_and_volume") - return self.local_space(ss).compute_face_and_volume_pattern(self.dd_grid().couplingGridPart(ss, nn), + return self.local_space(ss).compute_face_and_volume_pattern(self.dd_grid().coupling_grid_view(ss, nn), self.local_space(nn)); else DUNE_THROW(XT::Common::Exceptions::wrong_input_given, @@ -356,7 +356,7 @@ public: c.def("boundary_assembler", [](const type& self, const ssize_t subdomain) { auto ss = XT::Common::numeric_cast<size_t>(subdomain); - auto boundary_grid_part = self.dd_grid().boundaryGridPart(ss); + auto boundary_grid_part = self.dd_grid().boundary_grid_view(ss); return new GDT::SystemAssembler<S, decltype(boundary_grid_part), S>(self.local_space(ss), // see below for boundary_grid_part); // the 'new' }, @@ -365,7 +365,7 @@ public: [](const type& self, const ssize_t subdomain, const ssize_t neighbor) { auto ss = XT::Common::numeric_cast<size_t>(subdomain); auto nn = XT::Common::numeric_cast<size_t>(neighbor); - auto coupling_grid_part = self.dd_grid().couplingGridPart(ss, nn); + auto coupling_grid_part = self.dd_grid().coupling_grid_view(ss, nn); return new GDT::SystemAssembler<S, decltype(coupling_grid_part), S>(coupling_grid_part, // SystemAssembler self.local_space(ss), // is not copyable self.local_space(ss), // or movable, @@ -440,13 +440,8 @@ public: _DUNE_GDT_SPACES_BLOCK_BIND_YASP(_m, _s_type, _s_backend, _p) -#if HAVE_DUNE_FEM -#define _DUNE_GDT_SPACES_BLOCK_BIND_FEM(_m) _DUNE_GDT_SPACES_BLOCK_BIND_ALL_GRIDS(_m, dg, fem, 1) -#else -#define _DUNE_GDT_SPACES_BLOCK_BIND_FEM(_m) -#endif - -#define DUNE_GDT_SPACES_BLOCK_BIND(_m) _DUNE_GDT_SPACES_BLOCK_BIND_FEM(_m) +#define DUNE_GDT_SPACES_BLOCK_BIND(_m) _DUNE_GDT_SPACES_BLOCK_BIND_ALL_GRIDS(_m, dg, gdt, 1) +#define _DUNE_GDT_SPACES_BLOCK_BIND_FEM(_m) _DUNE_GDT_SPACES_BLOCK_BIND_ALL_GRIDS(_m, dg, gdt, 1) // end: this is what we need for the .so diff --git a/dune/gdt/playground/spaces/block.hh b/dune/gdt/playground/spaces/block.hh index 0cb1d8c166c217f39255e4d5e278f91439474926..3c5beaf15a2974c50df20a4889c8ce7da0acceaa 100644 --- a/dune/gdt/playground/spaces/block.hh +++ b/dune/gdt/playground/spaces/block.hh @@ -47,13 +47,13 @@ public: typedef std::vector<std::shared_ptr<const LocalSpaceType>> BackendType; typedef BlockMapper<LocalSpaceType> MapperType; typedef typename LocalSpaceType::BaseFunctionSetType BaseFunctionSetType; - typedef typename DdSubdomainsGridType::GlobalGridPartType GridLayerType; + typedef typename DdSubdomainsGridType::GlobalGridViewType GridLayerType; typedef typename LocalSpaceType::RangeFieldType RangeFieldType; - static const XT::Grid::Backends layer_backend = XT::Grid::Backends::part; + static const XT::Grid::Backends layer_backend = XT::Grid::Backends::view; static const constexpr Backends backend_type{Backends::gdt}; using DofCommunicationChooserType = DofCommunicationChooser<GridLayerType, true>; - using DofCommunicatorType = typename DofCommunicationChooserType::type; + using DofCommunicatorType = typename DofCommunicationChooserType::Type; static const bool needs_grid_view = false; }; // class BlockSpaceTraits @@ -85,7 +85,7 @@ public: typedef typename BaseType::PatternType PatternType; typedef typename BaseType::GridLayerType GridLayerType; typedef typename BaseType::EntityType EntityType; - typedef DofCommunicationChooser<GridLayerType, true> DofCommunicationChooserType; + typedef DofCommunicationChooser<GridLayerType> DofCommunicationChooserType; typedef typename DofCommunicationChooserType::Type DofCommunicatorType; typedef XT::Grid::DD::SubdomainGrid<typename XT::Grid::extract_grid<GridLayerType>::type> DdSubdomainsGridType; @@ -94,7 +94,7 @@ public: BlockSpace(const DdSubdomainsGridType& grid, const std::vector<std::shared_ptr<const LocalSpaceType>>& spaces) : dd_grid_(grid) , entity_to_subdomain_map_(dd_grid_.entityToSubdomainMap()) - , global_grid_part_(new GridLayerType(dd_grid_.globalGridPart())) + , global_grid_part_(new GridLayerType(dd_grid_.global_grid_view())) , local_spaces_(new std::vector<std::shared_ptr<const LocalSpaceType>>(spaces)) , mapper_(new MapperType(dd_grid_, global_grid_part_, local_spaces_)) , communicator_(Traits::DofCommunicationChooserType::create(*global_grid_part_)) diff --git a/dune/gdt/playground/spaces/cg/dune-fem-localfunctions-wrapper.hh b/dune/gdt/playground/spaces/cg/dune-fem-localfunctions-wrapper.hh deleted file mode 100644 index c63f82b7da9e47bd9733c472298de2f78a58d7b7..0000000000000000000000000000000000000000 --- a/dune/gdt/playground/spaces/cg/dune-fem-localfunctions-wrapper.hh +++ /dev/null @@ -1,266 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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 (2013 - 2017) -// Rene Milk (2014, 2016 - 2017) -// Tobias Leibner (2014) - -#ifndef DUNE_GDT_PLAYGROUND_SPACES_CG_DUNE_FEM_LOCALFUNCTIONS_WRAPPER_HH -#define DUNE_GDT_PLAYGROUND_SPACES_CG_DUNE_FEM_LOCALFUNCTIONS_WRAPPER_HH - -#include <memory> - -#include <dune/common/exceptions.hh> -#include <dune/common/deprecated.hh> - -#include <dune/geometry/referenceelements.hh> - -#include <dune/grid/common/capabilities.hh> - -#if HAVE_DUNE_FEM_LOCALFUNCTIONS -#include <dune/localfunctions/lagrange/equidistantpoints.hh> -#include <dune/localfunctions/lagrange.hh> - -#include <dune/fem_localfunctions/localfunctions/transformations.hh> -#include <dune/fem_localfunctions/basefunctions/genericbasefunctionsetstorage.hh> -#include <dune/fem_localfunctions/basefunctionsetmap/basefunctionsetmap.hh> -#include <dune/fem_localfunctions/space/genericdiscretefunctionspace.hh> -#endif // HAVE_DUNE_FEM_LOCALFUNCTIONS - -#include <dune/xt/common/type_traits.hh> - -#include <dune/gdt/spaces/mapper/dune-fem-wrapper.hh> -#include <dune/gdt/spaces/basefunctionset/dune-fem-localfunctions-wrapper.hh> -#include <dune/gdt/spaces/cg/interface.hh> - -namespace Dune { -namespace GDT { - -#if HAVE_DUNE_FEM_LOCALFUNCTIONS - - -// forward, to be used in the traits and to allow for specialization -template <class GridPartImp, int polynomialOrder, class RangeFieldImp, size_t rangeDim, size_t rangeDimCols = 1> -class DuneFemLocalfunctionsCgSpaceWrapper -{ - static_assert(Dune::AlwaysFalse<GridPartImp>::value, "Untested for these dimensions!"); -}; - - -template <class GridPartImp, int polynomialOrder, class RangeFieldImp, size_t rangeDim, size_t rangeDimCols> -class DuneFemLocalfunctionsCgSpaceWrapperTraits -{ -public: - typedef GridPartImp GridPartType; - typedef typename GridPartType::GridLayerType GridLayerType; - static const int polOrder = polynomialOrder; - static const bool continuous = true; - static_assert(polOrder >= 1, "Wrong polOrder given!"); - -private: - typedef typename GridPartType::ctype DomainFieldType; - static const size_t dimDomain = GridPartType::dimension; - -public: - typedef RangeFieldImp RangeFieldType; - typedef DuneFemLocalfunctionsCgSpaceWrapper<GridPartType, polOrder, RangeFieldType, rangeDim, rangeDimCols> - derived_type; - -private: - typedef typename GridPartType::GridType GridType; - static_assert(dimDomain == 1 || Dune::Capabilities::hasSingleGeometryType<GridType>::v, - "This space is only implemented for fully simplicial grids!"); - static_assert(dimDomain == 1 || (Dune::Capabilities::hasSingleGeometryType<GridType>::topologyId - == GenericGeometry::SimplexTopology<dimDomain>::type::id), - "This space is only implemented for fully simplicial grids!"); - typedef DuneFemLocalfunctionsCgSpaceWrapperTraits<GridPartType, polOrder, RangeFieldType, rangeDim, rangeDimCols> - ThisType; - -public: - typedef Dune::LagrangeLocalFiniteElement<Dune::EquidistantPointSet, dimDomain, DomainFieldType, RangeFieldType> - FiniteElementType; - -private: - typedef Dune::FemLocalFunctions::BaseFunctionSetMap<GridPartType, - FiniteElementType, - Dune::FemLocalFunctions::NoTransformation, - Dune::FemLocalFunctions::SimpleStorage, - polOrder, - polOrder> - BaseFunctionSetMapType; - -public: - typedef Dune::FemLocalFunctions::DiscreteFunctionSpace<BaseFunctionSetMapType> BackendType; - typedef Mapper::FemDofWrapper<typename BackendType::MapperType> MapperType; - typedef BaseFunctionSet::DuneFemLocalfunctionsWrapper<BaseFunctionSetMapType, - DomainFieldType, - dimDomain, - RangeFieldType, - rangeDim, - rangeDimCols> - BaseFunctionSetType; - typedef typename BaseFunctionSetType::EntityType EntityType; - static const XT::Grid::Backends layer_backend = XT::Grid::Backends::part; - static const bool needs_grid_view = false; - typedef XT::SequentialCommunicationType DofCommunicatorType; - -private: - template <class G, int p, class R, size_t r, size_t rC> - friend class DuneFemLocalfunctionsCgSpaceWrapper; -}; // class DuneFemLocalfunctionsCgSpaceWrapperTraits - - -template <class GridPartImp, int polynomialOrder, class RangeFieldImp> -class DuneFemLocalfunctionsCgSpaceWrapper<GridPartImp, polynomialOrder, RangeFieldImp, 1, 1> - : public CgSpaceInterface<DuneFemLocalfunctionsCgSpaceWrapperTraits<GridPartImp, - polynomialOrder, - RangeFieldImp, - 1, - 1>, - GridPartImp::dimension, - RangeFieldImp, - 1, - 1> -{ - typedef CgSpaceInterface<DuneFemLocalfunctionsCgSpaceWrapperTraits<GridPartImp, polynomialOrder, RangeFieldImp, 1, 1>, - GridPartImp::dimension, - RangeFieldImp, - 1, - 1> - BaseType; - typedef DuneFemLocalfunctionsCgSpaceWrapper<GridPartImp, polynomialOrder, RangeFieldImp, 1, 1> ThisType; - -public: - typedef DuneFemLocalfunctionsCgSpaceWrapperTraits<GridPartImp, polynomialOrder, RangeFieldImp, 1, 1> Traits; - - typedef typename Traits::GridPartType GridPartType; - typedef typename Traits::GridLayerType GridLayerType; - static const int polOrder = Traits::polOrder; - typedef typename GridPartType::ctype DomainFieldType; - static const size_t dimDomain = BaseType::dimension; - -private: - static_assert(GridPartType::dimension == dimDomain, "Dimension of GridPart has to match dimDomain"); - -public: - typedef FieldVector<DomainFieldType, dimDomain> DomainType; - typedef typename Traits::RangeFieldType RangeFieldType; - static const size_t dimRange = BaseType::dimRange; - static const size_t dimRangeCols = BaseType::dimRangeCols; - - typedef typename Traits::BackendType BackendType; - typedef typename Traits::MapperType MapperType; - typedef typename Traits::BaseFunctionSetType BaseFunctionSetType; - typedef typename Traits::EntityType EntityType; - - typedef Dune::XT::LA::SparsityPatternDefault PatternType; - using typename BaseType::DomainType; - using typename BaseType::BoundaryInfoType; - -private: - typedef typename Traits::BaseFunctionSetMapType BaseFunctionSetMapType; - -public: - DuneFemLocalfunctionsCgSpaceWrapper(GridPartType gridP) - : gridPart_(gridP) - , gridView_(gridPart_.gridView())) - , baseFunctionSetMap_(gridPart_) - , backend_(const_cast< GridPartType& >(gridPart_), baseFunctionSetMap_) - , mapper_(backend_->mapper()) - , tmp_global_indices_(mapper_->maxNumDofs()) - , communicator_(0.0) - { - } - - DuneFemLocalfunctionsCgSpaceWrapper(const ThisType& other) = default; - - ThisType& operator=(const ThisType& other) - { - if (this != &other) { - gridPart_ = other.gridPart_; - gridView_ = other.gridView_; - baseFunctionSetMap_ = other.baseFunctionSetMap_; - backend_ = other.backend_; - mapper_ = other.mapper_; - tmp_global_indices_.resize(mapper_->maxNumDofs()); - } - return *this; - } - - const GridPartType& grid_part() const - { - return gridPart_; - } - - const GridLayerType& grid_layer() const - { - return gridView_; - } - - const BackendType& backend() const - { - return backend_; - } - - bool continuous() const - { - return true; - } - - const MapperType& mapper() const - { - return mapper_; - } - - std::vector<DomainType> lagrange_points(const EntityType& entity) const - { - return BaseType::lagrange_points_order_1(entity); - } - - std::set<size_t> local_dirichlet_DoFs(const EntityType& entity, const BoundaryInfoType& boundaryInfo) const - { - return BaseType::local_dirichlet_DoFs_order_1(entity, boundaryInfo); - } - - BaseFunctionSetType base_function_set(const EntityType& entity) const - { - return BaseFunctionSetType(baseFunctionSetMap_, entity); - } - - double& dof_communicator() const - { - return communicator_; - } - -private: - const GridPartType gridPart_; - const GridLayerType gridView_; - BaseFunctionSetMapType baseFunctionSetMap_; - const BackendType backend_; - const MapperType mapper_; - mutable Dune::DynamicVector<size_t> tmp_global_indices_; - mutable double communicator_; -}; // class DuneFemLocalfunctionsCgSpaceWrapper< ..., 1, 1 > - - -#else // HAVE_DUNE_FEM_LOCALFUNCTIONS - - -template <class GridPartImp, int polynomialOrder, class RangeFieldImp, size_t rangeDim, size_t rangeDimCols = 1> -class DuneFemLocalfunctionsCgSpaceWrapper -{ - static_assert(Dune::AlwaysFalse<GridPartImp>::value, "You are missing dune-fem-localfunctions!"); -}; - - -#endif // HAVE_DUNE_FEM_LOCALFUNCTIONS - - -} // namespace GDT -} // namespace Dune - -#endif // DUNE_GDT_PLAYGROUND_SPACES_CG_DUNE_FEM_LOCALFUNCTIONS_WRAPPER_HH diff --git a/dune/gdt/playground/spaces/dg/dune-fem-localfunctions-wrapper.hh b/dune/gdt/playground/spaces/dg/dune-fem-localfunctions-wrapper.hh deleted file mode 100644 index f8fbb70156963dd9eeb0503ff2d2c72242d84368..0000000000000000000000000000000000000000 --- a/dune/gdt/playground/spaces/dg/dune-fem-localfunctions-wrapper.hh +++ /dev/null @@ -1,253 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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 (2013 - 2017) -// Rene Milk (2014, 2016 - 2017) -// Tobias Leibner (2014) - -#ifndef DUNE_GDT_PLAYGROUND_SPACES_DG_DUNE_FEM_LOCALFUNCTIONS_WRAPPER_HH -#define DUNE_GDT_PLAYGROUND_SPACES_DG_DUNE_FEM_LOCALFUNCTIONS_WRAPPER_HH - -#include <dune/common/deprecated.hh> - -#include <dune/grid/common/capabilities.hh> - -#if HAVE_DUNE_FEM_LOCALFUNCTIONS -#include <dune/localfunctions/lagrange/equidistantpoints.hh> -#include <dune/localfunctions/lagrange.hh> - -#include <dune/fem_localfunctions/localfunctions/transformations.hh> -#include <dune/fem_localfunctions/basefunctions/genericbasefunctionsetstorage.hh> -#include <dune/fem_localfunctions/basefunctionsetmap/basefunctionsetmap.hh> -#include <dune/fem_localfunctions/space/genericdiscretefunctionspace.hh> -#endif // HAVE_DUNE_FEM_LOCALFUNCTIONS - -#include <dune/xt/common/color.hh> -#include <dune/xt/common/type_traits.hh> - -#include <dune/gdt/spaces/mapper/dune-fem-wrapper.hh> -#include <dune/gdt/spaces/basefunctionset/dune-fem-localfunctions-wrapper.hh> -#include <dune/gdt/spaces/constraints.hh> -#include <dune/gdt/spaces/interface.hh> - -namespace Dune { -namespace GDT { - -#if HAVE_DUNE_FEM_LOCALFUNCTIONS - - -// forward, to be used in the traits and to allow for specialization -template <class GridPartImp, int polynomialOrder, class RangeFieldImp, size_t rangeDim, size_t rangeDimCols = 1> -class DuneFemLocalfunctionsDgSpaceWrapper -{ - static_assert(rangeDim == 1 && rangeDimCols == 1, "Not yet implemented (find suitable vector valued basis)!"); - static_assert(Dune::AlwaysFalse<GridPartImp>::value, "Untested for these dimensions!"); -}; - - -template <class GridPartImp, int polynomialOrder, class RangeFieldImp, size_t rangeDim, size_t rangeDimCols> -class DuneFemLocalfunctionsDgSpaceWrapperTraits -{ - static_assert(polynomialOrder >= 1, "Wrong polOrder given!"); - static_assert(rangeDim == 1, "Not yet implemented (find suitable vector valued basis)!"); - static_assert(rangeDimCols == 1, "Not yet implemented (find suitable vector valued basis)!"); - -public: - typedef GridPartImp GridPartType; - typedef typename GridPartType::GridLayerType GridLayerType; - static const int polOrder = polynomialOrder; - static const bool continuous = false; - -private: - typedef typename GridPartType::ctype DomainFieldType; - static const size_t dimDomain = GridPartType::dimension; - typedef typename GridPartType::GridType GridType; - static_assert(dimDomain == 1 || Dune::Capabilities::hasSingleGeometryType<GridType>::v, - "This space is only implemented for fully simplicial grids!"); - static_assert(dimDomain == 1 || (Dune::Capabilities::hasSingleGeometryType<GridType>::topologyId - == GenericGeometry::SimplexTopology<dimDomain>::type::id), - "This space is only implemented for fully simplicial grids!"); - -public: - typedef RangeFieldImp RangeFieldType; - typedef DuneFemLocalfunctionsDgSpaceWrapper<GridPartType, polOrder, RangeFieldType, rangeDim, rangeDimCols> - derived_type; - typedef Dune::LagrangeLocalFiniteElement<Dune::EquidistantPointSet, dimDomain, DomainFieldType, RangeFieldType> - ContinuousFiniteElementType; - typedef Dune::DGLocalFiniteElement<ContinuousFiniteElementType> FiniteElementType; - -private: - typedef Dune::FemLocalFunctions::BaseFunctionSetMap<GridPartType, - FiniteElementType, - Dune::FemLocalFunctions::NoTransformation, - Dune::FemLocalFunctions::SimpleStorage, - polOrder, - polOrder> - BaseFunctionSetMapType; - -public: - typedef Dune::FemLocalFunctions::DiscreteFunctionSpace<BaseFunctionSetMapType> BackendType; - typedef Mapper::FemDofWrapper<typename BackendType::MapperType> MapperType; - typedef BaseFunctionSet::DuneFemLocalfunctionsWrapper<BaseFunctionSetMapType, - DomainFieldType, - dimDomain, - RangeFieldType, - rangeDim, - rangeDimCols> - BaseFunctionSetType; - typedef typename BaseFunctionSetType::EntityType EntityType; - static const XT::Grid::Backends layer_backend = XT::Grid::Backends::part; - static const bool needs_grid_view = false; - typedef double DofCommunicatorType; - -private: - template <class G, int p, class R, size_t r, size_t rC> - friend class DuneFemLocalfunctionsDgSpaceWrapper; -}; // class DuneFemLocalfunctionsDgSpaceWrapperTraits - - -template <class GridPartImp, int polynomialOrder, class RangeFieldImp> -class DuneFemLocalfunctionsDgSpaceWrapper<GridPartImp, polynomialOrder, RangeFieldImp, 1, 1> - : public SpaceInterface<DuneFemLocalfunctionsDgSpaceWrapperTraits<GridPartImp, - polynomialOrder, - RangeFieldImp, - 1, - 1>, - typename GridPartImp::dimension, - 1, - 1> -{ - typedef SpaceInterface<DuneFemLocalfunctionsDgSpaceWrapperTraits<GridPartImp, polynomialOrder, RangeFieldImp, 1, 1>, - typename GridPartImp::dimension, - 1, - 1> - BaseType; - typedef DuneFemLocalfunctionsDgSpaceWrapper<GridPartImp, polynomialOrder, RangeFieldImp, 1, 1> ThisType; - -public: - typedef DuneFemLocalfunctionsDgSpaceWrapperTraits<GridPartImp, polynomialOrder, RangeFieldImp, 1, 1> Traits; - - typedef typename Traits::GridPartType GridPartType; - typedef typename Traits::GridLayerType GridLayerType; - typedef typename GridPartType::ctype DomainFieldType; - static const int polOrder = Traits::polOrder; - static const size_t dimDomain = BaseType::dimDomain; - -private: - static_assert(GridPartType::dimension == dimDomain, "Dimension of GridPart has to match dimDomain"); - -public: - typedef typename Traits::RangeFieldType RangeFieldType; - static const size_t dimRange = BaseType::dimRange; - static const size_t dimRangeCols = BaseType::dimRangeCols; - - typedef typename Traits::BackendType BackendType; - typedef typename Traits::MapperType MapperType; - typedef typename Traits::BaseFunctionSetType BaseFunctionSetType; - typedef typename Traits::EntityType EntityType; - - typedef Dune::XT::LA::SparsityPatternDefault PatternType; - -private: - typedef typename Traits::BaseFunctionSetMapType BaseFunctionSetMapType; - -public: - DuneFemLocalfunctionsDgSpaceWrapper(GridPartType gridP) - : gridPart_(gridP) - , gridView_(gridPart_->gridView()) - , baseFunctionSetMap_(gridPart_) - , backend_(const_cast<GridPartType&>(gridPart_), baseFunctionSetMap_) - , mapper_(backend_->mapper()) - , communicator_(0.0) - { - } - - DuneFemLocalfunctionsDgSpaceWrapper(const ThisType& other) = default; - - ThisType& operator=(const ThisType& other) - { - if (this != &other) { - gridPart_ = other.gridPart_; - gridView_ = other.gridView_; - baseFunctionSetMap_ = other.baseFunctionSetMap_; - backend_ = other.backend_; - mapper_ = other.mapper_; - } - return *this; - } - - const GridPartType& grid_part() const - { - return gridPart_; - } - - const GridLayerType& grid_layer() const - { - return gridView_; - } - - const BackendType& backend() const - { - return backend_; - } - - const MapperType& mapper() const - { - return mapper_; - } - - BaseFunctionSetType base_function_set(const EntityType& entity) const - { - return BaseFunctionSetType(baseFunctionSetMap_, entity); - } - - template <class R> - void local_constraints(const EntityType& /*entity*/, Constraints::LocalDefault<R>& /*ret*/) const - { - static_assert(Dune::AlwaysFalse<R>::value, "Not implemented for arbitrary constraints!"); - } - - using BaseType::compute_pattern; - - template <class G, class S> - PatternType compute_pattern(const GridView<G>& local_grid_layer, const SpaceInterface<S>& ansatz_space) const - { - return BaseType::compute_face_and_volume_pattern(local_grid_layer, ansatz_space); - } - - double& dof_communicator() const - { - return communicator_; - } - -private: - const GridPartType gridPart_; - const GridLayerType gridView_; - BaseFunctionSetMapType baseFunctionSetMap_; - const BackendType backend_; - const MapperType mapper_; - mutable double communicator_; -}; // class DuneFemLocalfunctionsDgSpaceWrapper< ..., 1, 1 > - - -#else // HAVE_DUNE_FEM_LOCALFUNCTIONS - - -template <class GridPartImp, int polynomialOrder, class RangeFieldImp, size_t rangeDim, size_t rangeDimCols = 1> -class DuneFemLocalfunctionsDgSpaceWrapper -{ - static_assert(Dune::AlwaysFalse<GridPartImp>::value, "You are missing dune-fem-localfunctions!"); -}; - - -#endif // HAVE_DUNE_FEM_LOCALFUNCTIONS - - -} // namespace GDT -} // namespace Dune - -#endif // DUNE_GDT_PLAYGROUND_SPACES_DG_DUNE_FEM_LOCALFUNCTIONS_WRAPPER_HH diff --git a/dune/gdt/playground/spaces/dg/dune-functions-wrapper.hh b/dune/gdt/playground/spaces/dg/dune-functions-wrapper.hh deleted file mode 100644 index e542dc9f1ae457f42e7b3ae99f5199214659990b..0000000000000000000000000000000000000000 --- a/dune/gdt/playground/spaces/dg/dune-functions-wrapper.hh +++ /dev/null @@ -1,160 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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) -// Rene Milk (2017 - 2018) - -#ifndef DUNE_GDT_PLAYGROUND_SPACES_DG_DUNE_FUNCTIONS_WRAPPER_HH -#define DUNE_GDT_PLAYGROUND_SPACES_DG_DUNE_FUNCTIONS_WRAPPER_HH - -#include <dune/common/typetraits.hh> - -#if HAVE_DUNE_FUNCTIONS -#include <dune/functions/functionspacebases/lagrangedgbasis.hh> -#endif - -#include <dune/xt/grid/type_traits.hh> - -#include <dune/gdt/spaces/interface.hh> -#include <dune/gdt/playground/spaces/mapper/dune-functions-wrapper.hh> -#include <dune/gdt/playground/spaces/basefunctionset/dune-functions-wrapper.hh> - -namespace Dune { -namespace GDT { - -#if HAVE_DUNE_FUNCTIONS - - -// forward, to be used in the traits and to allow for specialization -template <class GL, int p, class R, size_t r, size_t rC = 1> -class DuneFunctionsDgSpaceWrapper -{ - static_assert(Dune::AlwaysFalse<GL>::value, "Untested for these dimensions!"); -}; - - -namespace internal { - - -template <class GL, int p, class R, size_t r, size_t rC> -class DuneFunctionsDgSpaceWrapperTraits -{ - static_assert(XT::Grid::is_view<GL>::value, "We Probably need to use TemporaryGridView from dune-xt-grid!"); - -public: - typedef DuneFunctionsDgSpaceWrapper<GL, p, R, r, rC> derived_type; - static const int polOrder = p; - static const bool continuous = false; - static const XT::Grid::Backends layer_backend = XT::Grid::extract_layer_backend<GL>::value; - typedef Functions::LagrangeDGBasis<GL, p> BackendType; - typedef DuneFunctionsMapperWrapper<GL, p, R, r, rC> MapperType; - typedef DuneFunctionsBaseFunctionSetWrapper<GL, p, R, r, rC> BaseFunctionSetType; - typedef double DofCommunicatorType; - typedef GL GridLayerType; - typedef R RangeFieldType; - static const constexpr Backends backend_type{Backends::functions}; -}; // class DuneFunctionsDgSpaceWrapperTraits - - -} // namespace internal - - -template <class GL, int p, class R> -class DuneFunctionsDgSpaceWrapper<GL, p, R, 1, 1> - : public SpaceInterface<internal::DuneFunctionsDgSpaceWrapperTraits<GL, p, R, 1, 1>, GL::dimension, 1, 1> -{ - typedef DuneFunctionsDgSpaceWrapper<GL, p, R, 1, 1> ThisType; - typedef SpaceInterface<internal::DuneFunctionsDgSpaceWrapperTraits<GL, p, R, 1, 1>, GL::dimension, 1, 1> BaseType; - -public: - typedef internal::DuneFunctionsDgSpaceWrapperTraits<GL, p, R, 1, 1> Traits; - - using typename BaseType::BackendType; - using typename BaseType::BaseFunctionSetType; - using typename BaseType::DofCommunicatorType; - using typename BaseType::EntityType; - using typename BaseType::GridLayerType; - using typename BaseType::MapperType; - using typename BaseType::PatternType; - - DuneFunctionsDgSpaceWrapper(GridLayerType grd_layr) - : grid_layer_(new GridLayerType(grd_layr)) - , backend_(new BackendType(*grid_layer_)) - , mapper_(new MapperType(backend_)) - , communicator_(new DofCommunicatorType(0.)) - { - } - - DuneFunctionsDgSpaceWrapper(const ThisType& other) = default; - DuneFunctionsDgSpaceWrapper(ThisType&& source) = default; - - ThisType& operator=(const ThisType& other) = delete; - ThisType& operator=(ThisType&& source) = delete; - - const GridLayerType& grid_layer() const - { - return *grid_layer_; - } - - GridLayerType& grid_layer() - { - return *grid_layer_; - } - - const BackendType& backend() const - { - return *backend_; - } - - const MapperType& mapper() const - { - return *mapper_; - } - - BaseFunctionSetType base_function_set(const EntityType& entity) const - { - return BaseFunctionSetType(backend_, entity); - } - - using BaseType::compute_pattern; - - template <class G, class S, size_t d, size_t r, size_t rC> - typename std::enable_if<XT::Grid::is_layer<G>::value, PatternType>::type - compute_pattern(const G& grd_layr, const SpaceInterface<S, d, r, rC>& ansatz_space) const - { - return this->compute_face_and_volume_pattern(grd_layr, ansatz_space); - } - - DofCommunicatorType& dof_communicator() const - { - return *communicator_; - } - -private: - std::shared_ptr<GridLayerType> grid_layer_; - const std::shared_ptr<const BackendType> backend_; - const std::shared_ptr<const MapperType> mapper_; - mutable std::shared_ptr<DofCommunicatorType> communicator_; -}; // class DuneFunctionsDgSpaceWrapper - - -#else // HAVE_DUNE_FUNCTIONS - - -template <class GL, int p, class R, size_t r, size_t rC = 1> -class DuneFunctionsDgSpaceWrapper -{ - static_assert(Dune::AlwaysFalse<GL>::value, "You are missing dune-functions!"); -}; - - -#endif // HAVE_DUNE_FUNCTIONS - -} // namespace GDT -} // namespace Dune - -#endif // DUNE_GDT_PLAYGROUND_SPACES_DG_DUNE_FUNCTIONS_WRAPPER_HH diff --git a/dune/gdt/playground/spaces/dg/dune-pdelab-wrapper.hh b/dune/gdt/playground/spaces/dg/dune-pdelab-wrapper.hh deleted file mode 100644 index 3e2106e8a0d169982b091555614febb3fdcd74ba..0000000000000000000000000000000000000000 --- a/dune/gdt/playground/spaces/dg/dune-pdelab-wrapper.hh +++ /dev/null @@ -1,406 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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 (2014 - 2017) -// Rene Milk (2014, 2016 - 2018) -// Tobias Leibner (2014, 2016 - 2017) - -#ifndef DUNE_GDT_PLAYGROUND_SPACES_DG_DUNE_PDELAB_WRAPPER_HH -#define DUNE_GDT_PLAYGROUND_SPACES_DG_DUNE_PDELAB_WRAPPER_HH - -#include <memory> -#include <tuple> - -#include <dune/common/fvector.hh> -#include <dune/common/deprecated.hh> - -#include <dune/geometry/type.hh> - -#if HAVE_DUNE_PDELAB -#include <dune/pdelab/finiteelementmap/qkdg.hh> -#include <dune/pdelab/gridfunctionspace/gridfunctionspace.hh> -#include <dune/pdelab/constraints/conforming.hh> -#endif // HAVE_DUNE_PDELAB - -#include <dune/xt/common/tuple.hh> -#include <dune/xt/common/type_traits.hh> -#include <dune/xt/la/container/istl.hh> -#include <dune/xt/grid/type_traits.hh> -#include <dune/xt/grid/grids.hh> - -#include <dune/gdt/spaces/interface.hh> -#include <dune/gdt/spaces/parallel.hh> -#include <dune/gdt/spaces/dg/interface.hh> -#include <dune/gdt/spaces/basefunctionset/dune-pdelab-wrapper.hh> -#include <dune/gdt/playground/spaces/mapper/dune-pdelab-wrapper.hh> - -namespace Dune { -namespace GDT { - -#if HAVE_DUNE_PDELAB - - -// forward, to be used in the traits and to allow for specialization -template <class GridLayerImp, int polynomialOrder, class RangeFieldImp, size_t rangeDim, size_t rangeDimCols = 1> -class DunePdelabDgSpaceWrapper -{ - static_assert(Dune::AlwaysFalse<GridLayerImp>::value, "Untested for this combination of dimensions!"); -}; - - -// forward, to be used in the traits and to allow for specialization -template <class GridLayerImp, int polynomialOrder, class RangeFieldImp, size_t rangeDim, size_t rangeDimCols = 1> -class DunePdelabDgProductSpaceWrapper -{ - static_assert(Dune::AlwaysFalse<GridLayerImp>::value, "Untested for these dimensions!"); -}; - - -namespace internal { - - -template <class GridLayerImp, int polynomialOrder, class RangeFieldImp, size_t rangeDim, size_t rangeDimCols = 1> -class DunePdelabDgSpaceWrapperTraits -{ -public: - typedef DunePdelabDgSpaceWrapper<GridLayerImp, polynomialOrder, RangeFieldImp, rangeDim, rangeDimCols> derived_type; - typedef GridLayerImp GridLayerType; - static const int polOrder = polynomialOrder; - static const bool continuous = false; - static const constexpr Backends backend_type{Backends::pdelab}; - -private: - typedef typename GridLayerType::ctype DomainFieldType; - static const size_t dimDomain = GridLayerType::dimension; - -public: - typedef RangeFieldImp RangeFieldType; - -private: - template <class G, bool single_geom, bool is_simplex, bool is_cube> - struct FeMap - { - static_assert(single_geom, "This space is only implemented for grids with a single geometry type!"); - static_assert(is_simplex != is_cube, - "This space is only implemented for either fully simplicial or fully cubic grids!"); - using Type = PDELab::QkDGLocalFiniteElementMap<DomainFieldType, RangeFieldType, polOrder, dimDomain>; - }; - using GridType = XT::Grid::extract_grid_t<GridLayerType>; - static const bool single_geom_ = Dune::Capabilities::hasSingleGeometryType<GridType>::v; - static const bool simplicial_ = - (Dune::Capabilities::hasSingleGeometryType<GridType>::topologyId == Impl::SimplexTopology<dimDomain>::type::id); - static const bool cubic_ = - (Dune::Capabilities::hasSingleGeometryType<GridType>::topologyId == Impl::CubeTopology<dimDomain>::type::id); - typedef typename FeMap<GridType, single_geom_, simplicial_, cubic_>::Type FEMapType; - -public: - typedef PDELab::GridFunctionSpace<GridLayerType, FEMapType, PDELab::OverlappingConformingDirichletConstraints> - BackendType; - typedef DunePdelabDgMapperWrapper<BackendType> MapperType; - using EntityType = XT::Grid::extract_entity_t<GridLayerType>; - typedef BaseFunctionSet:: - DunePdelabWrapper<BackendType, EntityType, DomainFieldType, dimDomain, RangeFieldType, rangeDim, rangeDimCols> - BaseFunctionSetType; - static const XT::Grid::Backends layer_backend = XT::Grid::Backends::view; - static const bool needs_grid_view = true; - typedef DofCommunicationChooser<GridLayerType> DofCommunicationChooserType; - typedef typename DofCommunicationChooserType::Type DofCommunicatorType; - -private: - friend class DunePdelabDgSpaceWrapper<GridLayerImp, polynomialOrder, RangeFieldImp, rangeDim, rangeDimCols>; -}; // class DunePdelabDgSpaceWrapperTraits - - -template <class GridLayerImp, int polynomialOrder, class RangeFieldImp, size_t rangeDim, size_t rangeDimCols> -class DunePdelabDgProductSpaceWrapperTraits - : public DunePdelabDgSpaceWrapperTraits<GridLayerImp, polynomialOrder, RangeFieldImp, rangeDim, rangeDimCols> -{ - typedef DunePdelabDgSpaceWrapperTraits<GridLayerImp, polynomialOrder, RangeFieldImp, rangeDim, rangeDimCols> BaseType; - -public: - typedef DunePdelabDgProductSpaceWrapper<GridLayerImp, polynomialOrder, RangeFieldImp, rangeDim, rangeDimCols> - derived_type; - using typename BaseType::GridLayerType; - static const int polOrder = BaseType::polOrder; - static const size_t dimDomain = GridLayerType::dimension; - static const size_t dimRange = rangeDim; - static const size_t dimRangeCols = rangeDimCols; - using typename BaseType::BackendType; - using typename BaseType::EntityType; - using typename BaseType::RangeFieldType; - typedef ProductDgMapper<BackendType, rangeDim, rangeDimCols> MapperType; - using BaseType::layer_backend; - using BaseType::needs_grid_view; - - typedef typename Dune::GDT::DunePdelabDgSpaceWrapper<GridLayerType, polOrder, RangeFieldType, 1, dimRangeCols> - FactorSpaceType; - typedef typename Dune::XT::Common::make_identical_tuple<FactorSpaceType, dimRange>::type SpaceTupleType; -}; - - -} // namespace internal - - -template <class GridLayerImp, int polynomialOrder, class RangeFieldImp> -class DunePdelabDgSpaceWrapper<GridLayerImp, polynomialOrder, RangeFieldImp, 1, 1> - : public DgSpaceInterface<internal:: - DunePdelabDgSpaceWrapperTraits<GridLayerImp, polynomialOrder, RangeFieldImp, 1, 1>, - GridLayerImp::dimension, - 1, - 1> -{ - typedef DunePdelabDgSpaceWrapper<GridLayerImp, polynomialOrder, RangeFieldImp, 1, 1> ThisType; - typedef DgSpaceInterface<internal::DunePdelabDgSpaceWrapperTraits<GridLayerImp, polynomialOrder, RangeFieldImp, 1, 1>, - GridLayerImp::dimension, - 1, - 1> - BaseType; - -public: - using typename BaseType::Traits; - - using typename BaseType::GridLayerType; - using typename BaseType::BackendType; - using typename BaseType::MapperType; - using typename BaseType::EntityType; - using typename BaseType::BaseFunctionSetType; - -private: - typedef typename Traits::DofCommunicationChooserType DofCommunicationChooserType; - typedef typename Traits::FEMapType FEMapType; - -public: - using typename BaseType::DofCommunicatorType; - - DunePdelabDgSpaceWrapper(GridLayerType grd_vw) - : grid_layer_(grd_vw) - , fe_map_() - , backend_(grid_layer_, fe_map_) - , mapper_(backend_) - , communicator_(DofCommunicationChooser<GridLayerImp>::create(grid_layer_)) - , communicator_prepared_(false) - { - } - - /** - * \brief Copy ctor. - * \note Manually implemented bc of the std::mutex + communicator_ unique_ptr - */ - DunePdelabDgSpaceWrapper(const ThisType& other) - : grid_layer_(other.grid_layer_) - , fe_map_() - , backend_(grid_layer_, fe_map_) - , mapper_(backend_) - , communicator_(DofCommunicationChooser<GridLayerImp>::create(grid_layer_)) - , communicator_prepared_(false) - { - // make sure our new communicator is prepared if other's was - if (other.communicator_prepared_) - const auto& comm DUNE_UNUSED = this->dof_communicator(); - } - - /** - * \brief Move ctor. - * \note Manually implemented bc of the std::mutex. - */ - DunePdelabDgSpaceWrapper(ThisType&& source) - : grid_layer_(source.grid_layer_) - , fe_map_(source.fe_map_) - , backend_(source.backend_) - , mapper_(source.mapper_) - , communicator_(std::move(source.communicator_)) - , communicator_prepared_(source.communicator_prepared_) - { - } - - ThisType& operator=(const ThisType& other) = delete; - - ThisType& operator=(ThisType&& source) = delete; - - const GridLayerType& grid_layer() const - { - return grid_layer_; - } - - GridLayerType& grid_layer() - { - return grid_layer_; - } - - const BackendType& backend() const - { - return backend_; - } - - const MapperType& mapper() const - { - return mapper_; - } - - BaseFunctionSetType base_function_set(const EntityType& entity) const - { - return BaseFunctionSetType(backend_, entity); - } - - DofCommunicatorType& dof_communicator() const - { - DUNE_UNUSED std::lock_guard<std::mutex> gg(communicator_mutex_); - if (!communicator_prepared_) - communicator_prepared_ = DofCommunicationChooser<GridLayerType>::prepare(*this, *communicator_); - return *communicator_; - } // ... communicator(...) - -private: - GridLayerType grid_layer_; - const FEMapType fe_map_; - const BackendType backend_; - const MapperType mapper_; - mutable std::unique_ptr<DofCommunicatorType> communicator_; - mutable bool communicator_prepared_; - mutable std::mutex communicator_mutex_; -}; // class DunePdelabDgSpaceWrapper< ..., 1 > - - -template <class GridLayerImp, int polynomialOrder, class RangeFieldImp, size_t rangeDim> -class DunePdelabDgProductSpaceWrapper<GridLayerImp, polynomialOrder, RangeFieldImp, rangeDim, 1> - : public Dune::GDT::SpaceInterface<internal::DunePdelabDgProductSpaceWrapperTraits<GridLayerImp, - polynomialOrder, - RangeFieldImp, - rangeDim, - 1>, - GridLayerImp::dimension, - rangeDim, - 1>, - public Dune::GDT::ProductSpaceInterface<internal::DunePdelabDgProductSpaceWrapperTraits<GridLayerImp, - polynomialOrder, - RangeFieldImp, - rangeDim, - 1>, - GridLayerImp::dimension, - rangeDim, - 1> -{ - typedef DunePdelabDgProductSpaceWrapper<GridLayerImp, polynomialOrder, RangeFieldImp, rangeDim, 1> ThisType; - typedef typename Dune::GDT::SpaceInterface<internal::DunePdelabDgProductSpaceWrapperTraits<GridLayerImp, - polynomialOrder, - RangeFieldImp, - rangeDim, - 1>, - GridLayerImp::dimension, - rangeDim, - 1> - BaseType; - -public: - typedef typename internal:: - DunePdelabDgProductSpaceWrapperTraits<GridLayerImp, polynomialOrder, RangeFieldImp, rangeDim, 1> - Traits; - using typename BaseType::GridLayerType; - using typename BaseType::EntityType; - using typename BaseType::BaseFunctionSetType; - using typename BaseType::MapperType; - using typename BaseType::DofCommunicatorType; - using typename BaseType::BackendType; - using BaseType::dimDomain; - using BaseType::dimRange; - using BaseType::dimRangeCols; - typedef typename Traits::SpaceTupleType SpaceTupleType; - typedef typename Traits::FactorSpaceType FactorSpaceType; - - DunePdelabDgProductSpaceWrapper(GridLayerType grd_vw) - : grid_layer_(grd_vw) - , factor_space_(grid_layer_) - , factor_mapper_(factor_space_.backend()) - , communicator_(DofCommunicationChooser<GridLayerImp>::create(grid_layer_)) - , communicator_prepared_(false) - { - } - - DunePdelabDgProductSpaceWrapper(const ThisType& other) - : grid_layer_(other.grid_layer_) - , factor_space_(other.factor_space_) - , factor_mapper_(other.factor_mapper_) - , communicator_(DofCommunicationChooser<GridLayerImp>::create(grid_layer_)) - , communicator_prepared_(false) - { - // make sure our new communicator is prepared if other's was - if (other.communicator_prepared_) - const auto& comm DUNE_UNUSED = this->dof_communicator(); - } - - DunePdelabDgProductSpaceWrapper(ThisType&& source) = default; - - ThisType& operator=(const ThisType& other) = delete; - - ThisType& operator=(ThisType&& source) = delete; - - const GridLayerType& grid_layer() const - { - return grid_layer_; - } - - GridLayerType& grid_layer() - { - return grid_layer_; - } - - const BackendType& backend() const - { - return factor_space_.backend(); - } - - const MapperType& mapper() const - { - return factor_mapper_; - } - - BaseFunctionSetType base_function_set(const EntityType& entity) const - { - return BaseFunctionSetType(backend(), entity); - } - - DofCommunicatorType& dof_communicator() const - { - DUNE_UNUSED std::lock_guard<std::mutex> gg(communicator_mutex_); - if (!communicator_prepared_) - communicator_prepared_ = DofCommunicationChooser<GridLayerType>::prepare(*this, *communicator_); - return *communicator_; - } // ... communicator(...) - - template <size_t ii> - const FactorSpaceType& factor() const - { - return factor_space_; - } - -private: - GridLayerType grid_layer_; - const FactorSpaceType factor_space_; - const MapperType factor_mapper_; - mutable std::unique_ptr<DofCommunicatorType> communicator_; - mutable bool communicator_prepared_; - mutable std::mutex communicator_mutex_; -}; // class DefaultProduct< ..., 1 > - - -#else // HAVE_DUNE_PDELAB - - -template <class GridLayerImp, int polynomialOrder, class RangeFieldImp, size_t rangeDim, size_t rangeDimCols = 1> -class DunePdelabDgSpaceWrapper -{ - static_assert(Dune::AlwaysFalse<GridLayerImp>::value, "You are missing dune-pdelab!"); -}; - - -#endif // HAVE_DUNE_PDELAB - - -} // namespace GDT -} // namespace Dune - -#endif // DUNE_GDT_PLAYGROUND_SPACES_DG_DUNE_PDELAB_WRAPPER_HH diff --git a/dune/gdt/playground/spaces/mapper/block.hh b/dune/gdt/playground/spaces/mapper/block.hh index 52106eda8c02e041cfc9834a22430eadb56db57b..747edf41eff61d45e28e7f1c0be88161d31d373d 100644 --- a/dune/gdt/playground/spaces/mapper/block.hh +++ b/dune/gdt/playground/spaces/mapper/block.hh @@ -63,7 +63,7 @@ public: DdSubdomainsGridType; private: - typedef typename DdSubdomainsGridType::GlobalGridPartType GridLayerType; + typedef typename DdSubdomainsGridType::GlobalGridViewType GridLayerType; typedef typename DdSubdomainsGridType::EntityToSubdomainMapType EntityToSubdomainMapType; template <class L, class E> diff --git a/dune/gdt/playground/spaces/mapper/dune-functions-wrapper.hh b/dune/gdt/playground/spaces/mapper/dune-functions-wrapper.hh deleted file mode 100644 index 3dd0339516f40bdc03b09ebc82fe849f9948bbf2..0000000000000000000000000000000000000000 --- a/dune/gdt/playground/spaces/mapper/dune-functions-wrapper.hh +++ /dev/null @@ -1,155 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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) - -#ifndef DUNE_GDT_PLAYGROUND_SPACES_MAPPER_DUNE_FUNCTIONS_WRAPPER_HH -#define DUNE_GDT_PLAYGROUND_SPACES_MAPPER_DUNE_FUNCTIONS_WRAPPER_HH - -#include <dune/common/typetraits.hh> - -#if HAVE_DUNE_FUNCTIONS -#include <dune/functions/functionspacebases/lagrangedgbasis.hh> -#endif - -#include <dune/xt/grid/type_traits.hh> - -#include <dune/gdt/spaces/mapper/interfaces.hh> - -namespace Dune { -namespace GDT { - -#if HAVE_DUNE_FUNCTIONS - - -// forward, to be used in the traits and to allow for specialization -template <class GL, int p, class R, size_t r, size_t rC> -class DuneFunctionsMapperWrapper -{ - static_assert(Dune::AlwaysFalse<GL>::value, "Untested for these dimensions!"); -}; - - -namespace internal { - - -template <class GL, int p, class R, size_t r, size_t rC> -class DuneFunctionsMapperWrapperTraits -{ - static_assert(XT::Grid::is_view<GL>::value, "We Probably need to use TemporaryGridView from dune-xt-grid!"); - -public: - typedef DuneFunctionsMapperWrapper<GL, p, R, r, rC> derived_type; - typedef Functions::LagrangeDGBasis<GL, p> BackendType; - typedef typename XT::Grid::extract_entity<GL>::type EntityType; -}; - - -} // namespace internal - - -template <class GL, int p, class R> -class DuneFunctionsMapperWrapper<GL, p, R, 1, 1> - : public MapperInterface<internal::DuneFunctionsMapperWrapperTraits<GL, p, R, 1, 1>> -{ - typedef DuneFunctionsMapperWrapper<GL, p, R, 1, 1> ThisType; - typedef MapperInterface<internal::DuneFunctionsMapperWrapperTraits<GL, p, R, 1, 1>> BaseType; - -public: - typedef internal::DuneFunctionsMapperWrapperTraits<GL, p, R, 1, 1> Traits; - - using typename BaseType::BackendType; - using typename BaseType::EntityType; - - DuneFunctionsMapperWrapper(std::shared_ptr<const BackendType> bcknd) - : backend_(bcknd) - , max_num_dofs_(0) - { - auto local_view = backend_->localView(); - auto local_index_set = backend_->localIndexSet(); - for (auto&& entity : elements(backend_->gridView())) { - local_view.bind(entity); - local_index_set.bind(local_view); - max_num_dofs_ = std::max(max_num_dofs_, local_index_set.size()); - } - } - - DuneFunctionsMapperWrapper(const ThisType& other) = default; - DuneFunctionsMapperWrapper(ThisType&& source) = default; - - ThisType& operator=(const ThisType& other) = delete; - ThisType& operator=(ThisType&& source) = delete; - - const BackendType& backend() const - { - return *backend_; - } - - size_t size() const - { - return backend_->size(); - } - - size_t maxNumDofs() const - { - return max_num_dofs_; - } - - size_t numDofs(const EntityType& entity) const - { - auto local_view = backend_->localView(); - auto local_index_set = backend_->localIndexSet(); - local_view.bind(entity); - local_index_set.bind(local_view); - return local_index_set.size(); - } - - using BaseType::globalIndices; - - void globalIndices(const EntityType& entity, Dune::DynamicVector<size_t>& ret) const - { - auto local_view = backend_->localView(); - auto local_index_set = backend_->localIndexSet(); - local_view.bind(entity); - local_index_set.bind(local_view); - assert(ret.size() >= local_index_set.size()); - for (size_t ii = 0; ii < local_index_set.size(); ++ii) - ret[ii] = local_index_set.index(ii)[0]; - } - - size_t mapToGlobal(const EntityType& entity, const size_t& localIndex) const - { - auto local_view = backend_->localView(); - auto local_index_set = backend_->localIndexSet(); - local_view.bind(entity); - local_index_set.bind(local_view); - assert(localIndex < local_index_set.size()); - return local_index_set.index(localIndex)[0]; - } - -private: - const std::shared_ptr<const BackendType> backend_; - size_t max_num_dofs_; -}; // class DuneFunctionsMapperWrapper - - -#else // HAVE_DUNE_FUNCTIONS - - -template <class GL, int p, class R, size_t r, size_t rC = 1> -class DuneFunctionsMapperWrapper -{ - static_assert(Dune::AlwaysFalse<GL>::value, "You are missing dune-functions!"); -}; - - -#endif // HAVE_DUNE_FUNCTIONS - -} // namespace GDT -} // namespace Dune - -#endif // DUNE_GDT_PLAYGROUND_SPACES_MAPPER_DUNE_FUNCTIONS_WRAPPER_HH diff --git a/dune/gdt/playground/spaces/mapper/dune-pdelab-wrapper.hh b/dune/gdt/playground/spaces/mapper/dune-pdelab-wrapper.hh deleted file mode 100644 index 3c721925c7e166896ea10c76c5e8da3159de4554..0000000000000000000000000000000000000000 --- a/dune/gdt/playground/spaces/mapper/dune-pdelab-wrapper.hh +++ /dev/null @@ -1,169 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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 (2016 - 2017) -// Rene Milk (2016 - 2017) -// Tobias Leibner (2016) - -#ifndef DUNE_GDT_PLAYGROUND_SPACES_MAPPER_DUNE_PDELAB_WRAPPER_HH -#define DUNE_GDT_PLAYGROUND_SPACES_MAPPER_DUNE_PDELAB_WRAPPER_HH - -#include <dune/common/dynvector.hh> - -#include <dune/xt/common/debug.hh> -#include <dune/xt/common/type_traits.hh> - -#include <dune/gdt/spaces/mapper/interfaces.hh> -#include <dune/gdt/spaces/mapper/dune-pdelab-wrapper.hh> - -namespace Dune { -namespace GDT { - - -// forward -template <class PdelabSpaceImp, size_t rangeDim = 1, size_t rangeDimCols = 1> -class ProductDgMapper -{ - static_assert(AlwaysFalse<PdelabSpaceImp>::value, "Not available for these dimensions!"); -}; - - -namespace internal { - - -template <class PdelabSpaceImp, size_t rangeDim, size_t rangeDimCols> -class ProductDgMapperTraits -{ - static_assert(rangeDim >= 1, "Really?"); - static_assert(rangeDimCols >= 1, "Really?"); - -public: - typedef ProductDgMapper<PdelabSpaceImp, rangeDim, rangeDimCols> derived_type; - typedef PdelabSpaceImp BackendType; - typedef typename BackendType::Element EntityType; -}; - - -} // namespace internal - - -template <class PdelabSpaceImp, size_t rangeDim> -class ProductDgMapper<PdelabSpaceImp, rangeDim, 1> - : public ProductMapperInterface<internal::ProductDgMapperTraits<PdelabSpaceImp, rangeDim, 1>> -{ - typedef ProductMapperInterface<internal::ProductDgMapperTraits<PdelabSpaceImp, rangeDim, 1>> InterfaceType; - static const size_t dimRange = rangeDim; - -public: - typedef internal::ProductDgMapperTraits<PdelabSpaceImp, rangeDim, 1> Traits; - typedef typename Traits::BackendType BackendType; - typedef DunePdelabDgMapperWrapper<BackendType> FactorMapperType; - typedef typename Traits::EntityType EntityType; - - ProductDgMapper(const BackendType& pdelab_space) - : backend_(pdelab_space) - , factor_mapper_(pdelab_space) - { - } - - const BackendType& backend() const - { - return backend_; - } - - size_t size() const - { - return factor_mapper_.size() * dimRange; - } - - template <int cd, class GridImp, template <int, int, class> class EntityImp> - size_t numDofs(const Entity<cd, EntityType::dimension, GridImp, EntityImp>& entity) const - { - return dimRange * factor_mapper_.numDofs(entity); - } - - size_t maxNumDofs() const - { - return dimRange * factor_mapper_.maxNumDofs(); - } - - void globalIndices(const EntityType& entity, Dune::DynamicVector<size_t>& ret) const - { - if (ret.size() < numDofs(entity)) - ret.resize(numDofs(entity)); - const auto factor_num_dofs = factor_mapper_.numDofs(entity); - const auto factor_mapper_size = factor_mapper_.size(); - const auto factor_global_indices = factor_mapper_.globalIndices(entity); - for (size_t ii = 0; ii < dimRange; ++ii) { - const auto factor_num_dofs_times_ii = factor_num_dofs * ii; - const auto factor_mapper_size_times_ii = factor_mapper_size * ii; - for (size_t jj = 0; jj < factor_num_dofs; ++jj) { - ret[factor_num_dofs_times_ii + jj] = factor_global_indices[jj] + factor_mapper_size_times_ii; - } - } - } // ... globalIndices(...) - - size_t mapToGlobal(const EntityType& entity, const size_t& localIndex) const - { - assert(localIndex < numDofs(entity)); - size_t factor_index = 0; - const auto factor_mapper_num_dofs = factor_mapper_.numDofs(entity); - while (localIndex >= factor_mapper_num_dofs) { - localIndex -= factor_mapper_num_dofs; - ++factor_index; - } - return factor_mapper_.mapToGlobal(entity, localIndex) + factor_index * factor_mapper_.size(); - } - - using InterfaceType::globalIndices; - - size_t numDofs(const size_t /*factor_index*/, const EntityType& entity) const - { - return factor_mapper_.numDofs(entity); - } - - size_t maxNumDofs(const size_t /*factor_index*/) const - { - return factor_mapper_.maxNumDofs(); - } - - void globalIndices(const size_t factor_index, const EntityType& entity, Dune::DynamicVector<size_t>& ret) const - { - assert(factor_index < dimRange); - const auto factor_mapper_num_dofs = factor_mapper_.numDofs(entity); - if (ret.size() < factor_mapper_num_dofs) - ret.resize(factor_mapper_num_dofs); - const auto factor_mapper_size_times_factor_index = factor_mapper_.size() * factor_index; - const auto factor_mapper_global_indices = factor_mapper_.globalIndices(entity); - for (size_t jj = 0; jj < factor_mapper_num_dofs; ++jj) - ret[jj] = factor_mapper_global_indices[jj] + factor_mapper_size_times_factor_index; - } // ... globalIndices(...) - - size_t mapToGlobal(const size_t factor_index, const EntityType& entity, const size_t& local_index_in_factor) const - { - assert(local_index_in_factor < factor_mapper_.numDofs(entity)); - assert(factor_index < dimRange); - return factor_mapper_.mapToGlobal(entity, local_index_in_factor) + factor_index * factor_mapper_.size(); - } - - size_t mapToLocal(const size_t factor_index, const EntityType& entity, const size_t& local_index_in_factor) const - { - assert(local_index_in_factor < factor_mapper_.numDofs(entity)); - assert(factor_index < dimRange); - return factor_mapper_.numDofs(entity) * factor_index + local_index_in_factor; - } - -private: - const BackendType& backend_; - const FactorMapperType factor_mapper_; -}; // class ProductDgMapper< ..., rangeDim, 1 > - - -} // namespace GDT -} // namespace Dune - -#endif // DUNE_GDT_PLAYGROUND_SPACES_MAPPER_DUNE_PDELAB_WRAPPER_HH diff --git a/dune/gdt/playground/spaces/mapper/restricted.hh b/dune/gdt/playground/spaces/mapper/restricted.hh index 57a98d391ccb68d24b1354f1133e0b601943731b..adf6b0019eb284dcc87292b46ca8808bbf8f3398 100644 --- a/dune/gdt/playground/spaces/mapper/restricted.hh +++ b/dune/gdt/playground/spaces/mapper/restricted.hh @@ -81,8 +81,8 @@ public: map_to_unrestricted_[counter] = index; ++counter; } - if (map_to_restricted_.size() != map_to_unrestricted_.size()) - DUNE_THROW(InvalidStateException, "This should not happen!"); + DUNE_THROW_IF( + map_to_restricted_.size() != map_to_unrestricted_.size(), InvalidStateException, "This should not happen!"); } RestrictedMapper(const ThisType& other) = default; @@ -95,14 +95,14 @@ public: void restrict(const XT::LA::VectorInterface<U>& unrestricted_vector, XT::LA::VectorInterface<V>& restricted_vector) const { - if (unrestricted_vector.size() != backend().size()) - DUNE_THROW(XT::Common::Exceptions::shapes_do_not_match, - "unrestricted_vector.size() = " << unrestricted_vector.size() - << "\n unrestricted_space.mapper().size() = " - << backend().size()); - if (restricted_vector.size() != size()) - DUNE_THROW(XT::Common::Exceptions::shapes_do_not_match, - "restricted_vector.size() = " << restricted_vector.size() << "\n size() = " << size()); + DUNE_THROW_IF(unrestricted_vector.size() != backend().size(), + XT::Common::Exceptions::shapes_do_not_match, + "unrestricted_vector.size() = " << unrestricted_vector.size() + << "\n unrestricted_space.mapper().size() = " + << backend().size()); + DUNE_THROW_IF(restricted_vector.size() != size(), + XT::Common::Exceptions::shapes_do_not_match, + "restricted_vector.size() = " << restricted_vector.size() << "\n size() = " << size()); // the actual work for (size_t restricted_DoF = 0; restricted_DoF < map_to_unrestricted_.size(); ++restricted_DoF) restricted_vector[restricted_DoF] = unrestricted_vector[map_to_unrestricted_[restricted_DoF]]; @@ -120,14 +120,14 @@ public: void extend(const XT::LA::VectorInterface<U>& restricted_vector, XT::LA::VectorInterface<V>& unrestricted_vector) const { - if (restricted_vector.size() != size()) - DUNE_THROW(XT::Common::Exceptions::shapes_do_not_match, - "restricted_vector.size() = " << restricted_vector.size() << "\n size() = " << size()); - if (unrestricted_vector.size() != backend().size()) - DUNE_THROW(XT::Common::Exceptions::shapes_do_not_match, - "unrestricted_vector.size() = " << unrestricted_vector.size() - << "\n unrestricted_space.mapper().size() = " - << backend().size()); + DUNE_THROW_IF(restricted_vector.size() != size(), + XT::Common::Exceptions::shapes_do_not_match, + "restricted_vector.size() = " << restricted_vector.size() << "\n size() = " << size()); + DUNE_THROW_IF(unrestricted_vector.size() != backend().size(), + XT::Common::Exceptions::shapes_do_not_match, + "unrestricted_vector.size() = " << unrestricted_vector.size() + << "\n unrestricted_space.mapper().size() = " + << backend().size()); // the actual work unrestricted_vector *= 0.; for (size_t restricted_DoF = 0; restricted_DoF < map_to_unrestricted_.size(); ++restricted_DoF) @@ -159,9 +159,7 @@ public: size_t numDofs(const EntityType& entity) const { - const auto error_message = check_entity(entity); - if (error_message.size() > 0) - DUNE_THROW(restricted_space_error, error_message); + check_entity(entity); return backend().numDofs(entity); } @@ -169,9 +167,7 @@ public: void globalIndices(const EntityType& entity, DynamicVector<size_t>& ret) const { - const auto error_message = check_entity(entity); - if (error_message.size() > 0) - DUNE_THROW(restricted_space_error, error_message); + check_entity(entity); backend().globalIndices(entity, ret); for (size_t ii = 0; ii < numDofs(entity); ++ii) ret[ii] = map_to_restricted_.at(ret[ii]); @@ -179,25 +175,24 @@ public: size_t mapToGlobal(const EntityType& entity, const size_t& localIndex) const { - const auto error_message = check_entity(entity); - if (error_message.size() > 0) - DUNE_THROW(restricted_space_error, error_message); + check_entity(entity); return map_to_restricted_.at(backend().mapToGlobal(entity, localIndex)); } private: - std::string check_entity(const EntityType& entity) const + void check_entity(const EntityType& entity) const { - std::stringstream error_message; - if (!grid_layer_.indexSet().contains(entity)) { - if (unrestricted_space_.grid_layer().indexSet().contains(entity)) - error_message << "Entity not contained in restriction grid layer, but contained in the unrestricted grid layer " - "with index " - << unrestricted_space_.grid_layer().indexSet().index(entity) << "!"; - else - error_message << "Entity neither contained in restriction grid layer nor in the unrestricted grid layer!"; - } - return error_message.str(); + if (grid_layer_.indexSet().contains(entity)) + return; + if (unrestricted_space_.grid_layer().indexSet().contains(entity)) + DUNE_THROW(restricted_space_error, + "Entity not contained in restriction grid layer, but contained in the unrestricted grid layer " + << "with index " + << unrestricted_space_.grid_layer().indexSet().index(entity) + << "!"); + else + DUNE_THROW(restricted_space_error, + "Entity neither contained in restriction grid layer nor in the unrestricted grid layer!"); } // ... check_entity(...) const UnrestrictedSpace unrestricted_space_; diff --git a/dune/gdt/playground/spaces/restricted.hh b/dune/gdt/playground/spaces/restricted.hh index ece5929f9bc0ac61d778f50c430d89c7bca12efd..80ecaa4fa7d34abd1b0de9566d6f5e87c1d8d83c 100644 --- a/dune/gdt/playground/spaces/restricted.hh +++ b/dune/gdt/playground/spaces/restricted.hh @@ -69,6 +69,7 @@ public: typedef RestrictionGridLayer GridLayerType; typedef typename UnrestrictedSpace::RangeFieldType RangeFieldType; static const XT::Grid::Backends layer_backend = layer_backend_helper<>::value; + static constexpr const GDT::Backends backend_type{UnrestrictedSpace::backend_type}; }; // class RestrictedSpaceTraits @@ -131,9 +132,7 @@ public: BaseFunctionSetType base_function_set(const EntityType& entity) const { - const auto error_message = check_entity(entity); - if (error_message.size() > 0) - DUNE_THROW(restricted_space_error, error_message); + check_entity(entity); return unrestricted_space_.base_function_set(entity); } @@ -149,9 +148,7 @@ public: const EntityType& entity, ConstraintsInterface<C>& ret) const { - const auto error_message = check_entity(entity); - if (error_message.size() > 0) - DUNE_THROW(restricted_space_error, error_message); + check_entity(entity); return unrestricted_space_.local_constraints(ansatz_space, entity, ret); } @@ -168,18 +165,14 @@ public: template <class E> std::vector<DomainType> lagrange_points(const E& entity) const { - const auto error_message = check_entity(entity); - if (error_message.size() > 0) - DUNE_THROW(restricted_space_error, error_message); + check_entity(entity); return unrestricted_space_.lagrange_points(entity); } template <class E, class I> std::set<size_t> local_dirichlet_DoFs(const E& entity, const XT::Grid::BoundaryInfo<I>& boundaryInfo) const { - const auto error_message = check_entity(entity); - if (error_message.size() > 0) - DUNE_THROW(restricted_space_error, error_message); + check_entity(entity); return unrestricted_space_.local_dirichlet_DoFs(entity, boundaryInfo); } @@ -187,25 +180,25 @@ public: template <class E> std::vector<size_t> local_DoF_indices(const E& entity) const { - const auto error_message = check_entity(entity); - if (error_message.size() > 0) - DUNE_THROW(restricted_space_error, error_message); + check_entity(entity); return unrestricted_space_.local_DoF_indices(entity); } private: - std::string check_entity(const EntityType& entity) const + void check_entity(const EntityType& entity) const { - std::stringstream error_message; - if (!grid_layer_.indexSet().contains(entity)) { - if (unrestricted_space_.grid_layer().indexSet().contains(entity)) - error_message << "Entity not contained in restriction grid layer, but contained in the unrestricted grid layer " - "with index " - << unrestricted_space_.grid_layer().indexSet().index(entity) << "!"; - else - error_message << "Entity neither contained in restriction grid layer nor in the unrestricted grid layer!"; - } - return error_message.str(); + if (grid_layer_.indexSet().contains(entity)) + return; + if (unrestricted_space_.grid_layer().indexSet().contains(entity)) + DUNE_THROW(restricted_space_error, + "Entity not contained in restriction grid layer, but contained in the unrestricted grid layer " + << "with index " + << unrestricted_space_.grid_layer().indexSet().index(entity) + << "!"); + else + DUNE_THROW(restricted_space_error, + "Entity neither contained in restriction grid layer nor in the unrestricted grid layer!"); + } // ... check_entity(...) const UnrestrictedSpace unrestricted_space_; diff --git a/dune/gdt/projections.bindings.hh b/dune/gdt/projections.bindings.hh index ec28522ea733b3a91ef3b29adddffc5d9cbdc748..e8b532254b87b9e53f0f60eab87197f55a5e4b06 100644 --- a/dune/gdt/projections.bindings.hh +++ b/dune/gdt/projections.bindings.hh @@ -106,37 +106,12 @@ public: #define _DUNE_GDT_PROJECTIONS_BIND_DEFAULT(_m, _la) \ _DUNE_GDT_PROJECTIONS_BIND_ALL_GRIDS(_m, leaf, gdt, fv, 0, _la); \ - _DUNE_GDT_PROJECTIONS_BIND_ALL_GRIDS(_m, level, gdt, fv, 0, _la) - -#if HAVE_DUNE_FEM -#define _DUNE_GDT_PROJECTIONS_BIND_FEM(_m, _la) \ - _DUNE_GDT_PROJECTIONS_BIND_ALL_GRIDS(_m, leaf, fem, cg, 1, _la); \ - _DUNE_GDT_PROJECTIONS_BIND_ALL_GRIDS(_m, level, fem, cg, 1, _la); \ - _DUNE_GDT_PROJECTIONS_BIND_ALL_GRIDS(_m, dd_subdomain, fem, cg, 1, _la); \ - _DUNE_GDT_PROJECTIONS_BIND_ALL_GRIDS(_m, leaf, fem, dg, 1, _la); \ - _DUNE_GDT_PROJECTIONS_BIND_ALL_GRIDS(_m, level, fem, dg, 1, _la); \ - _DUNE_GDT_PROJECTIONS_BIND_ALL_GRIDS(_m, dd_subdomain, fem, dg, 1, _la) -#else -#define _DUNE_GDT_PROJECTIONS_BIND_FEM(_m, _la) -#endif + _DUNE_GDT_PROJECTIONS_BIND_ALL_GRIDS(_m, dd_subdomain, gdt, cg, 1, _la); \ + _DUNE_GDT_PROJECTIONS_BIND_ALL_GRIDS(_m, level, gdt, fv, 0, _la); \ + _DUNE_GDT_PROJECTIONS_BIND_ALL_GRIDS(_m, dd_subdomain, gdt, dg, 1, _la) -//#if HAVE_DUNE_FUNCTIONS -// ... -//#else -#define _DUNE_GDT_PROJECTIONS_BIND_FUNCTIONS(_m, _la) -//#endif - -//#if HAVE_DUNE_PDELAB -// ... -//#else -#define _DUNE_GDT_PROJECTIONS_BIND_PDELAB(_m, _la) -//#endif -#define _DUNE_GDT_PROJECTIONS_BIND_ALL_SPACES(_m, _la) \ - _DUNE_GDT_PROJECTIONS_BIND_DEFAULT(_m, _la); \ - _DUNE_GDT_PROJECTIONS_BIND_FEM(_m, _la); \ - _DUNE_GDT_PROJECTIONS_BIND_FUNCTIONS(_m, _la); \ - _DUNE_GDT_PROJECTIONS_BIND_PDELAB(_m, _la) +#define _DUNE_GDT_PROJECTIONS_BIND_ALL_SPACES(_m, _la) _DUNE_GDT_PROJECTIONS_BIND_DEFAULT(_m, _la); // for each la backend diff --git a/dune/gdt/projections/dirichlet.bindings.hh b/dune/gdt/projections/dirichlet.bindings.hh index 86c03e3735861583888b6659743b970217542a9f..38dba2bd2fbe7687f87895773df2b0280c3cd0ae 100644 --- a/dune/gdt/projections/dirichlet.bindings.hh +++ b/dune/gdt/projections/dirichlet.bindings.hh @@ -118,29 +118,14 @@ public: _DUNE_GDT_PROJECTIONS_DIRICHLET_BIND(_m, YASP_1D_EQUIDISTANT_OFFSET, _layer, _backend, 1, 1, _la); \ _DUNE_GDT_PROJECTIONS_DIRICHLET_BIND(_m, YASP_2D_EQUIDISTANT_OFFSET, _layer, _backend, 1, 1, _la) -#if HAVE_DUNE_FEM -#define _DUNE_GDT_PROJECTIONS_DIRICHLET_BIND_FEM(_m, _la) \ - _DUNE_GDT_PROJECTIONS_DIRICHLET_BIND_ALBERTA(_m, leaf, fem, _la); \ - _DUNE_GDT_PROJECTIONS_DIRICHLET_BIND_ALU(_m, leaf, fem, _la); \ - _DUNE_GDT_PROJECTIONS_DIRICHLET_BIND_UG(_m, leaf, fem, _la); \ - _DUNE_GDT_PROJECTIONS_DIRICHLET_BIND_YASP(_m, leaf, fem, _la) -#else -#define _DUNE_GDT_PROJECTIONS_DIRICHLET_BIND_FEM(_m, _la) -#endif +#define _DUNE_GDT_PROJECTIONS_DIRICHLET_BIND_GDT(_m, _la) \ + _DUNE_GDT_PROJECTIONS_DIRICHLET_BIND_ALBERTA(_m, leaf, gdt, _la); \ + _DUNE_GDT_PROJECTIONS_DIRICHLET_BIND_ALU(_m, leaf, gdt, _la); \ + _DUNE_GDT_PROJECTIONS_DIRICHLET_BIND_UG(_m, leaf, gdt, _la); \ + _DUNE_GDT_PROJECTIONS_DIRICHLET_BIND_YASP(_m, leaf, gdt, _la) -//#if HAVE_DUNE_PDELAB -//#define _DUNE_GDT_PROJECTIONS_DIRICHLET_BIND_PDELAB(_m, _la) \ -// _DUNE_GDT_PROJECTIONS_DIRICHLET_BIND_ALBERTA(_m, leaf, pdelab, _la); \ -// _DUNE_GDT_PROJECTIONS_DIRICHLET_BIND_ALU(_m, leaf, pdelab, _la); \ -// _DUNE_GDT_PROJECTIONS_DIRICHLET_BIND_YASP(_m, leaf, pdelab, _la) -//// _DUNE_GDT_PROJECTIONS_DIRICHLET_BIND_UG(_m, leaf, pdelab, _la); // <- does not work -//#else -#define _DUNE_GDT_PROJECTIONS_DIRICHLET_BIND_PDELAB(_m, _la) -//#endif -#define _DUNE_GDT_PROJECTIONS_DIRICHLET_BIND_BACKENDS(_m, _la) \ - _DUNE_GDT_PROJECTIONS_DIRICHLET_BIND_FEM(_m, _la); \ - _DUNE_GDT_PROJECTIONS_DIRICHLET_BIND_PDELAB(_m, _la) +#define _DUNE_GDT_PROJECTIONS_DIRICHLET_BIND_BACKENDS(_m, _la) _DUNE_GDT_PROJECTIONS_DIRICHLET_BIND_GDT(_m, _la); #define _DUNE_GDT_PROJECTIONS_DIRICHLET_BIND_COMMON(_m) //_DUNE_GDT_PROJECTIONS_DIRICHLET_BIND_BACKENDS(_m, common_dense) diff --git a/dune/gdt/spaces/basefunctionset/default.hh b/dune/gdt/spaces/basefunctionset/default.hh new file mode 100644 index 0000000000000000000000000000000000000000..15fbd559944993e153c2a9e422a32df77f41e5d5 --- /dev/null +++ b/dune/gdt/spaces/basefunctionset/default.hh @@ -0,0 +1,127 @@ +// This file is part of the dune-gdt project: +// https://github.com/dune-comparamnity/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 (2018) + +#ifndef DUNE_GDT_SPACES_BASEFUNCTIONSET_DEFAULT_HH +#define DUNE_GDT_SPACES_BASEFUNCTIONSET_DEFAULT_HH + +#include "interface.hh" + +namespace Dune { +namespace GDT { + + +// forwards, required for the traits +template <class Fe, class E, class R = double> +class ScalarBasefunctionSet; + + +namespace internal { + + +template <class Fe, class E, class R> +class ScalarBasefunctionSetTraits +{ + using LocalFunctionTraits = + XT::Functions::LocalfunctionSetInterface<E, typename E::Geometry::ctype, E::dimension, R, 1>; + +public: + using derived_type = ScalarBasefunctionSet<E, R>; + using EntityType = E; + using BackendType = Fe; +}; + + +} // namespace internal + + +template <class Fe, class E, class R> +class ScalarBasefunctionSet : public BaseFunctionSetInterface<internal::ScalarBasefunctionSetTraits<Fe, E, R>, + typename E::Geometry::ctype, + E::dimension, + R, + 1> +{ +public: + using Traits = internal::ScalarBasefunctionSetTraits<Fe, E, R>; + +private: + using BaseType = BaseFunctionSetInterface<Traits, typename E::Geometry::ctype, E::dimension, R, 1>; + using ThisType = ScalarBasefunctionSet<Fe, E, R>; + +public: + using typename BaseType::BackendType; + using typename BaseType::EntityType; + using typename BaseType::DomainType; + using typename BaseType::RangeType; + using typename BaseType::JacobianRangeType; + + ScalarBasefunctionSet(const EntityType& en, const BackendType& finite_element) + : BaseType(en) + , finite_element_(finite_element) + { + } + + ScalarBasefunctionSet(const ThisType&) = default; + ScalarBasefunctionSet(ThisType&&) = default; + + ThisType& operator=(const ThisType&) = delete; + ThisType& operator=(ThisType&&) = delete; + + const BackendType& backend() const + { + return finite_element_; + } + + size_t size() const override final + { + return finite_element_.localBasis().size(); + } + + size_t order(const XT::Common::Parameter& /*param*/ = {}) const override final + { + return finite_element_.localBasis().order(); + } + + using BaseType::evaluate; + + void evaluate(const DomainType& xx, + std::vector<RangeType>& ret, + const XT::Common::Parameter& /*param*/ = {}) const override final + { + assert(this->is_a_valid_point(xx)); + finite_element_.localBasis().evaluateFunction(xx, ret); + } + + using BaseType::jacobian; + + void jacobian(const DomainType& xx, + std::vector<JacobianRangeType>& ret, + const XT::Common::Parameter& /*param*/ = {}) const override final + { + assert(this->is_a_valid_point(xx)); + // evaluate jacobian of shape functions + finite_element_.localBasis().evaluateJacobian(xx, ret); + // apply transformation + const auto J_inv_T = this->entity().geometry().jacobianInverseTransposed(xx); + auto tmp_value = ret[0][0]; + for (size_t ii = 0; ii < finite_element_.localBasis().size(); ++ii) { + J_inv_T.mv(ret[ii][0], tmp_value); + ret[ii][0] = tmp_value; + } + } // ... jacobian(...) + +private: + const BackendType& finite_element_; +}; // class ScalarBasefunctionSet + + +} // namespace GDT +} // namespace Dune + +#endif // DUNE_GDT_SPACES_BASEFUNCTIONSET_DEFAULT_HH diff --git a/dune/gdt/spaces/basefunctionset/dune-fem-localfunctions-wrapper.hh b/dune/gdt/spaces/basefunctionset/dune-fem-localfunctions-wrapper.hh deleted file mode 100644 index 4b5152f0eda5ffcccc232aa2e98cd168ebcab7c6..0000000000000000000000000000000000000000 --- a/dune/gdt/spaces/basefunctionset/dune-fem-localfunctions-wrapper.hh +++ /dev/null @@ -1,164 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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 (2013 - 2017) -// Rene Milk (2014, 2016 - 2018) -// Tobias Leibner (2017) - -#ifndef DUNE_GDT_SPACES_BASEFUNCTIONSET_DUNE_FEM_LOCALFUNCTIONS_WRAPPER_HH -#define DUNE_GDT_SPACES_BASEFUNCTIONSET_DUNE_FEM_LOCALFUNCTIONS_WRAPPER_HH - -#include <vector> - -#include <dune/xt/common/type_traits.hh> - -#include "interface.hh" - -namespace Dune { -namespace GDT { -namespace BaseFunctionSet { - - -// forward, to be used in the traits and to allow for specialization -template <class BaseFunctionSetMapImp, - class DomainFieldImp, - size_t domainDim, - class RangeFieldImp, - size_t rangeDim, - size_t rangeDimCols = 1> -class DuneFemLocalfunctionsWrapper -{ - static_assert(AlwaysFalse<BaseFunctionSetMapImp>::value, "Untested for these dimensions!"); -}; - - -namespace internal { - - -template <class BaseFunctionSetMapImp, - class DomainFieldImp, - size_t domainDim, - class RangeFieldImp, - size_t rangeDim, - size_t rangeDimCols> -class DuneFemLocalfunctionsWrapperTraits -{ -public: - typedef DuneFemLocalfunctionsWrapper<BaseFunctionSetMapImp, - DomainFieldImp, - domainDim, - RangeFieldImp, - rangeDim, - rangeDimCols> - derived_type; - typedef typename BaseFunctionSetMapImp::BaseFunctionSetType BackendType; - typedef typename BackendType::EntityType EntityType; -}; - - -} // namespace internal - - -template <class BaseFunctionSetMapImp, class DomainFieldImp, size_t domainDim, class RangeFieldImp, size_t rangeDim> -class DuneFemLocalfunctionsWrapper<BaseFunctionSetMapImp, DomainFieldImp, domainDim, RangeFieldImp, rangeDim, 1> - : public BaseFunctionSetInterface<internal::DuneFemLocalfunctionsWrapperTraits<BaseFunctionSetMapImp, - DomainFieldImp, - domainDim, - RangeFieldImp, - rangeDim, - 1>, - DomainFieldImp, - domainDim, - RangeFieldImp, - rangeDim, - 1> -{ - typedef BaseFunctionSetInterface<internal::DuneFemLocalfunctionsWrapperTraits<BaseFunctionSetMapImp, - DomainFieldImp, - domainDim, - RangeFieldImp, - rangeDim, - 1>, - DomainFieldImp, - domainDim, - RangeFieldImp, - rangeDim, - 1> - BaseType; - typedef DuneFemLocalfunctionsWrapper<BaseFunctionSetMapImp, DomainFieldImp, domainDim, RangeFieldImp, rangeDim, 1> - ThisType; - -public: - typedef internal:: - DuneFemLocalfunctionsWrapperTraits<BaseFunctionSetMapImp, DomainFieldImp, domainDim, RangeFieldImp, rangeDim, 1> - Traits; - typedef typename Traits::BackendType BackendType; - typedef typename Traits::EntityType EntityType; - - using typename BaseType::DomainType; - using typename BaseType::RangeType; - using typename BaseType::JacobianRangeType; - - DuneFemLocalfunctionsWrapper(const BaseFunctionSetMapImp& baseFunctionSetMap, const EntityType& ent) - : BaseType(ent) - , baseFunctionSetMap_(baseFunctionSetMap) - , backend_(new BackendType(baseFunctionSetMap_.find(this->entity()))) - { - } - - DuneFemLocalfunctionsWrapper(ThisType&& source) = default; - - DuneFemLocalfunctionsWrapper(const ThisType& /*other*/) = delete; - - ThisType& operator=(const ThisType& /*other*/) = delete; - - const BackendType& backend() const - { - return *backend_; - } - - virtual size_t size() const override final - { - return backend_->size(); - } - - virtual size_t order(const XT::Common::Parameter& /*mu*/ = {}) const override final - { - return baseFunctionSetMap_.getOrder(this->entity()); - } - - void evaluate(const DomainType& x, - std::vector<RangeType>& ret, - const XT::Common::Parameter& /*mu*/ = {}) const override final - { - assert(ret.size() >= size()); - backend_->evaluateAll(x, ret); - } - - using BaseType::evaluate; - - void jacobian(const DomainType& x, - std::vector<JacobianRangeType>& ret, - const XT::Common::Parameter& /*mu*/ = {}) const override final - { - assert(ret.size() >= size()); - backend_->jacobianAll(x, this->entity().geometry().jacobianInverseTransposed(x), ret); - } - - using BaseType::jacobian; - -private: - const BaseFunctionSetMapImp& baseFunctionSetMap_; - std::unique_ptr<const BackendType> backend_; -}; // class DuneFemLocalfunctionsWrapper - - -} // namespace BaseFunctionSet -} // namespace GDT -} // namespace Dune - -#endif // DUNE_GDT_SPACES_BASEFUNCTIONSET_DUNE_FEM_LOCALFUNCTIONS_WRAPPER_HH diff --git a/dune/gdt/spaces/basefunctionset/dune-fem-wrapper.hh b/dune/gdt/spaces/basefunctionset/dune-fem-wrapper.hh deleted file mode 100644 index 84fe2c96f3f2de93b6835454f564926e2fb11fa5..0000000000000000000000000000000000000000 --- a/dune/gdt/spaces/basefunctionset/dune-fem-wrapper.hh +++ /dev/null @@ -1,201 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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 (2013 - 2017) -// Rene Milk (2014, 2016 - 2018) -// Tobias Leibner (2014, 2017) - -#ifndef DUNE_GDT_SAPCES_BASEFUNCTIONSET_DUNE_FEM_WRAPPER_HH -#define DUNE_GDT_SAPCES_BASEFUNCTIONSET_DUNE_FEM_WRAPPER_HH - -#include <dune/common/fmatrix.hh> -#include <dune/common/fvector.hh> - -#if HAVE_DUNE_FEM -#include <dune/fem/space/basisfunctionset/default.hh> -#include <dune/fem/space/common/discretefunctionspace.hh> -#endif - -#include <dune/xt/common/memory.hh> -#include <dune/xt/common/type_traits.hh> - -#include "interface.hh" - -namespace Dune { -namespace GDT { -namespace BaseFunctionSet { - -#if HAVE_DUNE_FEM - - -// forward, to be used in the traits and to allow for specialization -template <class BasisFunctionSetImp, - class EntityImp, - class DomainFieldImp, - size_t domainDim, - class RangeFieldImp, - size_t rangeDim, - size_t rangeDimCols = 1> -class DuneFemWrapper -{ - static_assert(Dune::AlwaysFalse<BasisFunctionSetImp>::value, "Untested for these dimensions!"); -}; - - -namespace internal { - - -template <class BasisFunctionSetImp, - class EntityImp, - class DomainFieldImp, - size_t domainDim, - class RangeFieldImp, - size_t rangeDim, - size_t rangeDimCols> -class DuneFemWrapperTraits -{ -public: - typedef DuneFemWrapper<BasisFunctionSetImp, - EntityImp, - DomainFieldImp, - domainDim, - RangeFieldImp, - rangeDim, - rangeDimCols> - derived_type; - typedef typename Dune::Fem::DefaultBasisFunctionSet<EntityImp, typename BasisFunctionSetImp::ShapeFunctionSetType> - BackendType; - typedef EntityImp EntityType; -}; - - -} // namespace internal - - -template <class BasisFunctionSetImp, - class EntityImp, - class DomainFieldImp, - size_t domainDim, - class RangeFieldImp, - size_t rangeDim> -class DuneFemWrapper<BasisFunctionSetImp, EntityImp, DomainFieldImp, domainDim, RangeFieldImp, rangeDim, 1> - : public BaseFunctionSetInterface<internal::DuneFemWrapperTraits<BasisFunctionSetImp, - EntityImp, - DomainFieldImp, - domainDim, - RangeFieldImp, - rangeDim, - 1>, - DomainFieldImp, - domainDim, - RangeFieldImp, - rangeDim, - 1> -{ - typedef DuneFemWrapper<BasisFunctionSetImp, EntityImp, DomainFieldImp, domainDim, RangeFieldImp, rangeDim, 1> - ThisType; - typedef BaseFunctionSetInterface<internal::DuneFemWrapperTraits<BasisFunctionSetImp, - EntityImp, - DomainFieldImp, - domainDim, - RangeFieldImp, - rangeDim, - 1>, - DomainFieldImp, - domainDim, - RangeFieldImp, - rangeDim, - 1> - BaseType; - -public: - typedef internal:: - DuneFemWrapperTraits<BasisFunctionSetImp, EntityImp, DomainFieldImp, domainDim, RangeFieldImp, rangeDim, 1> - Traits; - typedef typename Traits::BackendType BackendType; - typedef typename BaseType::EntityType EntityType; - typedef typename BaseType::DomainType DomainType; - typedef typename BaseType::RangeType RangeType; - typedef typename BaseType::JacobianRangeType JacobianRangeType; - - template <class S> - DuneFemWrapper(const Dune::Fem::DiscreteFunctionSpaceInterface<S>& femSpace, const EntityType& ent) - : BaseType(ent) - , backend_(new BackendType(ent, femSpace.basisFunctionSet(ent).shapeFunctionSet())) - { - } - - DuneFemWrapper(ThisType&& source) = default; - - DuneFemWrapper(const ThisType& /*other*/) = delete; - - ThisType& operator=(const ThisType& /*other*/) = delete; - - const BackendType& backend() const - { - return *backend_; - } - - virtual size_t size() const override final - { - return backend_->size(); - } - - virtual size_t order(const XT::Common::Parameter& /*mu*/ = {}) const override final - { - assert(backend_->order() >= 0); - return backend_->order(); - } - - void evaluate(const DomainType& xx, - std::vector<RangeType>& ret, - const XT::Common::Parameter& /*mu*/ = {}) const override final - { - assert(ret.size() >= size()); - backend_->evaluateAll(xx, ret); - } - - using BaseType::evaluate; - - void jacobian(const DomainType& xx, - std::vector<JacobianRangeType>& ret, - const XT::Common::Parameter& /*mu*/ = {}) const override final - { - assert(ret.size() >= size()); - backend_->jacobianAll(xx, ret); - } - - using BaseType::jacobian; - -private: - std::unique_ptr<const BackendType> backend_; -}; // class DuneFemWrapper - - -#else // HAVE_DUNE_FEM - - -template <class BasisFunctionSetImp, - class EntityImp, - class DomainFieldImp, - size_t domainDim, - class RangeFieldImp, - size_t rangeDim, - size_t rangeDimCols = 1> -class DuneFemWrapper -{ - static_assert(Dune::AlwaysFalse<BasisFunctionSetImp>::value, "You are missing dune-fem!"); -}; - - -#endif // HAVE_DUNE_FEM - -} // namespace BaseFunctionSet -} // namespace GDT -} // namespace Dune - -#endif // DUNE_GDT_SAPCES_BASEFUNCTIONSET_DUNE_FEM_WRAPPER_HH diff --git a/dune/gdt/spaces/basefunctionset/dune-pdelab-wrapper.hh b/dune/gdt/spaces/basefunctionset/dune-pdelab-wrapper.hh deleted file mode 100644 index 20a0f19dda3f897912875cfd08d813e2b3196f69..0000000000000000000000000000000000000000 --- a/dune/gdt/spaces/basefunctionset/dune-pdelab-wrapper.hh +++ /dev/null @@ -1,574 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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 (2014 - 2017) -// Rene Milk (2014, 2016 - 2018) -// Tobias Leibner (2014, 2016 - 2017) - -#ifndef DUNE_GDT_SPACES_BASEFUNCTIONSET_DUNE_PDELAB_WRAPPER_HH -#define DUNE_GDT_SPACES_BASEFUNCTIONSET_DUNE_PDELAB_WRAPPER_HH - -#include <dune/common/fmatrix.hh> -#include <dune/common/fvector.hh> - -#if HAVE_DUNE_PDELAB -#include <dune/pdelab/gridfunctionspace/localfunctionspace.hh> -#endif - -#include <dune/xt/common/type_traits.hh> - -#include "interface.hh" - -namespace Dune { -namespace GDT { -namespace BaseFunctionSet { - -#if HAVE_DUNE_PDELAB - - -// forwards, to be used in the traits and to allow for specialization -template <class PdelabSpaceImp, - class EntityImp, - class DomainFieldImp, - size_t domainDim, - class RangeFieldImp, - size_t rangeDim, - size_t rangeDimCols = 1> -class DunePdelabWrapper -{ - static_assert(Dune::AlwaysFalse<PdelabSpaceImp>::value, "Untested for arbitrary dimension!"); -}; - - -template <class PdelabSpaceImp, - class EntityImp, - class DomainFieldImp, - size_t domainDim, - class RangeFieldImp, - size_t rangeDim, - size_t rangeDimCols = 1> -class PiolaTransformedDunePdelabWrapper -{ - static_assert(Dune::AlwaysFalse<PdelabSpaceImp>::value, "Untested for these dimensions!"); -}; - - -namespace internal { - - -// forward, to allow for specialization -template <class PdelabSpaceImp, - class EntityImp, - class DomainFieldImp, - size_t domainDim, - class RangeFieldImp, - size_t rangeDim, - size_t rangeDimCols> -class DunePdelabWrapperTraits; - - -//! Specialization for rangeDimCols = 1 -template <class PdelabSpaceImp, - class EntityImp, - class DomainFieldImp, - size_t domainDim, - class RangeFieldImp, - size_t rangeDim> -class DunePdelabWrapperTraits<PdelabSpaceImp, EntityImp, DomainFieldImp, domainDim, RangeFieldImp, rangeDim, 1> -{ -public: - typedef DunePdelabWrapper<PdelabSpaceImp, EntityImp, DomainFieldImp, domainDim, RangeFieldImp, rangeDim, 1> - derived_type; - -private: - typedef PDELab::LocalFunctionSpace<PdelabSpaceImp, PDELab::TrialSpaceTag> PdelabLFSType; - typedef FiniteElementInterfaceSwitch<typename PdelabSpaceImp::Traits::FiniteElementType> FESwitchType; - -public: - typedef typename FESwitchType::Basis BackendType; - typedef EntityImp EntityType; - -private: - friend class DunePdelabWrapper<PdelabSpaceImp, EntityImp, DomainFieldImp, domainDim, RangeFieldImp, rangeDim, 1>; -}; - - -template <class PdelabSpaceImp, - class EntityImp, - class DomainFieldImp, - size_t domainDim, - class RangeFieldImp, - size_t rangeDim> -class PiolaTransformedDunePdelabWrapperTraits -{ - static_assert(domainDim == rangeDim, "Untested!"); - -public: - typedef PiolaTransformedDunePdelabWrapper<PdelabSpaceImp, - EntityImp, - DomainFieldImp, - domainDim, - RangeFieldImp, - rangeDim> - derived_type; - -private: - typedef PDELab::LocalFunctionSpace<PdelabSpaceImp, PDELab::TrialSpaceTag> PdelabLFSType; - typedef FiniteElementInterfaceSwitch<typename PdelabSpaceImp::Traits::FiniteElementType> FESwitchType; - -public: - typedef typename FESwitchType::Basis BackendType; - typedef EntityImp EntityType; - -private: - friend class PiolaTransformedDunePdelabWrapper<PdelabSpaceImp, - EntityImp, - DomainFieldImp, - domainDim, - RangeFieldImp, - rangeDim, - 1>; -}; - - -} // namespace internal - - -//! Specialization for dimRange = 1, dimRangeRows = 1 -template <class PdelabSpaceType, class EntityImp, class DomainFieldImp, size_t domainDim, class RangeFieldImp> -class DunePdelabWrapper<PdelabSpaceType, EntityImp, DomainFieldImp, domainDim, RangeFieldImp, 1, 1> - : public BaseFunctionSetInterface<internal::DunePdelabWrapperTraits<PdelabSpaceType, - EntityImp, - DomainFieldImp, - domainDim, - RangeFieldImp, - 1, - 1>, - DomainFieldImp, - domainDim, - RangeFieldImp, - 1, - 1> -{ - typedef DunePdelabWrapper<PdelabSpaceType, EntityImp, DomainFieldImp, domainDim, RangeFieldImp, 1, 1> ThisType; - typedef BaseFunctionSetInterface<internal::DunePdelabWrapperTraits<PdelabSpaceType, - EntityImp, - DomainFieldImp, - domainDim, - RangeFieldImp, - 1, - 1>, - DomainFieldImp, - domainDim, - RangeFieldImp, - 1, - 1> - BaseType; - -public: - typedef internal::DunePdelabWrapperTraits<PdelabSpaceType, EntityImp, DomainFieldImp, domainDim, RangeFieldImp, 1, 1> - Traits; - typedef typename Traits::BackendType BackendType; - typedef typename Traits::EntityType EntityType; - -private: - typedef typename Traits::PdelabLFSType PdelabLFSType; - typedef typename Traits::FESwitchType FESwitchType; - -public: - typedef typename BaseType::DomainType DomainType; - typedef typename BaseType::RangeType RangeType; - typedef typename BaseType::JacobianRangeType JacobianRangeType; - - DunePdelabWrapper(const PdelabSpaceType& space, const EntityType& ent) - : BaseType(ent) - , tmp_domain_(0) - { - PdelabLFSType* lfs_ptr = new PdelabLFSType(space); - lfs_ptr->bind(this->entity()); - lfs_ = std::unique_ptr<PdelabLFSType>(lfs_ptr); - backend_ = std::unique_ptr<BackendType>(new BackendType(FESwitchType::basis(lfs_->finiteElement()))); - } // DunePdelabWrapper(...) - - DunePdelabWrapper(ThisType&& source) = default; - DunePdelabWrapper(const ThisType& /*other*/) = delete; - - ThisType& operator=(const ThisType& /*other*/) = delete; - - const BackendType& backend() const - { - return *backend_; - } - - virtual size_t size() const override final - { - return backend_->size(); - } - - virtual size_t order(const XT::Common::Parameter& /*mu*/ = {}) const override final - { - return backend_->order(); - } - - void evaluate(const DomainType& xx, - std::vector<RangeType>& ret, - const XT::Common::Parameter& /*mu*/ = {}) const override final - { - assert(ret.size() >= backend_->size()); - backend_->evaluateFunction(xx, ret); - } - - using BaseType::evaluate; - - void jacobian(const DomainType& xx, - std::vector<JacobianRangeType>& ret, - const XT::Common::Parameter& /*mu*/ = {}) const override final - { - assert(ret.size() >= backend_->size()); - backend_->evaluateJacobian(xx, ret); - const auto jacobian_inverse_transposed = this->entity().geometry().jacobianInverseTransposed(xx); - for (size_t ii = 0; ii < ret.size(); ++ii) { - jacobian_inverse_transposed.mv(ret[ii][0], tmp_domain_); - ret[ii][0] = tmp_domain_; - } - } // ... jacobian(...) - - using BaseType::jacobian; - -private: - mutable DomainType tmp_domain_; - std::unique_ptr<const PdelabLFSType> lfs_; - std::unique_ptr<const BackendType> backend_; -}; // class DunePdelabWrapper - - -template <class PdelabSpaceType, - class EntityImp, - class DomainFieldImp, - size_t domainDim, - class RangeFieldImp, - size_t rangeDim> -class DunePdelabWrapper<PdelabSpaceType, EntityImp, DomainFieldImp, domainDim, RangeFieldImp, rangeDim, 1> - : public BaseFunctionSetInterface<internal::DunePdelabWrapperTraits<PdelabSpaceType, - EntityImp, - DomainFieldImp, - domainDim, - RangeFieldImp, - rangeDim, - 1>, - DomainFieldImp, - domainDim, - RangeFieldImp, - rangeDim, - 1> -{ - typedef DunePdelabWrapper<PdelabSpaceType, EntityImp, DomainFieldImp, domainDim, RangeFieldImp, rangeDim, 1> ThisType; - typedef BaseFunctionSetInterface<internal::DunePdelabWrapperTraits<PdelabSpaceType, - EntityImp, - DomainFieldImp, - domainDim, - RangeFieldImp, - rangeDim, - 1>, - DomainFieldImp, - domainDim, - RangeFieldImp, - rangeDim, - 1> - BaseType; - -public: - typedef internal:: - DunePdelabWrapperTraits<PdelabSpaceType, EntityImp, DomainFieldImp, domainDim, RangeFieldImp, rangeDim, 1> - Traits; - typedef typename Traits::BackendType BackendType; - typedef typename Traits::EntityType EntityType; - -private: - typedef typename Traits::PdelabLFSType PdelabLFSType; - typedef typename Traits::FESwitchType FESwitchType; - -public: - typedef typename BaseType::DomainType DomainType; - typedef typename BaseType::RangeType RangeType; - typedef typename BaseType::JacobianRangeType JacobianRangeType; - static const size_t dimDomain = domainDim; - static const size_t dimRange = rangeDim; - - DunePdelabWrapper(const PdelabSpaceType& space, const EntityType& ent) - : BaseType(ent) - , tmp_domain_(0) - { - PdelabLFSType* lfs_ptr = new PdelabLFSType(space); - lfs_ptr->bind(this->entity()); - lfs_ = std::unique_ptr<PdelabLFSType>(lfs_ptr); - backend_ = std::unique_ptr<BackendType>(new BackendType(FESwitchType::basis(lfs_->finiteElement()))); - } // DunePdelabWrapper(...) - - DunePdelabWrapper(ThisType&& source) = default; - DunePdelabWrapper(const ThisType& /*other*/) = delete; - - ThisType& operator=(const ThisType& /*other*/) = delete; - - const BackendType& backend() const - { - return *backend_; - } - - virtual size_t size() const override final - { - return backend_->size() * dimRange; - } - - virtual size_t order(const XT::Common::Parameter& /*mu*/ = {}) const override final - { - return backend_->order(); - } - - void evaluate(const DomainType& xx, - std::vector<RangeType>& ret, - const XT::Common::Parameter& /*mu*/ = {}) const override final - { - assert(ret.size() >= size()); - const size_t size_of_factor_basefunctionset = backend_->size(); - std::vector<Dune::FieldVector<RangeFieldImp, 1>> factor_ret(size_of_factor_basefunctionset); - backend_->evaluateFunction(xx, factor_ret); - // if factor_ret is [1 2] and we have two factors, we want to return [[1 0] [2 0] [0 1] [0 2]] - for (size_t jj = 0; jj < size_of_factor_basefunctionset; ++jj) { - for (size_t ii = 0; ii < dimRange; ++ii) { - ret[ii * size_of_factor_basefunctionset + jj] *= 0; - ret[ii * size_of_factor_basefunctionset + jj][ii] = factor_ret[jj][0]; - } - } - } - - using BaseType::evaluate; - - void jacobian(const DomainType& xx, - std::vector<JacobianRangeType>& ret, - const XT::Common::Parameter& /*mu*/ = {}) const override final - { - assert(ret.size() >= backend_->size()); - const size_t size_of_factor_basefunctionset = backend_->size(); - std::vector<FieldMatrix<RangeFieldImp, 1, dimDomain>> factor_ret(size_of_factor_basefunctionset); - backend_->evaluateJacobian(xx, factor_ret); - const auto jacobian_inverse_transposed = this->entity().geometry().jacobianInverseTransposed(xx); - for (size_t jj = 0; jj < factor_ret.size(); ++jj) { - jacobian_inverse_transposed.mv(factor_ret[jj][0], tmp_domain_); - factor_ret[jj][0] = tmp_domain_; - } - for (size_t ii = 0; ii < dimRange; ++ii) { - for (size_t jj = 0; jj < size_of_factor_basefunctionset; ++jj) { - ret[ii * size_of_factor_basefunctionset + jj] *= 0; - ret[ii * size_of_factor_basefunctionset + jj][ii] = factor_ret[jj][0]; - } - } - } // ... jacobian(...) - - using BaseType::jacobian; - -private: - mutable DomainType tmp_domain_; - std::unique_ptr<const PdelabLFSType> lfs_; - std::unique_ptr<const BackendType> backend_; -}; // class DunePdelabWrapper - - -template <class PdelabSpaceType, - class EntityImp, - class DomainFieldImp, - size_t domainDim, - class RangeFieldImp, - size_t rangeDim> -class PiolaTransformedDunePdelabWrapper<PdelabSpaceType, - EntityImp, - DomainFieldImp, - domainDim, - RangeFieldImp, - rangeDim, - 1> - : public BaseFunctionSetInterface<internal::PiolaTransformedDunePdelabWrapperTraits<PdelabSpaceType, - EntityImp, - DomainFieldImp, - domainDim, - RangeFieldImp, - rangeDim>, - DomainFieldImp, - domainDim, - RangeFieldImp, - rangeDim, - 1> -{ - typedef PiolaTransformedDunePdelabWrapper<PdelabSpaceType, - EntityImp, - DomainFieldImp, - domainDim, - RangeFieldImp, - rangeDim, - 1> - ThisType; - typedef BaseFunctionSetInterface<internal::PiolaTransformedDunePdelabWrapperTraits<PdelabSpaceType, - EntityImp, - DomainFieldImp, - domainDim, - RangeFieldImp, - rangeDim>, - DomainFieldImp, - domainDim, - RangeFieldImp, - rangeDim, - 1> - BaseType; - -public: - typedef internal::PiolaTransformedDunePdelabWrapperTraits<PdelabSpaceType, - EntityImp, - DomainFieldImp, - domainDim, - RangeFieldImp, - rangeDim> - Traits; - typedef typename Traits::BackendType BackendType; - typedef typename Traits::EntityType EntityType; - -private: - typedef typename Traits::PdelabLFSType PdelabLFSType; - typedef typename Traits::FESwitchType FESwitchType; - -public: - using typename BaseType::DomainFieldType; - using BaseType::dimDomain; - using typename BaseType::DomainType; - using typename BaseType::RangeType; - using typename BaseType::JacobianRangeType; - - PiolaTransformedDunePdelabWrapper(const PdelabSpaceType& space, const EntityType& ent) - : BaseType(ent) - , tmp_domain_(DomainFieldType(0)) - , tmp_jacobian_transposed_(DomainFieldType(0)) - , tmp_jacobian_inverse_transposed_(DomainFieldType(0)) - { - PdelabLFSType* lfs_ptr = new PdelabLFSType(space); - lfs_ptr->bind(this->entity()); - lfs_ = std::unique_ptr<PdelabLFSType>(lfs_ptr); - backend_ = std::unique_ptr<BackendType>(new BackendType(FESwitchType::basis(lfs_->finiteElement()))); - tmp_ranges_ = std::vector<RangeType>(backend_->size(), RangeType(0)); - tmp_jacobian_ranges_ = std::vector<JacobianRangeType>(backend_->size(), JacobianRangeType(0)); - } // DunePdelabWrapper(...) - - PiolaTransformedDunePdelabWrapper(ThisType&& source) = default; - - PiolaTransformedDunePdelabWrapper(const ThisType& /*other*/) = delete; - - ThisType& operator=(const ThisType& /*other*/) = delete; - - const BackendType& backend() const - { - return *backend_; - } - - virtual size_t size() const override final - { - return backend_->size(); - } - - virtual size_t order(const XT::Common::Parameter& /*mu*/ = {}) const override final - { - return backend_->order(); - } - - void evaluate(const DomainType& xx, - std::vector<RangeType>& ret, - const XT::Common::Parameter& /*mu*/ = {}) const override final - { - assert(lfs_); - assert(backend_); - assert(tmp_ranges_.size() >= backend_->size()); - assert(ret.size() >= backend_->size()); - backend_->evaluateFunction(xx, tmp_ranges_); - const auto geometry = this->entity().geometry(); - tmp_jacobian_transposed_ = geometry.jacobianTransposed(xx); - const DomainFieldType integration_element = geometry.integrationElement(xx); - for (size_t ii = 0; ii < backend_->size(); ++ii) { - tmp_jacobian_transposed_.mtv(tmp_ranges_[ii], ret[ii]); - ret[ii] /= integration_element; - } - } // ... evaluate(...) - - using BaseType::evaluate; - - void jacobian(const DomainType& xx, - std::vector<JacobianRangeType>& ret, - const XT::Common::Parameter& /*mu*/ = {}) const override final - { - assert(lfs_); - assert(backend_); - assert(ret.size() >= backend_->size()); - backend_->evaluateJacobian(xx, tmp_jacobian_ranges_); - const auto geometry = this->entity().geometry(); - tmp_jacobian_transposed_ = geometry.jacobianTransposed(xx); - tmp_jacobian_inverse_transposed_ = geometry.jacobianInverseTransposed(xx); - const DomainFieldType integration_element = geometry.integrationElement(xx); - for (size_t ii = 0; ii < backend_->size(); ++ii) { - for (size_t jj = 0; jj < dimDomain; ++jj) { - tmp_jacobian_inverse_transposed_.mv(tmp_jacobian_ranges_[ii][jj], ret[ii][jj]); - tmp_jacobian_transposed_.mv(ret[ii][jj], tmp_jacobian_ranges_[ii][jj]); - tmp_jacobian_ranges_[ii][jj] /= integration_element; - ret[ii][jj] = tmp_jacobian_ranges_[ii][jj]; - } - } - } // ... jacobian(...) - - using BaseType::jacobian; - -private: - mutable DomainType tmp_domain_; - mutable typename EntityType::Geometry::JacobianTransposed tmp_jacobian_transposed_; - mutable typename EntityType::Geometry::JacobianInverseTransposed tmp_jacobian_inverse_transposed_; - std::unique_ptr<const PdelabLFSType> lfs_; - std::unique_ptr<const BackendType> backend_; - mutable std::vector<RangeType> tmp_ranges_; - mutable std::vector<JacobianRangeType> tmp_jacobian_ranges_; -}; // class PiolaTransformedDunePdelabWrapper - - -#else // HAVE_DUNE_PDELAB - - -template <class PdelabSpaceImp, - class EntityImp, - class DomainFieldImp, - size_t domainDim, - class RangeFieldImp, - size_t rangeDim, - size_t rangeDimCols = 1> -class DunePdelabWrapper -{ - static_assert(AlwaysFalse<PdelabSpaceImp>::value, "You are missing dune-pdelab!"); -}; - - -template <class PdelabSpaceImp, - class EntityImp, - class DomainFieldImp, - size_t domainDim, - class RangeFieldImp, - size_t rangeDim, - size_t rangeDimCols = 1> -class PiolaTransformedDunePdelabWrapper -{ - static_assert(AlwaysFalse<PdelabSpaceImp>::value, "You are missing dune-pdelab!"); -}; - - -#endif // HAVE_DUNE_PDELAB - -} // namespace BaseFunctionSet -} // namespace GDT -} // namespace Dune - -#endif // DUNE_GDT_SPACES_BASEFUNCTIONSET_DUNE_PDELAB_WRAPPER_HH diff --git a/dune/gdt/spaces/cg.bindings.hh b/dune/gdt/spaces/cg.bindings.hh index a072fdd21e7feb87be05adfba404ce11e15da6b3..8c2fa88668ae56abd5532f0f2eafb4df6be60c54 100644 --- a/dune/gdt/spaces/cg.bindings.hh +++ b/dune/gdt/spaces/cg.bindings.hh @@ -19,126 +19,61 @@ // begin: this is what we need for the .so -// * fem -#if HAVE_DUNE_FEM -#define _DUNE_GDT_SPACES_CG_BIND_FEM(_m, _GRID, _layer, _r, _rC) \ +#define _DUNE_GDT_SPACES_CG_BIND(_m, _GRID, _layer, _r, _rC) \ Dune::GDT::bindings::SpaceInterface<Dune::GDT::CgSpaceProvider<_GRID, \ Dune::XT::Grid::Layers::_layer, \ - Dune::GDT::Backends::fem, \ + Dune::GDT::Backends::gdt, \ 1, \ double, \ _r, \ _rC>>::bind(_m) //#if HAVE_ALBERTA -//#define _DUNE_GDT_SPACES_CG_BIND_FEM_ALBERTA_LAYER(_m, _layer) \ -// _DUNE_GDT_SPACES_CG_BIND_FEM(_m, ALBERTA_2D, _layer, 1, 1) -//#define _DUNE_GDT_SPACES_CG_BIND_FEM_ALBERTA(_m) \ -// _DUNE_GDT_SPACES_CG_BIND_FEM_ALBERTA_LAYER(_m, dd_subdomain); \ -// _DUNE_GDT_SPACES_CG_BIND_FEM_ALBERTA_LAYER(_m, leaf); \ -// _DUNE_GDT_SPACES_CG_BIND_FEM_ALBERTA_LAYER(_m, level) +//#define _DUNE_GDT_SPACES_CG_BIND_ALBERTA_LAYER(_m, _layer) \ +// _DUNE_GDT_SPACES_CG_BIND(_m, ALBERTA_2D, _layer, 1, 1) +//#define _DUNE_GDT_SPACES_CG_BIND_ALBERTA(_m) \ +// _DUNE_GDT_SPACES_CG_BIND_ALBERTA_LAYER(_m, dd_subdomain); \ +// _DUNE_GDT_SPACES_CG_BIND_ALBERTA_LAYER(_m, leaf); \ +// _DUNE_GDT_SPACES_CG_BIND_ALBERTA_LAYER(_m, level) //#else -#define _DUNE_GDT_SPACES_CG_BIND_FEM_ALBERTA(_m) +#define _DUNE_GDT_SPACES_CG_BIND_ALBERTA(_m) //#endif #if HAVE_DUNE_ALUGRID -#define _DUNE_GDT_SPACES_CG_BIND_FEM_ALU_LAYER(_m, _layer) \ - _DUNE_GDT_SPACES_CG_BIND_FEM(_m, ALU_2D_SIMPLEX_CONFORMING, _layer, 1, 1) -#define _DUNE_GDT_SPACES_CG_BIND_FEM_ALU(_m) \ - _DUNE_GDT_SPACES_CG_BIND_FEM_ALU_LAYER(_m, dd_subdomain); \ - _DUNE_GDT_SPACES_CG_BIND_FEM_ALU_LAYER(_m, leaf); \ - _DUNE_GDT_SPACES_CG_BIND_FEM_ALU_LAYER(_m, level) +#define _DUNE_GDT_SPACES_CG_BIND_ALU_LAYER(_m, _layer) \ + _DUNE_GDT_SPACES_CG_BIND(_m, ALU_2D_SIMPLEX_CONFORMING, _layer, 1, 1) +#define _DUNE_GDT_SPACES_CG_BIND_ALU(_m) \ + _DUNE_GDT_SPACES_CG_BIND_ALU_LAYER(_m, dd_subdomain); \ + _DUNE_GDT_SPACES_CG_BIND_ALU_LAYER(_m, leaf); \ + _DUNE_GDT_SPACES_CG_BIND_ALU_LAYER(_m, level) #else -#define _DUNE_GDT_SPACES_CG_BIND_FEM_ALU(_m) +#define _DUNE_GDT_SPACES_CG_BIND_ALU(_m) #endif //#if HAVE_DUNE_UGGRID || HAVE_UG -//#define _DUNE_GDT_SPACES_CG_BIND_FEM_UG_LAYER(_m, _layer) _DUNE_GDT_SPACES_CG_BIND_FEM(_m, UG_2D, _layer, 1, 1) -//#define _DUNE_GDT_SPACES_CG_BIND_FEM_UG(_m) \ -// _DUNE_GDT_SPACES_CG_BIND_FEM_UG_LAYER(_m, dd_subdomain); \ -// _DUNE_GDT_SPACES_CG_BIND_FEM_UG_LAYER(_m, leaf); \ -// _DUNE_GDT_SPACES_CG_BIND_FEM_UG_LAYER(_m, level) +//#define _DUNE_GDT_SPACES_CG_BIND_UG_LAYER(_m, _layer) _DUNE_GDT_SPACES_CG_BIND(_m, UG_2D, _layer, 1, 1) +//#define _DUNE_GDT_SPACES_CG_BIND_UG(_m) \ +// _DUNE_GDT_SPACES_CG_BIND_UG_LAYER(_m, dd_subdomain); \ +// _DUNE_GDT_SPACES_CG_BIND_UG_LAYER(_m, leaf); \ +// _DUNE_GDT_SPACES_CG_BIND_UG_LAYER(_m, level) //#else -#define _DUNE_GDT_SPACES_CG_BIND_FEM_UG(_m) +#define _DUNE_GDT_SPACES_CG_BIND_UG(_m) //#endif -#define _DUNE_GDT_SPACES_CG_BIND_FEM_YASP_LAYER(_m, _layer) \ - _DUNE_GDT_SPACES_CG_BIND_FEM(_m, YASP_1D_EQUIDISTANT_OFFSET, _layer, 1, 1); \ - _DUNE_GDT_SPACES_CG_BIND_FEM(_m, YASP_2D_EQUIDISTANT_OFFSET, _layer, 1, 1) -#define _DUNE_GDT_SPACES_CG_BIND_FEM_YASP(_m) \ - _DUNE_GDT_SPACES_CG_BIND_FEM_YASP_LAYER(_m, dd_subdomain); \ - _DUNE_GDT_SPACES_CG_BIND_FEM_YASP_LAYER(_m, leaf); \ - _DUNE_GDT_SPACES_CG_BIND_FEM_YASP_LAYER(_m, level) - -#define _DUNE_GDT_SPACES_CG_BIND_FEM_ALL(_m) \ - _DUNE_GDT_SPACES_CG_BIND_FEM_ALBERTA(_m); \ - _DUNE_GDT_SPACES_CG_BIND_FEM_ALU(_m); \ - _DUNE_GDT_SPACES_CG_BIND_FEM_UG(_m); \ - _DUNE_GDT_SPACES_CG_BIND_FEM_YASP(_m) -#else // HAVE_DUNE_FEM -#define _DUNE_GDT_SPACES_CG_BIND_FEM_ALL(_m) -#endif - -//// * pdelab -//#if HAVE_DUNE_PDELAB -//#define _DUNE_GDT_SPACES_CG_BIND_PDELAB(_m, _GRID, _layer, _r, _rC) \ -// Dune::GDT::bindings::SpaceInterface<Dune::GDT::CgSpaceProvider<_GRID, \ -// Dune::XT::Grid::Layers::_layer, \ -// Dune::GDT::Backends::pdelab, \ -// 1, \ -// double, \ -// _r, \ -// _rC>>::bind(_m) - -//#if HAVE_ALBERTA -//#define _DUNE_GDT_SPACES_CG_BIND_PDELAB_ALBERTA_LAYER(_m, _layer) \ -// _DUNE_GDT_SPACES_CG_BIND_PDELAB(_m, ALBERTA_2D, _layer, 1, 1) -//#define _DUNE_GDT_SPACES_CG_BIND_PDELAB_ALBERTA(_m) \ -// _DUNE_GDT_SPACES_CG_BIND_PDELAB_ALBERTA_LAYER(_m, leaf); \ -// _DUNE_GDT_SPACES_CG_BIND_PDELAB_ALBERTA_LAYER(_m, level) -//#else -//#define _DUNE_GDT_SPACES_CG_BIND_PDELAB_ALBERTA(_m) -//#endif - -//#if HAVE_DUNE_ALUGRID -//#define _DUNE_GDT_SPACES_CG_BIND_PDELAB_ALU_LAYER(_m, _layer) \ -// _DUNE_GDT_SPACES_CG_BIND_PDELAB(_m, ALU_2D_SIMPLEX_CONFORMING, _layer, 1, 1) -//#define _DUNE_GDT_SPACES_CG_BIND_PDELAB_ALU(_m) \ -// _DUNE_GDT_SPACES_CG_BIND_PDELAB_ALU_LAYER(_m, leaf); \ -// _DUNE_GDT_SPACES_CG_BIND_PDELAB_ALU_LAYER(_m, level) -//#else -//#define _DUNE_GDT_SPACES_CG_BIND_PDELAB_ALU(_m, _layer) -//#endif - -////#if HAVE_DUNE_UGGRID || HAVE_UG // <- does not work -////#define _DUNE_GDT_SPACES_CG_BIND_PDELAB_UG_LAYER(_m, _layer) _DUNE_GDT_SPACES_CG_BIND_PDELAB(_m, UG_2D, _layer, 1, -/// 1) -////#define _DUNE_GDT_SPACES_CG_BIND_PDELAB_UG(_m) -//// _DUNE_GDT_SPACES_CG_BIND_PDELAB_UG_LAYER(_m, leaf); -//// _DUNE_GDT_SPACES_CG_BIND_PDELAB_UG_LAYER(_m, level) -////#else -////#define _DUNE_GDT_SPACES_CG_BIND_PDELAB_UG(_m, _layer) -////#endif - -//#define _DUNE_GDT_SPACES_CG_BIND_PDELAB_YASP_LAYER(_m, _layer) \ -// _DUNE_GDT_SPACES_CG_BIND_PDELAB(_m, YASP_1D_EQUIDISTANT_OFFSET, _layer, 1, 1);\ -// _DUNE_GDT_SPACES_CG_BIND_PDELAB(_m, YASP_2D_EQUIDISTANT_OFFSET, _layer, 1, 1) -//#define _DUNE_GDT_SPACES_CG_BIND_PDELAB_YASP(_m) \ -// _DUNE_GDT_SPACES_CG_BIND_PDELAB_YASP_LAYER(_m, leaf); \ -// _DUNE_GDT_SPACES_CG_BIND_PDELAB_YASP_LAYER(_m, level) - -//#define _DUNE_GDT_SPACES_CG_BIND_PDELAB_ALL(_m) \ -// _DUNE_GDT_SPACES_CG_BIND_PDELAB_ALBERTA(_m); \ -// _DUNE_GDT_SPACES_CG_BIND_PDELAB_ALU(_m); \ -// _DUNE_GDT_SPACES_CG_BIND_PDELAB_YASP(_m) -//// _DUNE_GDT_SPACES_CG_BIND_PDELAB_UG(_m); // <- does not work -//#else // HAVE_DUNE_PDELAB -#define _DUNE_GDT_SPACES_CG_BIND_PDELAB_ALL(_m) -//#endif +#define _DUNE_GDT_SPACES_CG_BIND_YASP_LAYER(_m, _layer) \ + _DUNE_GDT_SPACES_CG_BIND(_m, YASP_1D_EQUIDISTANT_OFFSET, _layer, 1, 1); \ + _DUNE_GDT_SPACES_CG_BIND(_m, YASP_2D_EQUIDISTANT_OFFSET, _layer, 1, 1) +#define _DUNE_GDT_SPACES_CG_BIND_YASP(_m) \ + _DUNE_GDT_SPACES_CG_BIND_YASP_LAYER(_m, dd_subdomain); \ + _DUNE_GDT_SPACES_CG_BIND_YASP_LAYER(_m, leaf); \ + _DUNE_GDT_SPACES_CG_BIND_YASP_LAYER(_m, level) #define DUNE_GDT_SPACES_CG_BIND(_m) \ - _DUNE_GDT_SPACES_CG_BIND_FEM_ALL(_m); \ - _DUNE_GDT_SPACES_CG_BIND_PDELAB_ALL(_m) + _DUNE_GDT_SPACES_CG_BIND_ALBERTA(_m); \ + _DUNE_GDT_SPACES_CG_BIND_ALU(_m); \ + _DUNE_GDT_SPACES_CG_BIND_UG(_m); \ + _DUNE_GDT_SPACES_CG_BIND_YASP(_m) + // end: this is what we need for the .so diff --git a/dune/gdt/spaces/cg.hh b/dune/gdt/spaces/cg.hh index 80587dbfc81591af801876ae15c41955e1caa200..b1047ebbf49ad00a571c191d731d085f49eb9c68 100644 --- a/dune/gdt/spaces/cg.hh +++ b/dune/gdt/spaces/cg.hh @@ -21,8 +21,7 @@ #include <dune/xt/grid/gridprovider/provider.hh> #include "interface.hh" -#include "cg/dune-fem-wrapper.hh" -#include "cg/dune-pdelab-wrapper.hh" +#include "cg/default.hh" #include <dune/gdt/playground/spaces/block.hh> @@ -56,15 +55,10 @@ private: }; template <class G, int p, class R, size_t r, size_t rC> - struct SpaceChooser<G, p, R, r, rC, GDT::Backends::fem> + struct SpaceChooser<G, p, R, r, rC, GDT::Backends::gdt> { - typedef GDT::DuneFemCgSpaceWrapper<GridLayerType, p, R, r, rC> Type; - }; - - template <class G, int p, class R, size_t r, size_t rC> - struct SpaceChooser<G, p, R, r, rC, GDT::Backends::pdelab> - { - typedef GDT::DunePdelabCgSpaceWrapper<GridLayerType, p, R, r, rC> Type; + static_assert(r == 1 && rC == 1, ""); + typedef GDT::ContinuousLagrangeSpace<GridLayerType, p, R> Type; }; public: diff --git a/dune/gdt/spaces/cg.lib.hh b/dune/gdt/spaces/cg.lib.hh index ec91df8ce76d744291911b37d4d23c7e4e8c5ccb..cd2548ed08c16feb10f60820add27ae7bede105a 100644 --- a/dune/gdt/spaces/cg.lib.hh +++ b/dune/gdt/spaces/cg.lib.hh @@ -22,26 +22,22 @@ _prefix class Dune::GDT:: \ CgSpaceProvider<_GRID, Dune::XT::Grid::Layers::_layer_type, Dune::GDT::Backends::_backend, _p, _R, _r, _rC> -#if HAVE_DUNE_FEM +#define _DUNE_GDT_SPACES_CG_LIB(_prefix, _GRID, _p, _R, _r, _rC) \ + _DUNE_GDT_SPACES_CG_LIB(_prefix, _GRID, adaptive_leaf, gdt, _p, _R, _r, _rC); \ + _DUNE_GDT_SPACES_CG_LIB(_prefix, _GRID, leaf, gdt, _p, _R, _r, _rC); \ + _DUNE_GDT_SPACES_CG_LIB(_prefix, _GRID, level, gdt, _p, _R, _r, _rC); \ + _DUNE_GDT_SPACES_CG_LIB(_prefix, _GRID, dd_subdomain, gdt, _p, _R, _r, _rC); \ + _DUNE_GDT_SPACES_CG_LIB(_prefix, _GRID, dd_subdomain_boundary, gdt, _p, _R, _r, _rC); \ + _DUNE_GDT_SPACES_CG_LIB(_prefix, _GRID, dd_subdomain_coupling, gdt, _p, _R, _r, _rC) -#define _DUNE_GDT_SPACES_CG_FEM_LIB(_prefix, _GRID, _p, _R, _r, _rC) \ - _DUNE_GDT_SPACES_CG_LIB(_prefix, _GRID, adaptive_leaf, fem, _p, _R, _r, _rC); \ - _DUNE_GDT_SPACES_CG_LIB(_prefix, _GRID, leaf, fem, _p, _R, _r, _rC); \ - _DUNE_GDT_SPACES_CG_LIB(_prefix, _GRID, level, fem, _p, _R, _r, _rC); \ - _DUNE_GDT_SPACES_CG_LIB(_prefix, _GRID, dd_subdomain, fem, _p, _R, _r, _rC); \ - _DUNE_GDT_SPACES_CG_LIB(_prefix, _GRID, dd_subdomain_boundary, fem, _p, _R, _r, _rC); \ - _DUNE_GDT_SPACES_CG_LIB(_prefix, _GRID, dd_subdomain_coupling, fem, _p, _R, _r, _rC) - -#define DUNE_GDT_SPACES_CG_FEM_LIB(_prefix, _GRID) _DUNE_GDT_SPACES_CG_FEM_LIB(_prefix, _GRID, 1, double, 1, 1) +#define DUNE_GDT_SPACES_CG_LIB(_prefix, _GRID) _DUNE_GDT_SPACES_CG_LIB(_prefix, _GRID, 1, double, 1, 1) #if HAVE_DUNE_ALUGRID -DUNE_GDT_SPACES_CG_FEM_LIB(extern template, ALU_2D_SIMPLEX_CONFORMING); +DUNE_GDT_SPACES_CG_LIB(extern template, ALU_2D_SIMPLEX_CONFORMING); #endif -DUNE_GDT_SPACES_CG_FEM_LIB(extern template, YASP_1D_EQUIDISTANT_OFFSET); -DUNE_GDT_SPACES_CG_FEM_LIB(extern template, YASP_2D_EQUIDISTANT_OFFSET); -DUNE_GDT_SPACES_CG_FEM_LIB(extern template, YASP_3D_EQUIDISTANT_OFFSET); - -#endif // HAVE_DUNE_FEM +DUNE_GDT_SPACES_CG_LIB(extern template, YASP_1D_EQUIDISTANT_OFFSET); +DUNE_GDT_SPACES_CG_LIB(extern template, YASP_2D_EQUIDISTANT_OFFSET); +DUNE_GDT_SPACES_CG_LIB(extern template, YASP_3D_EQUIDISTANT_OFFSET); #endif // DUNE_XT_WITH_PYTHON_BINDINGS diff --git a/dune/gdt/spaces/cg.lib/fem_yasp_1d_equidistant_offset.cc b/dune/gdt/spaces/cg.lib/alu_2d_simplex_conforming.cc similarity index 82% rename from dune/gdt/spaces/cg.lib/fem_yasp_1d_equidistant_offset.cc rename to dune/gdt/spaces/cg.lib/alu_2d_simplex_conforming.cc index 38ad228c29eb1e736f90c633169d6776d029acda..77ba6f9d7f45ca391f2432b022b5881bd3d559d0 100644 --- a/dune/gdt/spaces/cg.lib/fem_yasp_1d_equidistant_offset.cc +++ b/dune/gdt/spaces/cg.lib/alu_2d_simplex_conforming.cc @@ -9,12 +9,12 @@ #include <config.h> -#if HAVE_DUNE_FEM +#if HAVE_DUNE_ALUGRID #include "../cg.lib.hh" -DUNE_GDT_SPACES_CG_FEM_LIB(template, YASP_1D_EQUIDISTANT_OFFSET); +DUNE_GDT_SPACES_CG_LIB(template, ALU_2D_SIMPLEX_CONFORMING); -#endif // HAVE_DUNE_FEM +#endif // HAVE_DUNE_ALUGRID diff --git a/dune/gdt/spaces/cg.lib/fem_alu_2d_simplex_conforming.cc b/dune/gdt/spaces/cg.lib/fem_alu_2d_simplex_conforming.cc deleted file mode 100644 index fa0bea4014b6aedb042c8493ce44290a5e64c972..0000000000000000000000000000000000000000 --- a/dune/gdt/spaces/cg.lib/fem_alu_2d_simplex_conforming.cc +++ /dev/null @@ -1,20 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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_ALUGRID && HAVE_DUNE_FEM - -#include "../cg.lib.hh" - - -DUNE_GDT_SPACES_CG_FEM_LIB(template, ALU_2D_SIMPLEX_CONFORMING); - - -#endif // HAVE_DUNE_ALUGRID && HAVE_DUNE_FEM diff --git a/dune/gdt/spaces/cg.lib/fem_yasp_2d_equidistant_offset.cc b/dune/gdt/spaces/cg.lib/yasp_1d_equidistant_offset.cc similarity index 82% rename from dune/gdt/spaces/cg.lib/fem_yasp_2d_equidistant_offset.cc rename to dune/gdt/spaces/cg.lib/yasp_1d_equidistant_offset.cc index 1439bcf2cf0000ded47fc5f78726ab665684dce9..a85841612f99f6b061ca9ac8573191d982f54b17 100644 --- a/dune/gdt/spaces/cg.lib/fem_yasp_2d_equidistant_offset.cc +++ b/dune/gdt/spaces/cg.lib/yasp_1d_equidistant_offset.cc @@ -9,12 +9,7 @@ #include <config.h> -#if HAVE_DUNE_FEM - #include "../cg.lib.hh" -DUNE_GDT_SPACES_CG_FEM_LIB(template, YASP_2D_EQUIDISTANT_OFFSET); - - -#endif // HAVE_DUNE_FEM +DUNE_GDT_SPACES_CG_LIB(template, YASP_1D_EQUIDISTANT_OFFSET); diff --git a/dune/gdt/spaces/cg.lib/fem_yasp_3d_equidistant_offset.cc b/dune/gdt/spaces/cg.lib/yasp_2d_equidistant_offset.cc similarity index 82% rename from dune/gdt/spaces/cg.lib/fem_yasp_3d_equidistant_offset.cc rename to dune/gdt/spaces/cg.lib/yasp_2d_equidistant_offset.cc index b69ed5853d6316a41214d414abad462fc9f31b21..c58d15325bf1769e912acb89105734276d93a5ee 100644 --- a/dune/gdt/spaces/cg.lib/fem_yasp_3d_equidistant_offset.cc +++ b/dune/gdt/spaces/cg.lib/yasp_2d_equidistant_offset.cc @@ -9,12 +9,7 @@ #include <config.h> -#if HAVE_DUNE_FEM - #include "../cg.lib.hh" -DUNE_GDT_SPACES_CG_FEM_LIB(template, YASP_3D_EQUIDISTANT_OFFSET); - - -#endif // HAVE_DUNE_FEM +DUNE_GDT_SPACES_CG_LIB(template, YASP_2D_EQUIDISTANT_OFFSET); diff --git a/dune/gdt/spaces/cg.lib/yasp_3d_equidistant_offset.cc b/dune/gdt/spaces/cg.lib/yasp_3d_equidistant_offset.cc new file mode 100644 index 0000000000000000000000000000000000000000..467ea3d8a977a7c099642503737ac498149248ab --- /dev/null +++ b/dune/gdt/spaces/cg.lib/yasp_3d_equidistant_offset.cc @@ -0,0 +1,15 @@ +// This file is part of the dune-gdt project: +// https://github.com/dune-community/dune-gdt +// Copyright 2010-2018 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> + +#include "../cg.lib.hh" + + +DUNE_GDT_SPACES_CG_LIB(template, YASP_3D_EQUIDISTANT_OFFSET); diff --git a/dune/gdt/spaces/cg/default.hh b/dune/gdt/spaces/cg/default.hh new file mode 100644 index 0000000000000000000000000000000000000000..89a5a4e6257f9ed4a21d64306e8252a7f03b7edb --- /dev/null +++ b/dune/gdt/spaces/cg/default.hh @@ -0,0 +1,200 @@ +// 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) + +#ifndef DUNE_GDT_SPACES_CG_DEFAULT_HH +#define DUNE_GDT_SPACES_CG_DEFAULT_HH + +#include <memory> +#include <vector> + +#include <dune/common/typetraits.hh> + +#include <dune/geometry/referenceelements.hh> +#include <dune/geometry/type.hh> + +#include <dune/grid/common/capabilities.hh> +#include <dune/grid/common/rangegenerators.hh> + +#include <dune/localfunctions/lagrange/equidistantpoints.hh> +#include <dune/localfunctions/lagrange.hh> + +#include <dune/xt/common/exceptions.hh> +#include <dune/xt/common/numeric_cast.hh> + +#include <dune/gdt/spaces/basefunctionset/default.hh> +#include <dune/gdt/spaces/mapper/default.hh> +#include <dune/gdt/spaces/cg/interface.hh> + +namespace Dune { +namespace GDT { + + +template <class GL, int p, class R = double> +class ContinuousLagrangeSpace; + + +namespace internal { + + +template <class GL, int p, class R> +class ContinuousLagrangeSpaceTraits +{ + static_assert(XT::Grid::is_layer<GL>::value, ""); + static_assert(1 <= p && p <= 2, "Not implemented yet!"); + using G = XT::Grid::extract_grid_t<GL>; + +public: + using derived_type = ContinuousLagrangeSpace<GL, p, R>; + static const constexpr int polOrder = p; + static const constexpr size_t dimDomain = GL::dimension; + static const constexpr size_t dimRange = 1; + static const constexpr size_t dimRangeCols = 1; + static const constexpr bool continuous = false; + using GridLayerType = GL; + using LocalFiniteElement = LagrangeLocalFiniteElement<EquidistantPointSet, dimDomain, typename GL::ctype, R>; + using BaseFunctionSetType = ScalarBasefunctionSet<LocalFiniteElement, XT::Grid::extract_entity_t<GL>, R>; + using MapperType = FixedOrderMultipleCodimMultipleGeomTypeMapper<GL, LocalFiniteElement>; + using RangeFieldType = R; + using BackendType = double; + static const constexpr XT::Grid::Backends layer_backend = XT::Grid::Backends::view; + static const constexpr Backends backend_type{Backends::gdt}; + typedef DofCommunicationChooser<GridLayerType> DofCommunicationChooserType; + typedef typename DofCommunicationChooserType::Type DofCommunicatorType; +}; // class ContinuousLagrangeSpaceTraits + + +} // namespace internal + + +/** + * The following dimensions/orders/elements are tested to work: + * + * - 1d: orders 1, 2 work + * - 2d: orders 1, 2 work on simplices, cubes and mixed simplices and cubes + * - 3d: orders 1, 2 work on simplices, cubes, prisms + * + * The following dimensions/orders/elements are tested to fail: + * + * - 3d: pyramids (jacobians seem to be incorrect) + * - 3d: mixed simplices and cubes + */ +template <class GL, int p, class R> +class ContinuousLagrangeSpace + : public CgSpaceInterface<internal::ContinuousLagrangeSpaceTraits<GL, p, R>, GL::dimension, 1> +{ +public: + using Traits = internal::ContinuousLagrangeSpaceTraits<GL, p, R>; + +private: + using BaseType = CgSpaceInterface<Traits, GL::dimension, 1>; + using ThisType = ContinuousLagrangeSpace<GL, p, R>; + using D = typename GL::ctype; + static const constexpr size_t d = BaseType::dimDomain; + using FiniteElementType = LagrangeLocalFiniteElement<EquidistantPointSet, d, D, R>; + using DofCommunicationChooserType = typename Traits::DofCommunicationChooserType; + +public: + using typename BaseType::GridLayerType; + using typename BaseType::EntityType; + using typename BaseType::MapperType; + using typename BaseType::BaseFunctionSetType; + using DomainType = typename BaseFunctionSetType::DomainType; + using DofCommunicatorType = typename Traits::DofCommunicatorType; + + ContinuousLagrangeSpace(GridLayerType grd_lr) + : grid_layer_(grd_lr) + , communicator_(DofCommunicationChooserType::create(grid_layer_)) + , backend_(0) + , finite_elements_(new std::map<GeometryType, std::shared_ptr<FiniteElementType>>()) + , lagrange_points_(new std::map<GeometryType, std::vector<DomainType>>()) + , mapper_(nullptr) + { + // create finite elements and lagrange points + for (auto&& geometry_type : grid_layer_.indexSet().types(0)) { + if (geometry_type == GeometryType(GeometryType::pyramid, 3)) + DUNE_THROW(space_error, "Continuous Lagrange space does not seem to have working jacobians on pyramid grids!"); + auto fe = std::make_shared<FiniteElementType>(geometry_type, p); + const auto& lp = fe->localInterpolation().lagrangePoints(); + std::vector<DomainType> lagrange_points(lp.size()); + for (size_t ii = 0; ii < lp.size(); ++ii) + lagrange_points[ii] = lp[ii].point(); + lagrange_points_->insert(std::make_pair(geometry_type, std::move(lagrange_points))); + finite_elements_->insert(std::make_pair(geometry_type, std::move(fe))); + } + // check + if (d == 3 && finite_elements_->size() != 1) + DUNE_THROW(space_error, "Continuous Lagrange space with multiple finite elements in 3d not supported (yet)!"); + // create mapper + mapper_ = std::make_shared<MapperType>(grid_layer_, finite_elements_); + } + + ContinuousLagrangeSpace(const ThisType&) = default; + ContinuousLagrangeSpace(ThisType&&) = default; + + ThisType& operator=(const ThisType&) = delete; + ThisType& operator=(ThisType&&) = delete; + + const GridLayerType& grid_layer() const + { + return grid_layer_; + } + + const double& backend() const + { + return backend_; + } + + const MapperType& mapper() const + { + return *mapper_; + } + + BaseFunctionSetType base_function_set(const EntityType& entity) const + { + const auto finite_element_search_result = finite_elements_->find(entity.geometry().type()); + if (finite_element_search_result == finite_elements_->end()) + DUNE_THROW(XT::Common::Exceptions::internal_error, + "This must not happen, the grid layer did not report all geometry types!" + << "\n entity.geometry().type() = " + << entity.geometry().type()); + const auto& finite_element = *finite_element_search_result->second; + return BaseFunctionSetType(entity, finite_element); + } + + DofCommunicatorType& dof_communicator() const + { + DofCommunicationChooserType::prepare(*this, *communicator_); + return *communicator_; + } + + std::vector<DomainType> lagrange_points(const EntityType& entity) const + { + const auto lagrange_points_search_result = lagrange_points_->find(entity.geometry().type()); + if (lagrange_points_search_result == lagrange_points_->end()) + DUNE_THROW(XT::Common::Exceptions::internal_error, + "This must not happen, the grid layer did not report all geometry types!" + << "\n entity.geometry().type() = " + << entity.geometry().type()); + return lagrange_points_search_result->second; + } + +private: + const GridLayerType grid_layer_; + mutable std::shared_ptr<DofCommunicatorType> communicator_; + const double backend_; + std::shared_ptr<std::map<GeometryType, std::shared_ptr<FiniteElementType>>> finite_elements_; + std::shared_ptr<std::map<GeometryType, std::vector<DomainType>>> lagrange_points_; + std::shared_ptr<MapperType> mapper_; +}; // class ContinuousLagrangeSpace + + +} // namespace GDT +} // namespace Dune + +#endif // DUNE_GDT_SPACES_CG_DEFAULT_HH diff --git a/dune/gdt/spaces/cg/dune-fem-wrapper.hh b/dune/gdt/spaces/cg/dune-fem-wrapper.hh deleted file mode 100644 index 2977b2e8618f7cd713fbe113d9cc34b14f6e6483..0000000000000000000000000000000000000000 --- a/dune/gdt/spaces/cg/dune-fem-wrapper.hh +++ /dev/null @@ -1,227 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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 (2013 - 2017) -// Rene Milk (2014, 2016 - 2017) -// Tobias Leibner (2014, 2016) - -#ifndef DUNE_GDT_SPACES_CG_DUNE_FEM_WRAPPER_HH -#define DUNE_GDT_SPACES_CG_DUNE_FEM_WRAPPER_HH - -#include <memory> - -#include <dune/common/deprecated.hh> - -#if HAVE_DUNE_FEM -#include <dune/fem/space/common/functionspace.hh> -#include <dune/fem/space/lagrange/space.hh> -#endif - -#include <dune/xt/common/type_traits.hh> -#include <dune/xt/grid/dd/subdomains/grid.hh> -#include <dune/xt/grid/type_traits.hh> - -#include <dune/gdt/spaces/parallel.hh> - -#include "interface.hh" -#include "../mapper/dune-fem-wrapper.hh" -#include "../basefunctionset/dune-fem-wrapper.hh" -#include "../constraints.hh" - -namespace Dune { -namespace GDT { - -#if HAVE_DUNE_FEM - - -// forward, to be used in the traits and to allow for specialization -template <class GridPartImp, int polynomialOrder, class RangeFieldImp, size_t rangeDim, size_t rangeDimCols = 1> -class DuneFemCgSpaceWrapper -{ - static_assert(Dune::AlwaysFalse<GridPartImp>::value, "Untested for these dimensions!"); -}; - - -template <class GridPartImp, int polynomialOrder, class RangeFieldImp, size_t rangeDim, size_t rangeDimCols> -class DuneFemCgSpaceWrapperTraits -{ - static_assert(XT::Grid::is_layer<GridPartImp>::value && !XT::Grid::is_view<GridPartImp>::value, ""); - -public: - typedef DuneFemCgSpaceWrapper<GridPartImp, polynomialOrder, RangeFieldImp, rangeDim, rangeDimCols> derived_type; - typedef GridPartImp GridLayerType; - static const int polOrder = polynomialOrder; - static const bool continuous = true; - static_assert(polOrder >= 1, "Wrong polOrder given!"); - static const constexpr Backends backend_type{Backends::fem}; - -private: - typedef typename GridLayerType::ctype DomainFieldType; - static const size_t dimDomain = GridLayerType::dimension; - -public: - typedef RangeFieldImp RangeFieldType; - -private: - typedef Dune::Fem::FunctionSpace<DomainFieldType, RangeFieldType, dimDomain, rangeDim> FunctionSpaceType; - -public: - typedef Dune::Fem::LagrangeDiscreteFunctionSpace<FunctionSpaceType, GridLayerType, polOrder> BackendType; - typedef Mapper::FemDofWrapper<typename BackendType::BlockMapperType, BackendType::Traits::localBlockSize> MapperType; - using EntityType = XT::Grid::extract_entity_t<GridLayerType>; - typedef BaseFunctionSet::DuneFemWrapper<typename BackendType::BasisFunctionSetType, - EntityType, - DomainFieldType, - dimDomain, - RangeFieldType, - rangeDim, - rangeDimCols> - BaseFunctionSetType; - static const XT::Grid::Backends layer_backend = XT::Grid::Backends::part; - static const bool needs_grid_view = false; - typedef DofCommunicationChooser<GridLayerType, true> DofCommunicationChooserType; - typedef typename DofCommunicationChooserType::Type DofCommunicatorType; -}; // class DuneFemCgSpaceWrapperTraits - - -// untested for the vector-valued case, especially CgSpaceInterface -template <class GridPartImp, int polynomialOrder, class RangeFieldImp, size_t r> -class DuneFemCgSpaceWrapper<GridPartImp, polynomialOrder, RangeFieldImp, r, 1> - : public CgSpaceInterface<DuneFemCgSpaceWrapperTraits<GridPartImp, polynomialOrder, RangeFieldImp, r, 1>, - GridPartImp::dimension, - r, - 1> -{ - typedef CgSpaceInterface<DuneFemCgSpaceWrapperTraits<GridPartImp, polynomialOrder, RangeFieldImp, r, 1>, - GridPartImp::dimension, - r, - 1> - BaseType; - typedef DuneFemCgSpaceWrapper<GridPartImp, polynomialOrder, RangeFieldImp, r, 1> ThisType; - -public: - typedef DuneFemCgSpaceWrapperTraits<GridPartImp, polynomialOrder, RangeFieldImp, r, 1> Traits; - - static const int polOrder = Traits::polOrder; - static const size_t dimDomain = BaseType::dimDomain; - static const size_t dimRange = BaseType::dimRange; - static const size_t dimRangeCols = BaseType::dimRangeCols; - - typedef typename Traits::GridLayerType GridLayerType; - typedef typename Traits::BackendType BackendType; - typedef typename Traits::MapperType MapperType; - typedef typename Traits::BaseFunctionSetType BaseFunctionSetType; - typedef typename Traits::EntityType EntityType; - -private: - typedef typename Traits::DofCommunicationChooserType DofCommunicationChooserType; - -public: - typedef typename Traits::DofCommunicatorType DofCommunicatorType; - - using typename BaseType::DomainType; - - explicit DuneFemCgSpaceWrapper(GridLayerType grd_prt) - : grid_part_(new GridLayerType(grd_prt)) - , backend_(new BackendType(*grid_part_)) - , mapper_(new MapperType(backend_->blockMapper())) - , communicator_(DofCommunicationChooserType::create(*grid_part_)) - , communicator_prepared_(false) - { - } - -#if !DUNE_XT_WITH_PYTHON_BINDINGS - // There is a problem which prevents copy ctors which are manually marked as default to end up in a lib ... - DuneFemCgSpaceWrapper(const ThisType& other) = default; - DuneFemCgSpaceWrapper(ThisType&& source) = default; - - // ... and we need to guard these operators as well since they would hinder the creation of the respective ctors. - ThisType& operator=(const ThisType& other) = delete; - ThisType& operator=(ThisType&& source) = delete; -#endif // DUNE_XT_WITH_PYTHON_BINDINGS - - const GridLayerType& DUNE_DEPRECATED_MSG("Use grid_layer() instead (03.04.2017)!") grid_part() const - { - return *grid_part_; - } - - const GridLayerType& grid_layer() const - { - return *grid_part_; - } - - GridLayerType& grid_part() - { - return *grid_part_; - } - - const BackendType& backend() const - { - return *backend_; - } - - const MapperType& mapper() const - { - return *mapper_; - } - - std::vector<DomainType> lagrange_points(const EntityType& entity) const - { - return BaseType::lagrange_points_order_1(entity); - } - - std::set<size_t> local_dirichlet_DoFs( - const EntityType& entity, - const XT::Grid::BoundaryInfo<XT::Grid::extract_intersection_t<GridLayerType>>& boundaryInfo) const - { - return BaseType::local_dirichlet_DoFs_order_1(entity, boundaryInfo); - } - - BaseFunctionSetType base_function_set(const EntityType& entity) const - { - return BaseFunctionSetType(*backend_, entity); - } - - DofCommunicatorType& dof_communicator() const - { - if (!communicator_prepared_) { - // communicator_->remoteIndices().template rebuild<true>(); - communicator_prepared_ = DofCommunicationChooserType::prepare(*this, *communicator_); - } - return *communicator_; - } - -private: - std::shared_ptr<GridLayerType> grid_part_; - const std::shared_ptr<const BackendType> backend_; - const std::shared_ptr<const MapperType> mapper_; - mutable std::shared_ptr<DofCommunicatorType> communicator_; - mutable bool communicator_prepared_; -}; // class DuneFemCgSpaceWrapper< ..., 1 > - - -#else // HAVE_DUNE_FEM - - -template <class GridPartImp, int polynomialOrder, class RangeFieldImp, size_t rangeDim, size_t rangeDimCols = 1> -class DuneFemCgSpaceWrapper -{ - static_assert(Dune::AlwaysFalse<GridPartImp>::value, "You are missing dune-fem!"); -}; - - -#endif // HAVE_DUNE_FEM - - -} // namespace GDT -} // namespace Dune - - -#include "dune-fem-wrapper.lib.hh" - - -#endif // DUNE_GDT_SPACES_CG_DUNE_FEM_WRAPPER_HH diff --git a/dune/gdt/spaces/cg/dune-fem-wrapper.lib.hh b/dune/gdt/spaces/cg/dune-fem-wrapper.lib.hh deleted file mode 100644 index a7db7b3d40a03add3c5385d89d65c41d588ea907..0000000000000000000000000000000000000000 --- a/dune/gdt/spaces/cg/dune-fem-wrapper.lib.hh +++ /dev/null @@ -1,54 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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) - -#ifndef DUNE_GDT_SPACES_CG_DUNE_FEM_WRAPPER_LIB_HH -#define DUNE_GDT_SPACES_CG_DUNE_FEM_WRAPPER_LIB_HH - -#include <dune/xt/grid/grids.hh> -#include <dune/xt/grid/layers.hh> - -#include "dune-fem-wrapper.hh" - -#if DUNE_XT_WITH_PYTHON_BINDINGS && HAVE_DUNE_FEM - - -#define _DUNE_GDT_SPACES_CG_DUNE_FEM_WRAPPER_LIB(_prefix, _GRID, _layer_type, _p, _R, _r, _rC) \ - _prefix class Dune::GDT::DuneFemCgSpaceWrapper< \ - typename Dune::XT::Grid::Layer<_GRID, \ - Dune::XT::Grid::Layers::_layer_type, \ - Dune::XT::Grid::Backends::part, \ - Dune::XT::Grid::DD::SubdomainGrid<_GRID>>::type, \ - _p, \ - _R, \ - _r, \ - _rC> - -#define _DUNE_GDT_SPACES_CG_DUNE_FEM_WRAPPER_LIB_ALL_LAYERS(_prefix, _GRID, _p, _R, _r, _rC) \ - _DUNE_GDT_SPACES_CG_DUNE_FEM_WRAPPER_LIB(_prefix, _GRID, adaptive_leaf, _p, _R, _r, _rC); \ - _DUNE_GDT_SPACES_CG_DUNE_FEM_WRAPPER_LIB(_prefix, _GRID, leaf, _p, _R, _r, _rC); \ - _DUNE_GDT_SPACES_CG_DUNE_FEM_WRAPPER_LIB(_prefix, _GRID, level, _p, _R, _r, _rC); \ - _DUNE_GDT_SPACES_CG_DUNE_FEM_WRAPPER_LIB(_prefix, _GRID, dd_subdomain, _p, _R, _r, _rC); \ - _DUNE_GDT_SPACES_CG_DUNE_FEM_WRAPPER_LIB(_prefix, _GRID, dd_subdomain_boundary, _p, _R, _r, _rC); \ - _DUNE_GDT_SPACES_CG_DUNE_FEM_WRAPPER_LIB(_prefix, _GRID, dd_subdomain_coupling, _p, _R, _r, _rC) - -#define DUNE_GDT_SPACES_CG_DUNE_FEM_WRAPPER_LIB(_prefix, _GRID) \ - _DUNE_GDT_SPACES_CG_DUNE_FEM_WRAPPER_LIB_ALL_LAYERS(_prefix, _GRID, 1, double, 1, 1) - -#if HAVE_DUNE_ALUGRID -DUNE_GDT_SPACES_CG_DUNE_FEM_WRAPPER_LIB(extern template, ALU_2D_SIMPLEX_CONFORMING); -#endif -DUNE_GDT_SPACES_CG_DUNE_FEM_WRAPPER_LIB(extern template, YASP_1D_EQUIDISTANT_OFFSET); -DUNE_GDT_SPACES_CG_DUNE_FEM_WRAPPER_LIB(extern template, YASP_2D_EQUIDISTANT_OFFSET); -DUNE_GDT_SPACES_CG_DUNE_FEM_WRAPPER_LIB(extern template, YASP_3D_EQUIDISTANT_OFFSET); - - -#endif // DUNE_XT_WITH_PYTHON_BINDINGS && HAVE_DUNE_FEM - - -#endif // DUNE_GDT_SPACES_CG_DUNE_FEM_WRAPPER_LIB_HH diff --git a/dune/gdt/spaces/cg/dune-fem-wrapper.lib/alu_2d_simplex_conforming.cc b/dune/gdt/spaces/cg/dune-fem-wrapper.lib/alu_2d_simplex_conforming.cc deleted file mode 100644 index 98dcbd9f6d1b2c916857a17c1ba3298af921ee8e..0000000000000000000000000000000000000000 --- a/dune/gdt/spaces/cg/dune-fem-wrapper.lib/alu_2d_simplex_conforming.cc +++ /dev/null @@ -1,20 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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_ALUGRID && HAVE_DUNE_FEM - -#include "../dune-fem-wrapper.lib.hh" - - -DUNE_GDT_SPACES_CG_DUNE_FEM_WRAPPER_LIB(template, ALU_2D_SIMPLEX_CONFORMING); - - -#endif // HAVE_DUNE_ALUGRID && HAVE_DUNE_FEM diff --git a/dune/gdt/spaces/cg/dune-fem-wrapper.lib/yasp_1d_equidistant_offset.cc b/dune/gdt/spaces/cg/dune-fem-wrapper.lib/yasp_1d_equidistant_offset.cc deleted file mode 100644 index 9fcef0fcea9eb0f8aad91d901163f64cd06d6a5c..0000000000000000000000000000000000000000 --- a/dune/gdt/spaces/cg/dune-fem-wrapper.lib/yasp_1d_equidistant_offset.cc +++ /dev/null @@ -1,20 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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_FEM - -#include "../dune-fem-wrapper.lib.hh" - - -DUNE_GDT_SPACES_CG_DUNE_FEM_WRAPPER_LIB(template, YASP_1D_EQUIDISTANT_OFFSET); - - -#endif // HAVE_DUNE_FEM diff --git a/dune/gdt/spaces/cg/dune-fem-wrapper.lib/yasp_2d_equidistant_offset.cc b/dune/gdt/spaces/cg/dune-fem-wrapper.lib/yasp_2d_equidistant_offset.cc deleted file mode 100644 index 85aba8ceffc134ec3fb5f11153375336eb731f5c..0000000000000000000000000000000000000000 --- a/dune/gdt/spaces/cg/dune-fem-wrapper.lib/yasp_2d_equidistant_offset.cc +++ /dev/null @@ -1,20 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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_FEM - -#include "../dune-fem-wrapper.lib.hh" - - -DUNE_GDT_SPACES_CG_DUNE_FEM_WRAPPER_LIB(template, YASP_2D_EQUIDISTANT_OFFSET); - - -#endif // HAVE_DUNE_FEM diff --git a/dune/gdt/spaces/cg/dune-fem-wrapper.lib/yasp_3d_equidistant_offset.cc b/dune/gdt/spaces/cg/dune-fem-wrapper.lib/yasp_3d_equidistant_offset.cc deleted file mode 100644 index 312adc21fcb8332f0eca7a5c7ece4f1bfbe4a9db..0000000000000000000000000000000000000000 --- a/dune/gdt/spaces/cg/dune-fem-wrapper.lib/yasp_3d_equidistant_offset.cc +++ /dev/null @@ -1,20 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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_FEM - -#include "../dune-fem-wrapper.lib.hh" - - -DUNE_GDT_SPACES_CG_DUNE_FEM_WRAPPER_LIB(template, YASP_3D_EQUIDISTANT_OFFSET); - - -#endif // HAVE_DUNE_FEM diff --git a/dune/gdt/spaces/cg/dune-pdelab-wrapper.hh b/dune/gdt/spaces/cg/dune-pdelab-wrapper.hh deleted file mode 100644 index 4f05f811f9f2d31f74aff94ac5d3d208a4ef37ed..0000000000000000000000000000000000000000 --- a/dune/gdt/spaces/cg/dune-pdelab-wrapper.hh +++ /dev/null @@ -1,481 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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 (2014 - 2017) -// Rene Milk (2014, 2016 - 2017) -// Tobias Leibner (2014, 2016) - -#ifndef DUNE_GDT_SPACES_CG_DUNE_PDELAB_WRAPPER_HH -#define DUNE_GDT_SPACES_CG_DUNE_PDELAB_WRAPPER_HH - -#include <memory> - -#include <dune/common/fvector.hh> -#include <dune/common/deprecated.hh> - -#include <dune/geometry/type.hh> - -#if HAVE_DUNE_ISTL -#include <dune/istl/paamg/pinfo.hh> -#include <dune/xt/la/solver/istl/amg.hh> -#endif - -#if HAVE_DUNE_PDELAB -#include <dune/pdelab/finiteelementmap/pkfem.hh> -#include <dune/pdelab/finiteelementmap/qkfem.hh> -#include <dune/pdelab/gridfunctionspace/gridfunctionspace.hh> -#include <dune/pdelab/constraints/conforming.hh> -#endif // HAVE_DUNE_PDELAB - -#include <dune/xt/common/type_traits.hh> - -#include <dune/gdt/spaces/parallel.hh> - -#include "../mapper/dune-pdelab-wrapper.hh" -#include "../basefunctionset/dune-pdelab-wrapper.hh" - -#include "interface.hh" - -namespace Dune { -namespace GDT { - -#if HAVE_DUNE_PDELAB - - -// forward, to be used in the traits and to allow for specialization -template <class GridViewImp, int polynomialOrder, class RangeFieldImp, size_t rangeDim, size_t rangeDimCols = 1> -class DunePdelabCgSpaceWrapper -{ - static_assert(Dune::AlwaysFalse<GridViewImp>::value, "Untested for this combination of dimensions!"); -}; - - -template <class GridViewImp, int polynomialOrder, class RangeFieldImp, size_t rangeDim, size_t rangeDimCols = 1> -class DunePdelabCgSpaceWrapperTraits -{ - static_assert(XT::Grid::is_view<GridViewImp>::value, ""); - -public: - typedef DunePdelabCgSpaceWrapper<GridViewImp, polynomialOrder, RangeFieldImp, rangeDim, rangeDimCols> derived_type; - typedef GridViewImp GridLayerType; - static const int polOrder = polynomialOrder; - static_assert(polOrder >= 1, "Wrong polOrder given!"); - static const bool continuous = true; - static const constexpr Backends backend_type{Backends::pdelab}; - -private: - typedef typename GridLayerType::ctype DomainFieldType; - static const size_t dimDomain = GridLayerType::dimension; - -public: - typedef RangeFieldImp RangeFieldType; - -private: - template <class G, bool single_geom, bool is_simplex, bool is_cube> - struct FeMap - { - static_assert(Dune::AlwaysFalse<G>::value, - "This space is only implemented for either fully simplicial or fully cubic grids!"); - }; - template <class G> - struct FeMap<G, true, true, false> - { - typedef PDELab::PkLocalFiniteElementMap<GridLayerType, DomainFieldType, RangeFieldType, polOrder> Type; - }; - template <class G> - struct FeMap<G, true, false, true> - { - typedef PDELab::QkLocalFiniteElementMap<GridLayerType, DomainFieldType, RangeFieldType, polOrder> Type; - }; - typedef XT::Grid::extract_grid_t<GridLayerType> GridType; - static const bool single_geom_ = Dune::Capabilities::hasSingleGeometryType<GridType>::v; - static const bool simplicial_ = - (Dune::Capabilities::hasSingleGeometryType<GridType>::topologyId == Impl::SimplexTopology<dimDomain>::type::id); - static const bool cubic_ = - (Dune::Capabilities::hasSingleGeometryType<GridType>::topologyId == Impl::CubeTopology<dimDomain>::type::id); - typedef typename FeMap<GridType, single_geom_, simplicial_, cubic_>::Type FEMapType; - -public: - typedef PDELab::GridFunctionSpace<GridLayerType, FEMapType, PDELab::OverlappingConformingDirichletConstraints> - BackendType; - typedef DunePdelabCgMapperWrapper<BackendType, rangeDim> MapperType; - using EntityType = XT::Grid::extract_entity_t<GridLayerType>; - typedef BaseFunctionSet:: - DunePdelabWrapper<BackendType, EntityType, DomainFieldType, dimDomain, RangeFieldType, rangeDim, rangeDimCols> - BaseFunctionSetType; - static const XT::Grid::Backends layer_backend = XT::Grid::Backends::view; - static const bool needs_grid_view = true; - - typedef typename DofCommunicationChooser<GridLayerType>::Type DofCommunicatorType; - typedef typename Dune::XT::Common:: - make_identical_tuple<DunePdelabCgSpaceWrapper<GridViewImp, polynomialOrder, RangeFieldImp, 1, 1>, rangeDim>::type - SpaceTupleType; - -private: - friend class DunePdelabCgSpaceWrapper<GridViewImp, polynomialOrder, RangeFieldImp, rangeDim, rangeDimCols>; -}; // class DunePdelabCgSpaceWrapperTraits - - -namespace internal { - - -template <int polOrder, class SpaceType> -struct LocalDirichletDoFs -{ - template <class I> - static std::set<size_t> get(const typename SpaceType::EntityType& entity, - const XT::Grid::BoundaryInfo<I>& boundaryInfo, - const SpaceType& space) - { - return space.local_dirichlet_DoFs_simplicial_lagrange_elements(entity, boundaryInfo); - } -}; - -template <class SpaceType> -struct LocalDirichletDoFs<1, SpaceType> -{ - template <class I> - static std::set<size_t> get(const typename SpaceType::EntityType& entity, - const XT::Grid::BoundaryInfo<I>& boundaryInfo, - const SpaceType& space) - { - return space.local_dirichlet_DoFs_order_1(entity, boundaryInfo); - } -}; - - -} // namespace internal - - -template <class GridViewImp, int polynomialOrder, class RangeFieldImp> -class DunePdelabCgSpaceWrapper<GridViewImp, polynomialOrder, RangeFieldImp, 1, 1> - : public CgSpaceInterface<DunePdelabCgSpaceWrapperTraits<GridViewImp, polynomialOrder, RangeFieldImp, 1, 1>, - GridViewImp::dimension, - 1, - 1> -{ - typedef CgSpaceInterface<DunePdelabCgSpaceWrapperTraits<GridViewImp, polynomialOrder, RangeFieldImp, 1, 1>, - GridViewImp::dimension, - 1, - 1> - BaseType; - typedef DunePdelabCgSpaceWrapper<GridViewImp, polynomialOrder, RangeFieldImp, 1, 1> ThisType; - -public: - typedef DunePdelabCgSpaceWrapperTraits<GridViewImp, polynomialOrder, RangeFieldImp, 1, 1> Traits; - - static const int polOrder = Traits::polOrder; - static const size_t dimDomain = BaseType::dimDomain; - static const size_t dimRange = BaseType::dimRange; - static const size_t dimRangeCols = BaseType::dimRangeCols; - - typedef typename Traits::GridLayerType GridLayerType; - typedef typename Traits::RangeFieldType RangeFieldType; - typedef typename Traits::BackendType BackendType; - typedef typename Traits::MapperType MapperType; - typedef typename Traits::BaseFunctionSetType BaseFunctionSetType; - - typedef typename GridLayerType::ctype DomainFieldType; - typedef FieldVector<DomainFieldType, dimDomain> DomainType; - typedef DofCommunicationChooser<GridLayerType> DofCommunicationChooserType; - typedef typename DofCommunicationChooserType::Type DofCommunicatorType; - -private: - typedef typename Traits::FEMapType FEMapType; - -public: - typedef typename BaseType::EntityType EntityType; - typedef typename BaseType::PatternType PatternType; - - explicit DunePdelabCgSpaceWrapper(GridLayerType grd_vw) - : grid_view_(grd_vw) - , fe_map_(grid_view_) - , backend_(grid_view_, fe_map_) - , mapper_(backend_) - , communicator_(DofCommunicationChooser<GridViewImp>::create(grid_view_)) - , communicator_prepared_(false) - { - } - - /** - * \brief Copy ctor. - * \note Manually implemented bc of the std::mutex + communicator_ unique_ptr - */ - DunePdelabCgSpaceWrapper(const ThisType& other) - : grid_view_(other.grid_view_) - , fe_map_(grid_view_) - , backend_(grid_view_, fe_map_) - , mapper_(backend_) - , communicator_(DofCommunicationChooser<GridViewImp>::create(grid_view_)) - , communicator_prepared_(false) - { - // make sure our new communicator is prepared if other's was - if (other.communicator_prepared_) { - const auto& comm DUNE_UNUSED = this->dof_communicator(); - communicator_prepared_ = true; - } - } - - /** - * \brief Move ctor. - * \note Manually implemented bc of the std::mutex. - */ - DunePdelabCgSpaceWrapper(ThisType&& source) - : grid_view_(std::move(source.grid_view_)) - , fe_map_(std::move(source.fe_map_)) - , backend_(std::move(source.backend_)) - , mapper_(std::move(source.mapper_)) - , communicator_(std::move(source.communicator_)) - , communicator_prepared_(std::move(source.communicator_prepared_)) - { - } - - ThisType& operator=(const ThisType& other) = delete; - ThisType& operator=(ThisType&& source) = delete; - - const GridLayerType& grid_layer() const - { - return grid_view_; - } - - GridLayerType& grid_layer() - { - return grid_view_; - } - - const BackendType& backend() const - { - return backend_; - } - - const MapperType& mapper() const - { - return mapper_; - } - - std::vector<DomainType> lagrange_points(const EntityType& entity) const - { - return BaseType::lagrange_points_order_1(entity); - } - - template <class I> - std::set<size_t> local_dirichlet_DoFs(const EntityType& entity, const XT::Grid::BoundaryInfo<I>& boundaryInfo) const - { - return internal::LocalDirichletDoFs<polynomialOrder, ThisType>::get(entity, boundaryInfo, *this); - } - - BaseFunctionSetType base_function_set(const EntityType& entity) const - { - return BaseFunctionSetType(backend_, entity); - } - - DofCommunicatorType& dof_communicator() const - { - DUNE_UNUSED std::lock_guard<std::mutex> gg(communicator_mutex_); - if (!communicator_prepared_) - communicator_prepared_ = DofCommunicationChooserType::prepare(*this, *communicator_); - return *communicator_; - } // ... communicator(...) - -private: - GridLayerType grid_view_; - const FEMapType fe_map_; - const BackendType backend_; - const MapperType mapper_; - mutable std::unique_ptr<DofCommunicatorType> communicator_; - mutable bool communicator_prepared_; - mutable std::mutex communicator_mutex_; -}; // class DunePdelabCgSpaceWrapper<..., 1, 1> - - -template <class GridViewImp, int polynomialOrder, class RangeFieldImp, size_t rangeDim> -class DunePdelabCgSpaceWrapper<GridViewImp, polynomialOrder, RangeFieldImp, rangeDim, 1> - : public CgSpaceInterface<DunePdelabCgSpaceWrapperTraits<GridViewImp, polynomialOrder, RangeFieldImp, rangeDim, 1>, - GridViewImp::dimension, - rangeDim, - 1>, - public ProductSpaceInterface<DunePdelabCgSpaceWrapperTraits<GridViewImp, - polynomialOrder, - RangeFieldImp, - rangeDim, - 1>, - GridViewImp::dimension, - rangeDim, - 1> -{ - typedef CgSpaceInterface<DunePdelabCgSpaceWrapperTraits<GridViewImp, polynomialOrder, RangeFieldImp, rangeDim, 1>, - GridViewImp::dimension, - rangeDim, - 1> - BaseType; - typedef ProductSpaceInterface<DunePdelabCgSpaceWrapperTraits<GridViewImp, - polynomialOrder, - RangeFieldImp, - rangeDim, - 1>, - GridViewImp::dimension, - rangeDim, - 1> - ProductInterfaceType; - typedef DunePdelabCgSpaceWrapper<GridViewImp, polynomialOrder, RangeFieldImp, rangeDim, 1> ThisType; - -public: - typedef DunePdelabCgSpaceWrapperTraits<GridViewImp, polynomialOrder, RangeFieldImp, rangeDim, 1> Traits; - - static const int polOrder = Traits::polOrder; - static const size_t dimDomain = BaseType::dimDomain; - static const size_t dimRange = BaseType::dimRange; - static const size_t dimRangeCols = BaseType::dimRangeCols; - - typedef typename Traits::GridLayerType GridLayerType; - typedef typename Traits::RangeFieldType RangeFieldType; - typedef typename Traits::BackendType BackendType; - typedef typename Traits::MapperType MapperType; - typedef typename Traits::BaseFunctionSetType BaseFunctionSetType; - - typedef typename GridLayerType::ctype DomainFieldType; - typedef FieldVector<DomainFieldType, dimDomain> DomainType; - typedef DofCommunicationChooser<GridLayerType> DofCommunicationChooserType; - typedef typename DofCommunicationChooserType::Type DofCommunicatorType; - - using typename ProductInterfaceType::SpaceTupleType; - typedef DunePdelabCgSpaceWrapper<GridViewImp, polynomialOrder, RangeFieldImp, 1, 1> FactorSpaceType; - -private: - typedef typename Traits::FEMapType FEMapType; - -public: - typedef typename BaseType::EntityType EntityType; - typedef typename BaseType::PatternType PatternType; - - explicit DunePdelabCgSpaceWrapper(GridLayerType grd_vw) - : grid_view_(grd_vw) - , fe_map_(grid_view_) - , backend_(grid_view_, fe_map_) - , mapper_(backend_) - , factor_space_(grd_vw) - , communicator_(DofCommunicationChooser<GridViewImp>::create(grid_view_)) - , communicator_prepared_(false) - { - } - - /** - * \brief Copy ctor. - * \note Manually implemented bc of the std::mutex + communicator_ unique_ptr - */ - DunePdelabCgSpaceWrapper(const ThisType& other) - : grid_view_(other.grid_view_) - , fe_map_(grid_view_) - , backend_(grid_view_, fe_map_) - , mapper_(backend_) - , factor_space_(other.factor_space_) - , communicator_(DofCommunicationChooser<GridViewImp>::create(grid_view_)) - , communicator_prepared_(false) - { - // make sure our new communicator is prepared if other's was - if (other.communicator_prepared_) - const auto& comm DUNE_UNUSED = this->dof_communicator(); - } - - /** - * \brief Move ctor. - * \note Manually implemented bc of the std::mutex. - */ - DunePdelabCgSpaceWrapper(ThisType&& source) - : grid_view_(source.grid_view_) - , fe_map_(source.fe_map_) - , backend_(source.backend_) - , mapper_(source.mapper_) - , factor_space_(source.factor_space_) - , communicator_(std::move(source.communicator_)) - , communicator_prepared_(source.communicator_prepared_) - { - } - - ThisType& operator=(const ThisType& other) = delete; - - ThisType& operator=(ThisType&& source) = delete; - - const GridLayerType& grid_layer() const - { - return grid_view_; - } - - GridLayerType& grid_layer() - { - return grid_view_; - } - - const BackendType& backend() const - { - return backend_; - } - - const MapperType& mapper() const - { - return mapper_; - } - - std::vector<DomainType> lagrange_points(const EntityType& entity) const - { - return BaseType::lagrange_points_order_1(entity); - } - - template <class I> - std::set<size_t> local_dirichlet_DoFs(const EntityType& entity, const XT::Grid::BoundaryInfo<I>& boundaryInfo) const - { - return internal::LocalDirichletDoFs<polynomialOrder, ThisType>::get(entity, boundaryInfo, *this); - } - - BaseFunctionSetType base_function_set(const EntityType& entity) const - { - return BaseFunctionSetType(backend_, entity); - } - - DofCommunicatorType& dof_communicator() const - { - DUNE_UNUSED std::lock_guard<std::mutex> gg(communicator_mutex_); - if (!communicator_prepared_) - communicator_prepared_ = DofCommunicationChooserType::prepare(*this, *communicator_); - return *communicator_; - } // ... communicator(...) - - template <size_t ii> - const FactorSpaceType& factor() const - { - return factor_space_; - } - -private: - GridLayerType grid_view_; - const FEMapType fe_map_; - const BackendType backend_; - const MapperType mapper_; - const FactorSpaceType factor_space_; - mutable std::unique_ptr<DofCommunicatorType> communicator_; - mutable bool communicator_prepared_; - mutable std::mutex communicator_mutex_; -}; // class DunePdelabCgSpaceWrapper< ..., 1 > - - -#else // HAVE_DUNE_PDELAB - - -template <class GridViewImp, int polynomialOrder, class RangeFieldImp, size_t rangeDim, size_t rangeDimCols = 1> -class DunePdelabCgSpaceWrapper -{ - static_assert(Dune::AlwaysFalse<GridViewImp>::value, "You are missing dune-pdelab!"); -}; - - -#endif // HAVE_DUNE_PDELAB - - -} // namespace GDT -} // namespace Dune - -#endif // DUNE_GDT_SPACES_CG_DUNE_PDELAB_WRAPPER_HH diff --git a/dune/gdt/spaces/cg/interface.hh b/dune/gdt/spaces/cg/interface.hh index a5c792aff2d65c9b3d5bc09369e9ebfdf298d404..67342ed017b4789cee219717f568b90430efc70e 100644 --- a/dune/gdt/spaces/cg/interface.hh +++ b/dune/gdt/spaces/cg/interface.hh @@ -24,6 +24,7 @@ #include <dune/xt/common/type_traits.hh> #include <dune/xt/common/ranges.hh> #include <dune/xt/grid/boundaryinfo.hh> +#include <dune/xt/grid/intersection.hh> #include "../interface.hh" @@ -62,6 +63,8 @@ private: static const constexpr RangeFieldType compare_tolerance_ = 1e-13; public: + virtual ~CgSpaceInterface() = default; + /** * \defgroup interface ´´These methods have to be implemented!'' * @{ @@ -71,186 +74,34 @@ public: CHECK_CRTP(this->as_imp().lagrange_points(entity)); return this->as_imp().lagrange_points(entity); } - - std::set<size_t> local_dirichlet_DoFs( - const EntityType& entity, - const XT::Grid::BoundaryInfo<XT::Grid::extract_intersection_t<GridLayerType>>& boundaryInfo) const - { - CHECK_CRTP(this->as_imp().local_dirichlet_DoFs(entity, boundaryInfo)); - return this->as_imp().local_dirichlet_DoFs(entity, boundaryInfo); - } /** @} */ /** * \defgroup provided ´´These methods are provided by the interface for convenience.'' * @{ **/ - std::vector<DomainType> lagrange_points_order_1(const EntityType& entity) const - { - // check - static_assert(polOrder == 1, "Not tested for higher polynomial orders!"); - if (dimRange != 1) - DUNE_THROW(NotImplemented, "Does not work for higher dimensions"); - assert(this->grid_layer().indexSet().contains(entity)); - // get the basis and reference element - const auto basis = this->base_function_set(entity); - typedef typename BaseType::BaseFunctionSetType::RangeType RangeType; - std::vector<RangeType> tmp_basis_values(basis.size(), RangeType(0)); - const auto& reference_element = ReferenceElements<DomainFieldType, dimDomain>::general(entity.type()); - const auto num_vertices = reference_element.size(dimDomain); - assert(num_vertices >= 0); - assert(boost::numeric_cast<size_t>(num_vertices) == basis.size() && "This should not happen with polOrder 1!"); - // prepare return vector - std::vector<DomainType> local_vertices(num_vertices, DomainType(0)); - // loop over all vertices - for (auto ii : Dune::XT::Common::value_range(num_vertices)) { - // get the local coordinate of the iith vertex - const auto local_vertex = reference_element.position(ii, dimDomain); - // evaluate the basefunctionset - basis.evaluate(local_vertex, tmp_basis_values); - // find the basis function that evaluates to one here (has to be only one!) - size_t ones = 0; - size_t zeros = 0; - size_t failures = 0; - for (size_t jj = 0; jj < basis.size(); ++jj) { - if (std::abs((tmp_basis_values)[jj][0] - RangeFieldType(1)) < compare_tolerance_) { - local_vertices[jj] = local_vertex; - ++ones; - } else if (std::abs((tmp_basis_values)[jj][0]) < compare_tolerance_) - ++zeros; - else - ++failures; - } - assert(ones == 1 && zeros == (basis.size() - 1) && failures == 0 && "This must not happen for polOrder 1!"); - } - return local_vertices; - } // ... lagrange_points_order_1(...) - - std::set<size_t> local_dirichlet_DoFs_order_1( + virtual std::set<size_t> local_dirichlet_DoFs( const EntityType& entity, - const XT::Grid::BoundaryInfo<XT::Grid::extract_intersection_t<GridLayerType>>& boundaryInfo) const + const XT::Grid::BoundaryInfo<XT::Grid::extract_intersection_t<GridLayerType>>& boundary_info) const { - static_assert(polOrder == 1, "Not tested for higher polynomial orders!"); + std::set<size_t> ret; static const XT::Grid::DirichletBoundary dirichlet{}; - if (dimRange != 1) - DUNE_THROW(NotImplemented, "Does not work for higher dimensions"); - // check - assert(this->grid_layer().indexSet().contains(entity)); - if (!entity.hasBoundaryIntersections()) - return std::set<size_t>(); - // prepare - std::set<size_t> localDirichletDofs; - std::vector<DomainType> dirichlet_vertices; - // get all dirichlet vertices of this entity, therefore - // * loop over all intersections + const auto lps = lagrange_points(entity); const auto intersection_it_end = this->grid_layer().iend(entity); for (auto intersection_it = this->grid_layer().ibegin(entity); intersection_it != intersection_it_end; ++intersection_it) { // only work on dirichlet ones const auto& intersection = *intersection_it; // actual dirichlet intersections + process boundaries for parallel runs - if (boundaryInfo.type(intersection) == dirichlet || (!intersection.neighbor() && !intersection.boundary())) { - // and get the vertices of the intersection - const auto geometry = intersection.geometry(); - for (auto cc : Dune::XT::Common::value_range(geometry.corners())) - dirichlet_vertices.emplace_back(entity.geometry().local(geometry.corner(cc))); - } // only work on dirichlet ones - } // loop over all intersections - // find the corresponding basis functions - const auto basis = this->base_function_set(entity); - typedef typename BaseType::BaseFunctionSetType::RangeType RangeType; - std::vector<RangeType> tmp_basis_values(basis.size(), RangeType(0)); - for (size_t cc = 0; cc < dirichlet_vertices.size(); ++cc) { - // find the basis function that evaluates to one here (has to be only one!) - basis.evaluate(dirichlet_vertices[cc], tmp_basis_values); - size_t ones = 0; - size_t zeros = 0; - size_t failures = 0; - for (size_t jj = 0; jj < basis.size(); ++jj) { - if (std::abs(tmp_basis_values[jj][0] - RangeFieldType(1)) < compare_tolerance_) { - localDirichletDofs.insert(jj); - ++ones; - } else if (std::abs(tmp_basis_values[jj][0]) < compare_tolerance_) - ++zeros; - else - ++failures; - } - // asserts valid for polorder 1 only - assert(ones == 1); - assert(zeros == (basis.size() - 1)); - assert(failures == 0); - } - return localDirichletDofs; - } // ... local_dirichlet_DoFs_order_1(...) - - std::set<size_t> local_dirichlet_DoFs_simplicial_lagrange_elements( - const EntityType& entity, - const XT::Grid::BoundaryInfo<XT::Grid::extract_intersection_t<GridLayerType>>& boundaryInfo) const - { - if (!entity.type().isSimplex()) - DUNE_THROW(NotImplemented, "Only implemented for simplex elements!"); - // check - assert(this->grid_layer().indexSet().contains(entity)); - // prepare - std::set<size_t> localDirichletDofs; - std::vector<DomainType> dirichlet_vertices; - // get all dirichlet vertices of this entity, therefore - // * loop over all intersections - const auto intersection_it_end = this->grid_layer().iend(entity); - for (auto intersection_it = this->grid_layer().ibegin(entity); intersection_it != intersection_it_end; - ++intersection_it) { - const auto& intersection = *intersection_it; - std::vector<StuffDomainType> dirichlet_vertices_intersection; - // only work on dirichlet ones, actual dirichlet intersections + process boundaries for parallel runs - if (boundaryInfo.dirichlet(intersection) || (!intersection.neighbor() && !intersection.boundary())) { - // and get the vertices of the intersection - const auto geometry = intersection.geometry(); - for (auto cc : Dune::XT::Common::value_range(geometry.corners())) { - dirichlet_vertices_intersection.emplace_back(entity.geometry().local(geometry.corner(cc))); - dirichlet_vertices.emplace_back(entity.geometry().local(geometry.corner(cc))); + if (boundary_info.type(intersection) == dirichlet || (!intersection.neighbor() && !intersection.boundary())) + for (size_t ii = 0; ii < lps.size(); ++ii) { + const auto& local_lagrange_point = lps[ii]; + if (XT::Grid::contains(intersection, entity.geometry().global(local_lagrange_point))) + ret.insert(ii); } - } // only work on dirichlet ones - // for higher polynomial orders, add points associated to DoFs within the intersection - // calculate by using lagrange grid {x = \sum_{j=0}^d \lambda_j a_j | \sum_j lambda_j = 1}, where a_j are the - // vertices of the entity and \lambda_j \in {\frac{m}{polOrder} | m = 0, ... , polOrder} - std::vector<double> possible_coefficients(polOrder < 1 ? 0 : polOrder - 1); - for (int m = 0; m < polOrder; ++m) - possible_coefficients[m] = m / polOrder; - std::set<std::vector<double>> possible_coefficient_vectors; - possible_convex_combination_coefficients( - possible_coefficient_vectors, possible_coefficients, dirichlet_vertices_intersection.size()); - for (const auto& coefficient_vector : possible_coefficient_vectors) - dirichlet_vertices.emplace_back(std::inner_product(dirichlet_vertices_intersection.begin(), - dirichlet_vertices_intersection.end(), - coefficient_vector.begin(), - StuffDomainType(0))); - } // loop over all intersections - - // find the corresponding basis functions - const auto basis = this->base_function_set(entity); - typedef typename BaseType::BaseFunctionSetType::RangeType RangeType; - std::vector<RangeType> tmp_basis_values(basis.size(), RangeType(0)); - for (size_t cc = 0; cc < dirichlet_vertices.size(); ++cc) { - // find the basis function that evaluates to one here (has to be only one per range dimension!) - basis.evaluate(dirichlet_vertices[cc], tmp_basis_values); - size_t ones = 0; - size_t zeros = 0; - size_t failures = 0; - for (size_t jj = 0; jj < basis.size(); ++jj) { - for (size_t rr = 0; rr < dimRange; ++rr) { - if (std::abs(tmp_basis_values[jj][rr] - RangeFieldType(1)) < compare_tolerance_) { - localDirichletDofs.insert(jj); - ++ones; - } else if (std::abs(tmp_basis_values[jj][rr]) < compare_tolerance_) - ++zeros; - else - ++failures; - } - } - assert(ones == dimRange && zeros == ((basis.size() - 1) * dimRange) && failures == 0 && "This must not happen!"); } - return localDirichletDofs; - } // ... local_dirichlet_DoFs_simplicial_lagrange_elements(...) + return ret; + } // ... local_dirichlet_DoFs(...) using BaseType::compute_pattern; @@ -302,33 +153,47 @@ public: return codim == 0; } -private: - void possible_convex_combination_coefficients(std::set<std::vector<double>>& vectors_in, - const std::vector<double>& possible_coefficients, - const size_t final_size) const +protected: + std::vector<DomainType> lagrange_points_order_1(const EntityType& entity) const { - if (vectors_in.empty()) { - if (final_size != 0) - for (const auto& coeff : possible_coefficients) - vectors_in.insert(std::vector<double>(1, coeff)); - } else if (vectors_in.begin()->size() != final_size) { - std::set<std::vector<double>> vectors_out; - for (auto& vec : vectors_in) { - for (const auto& coeff : possible_coefficients) { - if ((vec.size() != final_size - 1 - && Dune::XT::Common::FloatCmp::le(std::accumulate(vec.begin(), vec.end(), 0.0) + coeff, 1.0)) - || (vec.size() == final_size - 1 - && Dune::XT::Common::FloatCmp::eq(std::accumulate(vec.begin(), vec.end(), 0.0) + coeff, 1.0))) { - std::vector<double> vec_copy = vec; - vec_copy.push_back(coeff); - vectors_out.insert(vec_copy); - } - } + // check + static_assert(polOrder == 1, "Not tested for higher polynomial orders!"); + if (dimRange != 1) + DUNE_THROW(NotImplemented, "Does not work for higher dimensions"); + assert(this->grid_layer().indexSet().contains(entity)); + // get the basis and reference element + const auto basis = this->base_function_set(entity); + typedef typename BaseType::BaseFunctionSetType::RangeType RangeType; + std::vector<RangeType> tmp_basis_values(basis.size(), RangeType(0)); + const auto& reference_element = ReferenceElements<DomainFieldType, dimDomain>::general(entity.type()); + const auto num_vertices = reference_element.size(dimDomain); + assert(num_vertices >= 0); + assert(boost::numeric_cast<size_t>(num_vertices) == basis.size() && "This should not happen with polOrder 1!"); + // prepare return vector + std::vector<DomainType> local_vertices(num_vertices, DomainType(0)); + // loop over all vertices + for (auto ii : Dune::XT::Common::value_range(num_vertices)) { + // get the local coordinate of the iith vertex + const auto local_vertex = reference_element.position(ii, dimDomain); + // evaluate the basefunctionset + basis.evaluate(local_vertex, tmp_basis_values); + // find the basis function that evaluates to one here (has to be only one!) + size_t ones = 0; + size_t zeros = 0; + size_t failures = 0; + for (size_t jj = 0; jj < basis.size(); ++jj) { + if (std::abs((tmp_basis_values)[jj][0] - RangeFieldType(1)) < compare_tolerance_) { + local_vertices[jj] = local_vertex; + ++ones; + } else if (std::abs((tmp_basis_values)[jj][0]) < compare_tolerance_) + ++zeros; + else + ++failures; } - vectors_in = vectors_out; - possible_convex_combination_coefficients(vectors_in, possible_coefficients, final_size); - } // if (...) - } // ... possible_convex_combination_coefficients(...) + assert(ones == 1 && zeros == (basis.size() - 1) && failures == 0 && "This must not happen for polOrder 1!"); + } + return local_vertices; + } // ... lagrange_points_order_1(...) }; // class CgSpaceInterface diff --git a/dune/gdt/spaces/constraints.bindings.hh b/dune/gdt/spaces/constraints.bindings.hh index c54f060abbdb26601a684f3bb1afb97317f303a8..73431cfb88fcbb3f4a6446f048bbf5cbea46d8f7 100644 --- a/dune/gdt/spaces/constraints.bindings.hh +++ b/dune/gdt/spaces/constraints.bindings.hh @@ -204,7 +204,7 @@ public: #define _DUNE_GDT_SPACES_CONSTRAINTS_BIND_ALU(_m) \ _DUNE_GDT_SPACES_CONSTRAINTS_BIND(_m, ALU_2D_SIMPLEX_CONFORMING, leaf, view, "leaf"); \ _DUNE_GDT_SPACES_CONSTRAINTS_BIND(_m, ALU_2D_SIMPLEX_CONFORMING, level, view, "level"); \ - _DUNE_GDT_SPACES_CONSTRAINTS_BIND(_m, ALU_2D_SIMPLEX_CONFORMING, dd_subdomain, part, "dd_subdomain") + _DUNE_GDT_SPACES_CONSTRAINTS_BIND(_m, ALU_2D_SIMPLEX_CONFORMING, dd_subdomain, view, "dd_subdomain") #else #define _DUNE_GDT_SPACES_CONSTRAINTS_BIND_ALU(_m) #endif @@ -220,9 +220,9 @@ public: #define _DUNE_GDT_SPACES_CONSTRAINTS_BIND_YASP(_m) \ _DUNE_GDT_SPACES_CONSTRAINTS_BIND(_m, YASP_1D_EQUIDISTANT_OFFSET, leaf, view, ""); \ - _DUNE_GDT_SPACES_CONSTRAINTS_BIND(_m, YASP_1D_EQUIDISTANT_OFFSET, dd_subdomain, part, "dd_subdomain"); \ + _DUNE_GDT_SPACES_CONSTRAINTS_BIND(_m, YASP_1D_EQUIDISTANT_OFFSET, dd_subdomain, view, "dd_subdomain"); \ _DUNE_GDT_SPACES_CONSTRAINTS_BIND(_m, YASP_2D_EQUIDISTANT_OFFSET, leaf, view, ""); \ - _DUNE_GDT_SPACES_CONSTRAINTS_BIND(_m, YASP_2D_EQUIDISTANT_OFFSET, dd_subdomain, part, "dd_subdomain") + _DUNE_GDT_SPACES_CONSTRAINTS_BIND(_m, YASP_2D_EQUIDISTANT_OFFSET, dd_subdomain, view, "dd_subdomain") #define DUNE_GDT_SPACES_CONSTRAINTS_BIND(_m) \ _DUNE_GDT_SPACES_CONSTRAINTS_BIND_ALBERTA(_m); \ diff --git a/dune/gdt/spaces/datahandles.hh b/dune/gdt/spaces/datahandles.hh index 27fc0f681dbb0b33ac4aa0a8b1d7762ee3a8dff2..3388d9deaf74819c8eb0d6741de93006c40b068b 100644 --- a/dune/gdt/spaces/datahandles.hh +++ b/dune/gdt/spaces/datahandles.hh @@ -99,7 +99,7 @@ class SpaceDataHandle public: using DataType = typename CommunicationDescriptor::DataType; - using Codim0EntityType = XT::Grid::extract_entity_t<typename SpaceType::GridViewType>; + using Codim0EntityType = XT::Grid::extract_entity_t<typename SpaceType::GridLayerType>; SpaceDataHandle(const SpaceType& space, VectorType& v, @@ -221,7 +221,7 @@ public: private: GatherScatter _gather_scatter; // this is currently the default since we have no non-overlapping parallel code - static const Partitions::All partitions_; + static constexpr const Partitions::All partitions_{}; }; diff --git a/dune/gdt/spaces/dg.bindings.hh b/dune/gdt/spaces/dg.bindings.hh index 066db803d90abab9ce403b0eb0a0e36aef3b6f3b..d27698d76bc3be70d363a32b20f4907f671ec590 100644 --- a/dune/gdt/spaces/dg.bindings.hh +++ b/dune/gdt/spaces/dg.bindings.hh @@ -9,7 +9,7 @@ #ifndef DUNE_GDT_SPACES_DG_BINDINGS_HH #define DUNE_GDT_SPACES_DG_BINDINGS_HH -//#if HAVE_DUNE_PYBINDXI +#if HAVE_DUNE_PYBINDXI #include <dune/xt/grid/grids.bindings.hh> @@ -19,70 +19,63 @@ // begin: this is what we need for the .so -// * fem -#if HAVE_DUNE_FEM -#define _DUNE_GDT_SPACES_DG_BIND_FEM(_m, _GRID, _layer, _r, _rC) \ +#define _DUNE_GDT_SPACES_DG_BIND(_m, _GRID, _layer, _r, _rC) \ Dune::GDT::bindings::SpaceInterface<Dune::GDT::DgSpaceProvider<_GRID, \ Dune::XT::Grid::Layers::_layer, \ - Dune::GDT::Backends::fem, \ + Dune::GDT::Backends::gdt, \ 1, \ double, \ _r, \ _rC>>::bind(_m) //#if HAVE_ALBERTA -//#define _DUNE_GDT_SPACES_DG_BIND_FEM_ALBERTA_LAYER(_m, _layer) \ -// _DUNE_GDT_SPACES_DG_BIND_FEM(_m, ALBERTA_2D, _layer, 1, 1) -//#define _DUNE_GDT_SPACES_DG_BIND_FEM_ALBERTA(_m) \ -// _DUNE_GDT_SPACES_DG_BIND_FEM_ALBERTA_LAYER(_m, dd_subdomain); \ -// _DUNE_GDT_SPACES_DG_BIND_FEM_ALBERTA_LAYER(_m, leaf); \ -// _DUNE_GDT_SPACES_DG_BIND_FEM_ALBERTA_LAYER(_m, level) +//#define _DUNE_GDT_SPACES_DG_BIND_ALBERTA_LAYER(_m, _layer) \ +// _DUNE_GDT_SPACES_DG_BIND(_m, ALBERTA_2D, _layer, 1, 1) +//#define _DUNE_GDT_SPACES_DG_BIND_ALBERTA(_m) \ +// _DUNE_GDT_SPACES_DG_BIND_ALBERTA_LAYER(_m, dd_subdomain); \ +// _DUNE_GDT_SPACES_DG_BIND_ALBERTA_LAYER(_m, leaf); \ +// _DUNE_GDT_SPACES_DG_BIND_ALBERTA_LAYER(_m, level) //#else -#define _DUNE_GDT_SPACES_DG_BIND_FEM_ALBERTA(_m) +#define _DUNE_GDT_SPACES_DG_BIND_ALBERTA(_m) //#endif #if HAVE_DUNE_ALUGRID -#define _DUNE_GDT_SPACES_DG_BIND_FEM_ALU_LAYER(_m, _layer) \ - _DUNE_GDT_SPACES_DG_BIND_FEM(_m, ALU_2D_SIMPLEX_CONFORMING, _layer, 1, 1) -#define _DUNE_GDT_SPACES_DG_BIND_FEM_ALU(_m) \ - _DUNE_GDT_SPACES_DG_BIND_FEM_ALU_LAYER(_m, dd_subdomain); \ - _DUNE_GDT_SPACES_DG_BIND_FEM_ALU_LAYER(_m, leaf); \ - _DUNE_GDT_SPACES_DG_BIND_FEM_ALU_LAYER(_m, level) +#define _DUNE_GDT_SPACES_DG_BIND_ALU_LAYER(_m, _layer) \ + _DUNE_GDT_SPACES_DG_BIND(_m, ALU_2D_SIMPLEX_CONFORMING, _layer, 1, 1) +#define _DUNE_GDT_SPACES_DG_BIND_ALU(_m) \ + _DUNE_GDT_SPACES_DG_BIND_ALU_LAYER(_m, dd_subdomain); \ + _DUNE_GDT_SPACES_DG_BIND_ALU_LAYER(_m, leaf); \ + _DUNE_GDT_SPACES_DG_BIND_ALU_LAYER(_m, level) #else -#define _DUNE_GDT_SPACES_DG_BIND_FEM_ALU(_m) +#define _DUNE_GDT_SPACES_DG_BIND_ALU(_m) #endif //#if HAVE_DUNE_UGGRID || HAVE_UG // <- does not work -//#define _DUNE_GDT_SPACES_DG_BIND_FEM_UG_LAYER(_m, _layer) _DUNE_GDT_SPACES_DG_BIND_FEM(_m, UG_2D, _layer, 1, 1) -//#define _DUNE_GDT_SPACES_DG_BIND_FEM_UG(_m) -// _DUNE_GDT_SPACES_DG_BIND_FEM_UG_LAYER(_m, dd_subdomain); -// _DUNE_GDT_SPACES_DG_BIND_FEM_UG_LAYER(_m, leaf); -// _DUNE_GDT_SPACES_DG_BIND_FEM_UG_LAYER(_m, level) +//#define _DUNE_GDT_SPACES_DG_BIND_UG_LAYER(_m, _layer) _DUNE_GDT_SPACES_DG_BIND(_m, UG_2D, _layer, 1, 1) +//#define _DUNE_GDT_SPACES_DG_BIND_UG(_m) +// _DUNE_GDT_SPACES_DG_BIND_UG_LAYER(_m, dd_subdomain); +// _DUNE_GDT_SPACES_DG_BIND_UG_LAYER(_m, leaf); +// _DUNE_GDT_SPACES_DG_BIND_UG_LAYER(_m, level) //#else -//#define _DUNE_GDT_SPACES_DG_BIND_FEM_UG(_m) +//#define _DUNE_GDT_SPACES_DG_BIND_UG(_m) //#endif -#define _DUNE_GDT_SPACES_DG_BIND_FEM_YASP_LAYER(_m, _layer) \ - _DUNE_GDT_SPACES_DG_BIND_FEM(_m, YASP_1D_EQUIDISTANT_OFFSET, _layer, 1, 1); \ - _DUNE_GDT_SPACES_DG_BIND_FEM(_m, YASP_2D_EQUIDISTANT_OFFSET, _layer, 1, 1) -#define _DUNE_GDT_SPACES_DG_BIND_FEM_YASP(_m) \ - _DUNE_GDT_SPACES_DG_BIND_FEM_YASP_LAYER(_m, dd_subdomain); \ - _DUNE_GDT_SPACES_DG_BIND_FEM_YASP_LAYER(_m, leaf); \ - _DUNE_GDT_SPACES_DG_BIND_FEM_YASP_LAYER(_m, level) +#define _DUNE_GDT_SPACES_DG_BIND_YASP_LAYER(_m, _layer) \ + _DUNE_GDT_SPACES_DG_BIND(_m, YASP_1D_EQUIDISTANT_OFFSET, _layer, 1, 1); \ + _DUNE_GDT_SPACES_DG_BIND(_m, YASP_2D_EQUIDISTANT_OFFSET, _layer, 1, 1) +#define _DUNE_GDT_SPACES_DG_BIND_YASP(_m) \ + _DUNE_GDT_SPACES_DG_BIND_YASP_LAYER(_m, dd_subdomain); \ + _DUNE_GDT_SPACES_DG_BIND_YASP_LAYER(_m, leaf); \ + _DUNE_GDT_SPACES_DG_BIND_YASP_LAYER(_m, level) -#define _DUNE_GDT_SPACES_DG_BIND_FEM_ALL(_m) \ - _DUNE_GDT_SPACES_DG_BIND_FEM_ALBERTA(_m); \ - _DUNE_GDT_SPACES_DG_BIND_FEM_ALU(_m); \ - _DUNE_GDT_SPACES_DG_BIND_FEM_YASP(_m) -//_DUNE_GDT_SPACES_DG_BIND_FEM_UG(_m); // <- does not work -#else // HAVE_DUNE_FEM -#define _DUNE_GDT_SPACES_DG_BIND_FEM_ALL(_m) -#endif - -#define DUNE_GDT_SPACES_DG_BIND(_m) _DUNE_GDT_SPACES_DG_BIND_FEM_ALL(_m) +#define DUNE_GDT_SPACES_DG_BIND(_m) \ + _DUNE_GDT_SPACES_DG_BIND_ALBERTA(_m); \ + _DUNE_GDT_SPACES_DG_BIND_ALU(_m); \ + _DUNE_GDT_SPACES_DG_BIND_YASP(_m) +//_DUNE_GDT_SPACES_DG_BIND_UG(_m); // <- does not work // end: this is what we need for the .so -//#endif // HAVE_DUNE_PYBINDXI +#endif // HAVE_DUNE_PYBINDXI #endif // DUNE_GDT_SPACES_DG_BINDINGS_HH diff --git a/dune/gdt/spaces/dg.hh b/dune/gdt/spaces/dg.hh index 2f15cc48999e933b45a47c0cbac4c59875aeb3ea..ad9d79e41014833a0981a71f7f902df651f95bc9 100644 --- a/dune/gdt/spaces/dg.hh +++ b/dune/gdt/spaces/dg.hh @@ -18,12 +18,11 @@ #include <dune/xt/grid/layers.hh> #include <dune/xt/grid/gridprovider/provider.hh> -#include "interface.hh" -#include "dg/dune-fem-wrapper.hh" -#include "../playground/spaces/dg/dune-pdelab-wrapper.hh" -#include "../playground/spaces/dg/dune-functions-wrapper.hh" #include <dune/gdt/playground/spaces/block.hh> +#include "interface.hh" +#include "dg/default.hh" + namespace Dune { namespace GDT { @@ -55,22 +54,13 @@ private: static_assert(AlwaysFalse<G>::value, "No space available for this backend!"); }; - template <class G, int p, class R, size_t r, size_t rC> - struct SpaceChooser<G, p, R, r, rC, GDT::Backends::fem> - { - typedef GDT::DuneFemDgSpaceWrapper<GridLayerType, p, R, r, rC> Type; - }; - - template <class G, int p, class R, size_t r, size_t rC> - struct SpaceChooser<G, p, R, r, rC, GDT::Backends::functions> - { - typedef GDT::DuneFunctionsDgSpaceWrapper<GridLayerType, p, R, r, rC> Type; - }; template <class G, int p, class R, size_t r, size_t rC> - struct SpaceChooser<G, p, R, r, rC, GDT::Backends::pdelab> + struct SpaceChooser<G, p, R, r, rC, GDT::Backends::gdt> { - typedef GDT::DunePdelabDgSpaceWrapper<GridLayerType, p, R, r, rC> Type; + static_assert(rC == 1, ""); + static_assert(r == 1, ""); + typedef GDT::DiscontinuousLagrangeSpace<GridLayerType, p, R> Type; }; public: diff --git a/dune/gdt/spaces/dg.lib.hh b/dune/gdt/spaces/dg.lib.hh index 96f56b95ef9398cfad8393d913d473f1599bb614..9655744a4e67649eeb5e16fcb1566319861bbbf3 100644 --- a/dune/gdt/spaces/dg.lib.hh +++ b/dune/gdt/spaces/dg.lib.hh @@ -18,39 +18,31 @@ #if DUNE_XT_WITH_PYTHON_BINDINGS -#if HAVE_DUNE_FEM #define _DUNE_GDT_SPACES_DG_LIB_BLOCK(_prefix, _GRID, _layer_type, _backend, _p, _R, _r, _rC) \ _prefix class Dune::GDT:: \ BlockDgSpaceProvider<_GRID, Dune::XT::Grid::Layers::_layer_type, Dune::GDT::Backends::_backend, _p, _R, _r, _rC> -#else -#define _DUNE_GDT_SPACES_DG_LIB_BLOCK(_prefix, _GRID, _layer_type, _backend, _p, _R, _r, _rC) -#endif #define _DUNE_GDT_SPACES_DG_LIB(_prefix, _GRID, _layer_type, _backend, _p, _R, _r, _rC) \ _prefix class Dune::GDT:: \ DgSpaceProvider<_GRID, Dune::XT::Grid::Layers::_layer_type, Dune::GDT::Backends::_backend, _p, _R, _r, _rC> -#if HAVE_DUNE_FEM - -#define _DUNE_GDT_SPACES_DG_FEM_LIB(_prefix, _GRID, _p, _R, _r, _rC) \ - _DUNE_GDT_SPACES_DG_LIB(_prefix, _GRID, adaptive_leaf, fem, _p, _R, _r, _rC); \ - _DUNE_GDT_SPACES_DG_LIB(_prefix, _GRID, leaf, fem, _p, _R, _r, _rC); \ - _DUNE_GDT_SPACES_DG_LIB(_prefix, _GRID, level, fem, _p, _R, _r, _rC); \ - _DUNE_GDT_SPACES_DG_LIB(_prefix, _GRID, dd_subdomain, fem, _p, _R, _r, _rC); \ - _DUNE_GDT_SPACES_DG_LIB(_prefix, _GRID, dd_subdomain_boundary, fem, _p, _R, _r, _rC); \ - _DUNE_GDT_SPACES_DG_LIB(_prefix, _GRID, dd_subdomain_coupling, fem, _p, _R, _r, _rC); \ - _DUNE_GDT_SPACES_DG_LIB_BLOCK(_prefix, _GRID, dd_subdomain, fem, _p, _R, _r, _rC) +#define _DUNE_GDT_SPACES_DG_LIB(_prefix, _GRID, _p, _R, _r, _rC) \ + _DUNE_GDT_SPACES_DG_LIB(_prefix, _GRID, adaptive_leaf, gdt, _p, _R, _r, _rC); \ + _DUNE_GDT_SPACES_DG_LIB(_prefix, _GRID, leaf, gdt, _p, _R, _r, _rC); \ + _DUNE_GDT_SPACES_DG_LIB(_prefix, _GRID, level, gdt, _p, _R, _r, _rC); \ + _DUNE_GDT_SPACES_DG_LIB(_prefix, _GRID, dd_subdomain, gdt, _p, _R, _r, _rC); \ + _DUNE_GDT_SPACES_DG_LIB(_prefix, _GRID, dd_subdomain_boundary, gdt, _p, _R, _r, _rC); \ + _DUNE_GDT_SPACES_DG_LIB(_prefix, _GRID, dd_subdomain_coupling, gdt, _p, _R, _r, _rC); \ + _DUNE_GDT_SPACES_DG_LIB_BLOCK(_prefix, _GRID, dd_subdomain, gdt, _p, _R, _r, _rC) -#define DUNE_GDT_SPACES_DG_FEM_LIB(_prefix, _GRID) _DUNE_GDT_SPACES_DG_FEM_LIB(_prefix, _GRID, 1, double, 1, 1) +#define DUNE_GDT_SPACES_DG_LIB(_prefix, _GRID) _DUNE_GDT_SPACES_DG_LIB(_prefix, _GRID, 1, double, 1, 1) #if HAVE_DUNE_ALUGRID -DUNE_GDT_SPACES_DG_FEM_LIB(extern template, ALU_2D_SIMPLEX_CONFORMING); +DUNE_GDT_SPACES_DG_LIB(extern template, ALU_2D_SIMPLEX_CONFORMING); #endif -DUNE_GDT_SPACES_DG_FEM_LIB(extern template, YASP_1D_EQUIDISTANT_OFFSET); -DUNE_GDT_SPACES_DG_FEM_LIB(extern template, YASP_2D_EQUIDISTANT_OFFSET); -DUNE_GDT_SPACES_DG_FEM_LIB(extern template, YASP_3D_EQUIDISTANT_OFFSET); - -#endif // HAVE_DUNE_FEM +DUNE_GDT_SPACES_DG_LIB(extern template, YASP_1D_EQUIDISTANT_OFFSET); +DUNE_GDT_SPACES_DG_LIB(extern template, YASP_2D_EQUIDISTANT_OFFSET); +DUNE_GDT_SPACES_DG_LIB(extern template, YASP_3D_EQUIDISTANT_OFFSET); #endif // DUNE_XT_WITH_PYTHON_BINDINGS diff --git a/dune/gdt/spaces/dg.lib/fem_yasp_2d_equidistant_offset.cc b/dune/gdt/spaces/dg.lib/alu_2d_simplex_conforming.cc similarity index 82% rename from dune/gdt/spaces/dg.lib/fem_yasp_2d_equidistant_offset.cc rename to dune/gdt/spaces/dg.lib/alu_2d_simplex_conforming.cc index 095b6fe4c1b25987fa0a9cf6e1a7f73282350fe5..cf07cc004d3aa879d6262368f2a7814c93d8e3fb 100644 --- a/dune/gdt/spaces/dg.lib/fem_yasp_2d_equidistant_offset.cc +++ b/dune/gdt/spaces/dg.lib/alu_2d_simplex_conforming.cc @@ -9,12 +9,12 @@ #include <config.h> -#if HAVE_DUNE_FEM +#if HAVE_DUNE_ALUGRID #include "../dg.lib.hh" -DUNE_GDT_SPACES_DG_FEM_LIB(template, YASP_2D_EQUIDISTANT_OFFSET); +DUNE_GDT_SPACES_DG_LIB(template, ALU_2D_SIMPLEX_CONFORMING); -#endif // HAVE_DUNE_FEM +#endif // HAVE_DUNE_ALUGRID diff --git a/dune/gdt/spaces/dg.lib/fem_alu_2d_simplex_conforming.cc b/dune/gdt/spaces/dg.lib/fem_alu_2d_simplex_conforming.cc deleted file mode 100644 index 3a760c04aa5bc02da1c177682852a3006421b743..0000000000000000000000000000000000000000 --- a/dune/gdt/spaces/dg.lib/fem_alu_2d_simplex_conforming.cc +++ /dev/null @@ -1,20 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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_ALUGRID && HAVE_DUNE_FEM - -#include "../dg.lib.hh" - - -DUNE_GDT_SPACES_DG_FEM_LIB(template, ALU_2D_SIMPLEX_CONFORMING); - - -#endif // HAVE_DUNE_ALUGRID && HAVE_DUNE_FEM diff --git a/dune/gdt/spaces/dg.lib/fem_yasp_3d_equidistant_offset.cc b/dune/gdt/spaces/dg.lib/yasp_1d_equidistant_offset.cc similarity index 82% rename from dune/gdt/spaces/dg.lib/fem_yasp_3d_equidistant_offset.cc rename to dune/gdt/spaces/dg.lib/yasp_1d_equidistant_offset.cc index ca15b4b47406e6606d572b824e2ade3f304f3d74..203fbf67f2a165b9f7f3946d4169b11c339693bf 100644 --- a/dune/gdt/spaces/dg.lib/fem_yasp_3d_equidistant_offset.cc +++ b/dune/gdt/spaces/dg.lib/yasp_1d_equidistant_offset.cc @@ -9,12 +9,7 @@ #include <config.h> -#if HAVE_DUNE_FEM - #include "../dg.lib.hh" -DUNE_GDT_SPACES_DG_FEM_LIB(template, YASP_3D_EQUIDISTANT_OFFSET); - - -#endif // HAVE_DUNE_FEM +DUNE_GDT_SPACES_DG_LIB(template, YASP_1D_EQUIDISTANT_OFFSET); diff --git a/dune/gdt/spaces/dg.lib/fem_yasp_1d_equidistant_offset.cc b/dune/gdt/spaces/dg.lib/yasp_2d_equidistant_offset.cc similarity index 82% rename from dune/gdt/spaces/dg.lib/fem_yasp_1d_equidistant_offset.cc rename to dune/gdt/spaces/dg.lib/yasp_2d_equidistant_offset.cc index a5dacd63059a15ad13a463e90e126e1b491ced46..8f1f45dc17925bf42065968bce4e5118a4ac9bdb 100644 --- a/dune/gdt/spaces/dg.lib/fem_yasp_1d_equidistant_offset.cc +++ b/dune/gdt/spaces/dg.lib/yasp_2d_equidistant_offset.cc @@ -9,12 +9,7 @@ #include <config.h> -#if HAVE_DUNE_FEM - #include "../dg.lib.hh" -DUNE_GDT_SPACES_DG_FEM_LIB(template, YASP_1D_EQUIDISTANT_OFFSET); - - -#endif // HAVE_DUNE_FEM +DUNE_GDT_SPACES_DG_LIB(template, YASP_2D_EQUIDISTANT_OFFSET); diff --git a/dune/gdt/spaces/dg.lib/yasp_3d_equidistant_offset.cc b/dune/gdt/spaces/dg.lib/yasp_3d_equidistant_offset.cc new file mode 100644 index 0000000000000000000000000000000000000000..cbf5744c9cfda28478a502854642cc5513ccec8f --- /dev/null +++ b/dune/gdt/spaces/dg.lib/yasp_3d_equidistant_offset.cc @@ -0,0 +1,15 @@ +// This file is part of the dune-gdt project: +// https://github.com/dune-community/dune-gdt +// Copyright 2010-2018 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> + +#include "../dg.lib.hh" + + +DUNE_GDT_SPACES_DG_LIB(template, YASP_3D_EQUIDISTANT_OFFSET); diff --git a/dune/gdt/spaces/dg/default.hh b/dune/gdt/spaces/dg/default.hh new file mode 100644 index 0000000000000000000000000000000000000000..a772c7fb924465a483962df440a523c854e4861f --- /dev/null +++ b/dune/gdt/spaces/dg/default.hh @@ -0,0 +1,269 @@ +// 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 (2018) + +#ifndef DUNE_GDT_SPACES_DG_DEFAULT_HH +#define DUNE_GDT_SPACES_DG_DEFAULT_HH + +#include <memory> +#include <vector> + +#include <dune/common/typetraits.hh> + +#include <dune/geometry/referenceelements.hh> +#include <dune/geometry/type.hh> + +#include <dune/grid/common/capabilities.hh> +#include <dune/grid/common/rangegenerators.hh> + +#include <dune/localfunctions/lagrange/equidistantpoints.hh> +#include <dune/localfunctions/lagrange.hh> + +#include <dune/xt/common/exceptions.hh> +#include <dune/xt/common/numeric_cast.hh> + +#include <dune/gdt/spaces/basefunctionset/default.hh> +#include <dune/gdt/spaces/mapper/default.hh> +#include <dune/gdt/spaces/dg/interface.hh> +#include <dune/gdt/spaces/fv/default.hh> + +namespace Dune { +namespace GDT { + + +template <class GL, int p, class R = double> +class DiscontinuousLagrangeSpace; + + +namespace internal { + + +template <class GL, int p, class R> +class DiscontinuousLagrangeSpaceTraits +{ + template <int d_ = GL::dimension, int p_ = p> + struct dim_and_polorder_match + { + static const constexpr bool value = true; + }; + + template <int p_> + struct dim_and_polorder_match<1, p_> + { + static const constexpr bool value = std::conditional<p_ <= 18, std::true_type, std::false_type>::type::value; + }; + + template <int p_> + struct dim_and_polorder_match<2, p_> + { + // simplices: up to 15 + // cubes: up to 10 + static const constexpr bool value = std::conditional<p_ <= 10, std::true_type, std::false_type>::type::value; + }; + + template <int p_> + struct dim_and_polorder_match<3, p_> + { + // simplices: up to 14 + // cubes: up to 7 + // prisms: up to 9 + static const constexpr bool value = std::conditional<p_ <= 7, std::true_type, std::false_type>::type::value; + }; + + static_assert(XT::Grid::is_layer<GL>::value, ""); + static_assert(p != 0, "This should not happen (should default to the FvSpace in this case)!"); + static_assert(0 <= p, "p-adaptive case not implemented yet!"); + static_assert(dim_and_polorder_match<>::value, + "The LagrangeLocalFiniteElement is known to fail for these combinations!"); + using G = XT::Grid::extract_grid_t<GL>; + +public: + using derived_type = DiscontinuousLagrangeSpace<GL, p, R>; + static const constexpr int polOrder = p; + static const constexpr size_t dimDomain = GL::dimension; + static const constexpr size_t dimRange = 1; + static const constexpr size_t dimRangeCols = 1; + static const constexpr bool continuous = false; + using GridLayerType = GL; + using LocalFiniteElement = LagrangeLocalFiniteElement<EquidistantPointSet, dimDomain, typename GL::ctype, R>; + using BaseFunctionSetType = ScalarBasefunctionSet<LocalFiniteElement, XT::Grid::extract_entity_t<GL>, R>; + using MapperType = FixedOrderScalarDiscontinuousMapper<GL, LocalFiniteElement>; + using RangeFieldType = R; + using BackendType = double; + static const constexpr XT::Grid::Backends layer_backend = XT::Grid::Backends::view; + static const constexpr Backends backend_type{Backends::gdt}; + typedef DofCommunicationChooser<GridLayerType> DofCommunicationChooserType; + typedef typename DofCommunicationChooserType::Type DofCommunicatorType; +}; // class DiscontinuousLagrangeSpaceTraits + + +} // namespace internal + + +/** + * \todo Drop this specialization once the local FEs are wrapped and the LagrangeLocalFiniteElement works for order 0. + */ +template <class GL, class R> +class DiscontinuousLagrangeSpace<GL, 0, R> : public FvSpace<GL, R, 1> +{ +private: + using BaseType = FvSpace<GL, R, 1>; + using ThisType = DiscontinuousLagrangeSpace<GL, 0, R>; + +public: + using typename BaseType::DomainType; + using typename BaseType::EntityType; + using typename BaseType::GridLayerType; + + DiscontinuousLagrangeSpace(GridLayerType grd_lr) + : BaseType(grd_lr) + { + } + + std::vector<DomainType> lagrange_points(const EntityType& entity) const + { + return {ReferenceElements<typename GL::ctype, GL::dimension>::general(entity.type()).position(0, 0)}; + } +}; // class DiscontinuousLagrangeSpace<..., 0, ...> + + +/** + * The following dimensions/orders/elements are tested to work: + * + * - 1d: orders 0, ..., 18 + * - 2d: orders 0, ..., 10 work on simplices, cubes and mixed simplices and cubes + * - 2d: orders 11, ..., 15 also work on simplices but are disabled + * - 3d: orders 0, ..., 7 work on simplices, cubes, prisms and mixed simplices and cubes + * - 3d: orders 8, ..., 14 also work on simplices but are disabled + * - 3d: orders 8, 9 also work on prisms but are disabled + * + * The following dimensions/orders/elements are tested to fail: + * + * - 1d: orders > 18 (basis matrix fails to invert) + * - 2d: orders > 15 on simplices (basis matrix fails to invert) + * - 2d: orders > 10 on cubes (basis matrix fails to invert) + * - 3d: orders > 14 on simplices(basis matrix fails to invert) + * - 3d: orders > 7 on cubes (basis matrix fails to invert) + * - 3d: orders > 9 on prisms (basis matrix fails to invert) + */ +template <class GL, int p, class R> +class DiscontinuousLagrangeSpace + : public DgSpaceInterface<internal::DiscontinuousLagrangeSpaceTraits<GL, p, R>, GL::dimension, 1> +{ +public: + using Traits = internal::DiscontinuousLagrangeSpaceTraits<GL, p, R>; + +private: + using BaseType = DgSpaceInterface<Traits, GL::dimension, 1>; + using ThisType = DiscontinuousLagrangeSpace<GL, p, R>; + using D = typename GL::ctype; + static const constexpr size_t d = BaseType::dimDomain; + using FiniteElementType = LagrangeLocalFiniteElement<EquidistantPointSet, d, D, R>; + using DofCommunicationChooserType = typename Traits::DofCommunicationChooserType; + +public: + using typename BaseType::GridLayerType; + using typename BaseType::EntityType; + using typename BaseType::MapperType; + using typename BaseType::BaseFunctionSetType; + using DomainType = typename BaseFunctionSetType::DomainType; + using DofCommunicatorType = typename Traits::DofCommunicatorType; + + DiscontinuousLagrangeSpace(GridLayerType grd_lr) + : grid_layer_(grd_lr) + , communicator_(DofCommunicationChooserType::create(grid_layer_)) + , backend_(0) + , finite_elements_(new std::map<GeometryType, std::shared_ptr<FiniteElementType>>()) + , lagrange_points_(new std::map<GeometryType, std::vector<DomainType>>()) + , mapper_(nullptr) + { + // create finite elements and lagrange points + for (auto&& geometry_type : grid_layer_.indexSet().types(0)) { + // if (geometry_type == GeometryType(GeometryType::pyramid, 3)) + // DUNE_THROW(space_error, "Discontinuous Lagrange space does not seem to have working jacobians on pyramid + // grids!"); + auto fe = std::make_shared<FiniteElementType>(geometry_type, p); + const auto& lp = fe->localInterpolation().lagrangePoints(); + std::vector<DomainType> lagrange_points(lp.size()); + for (size_t ii = 0; ii < lp.size(); ++ii) + lagrange_points[ii] = lp[ii].point(); + lagrange_points_->insert(std::make_pair(geometry_type, std::move(lagrange_points))); + finite_elements_->insert(std::make_pair(geometry_type, std::move(fe))); + } + // check + // if (d == 3 && finite_elements_->size() != 1) + // DUNE_THROW(space_error, "Discontinuous Lagrange space with multiple finite elements in 3d not supported + // (yet)!"); + // create mapper + mapper_ = std::make_shared<MapperType>(grid_layer_, finite_elements_); + } + + DiscontinuousLagrangeSpace(const ThisType&) = default; + DiscontinuousLagrangeSpace(ThisType&&) = default; + + ThisType& operator=(const ThisType&) = delete; + ThisType& operator=(ThisType&&) = delete; + + const GridLayerType& grid_layer() const + { + return grid_layer_; + } + + const double& backend() const + { + return backend_; + } + + const MapperType& mapper() const + { + return *mapper_; + } + + BaseFunctionSetType base_function_set(const EntityType& entity) const + { + const auto finite_element_search_result = finite_elements_->find(entity.geometry().type()); + if (finite_element_search_result == finite_elements_->end()) + DUNE_THROW(XT::Common::Exceptions::internal_error, + "This must not happen, the grid layer did not report all geometry types!" + << "\n entity.geometry().type() = " + << entity.geometry().type()); + const auto& finite_element = *finite_element_search_result->second; + return BaseFunctionSetType(entity, finite_element); + } + + DofCommunicatorType& dof_communicator() const + { + DofCommunicationChooserType::prepare(*this, *communicator_); + return *communicator_; + } + + std::vector<DomainType> lagrange_points(const EntityType& entity) const + { + const auto lagrange_points_search_result = lagrange_points_->find(entity.geometry().type()); + if (lagrange_points_search_result == lagrange_points_->end()) + DUNE_THROW(XT::Common::Exceptions::internal_error, + "This must not happen, the grid layer did not report all geometry types!" + << "\n entity.geometry().type() = " + << entity.geometry().type()); + return lagrange_points_search_result->second; + } + +private: + const GridLayerType grid_layer_; + mutable std::shared_ptr<DofCommunicatorType> communicator_; + const double backend_; + std::shared_ptr<std::map<GeometryType, std::shared_ptr<FiniteElementType>>> finite_elements_; + std::shared_ptr<std::map<GeometryType, std::vector<DomainType>>> lagrange_points_; + std::shared_ptr<MapperType> mapper_; +}; // class DiscontinuousLagrangeSpace + + +} // namespace GDT +} // namespace Dune + +#endif // DUNE_GDT_SPACES_DG_DEFAULT_HH diff --git a/dune/gdt/spaces/dg/dune-fem-wrapper.hh b/dune/gdt/spaces/dg/dune-fem-wrapper.hh deleted file mode 100644 index 2f043828a11ade7f2012fce34b30d8d867b6849f..0000000000000000000000000000000000000000 --- a/dune/gdt/spaces/dg/dune-fem-wrapper.hh +++ /dev/null @@ -1,209 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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 (2013 - 2017) -// Rene Milk (2014, 2016 - 2017) -// Tobias Leibner (2014, 2016) - -#ifndef DUNE_GDT_SPACES_DG_DUNE_FEM_WRAPPER_HH -#define DUNE_GDT_SPACES_DG_DUNE_FEM_WRAPPER_HH - -#include <memory> - -#include <dune/common/unused.hh> -#include <dune/common/deprecated.hh> - -#if HAVE_DUNE_FEM -#include <dune/fem/space/discontinuousgalerkin/lagrange.hh> -#endif - -#include <dune/xt/common/type_traits.hh> - -#include <dune/gdt/spaces/parallel.hh> - -#include "../mapper/dune-fem-wrapper.hh" -#include "../basefunctionset/dune-fem-wrapper.hh" -#include "interface.hh" - -namespace Dune { -namespace GDT { - -#if HAVE_DUNE_FEM - - -// forward, to be used in the traits and to allow for specialization -template <class GridPartImp, int polynomialOrder, class RangeFieldImp, size_t rangeDim, size_t rangeDimCols = 1> -class DuneFemDgSpaceWrapper -{ - static_assert(Dune::AlwaysFalse<GridPartImp>::value, "Untested for these dimensions!"); -}; - - -namespace internal { - - -template <class GridPartImp, int polynomialOrder, class RangeFieldImp, size_t rangeDim, size_t rangeDimCols> -class DuneFemDgSpaceWrapperTraits -{ - static_assert(XT::Grid::is_layer<GridPartImp>::value && !XT::Grid::is_view<GridPartImp>::value, ""); - -public: - typedef DuneFemDgSpaceWrapper<GridPartImp, polynomialOrder, RangeFieldImp, rangeDim, rangeDimCols> derived_type; - typedef GridPartImp GridLayerType; - static const int polOrder = polynomialOrder; - static const bool continuous = false; - static_assert(polOrder >= 0, "Wrong polOrder given!"); - static const constexpr Backends backend_type{Backends::fem}; - -private: - typedef typename GridLayerType::ctype DomainFieldType; - static const size_t dimDomain = GridLayerType::dimension; - -public: - typedef RangeFieldImp RangeFieldType; - -private: - typedef Dune::Fem::FunctionSpace<DomainFieldType, RangeFieldType, dimDomain, rangeDim> FunctionSpaceType; - -public: - typedef Dune::Fem::LagrangeDiscontinuousGalerkinSpace<FunctionSpaceType, GridLayerType, polOrder> BackendType; - typedef Mapper::FemDofWrapper<typename BackendType::BlockMapperType, BackendType::Traits::localBlockSize> MapperType; - using EntityType = XT::Grid::extract_entity_t<GridLayerType>; - typedef BaseFunctionSet::DuneFemWrapper<typename BackendType::BasisFunctionSetType, - EntityType, - DomainFieldType, - dimDomain, - RangeFieldType, - rangeDim, - rangeDimCols> - BaseFunctionSetType; - static const XT::Grid::Backends layer_backend = XT::Grid::Backends::part; - static const bool needs_grid_view = false; - typedef DofCommunicationChooser<GridLayerType, true> DofCommunicationChooserType; - typedef typename DofCommunicationChooserType::Type DofCommunicatorType; -}; // class DuneFemDgSpaceWrapperTraits - - -} // namespace internal - - -// untested for the vector-valued case -template <class GridPartImp, int polynomialOrder, class RangeFieldImp> -class DuneFemDgSpaceWrapper<GridPartImp, polynomialOrder, RangeFieldImp, 1, 1> - : public DgSpaceInterface<internal::DuneFemDgSpaceWrapperTraits<GridPartImp, polynomialOrder, RangeFieldImp, 1, 1>, - GridPartImp::dimension, - 1, - 1> -{ - typedef DuneFemDgSpaceWrapper<GridPartImp, polynomialOrder, RangeFieldImp, 1, 1> ThisType; - typedef DgSpaceInterface<internal::DuneFemDgSpaceWrapperTraits<GridPartImp, polynomialOrder, RangeFieldImp, 1, 1>, - GridPartImp::dimension, - 1, - 1> - BaseType; - -public: - using typename BaseType::Traits; - typedef typename Traits::GridLayerType GridLayerType; - using typename BaseType::BackendType; - using typename BaseType::MapperType; - using typename BaseType::BaseFunctionSetType; - using typename BaseType::EntityType; - -private: - typedef typename Traits::DofCommunicationChooserType DofCommunicationChooserType; - -public: - using typename BaseType::DofCommunicatorType; - - DuneFemDgSpaceWrapper(GridLayerType grd_prt) - : grid_part_(new GridLayerType(grd_prt)) - , backend_(new BackendType(*grid_part_)) - , mapper_(new MapperType(backend_->blockMapper())) - , communicator_(DofCommunicationChooserType::create(*grid_part_)) - , communicator_prepared_(false) - { - } - -#if !DUNE_XT_WITH_PYTHON_BINDINGS - // There is a problem which prevents copy ctors which are manually marked as default to end up in a lib ... - DuneFemDgSpaceWrapper(const ThisType& other) = default; - DuneFemDgSpaceWrapper(ThisType&& source) = default; - - // ... and we need to guard these operators as well since they would hinder the creation of the respective ctors. - ThisType& operator=(const ThisType& other) = delete; - ThisType& operator=(ThisType&& source) = delete; -#endif // DUNE_XT_WITH_PYTHON_BINDINGS - - const GridLayerType& DUNE_DEPRECATED_MSG("Use grid_layer() instead (03.04.2017)!") grid_part() const - { - return *grid_part_; - } - - const GridLayerType& grid_layer() const - { - return *grid_part_; - } - - GridLayerType& grid_layer() - { - return *grid_part_; - } - - const BackendType& backend() const - { - return *backend_; - } - - const MapperType& mapper() const - { - return *mapper_; - } - - BaseFunctionSetType base_function_set(const EntityType& entity) const - { - return BaseFunctionSetType(*backend_, entity); - } - - DofCommunicatorType& dof_communicator() const - { - if (!communicator_prepared_) { - communicator_prepared_ = DofCommunicationChooserType::prepare(*this, *communicator_); - } - return *communicator_; - } // ... communicator(...) - -private: - std::shared_ptr<GridLayerType> grid_part_; - const std::shared_ptr<const BackendType> backend_; - const std::shared_ptr<const MapperType> mapper_; - mutable std::shared_ptr<DofCommunicatorType> communicator_; - mutable bool communicator_prepared_; -}; // class DuneFemDgSpaceWrapper< ..., 1 > - - -#else // HAVE_DUNE_FEM - - -template <class GridPartImp, int polynomialOrder, class RangeFieldImp, size_t rangeDim, size_t rangeDimCols = 1> -class DuneFemDgSpaceWrapper -{ - static_assert(Dune::AlwaysFalse<GridPartImp>::value, "You are missing dune-fem!"); -}; - - -#endif // HAVE_DUNE_FEM - - -} // namespace GDT -} // namespace Dune - - -#include "dune-fem-wrapper.lib.hh" - - -#endif // DUNE_GDT_SPACES_DG_DUNE_FEM_WRAPPER_HH diff --git a/dune/gdt/spaces/dg/dune-fem-wrapper.lib.hh b/dune/gdt/spaces/dg/dune-fem-wrapper.lib.hh deleted file mode 100644 index ab8b374a500bd68bf23d6ae51e63a24e272154ed..0000000000000000000000000000000000000000 --- a/dune/gdt/spaces/dg/dune-fem-wrapper.lib.hh +++ /dev/null @@ -1,52 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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) - -#ifndef DUNE_GDT_SPACES_DG_DUNE_FEM_WRAPPER_LIB_HH -#define DUNE_GDT_SPACES_DG_DUNE_FEM_WRAPPER_LIB_HH - -#include "dune-fem-wrapper.hh" - - -#if DUNE_XT_WITH_PYTHON_BINDINGS && HAVE_DUNE_FEM - - -#define _DUNE_GDT_SPACES_DG_DUNE_FEM_WRAPPER_LIB(_prefix, _GRID, _layer_type, _p, _R, _r, _rC) \ - _prefix class Dune::GDT::DuneFemDgSpaceWrapper< \ - typename Dune::XT::Grid::Layer<_GRID, \ - Dune::XT::Grid::Layers::_layer_type, \ - Dune::XT::Grid::Backends::part, \ - Dune::XT::Grid::DD::SubdomainGrid<_GRID>>::type, \ - _p, \ - _R, \ - _r, \ - _rC> - -#define _DUNE_GDT_SPACES_DG_DUNE_FEM_WRAPPER_LIB_ALL_LAYERS(_prefix, _GRID, _p, _R, _r, _rC) \ - _DUNE_GDT_SPACES_DG_DUNE_FEM_WRAPPER_LIB(_prefix, _GRID, adaptive_leaf, _p, _R, _r, _rC); \ - _DUNE_GDT_SPACES_DG_DUNE_FEM_WRAPPER_LIB(_prefix, _GRID, leaf, _p, _R, _r, _rC); \ - _DUNE_GDT_SPACES_DG_DUNE_FEM_WRAPPER_LIB(_prefix, _GRID, level, _p, _R, _r, _rC); \ - _DUNE_GDT_SPACES_DG_DUNE_FEM_WRAPPER_LIB(_prefix, _GRID, dd_subdomain, _p, _R, _r, _rC); \ - _DUNE_GDT_SPACES_DG_DUNE_FEM_WRAPPER_LIB(_prefix, _GRID, dd_subdomain_boundary, _p, _R, _r, _rC); \ - _DUNE_GDT_SPACES_DG_DUNE_FEM_WRAPPER_LIB(_prefix, _GRID, dd_subdomain_coupling, _p, _R, _r, _rC) - -#define DUNE_GDT_SPACES_DG_DUNE_FEM_WRAPPER_LIB(_prefix, _GRID) \ - _DUNE_GDT_SPACES_DG_DUNE_FEM_WRAPPER_LIB_ALL_LAYERS(_prefix, _GRID, 1, double, 1, 1) - -#if HAVE_DUNE_ALUGRID -DUNE_GDT_SPACES_DG_DUNE_FEM_WRAPPER_LIB(extern template, ALU_2D_SIMPLEX_CONFORMING); -#endif -DUNE_GDT_SPACES_DG_DUNE_FEM_WRAPPER_LIB(extern template, YASP_1D_EQUIDISTANT_OFFSET); -DUNE_GDT_SPACES_DG_DUNE_FEM_WRAPPER_LIB(extern template, YASP_2D_EQUIDISTANT_OFFSET); -DUNE_GDT_SPACES_DG_DUNE_FEM_WRAPPER_LIB(extern template, YASP_3D_EQUIDISTANT_OFFSET); - - -#endif // DUNE_XT_WITH_PYTHON_BINDINGS && HAVE_DUNE_FEM - - -#endif // DUNE_GDT_SPACES_DG_DUNE_FEM_WRAPPER_LIB_HH diff --git a/dune/gdt/spaces/dg/dune-fem-wrapper.lib/alu_2d_simplex_conforming.cc b/dune/gdt/spaces/dg/dune-fem-wrapper.lib/alu_2d_simplex_conforming.cc deleted file mode 100644 index 0d09f37deacd831040c1cdab118ea83739c0af6a..0000000000000000000000000000000000000000 --- a/dune/gdt/spaces/dg/dune-fem-wrapper.lib/alu_2d_simplex_conforming.cc +++ /dev/null @@ -1,20 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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_ALUGRID && HAVE_DUNE_FEM - -#include "../dune-fem-wrapper.lib.hh" - - -DUNE_GDT_SPACES_DG_DUNE_FEM_WRAPPER_LIB(template, ALU_2D_SIMPLEX_CONFORMING); - - -#endif // HAVE_DUNE_ALUGRID && HAVE_DUNE_FEM diff --git a/dune/gdt/spaces/dg/dune-fem-wrapper.lib/yasp_1d_equidistant_offset.cc b/dune/gdt/spaces/dg/dune-fem-wrapper.lib/yasp_1d_equidistant_offset.cc deleted file mode 100644 index a0dd53ac458050ba75cf448069fd780a6e2c102f..0000000000000000000000000000000000000000 --- a/dune/gdt/spaces/dg/dune-fem-wrapper.lib/yasp_1d_equidistant_offset.cc +++ /dev/null @@ -1,20 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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_FEM - -#include "../dune-fem-wrapper.lib.hh" - - -DUNE_GDT_SPACES_DG_DUNE_FEM_WRAPPER_LIB(template, YASP_1D_EQUIDISTANT_OFFSET); - - -#endif // HAVE_DUNE_FEM diff --git a/dune/gdt/spaces/dg/dune-fem-wrapper.lib/yasp_2d_equidistant_offset.cc b/dune/gdt/spaces/dg/dune-fem-wrapper.lib/yasp_2d_equidistant_offset.cc deleted file mode 100644 index 8513437588bf0dae028cc21f65d1e8fd055a162c..0000000000000000000000000000000000000000 --- a/dune/gdt/spaces/dg/dune-fem-wrapper.lib/yasp_2d_equidistant_offset.cc +++ /dev/null @@ -1,20 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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_FEM - -#include "../dune-fem-wrapper.lib.hh" - - -DUNE_GDT_SPACES_DG_DUNE_FEM_WRAPPER_LIB(template, YASP_2D_EQUIDISTANT_OFFSET); - - -#endif // HAVE_DUNE_FEM diff --git a/dune/gdt/spaces/dg/dune-fem-wrapper.lib/yasp_3d_equidistant_offset.cc b/dune/gdt/spaces/dg/dune-fem-wrapper.lib/yasp_3d_equidistant_offset.cc deleted file mode 100644 index 34126b85f1a8be8ebabfff71d0cbb9766aab7013..0000000000000000000000000000000000000000 --- a/dune/gdt/spaces/dg/dune-fem-wrapper.lib/yasp_3d_equidistant_offset.cc +++ /dev/null @@ -1,20 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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_FEM - -#include "../dune-fem-wrapper.lib.hh" - - -DUNE_GDT_SPACES_DG_DUNE_FEM_WRAPPER_LIB(template, YASP_3D_EQUIDISTANT_OFFSET); - - -#endif // HAVE_DUNE_FEM diff --git a/dune/gdt/spaces/fv/default.hh b/dune/gdt/spaces/fv/default.hh index db519074f327dbad56755f102bcb325c26b556eb..b4b22759bbf86fa35edde5145328fdf09d5462f3 100644 --- a/dune/gdt/spaces/fv/default.hh +++ b/dune/gdt/spaces/fv/default.hh @@ -146,7 +146,7 @@ public: DofCommunicatorType& dof_communicator() const { - // no need to prepare the communicator, since we are not pdelab based + // no need to prepare the communicator return *communicator_; } diff --git a/dune/gdt/spaces/interface.bindings.hh b/dune/gdt/spaces/interface.bindings.hh index 0fb1f45af4f09bf7df273a61021d4cc845b1d488..828a1d3b19025a5526800c5370f74b4b0536078e 100644 --- a/dune/gdt/spaces/interface.bindings.hh +++ b/dune/gdt/spaces/interface.bindings.hh @@ -47,15 +47,6 @@ struct backend_name } }; -template <> -struct backend_name<Backends::fem> -{ - static std::string value() - { - return "fem"; - } -}; - template <> struct backend_name<Backends::gdt> { @@ -65,15 +56,6 @@ struct backend_name<Backends::gdt> } }; -template <> -struct backend_name<Backends::pdelab> -{ - static std::string value() - { - return "pdelab"; - } -}; - template <SpaceType tp> struct space_type_name @@ -552,14 +534,9 @@ public: const auto sp_name = space_name<SP>::value(); auto c = SpaceInterfaceWoFactory<S>::bind(m, sp_name); - addbind_restricted<XT::Grid::Backends::part, XT::Grid::Layers::adaptive_leaf>(m, c, sp_name); - addbind_restricted<XT::Grid::Backends::part, XT::Grid::Layers::dd_subdomain>(m, c, sp_name); - addbind_restricted<XT::Grid::Backends::part, XT::Grid::Layers::dd_subdomain_boundary>(m, c, sp_name); - addbind_restricted<XT::Grid::Backends::part, XT::Grid::Layers::dd_subdomain_coupling>(m, c, sp_name); - addbind_restricted<XT::Grid::Backends::part, XT::Grid::Layers::dd_subdomain_oversampled>(m, c, sp_name); - addbind_restricted<XT::Grid::Backends::part, XT::Grid::Layers::leaf>(m, c, sp_name); - addbind_restricted<XT::Grid::Backends::part, XT::Grid::Layers::level>(m, c, sp_name); addbind_restricted<XT::Grid::Backends::view, XT::Grid::Layers::dd_subdomain>(m, c, sp_name); + addbind_restricted<XT::Grid::Backends::view, XT::Grid::Layers::dd_subdomain_boundary>(m, c, sp_name); + addbind_restricted<XT::Grid::Backends::view, XT::Grid::Layers::dd_subdomain_coupling>(m, c, sp_name); addbind_restricted<XT::Grid::Backends::view, XT::Grid::Layers::dd_subdomain_oversampled>(m, c, sp_name); addbind_restricted<XT::Grid::Backends::view, XT::Grid::Layers::leaf>(m, c, sp_name); addbind_restricted<XT::Grid::Backends::view, XT::Grid::Layers::level>(m, c, sp_name); diff --git a/dune/gdt/spaces/interface.hh b/dune/gdt/spaces/interface.hh index cb738dc96f4e805f179742f74f506a888220f93e..98e092fd8cfe17bddb9485881eff027285379087 100644 --- a/dune/gdt/spaces/interface.hh +++ b/dune/gdt/spaces/interface.hh @@ -39,6 +39,7 @@ #include <dune/xt/grid/view/from-part.hh> #include <dune/gdt/spaces/mapper/interfaces.hh> +#include <dune/gdt/spaces/parallel.hh> #include "constraints.hh" @@ -48,23 +49,10 @@ namespace GDT { enum class Backends { - fem, - functions, - gdt, - pdelab + gdt }; -static const XT::Common::FixedMap<Backends, std::string, 4> backend_names = { - {Backends::fem, "fem"}, {Backends::functions, "functions"}, {Backends::gdt, "gdt"}, {Backends::pdelab, "pdelab"}}; - -// disable GCC warning "type attributes ignored after type is already defined [-Wattributes]" -#include <dune/xt/common/disable_warnings.hh> -enum class DUNE_DEPRECATED_MSG("Use Backends instead (04.04.2017)!") ChooseSpaceBackend -{ - None -}; -#include <dune/xt/common/reenable_warnings.hh> - +static const XT::Common::FixedMap<Backends, std::string, 1> backend_names = {{Backends::gdt, "gdt"}}; enum class SpaceType { @@ -100,15 +88,7 @@ struct space_type_dependent_typename } // namespace internal -static constexpr Backends default_space_backend = -#if HAVE_DUNE_FEM - Backends::fem; -#elif HAVE_DUNE_PDELAB - Backends::pdelab; -#else - Backends::gdt; -#endif - +static constexpr Backends default_space_backend = Backends::gdt; enum class ChoosePattern { @@ -121,37 +101,12 @@ enum class ChoosePattern template <Backends type> struct layer_from_backend; -template <> -struct layer_from_backend<Backends::fem> -{ - static const XT::Grid::Backends type = XT::Grid::Backends::part; -}; - -template <> -struct layer_from_backend<Backends::functions> -{ - static const XT::Grid::Backends type = XT::Grid::Backends::view; -}; - template <> struct layer_from_backend<Backends::gdt> { static const XT::Grid::Backends type = XT::Grid::Backends::view; }; -template <> -struct layer_from_backend<Backends::pdelab> -{ - static const XT::Grid::Backends type = XT::Grid::Backends::view; -}; - - -template <Backends type> -struct DUNE_DEPRECATED_MSG("Use layer_from_backend instead (04.04.2017)!") ChooseGridPartView - : public layer_from_backend<type> -{ -}; - template <class Traits, size_t domainDim, size_t rangeDim, size_t rangeDimCols = 1> class SpaceInterface : public XT::CRTPInterface<SpaceInterface<Traits, domainDim, rangeDim, rangeDimCols>, Traits> @@ -164,7 +119,6 @@ public: typedef typename Traits::MapperType MapperType; typedef typename Traits::BaseFunctionSetType BaseFunctionSetType; typedef typename Traits::DofCommunicatorType DofCommunicatorType; - typedef typename Traits::GridLayerType GridViewType DUNE_DEPRECATED_MSG("Use GridLayerType instead (02.04.2017)!"); typedef typename Traits::GridLayerType GridLayerType; typedef typename Traits::RangeFieldType RangeFieldType; static const size_t dimDomain = domainDim; @@ -188,21 +142,12 @@ public: static const XT::Grid::Backends layer_backend = Traits::layer_backend; - static const XT::Grid::Backends - DUNE_DEPRECATED_MSG("Use layer_type instead (03.04.2017)!") part_view_type = layer_backend; - static const bool DUNE_DEPRECATED_MSG("Use layer_type instead (03.04.2017)!") needs_grid_view = false; - public: /** * \defgroup interface ´´These methods have to be implemented!'' * @{ **/ - const GridLayerType& DUNE_DEPRECATED_MSG("Use grid_layer() instead (02.04.2017)!") grid_view() const - { - return this->grid_layer(); - } - const GridLayerType& grid_layer() const { CHECK_CRTP(this->as_imp().grid_layer()); diff --git a/dune/gdt/spaces/localview.hh b/dune/gdt/spaces/localview.hh index e8a10a78a23e4cf2aba3e137f00bc995439b7c1a..8b450d8481ed0cdf7cd654dc9ebfa95be77db945 100644 --- a/dune/gdt/spaces/localview.hh +++ b/dune/gdt/spaces/localview.hh @@ -28,7 +28,7 @@ template <class VectorTraits, class ScalarType, class SpaceType, class Descripto class LocalView { using VectorInterface = XT::LA::VectorInterface<VectorTraits, ScalarType>; - using EntityType = XT::Grid::extract_entity_t<typename SpaceType::GridViewType>; + using EntityType = XT::Grid::extract_entity_t<typename SpaceType::GridLayerType>; private: void resize(size_t size) diff --git a/dune/gdt/spaces/mapper/default.hh b/dune/gdt/spaces/mapper/default.hh new file mode 100644 index 0000000000000000000000000000000000000000..5986db9fb5cd6249d7b4ce4607098d4bf95afcc5 --- /dev/null +++ b/dune/gdt/spaces/mapper/default.hh @@ -0,0 +1,451 @@ +// 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 <set> + +#include <dune/geometry/type.hh> + +#include <dune/grid/common/mcmgmapper.hh> + +#include <dune/localfunctions/common/virtualinterface.hh> + +#include <dune/xt/common/numeric_cast.hh> +#include <dune/xt/grid/type_traits.hh> +#include <dune/xt/functions/interfaces/local-functions.hh> + +#include <dune/gdt/exceptions.hh> +#include <dune/gdt/spaces/mapper/interfaces.hh> + +#ifndef DUNE_GDT_SPACES_MAPPER_DEFAULT_HH +#define DUNE_GDT_SPACES_MAPPER_DEFAULT_HH + +namespace Dune { +namespace GDT { + + +// forward, required for the traits +template <class GL, class FiniteElementType> +class FixedOrderMultipleCodimMultipleGeomTypeMapper; + +template <class GL> +class ZeroOrderScalarDiscontinuousMapper; + +template <class GL, class FiniteElementType> +class FixedOrderScalarDiscontinuousMapper; + + +namespace internal { + + +template <class GL, class FiniteElementType> +class FixedOrderMultipleCodimMultipleGeomTypeMapperTraits +{ + static_assert(XT::Grid::is_layer<GL>::value, ""); + + template <int dim_> + struct GeometryTypeLayout + { + GeometryTypeLayout(std::set<GeometryType>&& types) + : types_(std::move(types)) + { + } + + GeometryTypeLayout(const GeometryTypeLayout<dim_>&) = default; + GeometryTypeLayout(GeometryTypeLayout<dim_>&&) = default; + + bool contains(const GeometryType& gt) const + { + return types_.count(gt) > 0; + } + + const std::set<GeometryType> types_; + }; + +public: + using derived_type = FixedOrderMultipleCodimMultipleGeomTypeMapper<GL, FiniteElementType>; + using BackendType = MultipleCodimMultipleGeomTypeMapper<GL, GeometryTypeLayout>; + using EntityType = XT::Grid::extract_entity_t<GL>; + +private: + friend class FixedOrderMultipleCodimMultipleGeomTypeMapper<GL, FiniteElementType>; +}; // class FixedOrderMultipleCodimMultipleGeomTypeMapperTraits + + +template <class GL> +class ZeroOrderScalarDiscontinuousMapperTraits +{ + static_assert(XT::Grid::is_layer<GL>::value, ""); + + template <int dim_> + struct GeometryTypeLayout + { + bool contains(const GeometryType& gt) const + { + return gt.dim() == dim_; + } + }; + +public: + using derived_type = ZeroOrderScalarDiscontinuousMapper<GL>; + using BackendType = MultipleCodimMultipleGeomTypeMapper<GL, GeometryTypeLayout>; + using EntityType = XT::Grid::extract_entity_t<GL>; +}; + + +template <class GL, class FiniteElementType> +class FixedOrderScalarDiscontinuousMapperTraits +{ + static_assert(XT::Grid::is_layer<GL>::value, ""); + + template <int dim_> + struct GeometryTypeLayout + { + bool contains(const GeometryType& gt) const + { + return gt.dim() == dim_; + } + }; + +public: + using derived_type = FixedOrderScalarDiscontinuousMapper<GL, FiniteElementType>; + using BackendType = MultipleCodimMultipleGeomTypeMapper<GL, GeometryTypeLayout>; + using EntityType = XT::Grid::extract_entity_t<GL>; +}; + + +} // namespace internal + + +template <class GL, class FiniteElementType> +class FixedOrderMultipleCodimMultipleGeomTypeMapper + : public MapperInterface<internal::FixedOrderMultipleCodimMultipleGeomTypeMapperTraits<GL, FiniteElementType>> +{ +public: + using Traits = internal::FixedOrderMultipleCodimMultipleGeomTypeMapperTraits<GL, FiniteElementType>; + +private: + using ThisType = FixedOrderMultipleCodimMultipleGeomTypeMapper<GL, FiniteElementType>; + using BaseType = MapperInterface<Traits>; + using D = typename GL::ctype; + static const constexpr size_t d = GL::dimension; + +public: + using typename BaseType::EntityType; + using typename BaseType::BackendType; + + FixedOrderMultipleCodimMultipleGeomTypeMapper( + const GL& grid_layer, + const std::shared_ptr<std::map<GeometryType, std::shared_ptr<FiniteElementType>>>& finite_elements) + : finite_elements_(finite_elements) + , mapper_(nullptr) + { + std::set<GeometryType> all_DoF_attached_geometry_types; + // collect all entities (for all codims) which are used to attach DoFs to + for (auto&& geometry_type : grid_layer.indexSet().types(0)) { + // get the finite element for this geometry type + const auto finite_element_search_result = finite_elements_->find(geometry_type); + if (finite_element_search_result == finite_elements_->end()) + DUNE_THROW(mapper_error, "Missing finite element for the required geometry type " << geometry_type << "!"); + const auto& finite_element = *finite_element_search_result->second; + // loop over all keys of this finite element + const auto& reference_element = ReferenceElements<D, d>::general(geometry_type); + const auto& coeffs = finite_element.localCoefficients(); + for (size_t ii = 0; ii < coeffs.size(); ++ii) { + const auto& local_key = coeffs.localKey(ii); + if (local_key.index() != 0) // Would require twisting of DoFs and possibly more knowledge from the FE + DUNE_THROW(mapper_error, "This case is not covered yet, when we have more than one DoF per (sub)entity!"); + // find the (sub)entity for this key + const auto sub_entity = local_key.subEntity(); + const auto codim = local_key.codim(); + const auto& subentity_geometry_type = reference_element.type(sub_entity, codim); + // and add the respective geometry type + all_DoF_attached_geometry_types.insert(subentity_geometry_type); + } + } + if (all_DoF_attached_geometry_types.size() == 0) + DUNE_THROW(mapper_error, "This must not happen, the finite elements report no DoFs attached to (sub)entities!"); + mapper_ = std::make_shared<BackendType>( + grid_layer, + std::move(typename Traits::template GeometryTypeLayout<d>(std::move(all_DoF_attached_geometry_types)))); + } // ... FixedOrderMultipleCodimMultipleGeomTypeMapper(...) + + FixedOrderMultipleCodimMultipleGeomTypeMapper(const ThisType&) = default; + FixedOrderMultipleCodimMultipleGeomTypeMapper(ThisType&&) = default; + FixedOrderMultipleCodimMultipleGeomTypeMapper& operator=(const ThisType&) = delete; + FixedOrderMultipleCodimMultipleGeomTypeMapper& operator=(ThisType&&) = delete; + + const BackendType& backend() const + { + return *mapper_; + } + + size_t size() const + { + return mapper_->size(); + } + + size_t maxNumDofs() const + { + size_t ret = 0; + for (const auto& geometry_type_and_finite_element_pair : *finite_elements_) { + const auto& finite_element = *geometry_type_and_finite_element_pair.second; + ret = std::max(ret, XT::Common::numeric_cast<size_t>(finite_element.size())); + } + return ret; + } // ... maxNumDofs(...) + + size_t numDofs(const EntityType& entity) const + { + const auto finite_element_search_result = finite_elements_->find(entity.geometry().type()); + if (finite_element_search_result == finite_elements_->end()) + DUNE_THROW(XT::Common::Exceptions::internal_error, + "This must not happen after the checks in the ctor, the grid layer did not report all geometry types!" + "\n entity.geometry().type() = " + << entity.geometry().type()); + const auto& finite_element = *finite_element_search_result->second; + return finite_element.size(); + } // ... numDofs(...) + + template <int cd, class GridImp, template <int, int, class> class EntityImp> + typename std::enable_if<cd != EntityType::codimension, size_t>::type + numDofs(const Entity<cd, EntityType::dimension, GridImp, EntityImp>& entity) const + { + return 0; + } + + using BaseType::globalIndices; + + void globalIndices(const EntityType& entity, DynamicVector<size_t>& ret) const + { + const auto finite_element_search_result = finite_elements_->find(entity.geometry().type()); + if (finite_element_search_result == finite_elements_->end()) + DUNE_THROW(XT::Common::Exceptions::internal_error, + "This must not happen after the checks in the ctor, the grid layer did not report all geometry types!" + "\n entity.geometry().type() = " + << entity.geometry().type()); + const auto& finite_element = *finite_element_search_result->second; + const auto& local_coefficients = finite_element.localCoefficients(); + const auto local_size = local_coefficients.size(); + if (ret.size() < local_size) + ret.resize(local_size, 0); + for (size_t ii = 0; ii < local_size; ++ii) { + const auto& local_key = local_coefficients.localKey(ii); + // No need to assert local_key.index() == 0, has been checked in the ctor! + ret[ii] = mapper_->subIndex(entity, local_key.subEntity(), local_key.codim()); + } + } // ... globalIndices(...) + + size_t mapToGlobal(const EntityType& entity, const size_t local_index) const + { + const auto finite_element_search_result = finite_elements_->find(entity.geometry().type()); + if (finite_element_search_result == finite_elements_->end()) + DUNE_THROW(XT::Common::Exceptions::internal_error, + "This must not happen after the checks in the ctor, the grid layer did not report all geometry types!" + "\n entity.geometry().type() = " + << entity.geometry().type()); + const auto& finite_element = *finite_element_search_result->second; + const auto& local_coefficients = finite_element.localCoefficients(); + if (local_index >= local_coefficients.size()) + DUNE_THROW(Exception, + "finite_element.localCoefficients().size() = " << local_coefficients.size() << "\n local_index = " + << local_index); + const auto& local_key = local_coefficients.localKey(local_index); + // No need to assert local_key.index() == 0, has been checked in the ctor! + return mapper_->subIndex(entity, local_key.subEntity(), local_key.codim()); + } // ... mapToGlobal(...) + +private: + const std::shared_ptr<std::map<GeometryType, std::shared_ptr<FiniteElementType>>> finite_elements_; + std::shared_ptr<BackendType> mapper_; +}; // class FixedOrderMultipleCodimMultipleGeomTypeMapper + + +template <class GL> +class ZeroOrderScalarDiscontinuousMapper + : public MapperInterface<internal::ZeroOrderScalarDiscontinuousMapperTraits<GL>> +{ +public: + using Traits = internal::ZeroOrderScalarDiscontinuousMapperTraits<GL>; + +private: + using ThisType = ZeroOrderScalarDiscontinuousMapper<GL>; + using BaseType = MapperInterface<Traits>; + using D = typename GL::ctype; + static const constexpr size_t d = GL::dimension; + +public: + using typename BaseType::EntityType; + using typename BaseType::BackendType; + + ZeroOrderScalarDiscontinuousMapper(const GL& grid_layer) + : mapper_(new BackendType(grid_layer)) + { + } + + ZeroOrderScalarDiscontinuousMapper(const ThisType&) = default; + ZeroOrderScalarDiscontinuousMapper(ThisType&&) = default; + ZeroOrderScalarDiscontinuousMapper& operator=(const ThisType&) = delete; + ZeroOrderScalarDiscontinuousMapper& operator=(ThisType&&) = delete; + + const BackendType& backend() const + { + return *mapper_; + } + + size_t size() const + { + return mapper_->size(); + } + + size_t maxNumDofs() const + { + return 1; + } + + size_t numDofs(const EntityType& /*entity*/) const + { + return 1; + } + + template <int cd, class GridImp, template <int, int, class> class EntityImp> + typename std::enable_if<cd != EntityType::codimension, size_t>::type + numDofs(const Entity<cd, EntityType::dimension, GridImp, EntityImp>& /*entity*/) const + { + return 0; + } + + using BaseType::globalIndices; + + void globalIndices(const EntityType& entity, DynamicVector<size_t>& ret) const + { + ret[0] = mapper_->subIndex(entity, 0, 0); + } + + size_t mapToGlobal(const EntityType& entity, const size_t local_index) const + { + if (local_index >= 1) + DUNE_THROW(Exception, "numDofs(entity) = " << numDofs(entity) << "\n local_index = " << local_index); + return mapper_->subIndex(entity, 0, 0); + } + +private: + const std::shared_ptr<BackendType> mapper_; +}; // class ZeroOrderScalarDiscontinuousMapper + + +template <class GL, class FiniteElementType> +class FixedOrderScalarDiscontinuousMapper + : public MapperInterface<internal::FixedOrderScalarDiscontinuousMapperTraits<GL, FiniteElementType>> +{ +public: + using Traits = internal::FixedOrderScalarDiscontinuousMapperTraits<GL, FiniteElementType>; + +private: + using ThisType = FixedOrderScalarDiscontinuousMapper<GL, FiniteElementType>; + using BaseType = MapperInterface<Traits>; + using D = typename GL::ctype; + static const constexpr size_t d = GL::dimension; + +public: + using typename BaseType::EntityType; + using typename BaseType::BackendType; + + FixedOrderScalarDiscontinuousMapper( + const GL& grid_layer, + const std::shared_ptr<std::map<GeometryType, std::shared_ptr<FiniteElementType>>>& finite_elements) + : finite_elements_(finite_elements) + , mapper_(new BackendType(grid_layer)) + , offset_(new std::vector<size_t>(mapper_->size())) + , max_num_dofs_(0) + , size_(0) + { + for (auto&& element : elements(grid_layer)) { + (*offset_)[mapper_->subIndex(element, 0, 0)] = size_; + const auto finite_element_search_result = finite_elements_->find(element.geometry().type()); + if (finite_element_search_result == finite_elements_->end()) + DUNE_THROW(mapper_error, + "Missing finite element for the required geometry type " << element.geometry().type() << "!"); + const auto& finite_element = *finite_element_search_result->second; + size_ += finite_element.size(); + max_num_dofs_ = std::max(max_num_dofs_, XT::Common::numeric_cast<size_t>(finite_element.size())); + } + } // ... FixedOrderScalarDiscontinuousMapper(...) + + FixedOrderScalarDiscontinuousMapper(const ThisType&) = default; + FixedOrderScalarDiscontinuousMapper(ThisType&&) = default; + FixedOrderScalarDiscontinuousMapper& operator=(const ThisType&) = delete; + FixedOrderScalarDiscontinuousMapper& operator=(ThisType&&) = delete; + + const BackendType& backend() const + { + return *mapper_; + } + + size_t size() const + { + return size_; + } + + size_t maxNumDofs() const + { + return max_num_dofs_; + } + + size_t numDofs(const EntityType& entity) const + { + const auto finite_element_search_result = finite_elements_->find(entity.geometry().type()); + if (finite_element_search_result == finite_elements_->end()) + DUNE_THROW(XT::Common::Exceptions::internal_error, + "This must not happen after the checks in the ctor, the grid layer did not report all geometry types!" + << "\n entity.geometry().type() = " + << entity.geometry().type()); + const auto& finite_element = *finite_element_search_result->second; + return finite_element.size(); + } // ... numDofs(...) + + template <int cd, class GridImp, template <int, int, class> class EntityImp> + typename std::enable_if<cd != EntityType::codimension, size_t>::type + numDofs(const Entity<cd, EntityType::dimension, GridImp, EntityImp>& /*entity*/) const + { + return 0; + } + + using BaseType::globalIndices; + + void globalIndices(const EntityType& entity, DynamicVector<size_t>& ret) const + { + const size_t offset = (*offset_)[mapper_->subIndex(entity, 0, 0)]; + const auto local_size = numDofs(entity); + if (ret.size() < local_size) + ret.resize(local_size, 0); + for (size_t ii = 0; ii < local_size; ++ii) + ret[ii] = offset + ii; + } // ... globalIndices(...) + + size_t mapToGlobal(const EntityType& entity, const size_t local_index) const + { + if (local_index >= numDofs(entity)) + DUNE_THROW(Exception, "numDofs(entity) = " << numDofs(entity) << "\n local_index = " << local_index); + const size_t offset = (*offset_)[mapper_->subIndex(entity, 0, 0)]; + return offset + local_index; + } + +private: + const std::shared_ptr<std::map<GeometryType, std::shared_ptr<FiniteElementType>>> finite_elements_; + const std::shared_ptr<BackendType> mapper_; + std::shared_ptr<std::vector<size_t>> offset_; + size_t max_num_dofs_; + size_t size_; +}; // class FixedOrderScalarDiscontinuousMapper + + +} // namespace GDT +} // namespace Dune + +#endif // DUNE_GDT_SPACES_MAPPER_DEFAULT_HH diff --git a/dune/gdt/spaces/mapper/dune-fem-wrapper.hh b/dune/gdt/spaces/mapper/dune-fem-wrapper.hh deleted file mode 100644 index 818dcae8200f7507de5fb80b11e4bb996da81907..0000000000000000000000000000000000000000 --- a/dune/gdt/spaces/mapper/dune-fem-wrapper.hh +++ /dev/null @@ -1,270 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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 (2013 - 2017) -// Rene Milk (2014, 2016 - 2018) - -#ifndef DUNE_GDT_SPACES_MAPPER_DUNE_FEM_WRAPPER_HH -#define DUNE_GDT_SPACES_MAPPER_DUNE_FEM_WRAPPER_HH - -#include <dune/common/dynvector.hh> -#include <dune/common/typetraits.hh> - -#if HAVE_DUNE_FEM -#include <dune/fem/space/mapper/nonblockmapper.hh> -#endif - -#include <dune/xt/common/type_traits.hh> - -#include "interfaces.hh" - -namespace Dune { -namespace GDT { -namespace Mapper { - -#if HAVE_DUNE_FEM - - -// forward -template <class FemDofMapperImp, int block_size = 1> -class FemDofWrapper; - - -namespace internal { - - -template <class FemDofMapperImp, int block_size> -class FemDofWrapperTraits -{ -public: - typedef FemDofWrapper<FemDofMapperImp, block_size> derived_type; - typedef Fem::NonBlockMapper<FemDofMapperImp, block_size> BackendType; - typedef typename BackendType::ElementType EntityType; -}; - - -template <class FemDofMapperImp> -class FemDofWrapperTraits<FemDofMapperImp, 1> -{ -public: - typedef FemDofWrapper<FemDofMapperImp, 1> derived_type; - typedef FemDofMapperImp BackendType; - typedef typename BackendType::ElementType EntityType; -}; - -template <class Backend, class Entity, int cd> -size_t fem_dof_count(Backend& /*backend*/, Entity& entity, std::integral_constant<int, cd>) -{ - DUNE_THROW(NotImplemented, "not sure if this should ever be called"); - return 0; -}; - -template <class Backend, class Entity> -size_t fem_dof_count(Backend& backend, Entity& entity, std::integral_constant<int, 0>) -{ - return backend.numDofs(entity); -}; - -} // namespace internal - - -template <class FemDofMapperImp, int block_size> -class FemDofWrapper : public MapperInterface<internal::FemDofWrapperTraits<FemDofMapperImp, block_size>> -{ - typedef MapperInterface<internal::FemDofWrapperTraits<FemDofMapperImp, block_size>> InterfaceType; - -public: - typedef internal::FemDofWrapperTraits<FemDofMapperImp, block_size> Traits; - typedef typename Traits::BackendType BackendType; - typedef typename Traits::EntityType EntityType; - - explicit FemDofWrapper(FemDofMapperImp& femNonBlockMapper) - : backend_(femNonBlockMapper) - { - assert(size() > 0); - } - - const BackendType& backend() const - { - return backend_; - } - - size_t size() const - { - return backend_.size(); - } - - template <int cd, class GridImp, template <int, int, class> class EntityImp> - size_t numDofs(const Entity<cd, EntityType::dimension, GridImp, EntityImp>& entity) const - { - return backend_.numEntityDofs(entity); - } - - size_t numDofs(const EntityType& entity) const - { - return backend_.numDofs(entity); - } - - size_t maxNumDofs() const - { - return backend_.maxNumDofs(); - } - -private: - class Functor - { - public: - explicit Functor(Dune::DynamicVector<size_t>& globalIndices) - : globalIndices_(globalIndices) - { - } - - void operator()(size_t localDoF, size_t globalDoF) - { - assert(localDoF < globalIndices_.size()); - globalIndices_[localDoF] = globalDoF; - } - - private: - Dune::DynamicVector<size_t>& globalIndices_; - }; - -public: - void globalIndices(const EntityType& entity, Dune::DynamicVector<size_t>& ret) const - { - // some checks - const size_t numLocalDofs = numDofs(entity); - if (ret.size() < numLocalDofs) - ret.resize(numLocalDofs); - // compute - Functor functor(ret); - backend_.mapEach(entity, functor); - } - - using InterfaceType::globalIndices; - - /** - * \attention This method is implemented using globalIndices() and thus not optimal! - */ - size_t mapToGlobal(const EntityType& entity, const size_t& localIndex) const - { - const size_t numLocalDofs = numDofs(entity); - assert(localIndex < numLocalDofs); - Dune::DynamicVector<size_t> tmpGlobalIndices(numLocalDofs); - globalIndices(entity, tmpGlobalIndices); - return tmpGlobalIndices[localIndex]; - } - -private: - const BackendType backend_; -}; // class FemDofWrapper - - -template <class FemDofMapperImp> -class FemDofWrapper<FemDofMapperImp, 1> : public MapperInterface<internal::FemDofWrapperTraits<FemDofMapperImp, 1>> -{ - typedef MapperInterface<internal::FemDofWrapperTraits<FemDofMapperImp, 1>> InterfaceType; - -public: - typedef internal::FemDofWrapperTraits<FemDofMapperImp, 1> Traits; - typedef typename Traits::BackendType BackendType; - typedef typename Traits::EntityType EntityType; - - explicit FemDofWrapper(const BackendType& femMapper) - : backend_(femMapper) - { - assert(size() > 0); - } - - const BackendType& backend() const - { - return backend_; - } - - size_t size() const - { - return backend_.size(); - } - - template <int cd, class GridImp, template <int, int, class> class EntityImp> - size_t numDofs(const Entity<cd, EntityType::dimension, GridImp, EntityImp>& entity) const - { - return internal::fem_dof_count(backend_, entity, std::integral_constant<int, cd>()); - } - - size_t maxNumDofs() const - { - return backend_.maxNumDofs(); - } - -private: - class Functor - { - public: - explicit Functor(Dune::DynamicVector<size_t>& globalIndices) - : globalIndices_(globalIndices) - { - } - - void operator()(size_t localDoF, size_t globalDoF) - { - assert(localDoF < globalIndices_.size()); - globalIndices_[localDoF] = globalDoF; - } - - private: - Dune::DynamicVector<size_t>& globalIndices_; - }; - -public: - void globalIndices(const EntityType& entity, Dune::DynamicVector<size_t>& ret) const - { - // some checks - const size_t numLocalDofs = numDofs(entity); - if (ret.size() < numLocalDofs) - ret.resize(numLocalDofs); - // compute - Functor functor(ret); - backend_.mapEach(entity, functor); - } - - using InterfaceType::globalIndices; - - /** - * \attention This method is implemented using globalIndices() and thus not optimal! - */ - size_t mapToGlobal(const EntityType& entity, const size_t& localIndex) const - { - const size_t numLocalDofs = numDofs(entity); - assert(localIndex < numLocalDofs); - Dune::DynamicVector<size_t> tmpGlobalIndices(numLocalDofs); - globalIndices(entity, tmpGlobalIndices); - return tmpGlobalIndices[localIndex]; - } - -private: - const BackendType& backend_; -}; // class FemDofWrapper< ..., 1 > - - -#else // HAVE_DUNE_FEM - - -template <class FemDofMapperImp> -class FemDofWrapper -{ - static_assert(Dune::AlwaysFalse<FemDofMapperImp>::value, "You are missing dune-fem!"); -}; - - -#endif // HAVE_DUNE_FEM - -} // namespace Mapper -} // namespace GDT -} // namespace Dune - -#endif // DUNE_GDT_SPACES_MAPPER_DUNE_FEM_WRAPPER_HH diff --git a/dune/gdt/spaces/mapper/dune-pdelab-wrapper.hh b/dune/gdt/spaces/mapper/dune-pdelab-wrapper.hh deleted file mode 100644 index 09a628ad4e4ab839918974c805e8c1bbd49da8e1..0000000000000000000000000000000000000000 --- a/dune/gdt/spaces/mapper/dune-pdelab-wrapper.hh +++ /dev/null @@ -1,275 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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 (2014 - 2017) -// Rene Milk (2014, 2016 - 2018) -// Tobias Leibner (2014, 2016 - 2017) - -#ifndef DUNE_GDT_SPACES_MAPPER_DUNE_PDELAB_WRAPPER_HH -#define DUNE_GDT_SPACES_MAPPER_DUNE_PDELAB_WRAPPER_HH - -#include <unordered_map> - -#include <dune/common/dynvector.hh> -#include <dune/common/typetraits.hh> - -#if HAVE_DUNE_PDELAB -#include <dune/pdelab/gridfunctionspace/localfunctionspace.hh> -#endif - -#include <dune/xt/common/parallel/threadstorage.hh> -#include <dune/xt/common/type_traits.hh> -#include <dune/xt/common/tuple.hh> - -#include "interfaces.hh" -#include "product.hh" - -namespace Dune { -namespace GDT { - -#if HAVE_DUNE_PDELAB - - -// forwards -template <class PdelabSpaceImp, size_t rangeDim> -class DunePdelabCgMapperWrapper; - -template <class PdelabSpaceImp> -class DunePdelabDgMapperWrapper; - - -namespace internal { - -template <class Backend, class Entity, int cd> -size_t dof_count(Backend& /*backend*/, Entity& entity, std::integral_constant<int, cd>) -{ - DUNE_THROW(NotImplemented, "not sure if this should ever be called"); - return 0; -}; - -template <class Backend, class Entity> -size_t dof_count(Backend& backend, Entity& entity, std::integral_constant<int, 0>) -{ - backend.bind(entity); - return backend.size(); -}; - - -template <class PdelabSpaceImp, size_t rangeDim> -class DunePdelabCgMapperWrapperTraits -{ -public: - typedef DunePdelabCgMapperWrapper<PdelabSpaceImp, rangeDim> derived_type; - typedef PdelabSpaceImp SpaceType; - typedef PDELab::LocalFunctionSpace<SpaceType, PDELab::TrialSpaceTag> BackendType; - typedef typename SpaceType::Element EntityType; -}; - -template <class PdelabSpaceImp> -class DunePdelabDgMapperWrapperTraits -{ -public: - typedef DunePdelabDgMapperWrapper<PdelabSpaceImp> derived_type; - typedef PdelabSpaceImp SpaceType; - typedef PDELab::LocalFunctionSpace<SpaceType, PDELab::TrialSpaceTag> BackendType; - typedef typename SpaceType::Element EntityType; -}; - - -template <class ImpTraits> -class PdelabWrapperBase : public MapperInterface<ImpTraits> -{ - typedef PdelabWrapperBase<ImpTraits> ThisType; - typedef MapperInterface<ImpTraits> InterfaceType; - typedef typename ImpTraits::SpaceType SpaceType; - -public: - typedef typename InterfaceType::EntityType EntityType; - typedef typename InterfaceType::BackendType BackendType; - -private: - typedef typename BackendType::Traits::DOFIndex MultiIndexType; - -public: - explicit PdelabWrapperBase(const SpaceType& pdelab_space) - : space_(pdelab_space) - , backend_(space_) - { - const auto& grid_view = space_.gridView(); - const auto it_end = grid_view.template end<0>(); - std::size_t count = 0; - for (auto it = grid_view.template begin<0>(); it != it_end; ++it) { - const auto& entity = *it; - backend_.bind(entity); - for (size_t ii = 0; ii < backend_.size(); ++ii) - if (index_map_.find(backend_.dofIndex(ii)) == index_map_.end()) - index_map_.insert(std::make_pair(backend_.dofIndex(ii), count++)); - } - assert(size() > 0); - } - - PdelabWrapperBase(const ThisType& other) - : space_(other.space_) - , backend_(space_) - , index_map_(other.index_map_) - { - } - - PdelabWrapperBase(ThisType&& source) = default; - - virtual ~PdelabWrapperBase() - { - } - - const BackendType& backend() const - { - return backend_; - } - - size_t size() const - { - return space_.size(); - } - - template <int cd, class GridImp, template <int, int, class> class EntityImp> - size_t numDofs(const Entity<cd, EntityType::dimension, GridImp, EntityImp>& entity) const - { - return dof_count(backend_, entity, std::integral_constant<int, cd>()); - } - - size_t maxNumDofs() const - { - return space_.maxLocalSize(); - } - - void globalIndices(const EntityType& entity, Dune::DynamicVector<size_t>& ret) const - { - backend_.bind(entity); - // some checks - const size_t numLocalDofs = numDofs(entity); - if (ret.size() < numLocalDofs) - ret.resize(numLocalDofs); - // compute - for (size_t ii = 0; ii < numLocalDofs; ++ii) - ret[ii] = mapToGlobal(entity, ii); - } // ... globalIndices(...) - - using InterfaceType::globalIndices; - - size_t mapToGlobal(const EntityType& entity, const size_t& localIndex) const - { - backend_.bind(entity); - assert(localIndex < backend_.size()); - return index_map_[backend_.dofIndex(localIndex)]; - } // ... mapToGlobal(...) - -protected: - virtual size_t mapAfterBound(const EntityType& entity, const size_t& localIndex) const = 0; - - const SpaceType& space_; - mutable BackendType backend_; - mutable std::unordered_map<MultiIndexType, std::size_t> index_map_; -}; // class PdelabWrapperBase - - -} // namespace internal - - -template <class PdelabSpaceImp, size_t rangeDim = 1> -class DunePdelabCgMapperWrapper - : public DefaultProductMapperFromTuple< - typename PdelabSpaceImp::Traits::GridLayerType, - typename Dune::XT::Common::make_identical_tuple<DunePdelabCgMapperWrapper<PdelabSpaceImp, 1>, - rangeDim>::type>::type -{ - typedef DunePdelabCgMapperWrapper<PdelabSpaceImp, 1> ScalarValuedMapperType; - typedef typename DefaultProductMapperFromTuple< - typename PdelabSpaceImp::Traits::GridLayerType, - typename Dune::XT::Common::make_identical_tuple<ScalarValuedMapperType, rangeDim>::type>::type BaseType; - -public: - typedef typename internal::DunePdelabCgMapperWrapperTraits<PdelabSpaceImp, rangeDim>::BackendType BackendType; - DunePdelabCgMapperWrapper(const BackendType& pdelab_space) - : BaseType(pdelab_space.gridView(), - Dune::XT::Common::make_identical_tuple<ScalarValuedMapperType, rangeDim>::create(pdelab_space)) - { - } -}; // class DunePdelabCgMapperWrapper - - -template <class PdelabSpaceImp> -class DunePdelabCgMapperWrapper<PdelabSpaceImp, 1> - : public internal::PdelabWrapperBase<internal::DunePdelabCgMapperWrapperTraits<PdelabSpaceImp, 1>> -{ - typedef DunePdelabCgMapperWrapper<PdelabSpaceImp, 1> ThisType; - -public: - typedef typename internal::DunePdelabCgMapperWrapperTraits<PdelabSpaceImp, 1> Traits; - typedef typename Traits::EntityType EntityType; - - template <class... Args> - DunePdelabCgMapperWrapper(Args&&... args) - : internal::PdelabWrapperBase<Traits>(std::forward<Args>(args)...) - { - } - - DunePdelabCgMapperWrapper(const ThisType& other) = default; - DunePdelabCgMapperWrapper(ThisType& other) = default; // required b.c. of the too perfect forwarding ctor above - DunePdelabCgMapperWrapper(ThisType&& source) = default; - -protected: - virtual size_t mapAfterBound(const EntityType& /*entity*/, const size_t& localIndex) const override - { - return this->backend_.dofIndex(localIndex).entityIndex()[1]; - } -}; // class DunePdelabCgMapperWrapper - - -template <class PdelabSpaceImp> -class DunePdelabDgMapperWrapper - : public internal::PdelabWrapperBase<internal::DunePdelabDgMapperWrapperTraits<PdelabSpaceImp>> -{ -public: - typedef typename internal::DunePdelabDgMapperWrapperTraits<PdelabSpaceImp> Traits; - typedef typename Traits::EntityType EntityType; - - template <class... Args> - DunePdelabDgMapperWrapper(Args&&... args) - : internal::PdelabWrapperBase<Traits>(std::forward<Args>(args)...) - { - } - -protected: - virtual size_t mapAfterBound(const EntityType& entity, const size_t& localIndex) const override - { - return this->backend_.dofIndex(localIndex).entityIndex()[1] * this->numDofs(entity) + localIndex; - } -}; // class DunePdelabDgMapperWrapper - - -#else // HAVE_DUNE_PDELAB - - -template <class PdelabSpaceImp> -class DunePdelabCgMapperWrapper -{ - static_assert(Dune::AlwaysFalse<PdelabSpaceImp>::value, "You are missing dune-pdelab!"); -}; - -template <class PdelabSpaceImp> -class DunePdelabDgMapperWrapper -{ - static_assert(Dune::AlwaysFalse<PdelabSpaceImp>::value, "You are missing dune-pdelab!"); -}; - - -#endif // HAVE_DUNE_PDELAB - -} // namespace GDT -} // namespace Dune - -#endif // DUNE_GDT_SPACES_MAPPER_DUNE_PDELAB_WRAPPER_HH diff --git a/dune/gdt/spaces/mapper/fv.hh b/dune/gdt/spaces/mapper/fv.hh index 0d2bd4a3bb382a17126243ae11691b9084bc8cf1..b3910996610bcd5017ef85ffb22ae3b1771d40f9 100644 --- a/dune/gdt/spaces/mapper/fv.hh +++ b/dune/gdt/spaces/mapper/fv.hh @@ -16,6 +16,8 @@ #include <dune/common/dynvector.hh> +#include <dune/grid/common/mcmgmapper.hh> + #include <dune/xt/common/unused.hh> #include <dune/xt/common/type_traits.hh> #include <dune/xt/grid/type_traits.hh> @@ -49,10 +51,20 @@ class FvMapperTraits static_assert(rangeDim >= 1, "Really?"); static_assert(rangeDimCols >= 1, "Really?"); + template <int dim_> + struct GeometryTypeLayout + { + bool contains(const GeometryType& gt) const + { + return gt.dim() == dim_; + } + }; + public: typedef GridLayerImp GridLayerType; typedef FvMapper<GridLayerType, rangeDim, rangeDimCols> derived_type; - typedef typename GridLayerImp::IndexSet BackendType; + // just using the index set of the grid layer fails for mixed geometry types + typedef MultipleCodimMultipleGeomTypeMapper<GridLayerImp, GeometryTypeLayout> BackendType; using EntityType = XT::Grid::extract_entity_t<GridLayerType>; }; @@ -81,23 +93,27 @@ public: typedef typename Traits::EntityType EntityType; FvMapper(const GridLayerType& grd_layr) - : backend_(grd_layr.indexSet()) + : mapper_(new BackendType(grd_layr)) { - assert(size() > 0); } const BackendType& backend() const { - return backend_; + return *mapper_; } size_t size() const { - return dimRange * backend_.size(0); + return dimRange * mapper_->size(); } template <int cd, class GridImp, template <int, int, class> class EntityImp> - size_t numDofs(const Entity<cd, EntityType::dimension, GridImp, EntityImp>& entity) const + size_t numDofs(const Entity<cd, EntityType::dimension, GridImp, EntityImp>& /*entity*/) const + { + return 0; + } + + size_t numDofs(const EntityType& /*entity*/) const { return dimRange; } @@ -111,7 +127,7 @@ public: { if (ret.size() < dimRange) ret.resize(dimRange); - const size_t base = dimRange * backend_.index(entity); + const size_t base = dimRange * mapper_->subIndex(entity, 0, 0); for (size_t ii = 0; ii < dimRange; ++ii) ret[ii] = base + ii; } // ... globalIndices(...) @@ -121,11 +137,11 @@ public: size_t mapToGlobal(const EntityType& entity, const size_t& localIndex) const { assert(localIndex < dimRange); - return (dimRange * backend_.index(entity)) + localIndex; + return (dimRange * mapper_->subIndex(entity, 0, 0)) + localIndex; } private: - const BackendType& backend_; + const std::shared_ptr<BackendType> mapper_; }; // class FvMapper< ..., rangeDim, 1 > @@ -141,18 +157,18 @@ public: typedef typename Traits::EntityType EntityType; FvMapper(const GridLayerType& grd_layr) - : backend_(grd_layr.indexSet()) + : mapper_(new BackendType(grd_layr)) { } const BackendType& backend() const { - return backend_; + return *mapper_; } size_t size() const { - return backend_.size(0); + return mapper_->size(); } size_t numDofs(const EntityType& /*entity*/) const @@ -177,11 +193,11 @@ public: size_t mapToGlobal(const EntityType& entity, const size_t& DXTC_DEBUG_ONLY(localIndex)) const { assert(localIndex == 0); - return backend_.index(entity); + return mapper_->subIndex(entity, 0, 0); } private: - const BackendType& backend_; + const std::shared_ptr<BackendType> mapper_; }; // class FvMapper< ..., 1, 1 > diff --git a/dune/gdt/spaces/parallel.hh b/dune/gdt/spaces/parallel.hh index 031c00db696f3f811d8cb00c4f352c509ef7977f..e3b643c9daff3ba91bd2d3bfc99a94b2c71094a1 100644 --- a/dune/gdt/spaces/parallel.hh +++ b/dune/gdt/spaces/parallel.hh @@ -18,10 +18,6 @@ #include <dune/istl/owneroverlapcopy.hh> #endif -#if HAVE_DUNE_PDELAB -#include <dune/pdelab/backend/istl.hh> -#endif - #include <dune/xt/la/container/istl.hh> #include <dune/xt/common/parallel/helper.hh> //#include <dune/xt/grid/layers.hh> @@ -34,7 +30,8 @@ namespace GDT { template <class ViewImp, - bool is_parallel = Dune::XT::UseParallelCommunication<typename ViewImp::Grid::CollectiveCommunication>::value> + bool is_parallel = Dune::XT::UseParallelCommunication< + typename XT::Grid::extract_grid<ViewImp>::type::CollectiveCommunication>::value> struct DofCommunicationChooser { typedef Dune::XT::SequentialCommunication Type; diff --git a/dune/gdt/spaces/rt.bindings.hh b/dune/gdt/spaces/rt.bindings.hh index be285f5a838e85a92af0fc1e84b3067346114932..9db789224f76cf959f69ea96e3063b8ed5915c10 100644 --- a/dune/gdt/spaces/rt.bindings.hh +++ b/dune/gdt/spaces/rt.bindings.hh @@ -19,32 +19,25 @@ // begin: this is what we need for the .so -#if HAVE_DUNE_PDELAB -#define _DUNE_GDT_SPACES_RT_BIND_PDELAB(_m, _GRID, _layer) \ +#define _DUNE_GDT_SPACES_RT_BIND(_m, _GRID, _layer) \ Dune::GDT::bindings::SpaceInterface<Dune::GDT::RtSpaceProvider<_GRID, \ Dune::XT::Grid::Layers::_layer, \ - Dune::GDT::Backends::pdelab, \ + Dune::GDT::Backends::gdt, \ 0, \ double, \ _GRID::dimension, \ 1>>::bind(_m) #if HAVE_DUNE_ALUGRID -#define _DUNE_GDT_SPACES_RT_BIND_PDELAB_ALU_LAYER(_m, _layer) \ - _DUNE_GDT_SPACES_RT_BIND_PDELAB(_m, ALU_2D_SIMPLEX_CONFORMING, _layer) -#define _DUNE_GDT_SPACES_RT_BIND_PDELAB_ALU(_m) \ - _DUNE_GDT_SPACES_RT_BIND_PDELAB_ALU_LAYER(_m, leaf); \ - _DUNE_GDT_SPACES_RT_BIND_PDELAB_ALU_LAYER(_m, level) +#define _DUNE_GDT_SPACES_RT_BIND_ALU_LAYER(_m, _layer) _DUNE_GDT_SPACES_RT_BIND(_m, ALU_2D_SIMPLEX_CONFORMING, _layer) +#define _DUNE_GDT_SPACES_RT_BIND_ALU(_m) \ + _DUNE_GDT_SPACES_RT_BIND_ALU_LAYER(_m, leaf); \ + _DUNE_GDT_SPACES_RT_BIND_ALU_LAYER(_m, level) #else -#define _DUNE_GDT_SPACES_RT_BIND_PDELAB_ALU(_m) +#define _DUNE_GDT_SPACES_RT_BIND_ALU(_m) #endif -#define _DUNE_GDT_SPACES_RT_BIND_PDELAB_ALL(_m) _DUNE_GDT_SPACES_RT_BIND_PDELAB_ALU(_m) -#else // HAVE_DUNE_PDELAB -#define _DUNE_GDT_SPACES_RT_BIND_PDELAB_ALL(_m) -#endif - -#define DUNE_GDT_SPACES_RT_BIND(_m) _DUNE_GDT_SPACES_RT_BIND_PDELAB_ALL(_m) +#define DUNE_GDT_SPACES_RT_BIND(_m) _DUNE_GDT_SPACES_RT_BIND_ALU(_m) // end: this is what we need for the .so diff --git a/dune/gdt/spaces/rt.hh b/dune/gdt/spaces/rt.hh index 8751c9a1e46bc62f583a31551b02bbc6936325c0..0f9d3aad1a5acc0b63366ef90919ba7945cd32ad 100644 --- a/dune/gdt/spaces/rt.hh +++ b/dune/gdt/spaces/rt.hh @@ -14,7 +14,7 @@ #include <dune/xt/grid/gridprovider/provider.hh> #include "rt/interface.hh" -#include "rt/dune-pdelab-wrapper.hh" +#include "rt/default.hh" #include <dune/gdt/playground/spaces/block.hh> namespace Dune { @@ -47,9 +47,11 @@ private: }; template <class G, int p, class R, size_t r, size_t rC> - struct SpaceChooser<G, p, R, r, rC, GDT::Backends::pdelab> + struct SpaceChooser<G, p, R, r, rC, GDT::Backends::gdt> { - typedef GDT::DunePdelabRtSpaceWrapper<GridLayerType, p, R, r, rC> Type; + static_assert(rC == 1, ""); + static_assert(r == G::dimension, ""); + typedef GDT::RaviartThomasSpace<GridLayerType, p, R> Type; }; public: diff --git a/dune/gdt/spaces/rt/default.hh b/dune/gdt/spaces/rt/default.hh new file mode 100644 index 0000000000000000000000000000000000000000..774195bac8976afac828dbf03a4aa77471d17f07 --- /dev/null +++ b/dune/gdt/spaces/rt/default.hh @@ -0,0 +1,461 @@ +// 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) + +#ifndef DUNE_GDT_SPACES_RT_DEFAULT_HH +#define DUNE_GDT_SPACES_RT_DEFAULT_HH + +#include <memory> +#include <vector> + +#include <dune/common/typetraits.hh> + +#include <dune/geometry/referenceelements.hh> +#include <dune/geometry/type.hh> + +#include <dune/grid/common/capabilities.hh> +#include <dune/grid/common/rangegenerators.hh> + +#include <dune/localfunctions/raviartthomas.hh> + +#include <dune/xt/common/exceptions.hh> +#include <dune/xt/common/numeric_cast.hh> + +#include <dune/gdt/spaces/basefunctionset/interface.hh> +#include <dune/gdt/spaces/mapper/default.hh> +#include <dune/gdt/spaces/rt/interface.hh> + +namespace Dune { + + +// forwards +template <int dim, class Coordinates> +class YaspGrid; + +class OneDGrid; + + +namespace GDT { + + +// forwards, required for the traits +template <class FE, class E, class R = double> +class RaviartThomasBasefunctionSet; + +template <class GL, int p, class R = double> +class RaviartThomasSpace; + + +namespace internal { + + +template <class FE, class E, class R> +class RaviartThomasBasefunctionSetTraits +{ + using LocalFunctionTraits = + XT::Functions::LocalfunctionSetInterface<E, typename E::Geometry::ctype, E::dimension, R, E::dimension>; + +public: + using derived_type = RaviartThomasBasefunctionSet<FE, E, R>; + using EntityType = E; + using BackendType = FE; +}; + + +template <class GL, int p, class R> +class RaviartThomasSpaceTraits +{ + static_assert(XT::Grid::is_layer<GL>::value, ""); + static_assert(p == 0, "Not implemented yet!"); + using G = XT::Grid::extract_grid_t<GL>; + +public: + static const constexpr int polOrder = p; + static const constexpr size_t dimDomain = GL::dimension; + static const constexpr size_t dimRange = dimDomain; + static const constexpr size_t dimRangeCols = 1; + +private: + template <class G_ = G, bool anything = true> + struct ChooseLocalFiniteElement + { + template <class some_type_we_need_for_the_always_false = G_, + bool single_geometry_type = Capabilities::hasSingleGeometryType<G>::v, + bool is_simplex = + Capabilities::hasSingleGeometryType<G>::topologyId == Impl::SimplexTopology<dimDomain>::type::id, + bool is_cube = + Capabilities::hasSingleGeometryType<G>::topologyId == Impl::CubeTopology<dimDomain>::type::id> + struct geometry_type_switch + { + // This requires virtual interfaces for the local finite elements. + static_assert(AlwaysFalse<some_type_we_need_for_the_always_false>::value, + "RaviartThomasSpace is only available for purely simplicial or purely cubic grids atm!"); + }; + + template <class some_type_we_need_for_the_always_false> + struct geometry_type_switch<some_type_we_need_for_the_always_false, true, true, false> + { + using type = RaviartThomasSimplexLocalFiniteElement<dimDomain, typename GL::ctype, R>; + + static std::shared_ptr<type> create(const Dune::GeometryType& geometry_type, const int& polorder) + { + return std::make_shared<type>(geometry_type, polorder); + } + }; + + template <class some_type_we_need_for_the_always_false> + struct geometry_type_switch<some_type_we_need_for_the_always_false, true, false, true> + { + using type = RaviartThomasCubeLocalFiniteElement<typename GL::ctype, R, dimDomain, p>; + + static std::shared_ptr<type> create(const Dune::GeometryType& /*geometry_type*/, const int& /*polorder*/) + { + return std::make_shared<type>(); + } + }; + + using type = typename geometry_type_switch<>::type; + + static std::shared_ptr<type> create(const Dune::GeometryType& geometry_type, const int& polorder) + { + return geometry_type_switch<>::create(geometry_type, polorder); + } + }; + + // We need an exception for 1d YaspGrid: it reports to contain cubes but everything is a simplex in 1d. + template <bool anything, class Coordinates> + struct ChooseLocalFiniteElement<YaspGrid<1, Coordinates>, anything> + { + using type = RaviartThomasSimplexLocalFiniteElement<dimDomain, typename GL::ctype, R>; + + static std::shared_ptr<type> create(const Dune::GeometryType& geometry_type, const int& polorder) + { + return std::make_shared<type>(geometry_type, polorder); + } + }; + + // We need an exception for OneDGrid: it reports to contain cubes but everything is a simplex in 1d. + template <bool anything> + struct ChooseLocalFiniteElement<OneDGrid, anything> + { + using type = RaviartThomasSimplexLocalFiniteElement<dimDomain, typename GL::ctype, R>; + + static std::shared_ptr<type> create(const Dune::GeometryType& geometry_type, const int& polorder) + { + return std::make_shared<type>(geometry_type, polorder); + } + }; + +public: + using derived_type = RaviartThomasSpace<GL, p, R>; + static const constexpr bool continuous = false; + using GridLayerType = GL; + using BackendType = typename ChooseLocalFiniteElement<>::type; + using BaseFunctionSetType = RaviartThomasBasefunctionSet<BackendType, XT::Grid::extract_entity_t<GL>, R>; + using MapperType = FixedOrderMultipleCodimMultipleGeomTypeMapper<GL, BackendType>; + using RangeFieldType = R; + static const constexpr XT::Grid::Backends layer_backend = XT::Grid::Backends::view; + static const constexpr Backends backend_type{Backends::gdt}; + typedef DofCommunicationChooser<GridLayerType, false> DofCommunicationChooserType; + typedef typename DofCommunicationChooserType::Type DofCommunicatorType; + +private: + friend class RaviartThomasSpace<GL, p, R>; +}; // class RaviartThomasSpaceTraits + + +} // namespace internal + + +template <class FE, class E, class R> +class RaviartThomasBasefunctionSet + : public BaseFunctionSetInterface<internal::RaviartThomasBasefunctionSetTraits<FE, E, R>, + typename E::Geometry::ctype, + E::dimension, + R, + E::dimension, + 1> +{ +public: + using Traits = internal::RaviartThomasBasefunctionSetTraits<FE, E, R>; + +private: + using BaseType = BaseFunctionSetInterface<Traits, typename E::Geometry::ctype, E::dimension, R, E::dimension, 1>; + using ThisType = RaviartThomasBasefunctionSet<FE, E, R>; + +public: + using typename BaseType::BackendType; + using typename BaseType::EntityType; + using typename BaseType::DomainType; + using typename BaseType::RangeType; + using typename BaseType::JacobianRangeType; + using BaseType::d; + + RaviartThomasBasefunctionSet(const EntityType& en, const BackendType& finite_element, const std::vector<R>& switches) + : BaseType(en) + , finite_element_(finite_element) + , switches_(switches) + { + if (switches_.size() != finite_element_.size()) + DUNE_THROW(XT::Common::Exceptions::shapes_do_not_match, + "finite_element.size() = " << finite_element_.size() << "\n switches.size() = " << switches_.size()); + } + + RaviartThomasBasefunctionSet(const ThisType&) = default; + RaviartThomasBasefunctionSet(ThisType&&) = default; + + ThisType& operator=(const ThisType&) = delete; + ThisType& operator=(ThisType&&) = delete; + + const BackendType& backend() const + { + return finite_element_; + } + + size_t size() const override final + { + return finite_element_.localBasis().size(); + } + + size_t order(const XT::Common::Parameter& /*mu*/ = {}) const override final + { + return finite_element_.localBasis().order(); + } + + using BaseType::evaluate; + + void evaluate(const DomainType& xx, + std::vector<RangeType>& ret, + const XT::Common::Parameter& /*mu*/ = {}) const override final + { + assert(this->is_a_valid_point(xx)); + // evaluate shape functions + finite_element_.localBasis().evaluateFunction(xx, ret); + // flip and scale shape functions to ensure + // - continuity of normal component and + // - to ensure basis*integrationElementNormal = 1 + for (size_t ii = 0; ii < finite_element_.localBasis().size(); ++ii) + ret[ii] *= switches_[ii]; + // apply piola transformation + const auto J_T = this->entity().geometry().jacobianTransposed(xx); + const auto det_J_T = std::abs(J_T.determinant()); + RangeType tmp_value; + for (size_t ii = 0; ii < finite_element_.localBasis().size(); ++ii) { + J_T.mtv(ret[ii], tmp_value); + tmp_value /= det_J_T; + ret[ii] = tmp_value; + } + } // ... evaluate(...) + + using BaseType::jacobian; + + void jacobian(const DomainType& xx, + std::vector<JacobianRangeType>& ret, + const XT::Common::Parameter& /*mu*/ = {}) const override final + { + assert(this->is_a_valid_point(xx)); + // evaluate jacobian of shape functions + finite_element_.localBasis().evaluateJacobian(xx, ret); + // flip and scale shape functions to ensure + // - continuity of normal component and + // - to ensure basis*integrationElementNormal = 1 + for (size_t ii = 0; ii < finite_element_.localBasis().size(); ++ii) + ret[ii] *= switches_[ii]; + // apply piola transformation + const auto J_T = this->entity().geometry().jacobianTransposed(xx); + const auto det_J_T = std::abs(J_T.determinant()); + const auto J_inv_T = this->entity().geometry().jacobianInverseTransposed(xx); + auto tmp_jacobian_row = ret[0][0]; + for (size_t ii = 0; ii < finite_element_.localBasis().size(); ++ii) { + for (size_t jj = 0; jj < d; ++jj) { + J_inv_T.mtv(ret[ii][jj], tmp_jacobian_row); + J_T.mtv(tmp_jacobian_row, ret[ii][jj]); + ret[ii][jj] /= det_J_T; + } + } + } // ... jacobian(...) + +private: + const BackendType& finite_element_; + const std::vector<R>& switches_; +}; // class RaviartThomasBasefunctionSet + + +template <class GL, int p, class R> +class RaviartThomasSpace + : public RtSpaceInterface<internal::RaviartThomasSpaceTraits<GL, p, R>, GL::dimension, GL::dimension> +{ +public: + using Traits = internal::RaviartThomasSpaceTraits<GL, p, R>; + +private: + using BaseType = RtSpaceInterface<Traits, GL::dimension, GL::dimension>; + using ThisType = RaviartThomasSpace<GL, p, R>; + using D = typename GL::ctype; + static const constexpr size_t d = BaseType::dimDomain; + using FiniteElementType = typename BaseType::BackendType; + typedef typename Traits::DofCommunicationChooserType DofCommunicationChooserType; + +public: + using typename BaseType::GridLayerType; + using typename BaseType::BackendType; + using typename BaseType::EntityType; + using typename BaseType::MapperType; + using typename BaseType::BaseFunctionSetType; + typedef typename Traits::DofCommunicatorType DofCommunicatorType; + + RaviartThomasSpace(GridLayerType grd_lr) + : grid_layer_(grd_lr) + , communicator_(DofCommunicationChooserType::create(grid_layer_)) + , backend_(0) + , finite_elements_(new std::map<GeometryType, std::shared_ptr<FiniteElementType>>()) + , geometry_to_local_DoF_indices_map_(new std::map<GeometryType, std::vector<size_t>>()) + , entity_indices_(new ZeroOrderScalarDiscontinuousMapper<GL>(grid_layer_)) // <- We need unique indices for codim 0 + , switches_(new std::vector<std::vector<R>>(entity_indices_->size())) // entities: this cannot be achieved by + , mapper_(nullptr) // the grid layers index set for mixed grids. + , communicator_prepared_(false) + { + // create finite elements + for (auto&& geometry_type : grid_layer_.indexSet().types(0)) { + auto finite_element = Traits::template ChooseLocalFiniteElement<>::create(geometry_type, p); + finite_elements_->insert(std::make_pair(geometry_type, finite_element)); + // this is only valid for p0 elements + geometry_to_local_DoF_indices_map_->insert( + std::make_pair(geometry_type, std::vector<size_t>(finite_element->size()))); + } + // compute local-key-to-intersection relationship + for (const auto& geometry_type_and_finite_element_ptr : *finite_elements_) { + const auto& geometry_type = geometry_type_and_finite_element_ptr.first; + const auto& finite_element = *geometry_type_and_finite_element_ptr.second; + const auto& coeffs = finite_element.localCoefficients(); + auto& local_key_to_intersection_map = geometry_to_local_DoF_indices_map_->at(geometry_type); + for (size_t ii = 0; ii < coeffs.size(); ++ii) { + const auto& local_key = coeffs.localKey(ii); + if (local_key.index() != 0) + DUNE_THROW(XT::Common::Exceptions::internal_error, "This must not happen for p0!"); + if (local_key.codim() != 1) + DUNE_THROW(XT::Common::Exceptions::internal_error, "This must not happen for p0!"); + local_key_to_intersection_map[ii] = local_key.subEntity(); + } + } + // compute scaling to ensure basis*integrationElementNormal = 1 + std::map<GeometryType, std::vector<R>> geometry_to_scaling_factors_map; + for (const auto& geometry_type_and_finite_element_ptr : *finite_elements_) { + const auto& geometry_type = geometry_type_and_finite_element_ptr.first; + const auto& finite_element = *geometry_type_and_finite_element_ptr.second; + const auto& shape_functions = finite_element.localBasis(); + std::vector<typename BaseFunctionSetType::RangeType> shape_functions_evaluations(shape_functions.size()); + const auto& reference_element = ReferenceElements<D, d>::general(geometry_type); + const auto num_intersections = reference_element.size(1); + geometry_to_scaling_factors_map.insert(std::make_pair(geometry_type, std::vector<R>(num_intersections, R(1.)))); + auto& scaling_factors = geometry_to_scaling_factors_map.at(geometry_type); + const auto& DoF_indices = geometry_to_local_DoF_indices_map_->at(geometry_type); + for (auto&& intersection_index : XT::Common::value_range(num_intersections)) { + const auto& normal = reference_element.integrationOuterNormal(intersection_index); + const auto& intersection_center = reference_element.position(intersection_index, 1); + const auto DoF_index = DoF_indices[intersection_index]; + shape_functions.evaluateFunction(intersection_center, shape_functions_evaluations); + scaling_factors[intersection_index] /= shape_functions_evaluations[DoF_index] * normal; + } + } + // compute switches (as signs of the scaling factor) to ensure continuity of the normal component + for (auto&& entity : elements(grid_layer_)) { + const auto geometry_type = entity.geometry().type(); + const auto& finite_element = *finite_elements_->at(geometry_type); + const auto& coeffs = finite_element.localCoefficients(); + const auto entity_index = entity_indices_->mapToGlobal(entity, 0); + (*switches_)[entity_index] = geometry_to_scaling_factors_map.at(geometry_type); + auto& local_switches = switches_->at(entity_index); + for (auto&& intersection : intersections(grid_layer_, entity)) { + if (intersection.neighbor() && entity_index < entity_indices_->mapToGlobal(intersection.outside(), 0)) { + const auto intersection_index = XT::Common::numeric_cast<unsigned int>(intersection.indexInInside()); + for (size_t ii = 0; ii < coeffs.size(); ++ii) { + const auto& local_key = coeffs.localKey(ii); + const auto DoF_subentity_index = local_key.subEntity(); + if (local_key.codim() == 1 && DoF_subentity_index == intersection_index) + local_switches[DoF_subentity_index] *= -1.; + } + } + } + } + // create mapper + mapper_ = std::make_shared<MapperType>(grid_layer_, finite_elements_); + } // RaviartThomasSpace(...) + + RaviartThomasSpace(const ThisType&) = default; + RaviartThomasSpace(ThisType&&) = default; + + ThisType& operator=(const ThisType&) = delete; + ThisType& operator=(ThisType&&) = delete; + + const GridLayerType& grid_layer() const + { + return grid_layer_; + } + + const BackendType& backend() const + { + // this only works because we know that there can only be one geometry. + return *finite_elements_->begin()->second; + } + + const MapperType& mapper() const + { + return *mapper_; + } + + BaseFunctionSetType base_function_set(const EntityType& entity) const + { + const auto finite_element_search_result = finite_elements_->find(entity.geometry().type()); + if (finite_element_search_result == finite_elements_->end()) + DUNE_THROW(XT::Common::Exceptions::internal_error, + "This must not happen after the checks in the ctor, the grid layer did not report all geometry types!" + "\n entity.geometry().type() = " + << entity.geometry().type()); + const auto& finite_element = *finite_element_search_result->second; + return BaseFunctionSetType(entity, finite_element, (*switches_)[entity_indices_->mapToGlobal(entity, 0)]); + } + + DofCommunicatorType& dof_communicator() const + { + if (!communicator_prepared_) { + communicator_prepared_ = DofCommunicationChooserType::prepare(*this, *communicator_); + } + return *communicator_; + } + + // this makes sense only for for p0 (and only on simplices?) + // once we export the local finite element, this should become obsolete! + std::vector<size_t> local_DoF_indices(const EntityType& entity) const + { + const auto search_result = geometry_to_local_DoF_indices_map_->find(entity.geometry().type()); + if (search_result == geometry_to_local_DoF_indices_map_->end()) + DUNE_THROW(XT::Common::Exceptions::internal_error, + "This must not happen after the checks in the ctor, the grid layer did not report all geometry types!" + "\n entity.geometry().type() = " + << entity.geometry().type()); + return search_result->second; + } // ... local_DoF_indices(...) + +private: + const GridLayerType grid_layer_; + mutable std::shared_ptr<DofCommunicatorType> communicator_; + const double backend_; + std::shared_ptr<std::map<GeometryType, std::shared_ptr<FiniteElementType>>> finite_elements_; + std::shared_ptr<std::map<GeometryType, std::vector<size_t>>> geometry_to_local_DoF_indices_map_; + std::shared_ptr<ZeroOrderScalarDiscontinuousMapper<GL>> entity_indices_; + std::shared_ptr<std::vector<std::vector<R>>> switches_; + std::shared_ptr<MapperType> mapper_; + mutable bool communicator_prepared_; +}; // class RaviartThomasSpace + + +} // namespace GDT +} // namespace Dune + +#endif // DUNE_GDT_SPACES_RT_DEFAULT_HH diff --git a/dune/gdt/spaces/rt/dune-pdelab-wrapper.hh b/dune/gdt/spaces/rt/dune-pdelab-wrapper.hh deleted file mode 100644 index 1ad75dfba398e8025caa40ff18edc78e61744fee..0000000000000000000000000000000000000000 --- a/dune/gdt/spaces/rt/dune-pdelab-wrapper.hh +++ /dev/null @@ -1,304 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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 (2014 - 2017) -// Rene Milk (2014, 2016 - 2017) -// Tobias Leibner (2014, 2016) - -#ifndef DUNE_GDT_SPACES_RT_DUNE_PDELAB_WRAPPER_HH -#define DUNE_GDT_SPACES_RT_DUNE_PDELAB_WRAPPER_HH - -#include <type_traits> -#include <limits> -#include <mutex> - -#include <dune/geometry/type.hh> -#include <dune/geometry/referenceelements.hh> - -#include <dune/grid/common/capabilities.hh> - -#if HAVE_DUNE_PDELAB -#include <dune/pdelab/finiteelementmap/raviartthomasfem.hh> -#include <dune/pdelab/gridfunctionspace/gridfunctionspace.hh> -#endif // HAVE_DUNE_PDELAB - -#include <dune/xt/common/float_cmp.hh> -#include <dune/xt/common/exceptions.hh> -#include <dune/xt/common/type_traits.hh> - -#include <dune/gdt/spaces/basefunctionset/dune-pdelab-wrapper.hh> -#include <dune/gdt/spaces/mapper/dune-pdelab-wrapper.hh> -#include <dune/gdt/spaces/parallel.hh> - -#include "interface.hh" - -namespace Dune { -namespace GDT { - -#if HAVE_DUNE_PDELAB - - -// forward, to be used in the traits and to allow for specialization -template <class GridViewImp, int polynomialOrder, class RangeFieldImp, size_t rangeDim, size_t rangeDimCols = 1> -class DunePdelabRtSpaceWrapper -{ - static_assert(AlwaysFalse<GridViewImp>::value, "Untested for these dimensions or polynomial order!"); -}; // class DunePdelabRtSpaceWrapper - - -namespace internal { - - -template <class GridViewImp, int polynomialOrder, class RangeFieldImp, size_t rangeDim, size_t rangeDimCols> -class DunePdelabRtSpaceWrapperTraits -{ - static_assert(XT::Grid::is_view<GridViewImp>::value, ""); - -public: - typedef DunePdelabRtSpaceWrapper<GridViewImp, polynomialOrder, RangeFieldImp, rangeDim, rangeDimCols> derived_type; - typedef GridViewImp GridLayerType; - static const int polOrder = polynomialOrder; - static const bool continuous = false; - static_assert(polOrder == 0, "Untested!"); - static_assert(rangeDim == GridLayerType::dimension, "Untested!"); - static_assert(rangeDimCols == 1, "Untested!"); - static const constexpr Backends backend_type{Backends::pdelab}; - -private: - typedef typename GridLayerType::ctype DomainFieldType; - static const size_t dimDomain = GridLayerType::dimension; - -public: - typedef RangeFieldImp RangeFieldType; - -private: - template <class G, bool single_geom, bool is_simplex, bool is_cube> - struct FeMap - { - static_assert(AlwaysFalse<G>::value, - "This space is only implemented for either fully simplicial or fully cubic grids!"); - }; - template <class G> - struct FeMap<G, true, true, false> - { - typedef PDELab::RaviartThomasLocalFiniteElementMap<GridLayerType, - DomainFieldType, - RangeFieldType, - polOrder, - Dune::GeometryType::simplex> - Type; - }; - template <class G> - struct FeMap<G, true, false, true> - { - typedef PDELab::RaviartThomasLocalFiniteElementMap<GridLayerType, - DomainFieldType, - RangeFieldType, - polOrder, - Dune::GeometryType::cube> - Type; - }; - typedef XT::Grid::extract_grid_t<GridLayerType> GridType; - static const bool single_geom_ = Dune::Capabilities::hasSingleGeometryType<GridType>::v; - static const bool simplicial_ = - (Dune::Capabilities::hasSingleGeometryType<GridType>::topologyId == Impl::SimplexTopology<dimDomain>::type::id); - static const bool cubic_ = - (Dune::Capabilities::hasSingleGeometryType<GridType>::topologyId == Impl::CubeTopology<dimDomain>::type::id); - typedef typename FeMap<GridType, single_geom_, simplicial_, cubic_>::Type FEMapType; - -public: - typedef PDELab::GridFunctionSpace<GridLayerType, FEMapType> BackendType; - typedef DunePdelabCgMapperWrapper<BackendType> MapperType; - using EntityType = XT::Grid::extract_entity_t<GridLayerType>; - typedef BaseFunctionSet::PiolaTransformedDunePdelabWrapper<BackendType, - EntityType, - DomainFieldType, - dimDomain, - RangeFieldType, - rangeDim, - rangeDimCols> - BaseFunctionSetType; - static const XT::Grid::Backends layer_backend = XT::Grid::Backends::view; - static const bool needs_grid_view = true; - typedef DofCommunicationChooser<GridLayerType, false> DofCommunicationChooserType; - typedef typename DofCommunicationChooserType::Type DofCommunicatorType; - -private: - friend class DunePdelabRtSpaceWrapper<GridViewImp, polynomialOrder, RangeFieldImp, rangeDim, rangeDimCols>; -}; // class DunePdelabRtSpaceWrapperTraits - - -} // namespace internal - - -/** - * \attention When using alugrid, this space only works on the leaf view, not on level or dd_subdomain* views! - */ -template <class GridViewImp, class RangeFieldImp, size_t rangeDim> -class DunePdelabRtSpaceWrapper<GridViewImp, 0, RangeFieldImp, rangeDim, 1> - : public RtSpaceInterface<internal::DunePdelabRtSpaceWrapperTraits<GridViewImp, 0, RangeFieldImp, rangeDim, 1>, - GridViewImp::dimension, - rangeDim, - 1> -{ - typedef DunePdelabRtSpaceWrapper<GridViewImp, 0, RangeFieldImp, rangeDim, 1> ThisType; - typedef RtSpaceInterface<internal::DunePdelabRtSpaceWrapperTraits<GridViewImp, 0, RangeFieldImp, rangeDim, 1>, - GridViewImp::dimension, - rangeDim, - 1> - BaseType; - -public: - typedef internal::DunePdelabRtSpaceWrapperTraits<GridViewImp, 0, RangeFieldImp, rangeDim, 1> Traits; - - using BaseType::dimDomain; - using BaseType::polOrder; - - using typename BaseType::GridLayerType; - using typename BaseType::BackendType; - using typename BaseType::MapperType; - using typename BaseType::BaseFunctionSetType; - using typename BaseType::DofCommunicatorType; - - using typename BaseType::PatternType; - using typename BaseType::EntityType; - -private: - typedef typename Traits::FEMapType FEMapType; - -public: - DunePdelabRtSpaceWrapper(GridLayerType grd_vw) - : grid_view_(grd_vw) - , fe_map_(grid_view_) - , backend_(grid_view_, fe_map_) - , mapper_(backend_) - , communicator_(Traits::DofCommunicationChooserType::create(grid_view_)) - , communicator_prepared_(false) - { - } - - /** - * \brief Copy ctor. - * \note Manually implemented bc of the std::mutex and our space creation policy - * (see https://github.com/pymor/dune-gdt/issues/28) - */ - DunePdelabRtSpaceWrapper(const ThisType& other) - : grid_view_(other.grid_view_) - , fe_map_(grid_view_) - , backend_(grid_view_, fe_map_) - , mapper_(backend_) - , communicator_(Traits::DofCommunicationChooserType::create(grid_view_)) - , communicator_prepared_(false) - { - // make sure our new communicator is prepared if other's was - if (other.communicator_prepared_) - const auto& comm DUNE_UNUSED = this->dof_communicator(); - } - - /** - * \brief Move ctor. - * \note Manually implemented bc of the std::mutex and our space creation policy - * (see https://github.com/pymor/dune-gdt/issues/28) - */ - DunePdelabRtSpaceWrapper(ThisType&& source) - : grid_view_(source.grid_view_) - , fe_map_(grid_view_) - , backend_(grid_view_, fe_map_) - , mapper_(backend_) - , communicator_(std::move(source.communicator_)) - , communicator_prepared_(source.communicator_prepared_) - { - } - - ThisType& operator=(const ThisType& other) = delete; - - ThisType& operator=(ThisType&& source) = delete; - - const GridLayerType& grid_layer() const - { - return grid_view_; - } - - GridLayerType& grid_layer() - { - return grid_view_; - } - - const BackendType& backend() const - { - return backend_; - } - - const MapperType& mapper() const - { - return mapper_; - } - - BaseFunctionSetType base_function_set(const EntityType& entity) const - { - return BaseFunctionSetType(backend_, entity); - } - - DofCommunicatorType& dof_communicator() const - { - DUNE_UNUSED std::lock_guard<std::mutex> gg(communicator_mutex_); - if (!communicator_prepared_) - communicator_prepared_ = Traits::DofCommunicationChooserType::prepare(*this, *communicator_); - return *communicator_; - } // ... communicator(...) - -private: - template <class S, size_t d, int p, bool simplicial> - struct Helper - { - static_assert(AlwaysFalse<S>::value, "Not available for this combination!"); - }; - - template <class S> - struct Helper<S, 2, 0, true> - { - static std::vector<size_t> local_DoF_indices(const S& space, const EntityType& entity) - { - return space.local_DoF_indices_2dsimplex_order0(entity); - } - }; - -public: - std::vector<size_t> local_DoF_indices(const EntityType& entity) const - { - return Helper < ThisType, dimDomain, polOrder, - Traits::single_geom_ && Traits::simplicial_ > ::local_DoF_indices(*this, entity); - } - -private: - GridLayerType grid_view_; - const FEMapType fe_map_; - const BackendType backend_; - const MapperType mapper_; - mutable std::unique_ptr<DofCommunicatorType> communicator_; - mutable bool communicator_prepared_; - mutable std::mutex communicator_mutex_; -}; // class DunePdelabRtSpaceWrapper< ..., 0, ..., 1 > - - -#else // HAVE_DUNE_PDELAB - - -template <class GridViewImp, int polynomialOrder, class RangeFieldImp, size_t rangeDim, size_t rangeDimCols = 1> -class DunePdelabRtSpaceWrapper -{ - static_assert(AlwaysFalse<GridViewImp>::value, "You are missing dune-pdelab!"); -}; - - -#endif // HAVE_DUNE_PDELAB - - -} // namespace GDT -} // namespace Dune - -#endif // DUNE_GDT_SPACES_RT_DUNE_PDELAB_WRAPPER_HH diff --git a/dune/gdt/spaces/rt/interface.hh b/dune/gdt/spaces/rt/interface.hh index b3dc237a06c422ea530c7ebb4382e059f52c78d1..28f01d67b74e32a1c8a30ff4b5c2860500961682 100644 --- a/dune/gdt/spaces/rt/interface.hh +++ b/dune/gdt/spaces/rt/interface.hh @@ -165,8 +165,8 @@ public: typename std::enable_if<XT::Grid::is_layer<GL>::value, PatternType>::type compute_pattern(const GL& grd_layr, const SpaceInterface<S, d, r, rC>& ansatz_space) const { - Dune::XT::Common::TimedLogger().get("gdt.spaces.rt.pdelab.compute_pattern").warn() - << "Returning largest possible pattern!" << std::endl; + Dune::XT::Common::TimedLogger().get("gdt.spaces.rt.compute_pattern").warn() << "Returning largest possible pattern!" + << std::endl; return BaseType::compute_face_and_volume_pattern(grd_layr, ansatz_space); } diff --git a/dune/gdt/spaces/th/dune-pdelab-wrapper.hh b/dune/gdt/spaces/th/dune-pdelab-wrapper.hh deleted file mode 100644 index 63ba673acee8d929f20d1b7adedb238ac8ca3552..0000000000000000000000000000000000000000 --- a/dune/gdt/spaces/th/dune-pdelab-wrapper.hh +++ /dev/null @@ -1,42 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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 (2016 - 2017) - -#ifndef DUNE_GDT_SPACES_TH_DUNE_PDELAB_WRAPPER_HH -#define DUNE_GDT_SPACES_TH_DUNE_PDELAB_WRAPPER_HH - -#include <dune/gdt/spaces/cg/dune-pdelab-wrapper.hh> -#include <dune/gdt/spaces/product.hh> - -namespace Dune { -namespace GDT { - - -template <class GridViewImp, int polynomialOrder, size_t domainDim, class RangeFieldImp> -class DunePdelabTaylorHoodSpaceWrapper - : public DefaultProductSpace<DunePdelabCgSpaceWrapper<GridViewImp, polynomialOrder, RangeFieldImp, domainDim, 1>, - DunePdelabCgSpaceWrapper<GridViewImp, polynomialOrder - 1, RangeFieldImp, 1, 1>> -{ - static_assert(polynomialOrder > 0, ""); - -public: - typedef DunePdelabCgSpaceWrapper<GridViewImp, polynomialOrder, RangeFieldImp, domainDim, 1> VelocitySpaceType; - typedef DunePdelabCgSpaceWrapper<GridViewImp, polynomialOrder - 1, RangeFieldImp, 1, 1> PressureSpaceType; - typedef DefaultProductSpace<VelocitySpaceType, PressureSpaceType> BaseType; - - DunePdelabTaylorHoodSpaceWrapper(const GridViewImp& grid_view) - : BaseType(VelocitySpaceType(grid_view), PressureSpaceType(grid_view)) - { - } -}; - - -} // namespace GDT -} // namespace Dune - -#endif // DUNE_GDT_SPACES_TH_DUNE_PDELAB_WRAPPER_HH diff --git a/dune/gdt/spaces/tools.hh b/dune/gdt/spaces/tools.hh deleted file mode 100644 index c95135fa6bf12b5b9052d76940f29d89eedd0b6b..0000000000000000000000000000000000000000 --- a/dune/gdt/spaces/tools.hh +++ /dev/null @@ -1,126 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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 (2014, 2016 - 2017) -// Rene Milk (2014, 2017) -// Tobias Leibner (2014) - -#ifndef DUNE_GDT_SPACE_TOOLS_HH -#define DUNE_GDT_SPACE_TOOLS_HH - -#warning This header is deprecated, all information is in the space now (04.04.2017)! - -#include <memory> -#include <type_traits> - -#include "interface.hh" - -#if HAVE_DUNE_FEM -#include <dune/fem/gridpart/levelgridpart.hh> -#include <dune/fem/gridpart/leafgridpart.hh> -#endif - -#include <dune/xt/grid/type_traits.hh> - -namespace Dune { -namespace GDT { -namespace SpaceTools { - - -template <class GridType, bool view = true> -struct DUNE_DEPRECATED_MSG("Do not use this any more, all information is in the space (04.04.2017)!") LeafGridPartView -{ - typedef typename GridType::LeafGridView Type; - - static Type create(GridType& grid) - { - return Type(grid.leafGridView()); - } -}; // struct LeafGridPartView< ..., true > - - -template <class GridType, bool view = true> -struct DUNE_DEPRECATED_MSG("Do not use this any more, all information is in the space (04.04.2017)!") LevelGridPartView -{ - typedef typename GridType::LevelGridView Type; - - static Type create(GridType& grid, const int level) - { - assert(level >= 0); - assert(level <= grid.maxLevel()); - return Type(grid.levelGridView(level)); - } -}; // struct LevelGridPartView< ..., true > - - -#if HAVE_DUNE_FEM - - -template <class GridType> -struct DUNE_DEPRECATED_MSG("Do not use this any more, all information is in the space (04.04.2017)!") - LeafGridPartView<GridType, false> -{ - typedef Dune::Fem::LeafGridPart<GridType> Type; - - static Type create(GridType& grid) - { - return Type(grid); - } -}; // struct LeafGridPartView< ..., false > - - -template <class GridType> -struct DUNE_DEPRECATED_MSG("Do not use this any more, all information is in the space (04.04.2017)!") - LevelGridPartView<GridType, false> -{ - typedef Dune::Fem::LevelGridPart<GridType> Type; - - static Type create(GridType& grid, const int level) - { - assert(level >= 0); - assert(level <= grid.maxLevel()); - return Type(grid, level); - } -}; // struct LevelGridPartView< ..., false > - - -#endif // HAVE_DUNE_FEM - - -template <class SpaceType> -class DUNE_DEPRECATED_MSG("Do not use this any more, all information is in the space (04.04.2017)!") GridPartView -{ - static_assert(std::is_base_of<SpaceInterface<typename SpaceType::Traits, - SpaceType::dimDomain, - SpaceType::dimRange, - SpaceType::dimRangeCols>, - SpaceType>::value, - "SpaceType has to be derived from SpaceInterface!"); - static const bool needs_grid_view = (SpaceType::layer_backend == XT::Grid::Backends::view); - -public: - using GridType = XT::Grid::extract_grid_t<typename SpaceType::GridLayerType>; - typedef typename LeafGridPartView<GridType, needs_grid_view>::Type LeafGridLayerType; - typedef typename LevelGridPartView<GridType, needs_grid_view>::Type LevelGridLayerType; - - static LeafGridLayerType create_leaf(GridType& grid) - { - return LeafGridPartView<GridType, needs_grid_view>::create(grid); - } - - static LevelGridLayerType create_level(GridType& grid, const int level) - { - return LevelGridPartView<GridType, needs_grid_view>::create(grid, level); - } -}; // struct GridPartView - - -} // namespace SpaceTools -} // namespace GDT -} // namespace Dune - -#endif // DUNE_GDT_SPACE_TOOLS_HH diff --git a/dune/gdt/test/grids.hh b/dune/gdt/test/grids.hh index 2e91069b87f380eedfefd80ae03189e469ab0b64..a90ad870a025ce6b907dd1998d712738581e5a12 100644 --- a/dune/gdt/test/grids.hh +++ b/dune/gdt/test/grids.hh @@ -21,12 +21,6 @@ #include <dune/xt/grid/type_traits.hh> #define YASPGRID_TYPES(dim) \ - typedef typename Dune::XT::Grid::Layer<Dune::YaspGrid<dim, Dune::EquidistantOffsetCoordinates<double, dim>>, \ - Dune::XT::Grid::Layers::leaf, \ - Dune::XT::Grid::Backends::part>::type Yasp##dim##dLeafGridPartType; \ - typedef typename Dune::XT::Grid::Layer<Dune::YaspGrid<dim, Dune::EquidistantOffsetCoordinates<double, dim>>, \ - Dune::XT::Grid::Layers::level, \ - Dune::XT::Grid::Backends::part>::type Yasp##dim##dLevelGridPartType; \ typedef typename Dune::XT::Grid::Layer<Dune::YaspGrid<dim, Dune::EquidistantOffsetCoordinates<double, dim>>, \ Dune::XT::Grid::Layers::leaf, \ Dune::XT::Grid::Backends::view>::type Yasp##dim##dLeafGridViewType; \ @@ -47,12 +41,6 @@ typedef Dune::ALUGridNoComm AluComm; #endif typedef Dune::ALUGrid<2, 2, Dune::simplex, Dune::conforming, AluComm> AluConform2dGridType; -typedef typename Dune::XT::Grid::Layer<AluConform2dGridType, - Dune::XT::Grid::Layers::leaf, - Dune::XT::Grid::Backends::part>::type AluConform2dLeafGridPartType; -typedef typename Dune::XT::Grid::Layer<AluConform2dGridType, - Dune::XT::Grid::Layers::level, - Dune::XT::Grid::Backends::part>::type AluConform2dLevelGridPartType; typedef typename Dune::XT::Grid::Layer<AluConform2dGridType, Dune::XT::Grid::Layers::leaf, Dune::XT::Grid::Backends::view>::type AluConform2dLeafGridViewType; @@ -62,12 +50,6 @@ typedef typename Dune::XT::Grid::Layer<AluConform2dGridType, // typedef Dune::ALUGrid<3, 3, Dune::simplex, Dune::conforming, AluComm> AluConform3dGridType; typedef Dune::YaspGrid<3, Dune::EquidistantOffsetCoordinates<double, 3>> AluConform3dGridType; -typedef typename Dune::XT::Grid::Layer<AluConform3dGridType, - Dune::XT::Grid::Layers::leaf, - Dune::XT::Grid::Backends::part>::type AluConform3dLeafGridPartType; -typedef typename Dune::XT::Grid::Layer<AluConform3dGridType, - Dune::XT::Grid::Layers::level, - Dune::XT::Grid::Backends::part>::type AluConform3dLevelGridPartType; typedef typename Dune::XT::Grid::Layer<AluConform3dGridType, Dune::XT::Grid::Layers::leaf, Dune::XT::Grid::Backends::view>::type AluConform3dLeafGridViewType; @@ -76,12 +58,6 @@ typedef typename Dune::XT::Grid::Layer<AluConform3dGridType, Dune::XT::Grid::Backends::view>::type AluConform3dLevelGridViewType; typedef Dune::ALUGrid<2, 2, Dune::simplex, Dune::nonconforming, AluComm> AluSimplex2dGridType; -typedef typename Dune::XT::Grid::Layer<AluSimplex2dGridType, - Dune::XT::Grid::Layers::leaf, - Dune::XT::Grid::Backends::part>::type AluSimplex2dLeafGridPartType; -typedef typename Dune::XT::Grid::Layer<AluSimplex2dGridType, - Dune::XT::Grid::Layers::level, - Dune::XT::Grid::Backends::part>::type AluSimplex2dLevelGridPartType; typedef typename Dune::XT::Grid::Layer<AluSimplex2dGridType, Dune::XT::Grid::Layers::leaf, Dune::XT::Grid::Backends::view>::type AluSimplex2dLeafGridViewType; @@ -90,12 +66,6 @@ typedef typename Dune::XT::Grid::Layer<AluSimplex2dGridType, Dune::XT::Grid::Backends::view>::type AluSimplex2dLevelGridViewType; typedef Dune::ALUGrid<3, 3, Dune::simplex, Dune::nonconforming, AluComm> AluSimplex3dGridType; -typedef typename Dune::XT::Grid::Layer<AluSimplex3dGridType, - Dune::XT::Grid::Layers::leaf, - Dune::XT::Grid::Backends::part>::type AluSimplex3dLeafGridPartType; -typedef typename Dune::XT::Grid::Layer<AluSimplex3dGridType, - Dune::XT::Grid::Layers::level, - Dune::XT::Grid::Backends::part>::type AluSimplex3dLevelGridPartType; typedef typename Dune::XT::Grid::Layer<AluSimplex3dGridType, Dune::XT::Grid::Layers::leaf, Dune::XT::Grid::Backends::view>::type AluSimplex3dLeafGridViewType; @@ -104,12 +74,6 @@ typedef typename Dune::XT::Grid::Layer<AluSimplex3dGridType, Dune::XT::Grid::Backends::view>::type AluSimplex3dLevelGridViewType; typedef Dune::ALUGrid<2, 2, Dune::cube, Dune::nonconforming, AluComm> AluCube2dGridType; -typedef typename Dune::XT::Grid::Layer<AluCube2dGridType, - Dune::XT::Grid::Layers::leaf, - Dune::XT::Grid::Backends::part>::type AluCube2dLeafGridPartType; -typedef typename Dune::XT::Grid::Layer<AluCube2dGridType, - Dune::XT::Grid::Layers::level, - Dune::XT::Grid::Backends::part>::type AluCube2dLevelGridPartType; typedef typename Dune::XT::Grid::Layer<AluCube2dGridType, Dune::XT::Grid::Layers::leaf, Dune::XT::Grid::Backends::view>::type AluCube2dLeafGridViewType; @@ -118,12 +82,6 @@ typedef typename Dune::XT::Grid::Layer<AluCube2dGridType, Dune::XT::Grid::Backends::view>::type AluCube2dLevelGridViewType; typedef Dune::ALUGrid<3, 3, Dune::cube, Dune::nonconforming, AluComm> AluCube3dGridType; -typedef typename Dune::XT::Grid::Layer<AluCube3dGridType, - Dune::XT::Grid::Layers::leaf, - Dune::XT::Grid::Backends::part>::type AluCube3dLeafGridPartType; -typedef typename Dune::XT::Grid::Layer<AluCube3dGridType, - Dune::XT::Grid::Layers::level, - Dune::XT::Grid::Backends::part>::type AluCube3dLevelGridPartType; typedef typename Dune::XT::Grid::Layer<AluCube3dGridType, Dune::XT::Grid::Layers::leaf, Dune::XT::Grid::Backends::view>::type AluCube3dLeafGridViewType; @@ -134,7 +92,7 @@ typedef typename Dune::XT::Grid::Layer<AluCube3dGridType, #endif // HAVE_DUNE_ALUGRID template <class T> -double pdelab_rt_tolerance() +double rt_tolerance() { using Grid = Dune::XT::Grid::extract_grid_t<typename T::GridLayerType>; constexpr auto dim = Grid::dimension; @@ -144,7 +102,7 @@ double pdelab_rt_tolerance() } template <class T> -double pdelab_cg_tolerance() +double cg_tolerance() { using Grid = Dune::XT::Grid::extract_grid_t<typename T::GridLayerType>; const auto dim = Grid::dimension; @@ -153,13 +111,4 @@ double pdelab_cg_tolerance() return tolerance; } -template <class T> -double fem_cg_tolerance() -{ - using Grid = Dune::XT::Grid::extract_grid_t<typename T::GridLayerType>; - const auto dim = Grid::dimension; - const auto tolerance = - Dune::XT::Grid::is_conforming_alugrid<Grid>::value ? (dim == 3 ? 1.1e-13 : 1e-15) : (dim == 3 ? 2.49e-14 : 1e-15); - return tolerance; -} #endif // DUNE_GDT_TEST_GRIDS_HH diff --git a/dune/gdt/test/grids.py b/dune/gdt/test/grids.py index 55c8cbfe482d23832b1f151ce6f44596ebf9e5f5..28c4a36580068a413d99f06493f0a95c39686958 100644 --- a/dune/gdt/test/grids.py +++ b/dune/gdt/test/grids.py @@ -47,4 +47,4 @@ class LevelGrids(Grids): yasp_view_fmt = 'Yasp{}dLevelGridViewType' def __init__(self, cache): - super(LevelGrids, self).__init__(cache) \ No newline at end of file + super(LevelGrids, self).__init__(cache) diff --git a/dune/gdt/test/linearelliptic/discretizers/block-ipdg.hh b/dune/gdt/test/linearelliptic/discretizers/block-ipdg.hh index d55a8a1150ab4624a562ef8a26bce91e76b94d61..e3d4d1933cc074bd773944780f702299a6e85f66 100644 --- a/dune/gdt/test/linearelliptic/discretizers/block-ipdg.hh +++ b/dune/gdt/test/linearelliptic/discretizers/block-ipdg.hh @@ -18,7 +18,7 @@ #include <dune/xt/grid/boundaryinfo.hh> #include <dune/xt/grid/layers.hh> #include <dune/xt/grid/gridprovider.hh> -#include <dune/xt/grid/view/subdomain/part.hh> +#include <dune/xt/grid/view/subdomain/view.hh> #include <dune/xt/la/container.hh> #include <dune/gdt/playground/spaces/block.hh> @@ -39,7 +39,7 @@ namespace LinearElliptic { * \todo add pattern() to StationaryContainerBasedDefaultDiscretization, avoid computation of local_pattern below */ template <class GridType, - Backends spacebackend = Backends::fem, // we only have local grid parts atm + Backends spacebackend = Backends::gdt, // we only have local grid parts atm XT::LA::Backends la = XT::LA::default_sparse_backend, int pol = 1, class RangeFieldType = double, diff --git a/dune/gdt/test/linearelliptic/estimators/swipdg-fluxreconstruction.hh b/dune/gdt/test/linearelliptic/estimators/swipdg-fluxreconstruction.hh index ec40317d72b78d2281256664eb789da61bb5e595..dd5b29e875fc75f2d3c36cc9022c2f23ec570e0d 100644 --- a/dune/gdt/test/linearelliptic/estimators/swipdg-fluxreconstruction.hh +++ b/dune/gdt/test/linearelliptic/estimators/swipdg-fluxreconstruction.hh @@ -26,8 +26,8 @@ #include <dune/gdt/projections.hh> #include <dune/gdt/local/integrands/ESV2007.hh> #include <dune/gdt/operators/fluxreconstruction.hh> -#include <dune/gdt/spaces/fv/default.hh> -#include <dune/gdt/spaces/rt/dune-pdelab-wrapper.hh> +#include <dune/gdt/spaces/fv.hh> +#include <dune/gdt/spaces/rt/default.hh> namespace Dune { namespace GDT { @@ -204,7 +204,7 @@ class LocalResidualESV2007 : public XT::Grid::Functor::Codim0Return<GridLayerTyp ThisType; typedef typename ForceType::RangeFieldType RangeFieldType; typedef ConstDiscreteFunction<SpaceType, VectorType> ConstDiscreteFunctionType; - typedef DunePdelabRtSpaceWrapper<GridLayerType, 0, RangeFieldType, SpaceType::dimDomain> RTN0SpaceType; + typedef RaviartThomasSpace<GridLayerType, 0, RangeFieldType> RTN0SpaceType; typedef DiscreteFunction<RTN0SpaceType, VectorType> DiffusiveFluxType; typedef XT::Functions::DivergenceFunction<DiffusiveFluxType> DivergenceType; typedef typename DivergenceType::DifferenceType DifferenceType; @@ -338,7 +338,7 @@ class LocalDiffusiveFluxESV2007 typedef XT::Grid::Functor::Codim0Return<GridLayerType, typename SpaceType::RangeFieldType> BaseType; typedef typename SpaceType::RangeFieldType RangeFieldType; typedef ConstDiscreteFunction<SpaceType, VectorType> ConstDiscreteFunctionType; - typedef DunePdelabRtSpaceWrapper<GridLayerType, 0, RangeFieldType, SpaceType::dimDomain> RTN0SpaceType; + typedef RaviartThomasSpace<GridLayerType, 0> RTN0SpaceType; typedef DiscreteFunction<RTN0SpaceType, VectorType> RTN0DiscreteFunctionType; public: diff --git a/dune/gdt/test/linearelliptic/linearelliptic__cg_discretization.py b/dune/gdt/test/linearelliptic/linearelliptic__cg_discretization.py index cc576ff7f9d27517286e39bfdd91ae19d62679b1..9cfb0f37482bf3446dd42cb2286f532a8a2d9d14 100644 --- a/dune/gdt/test/linearelliptic/linearelliptic__cg_discretization.py +++ b/dune/gdt/test/linearelliptic/linearelliptic__cg_discretization.py @@ -23,17 +23,5 @@ except KeyError: casenames = ['AO2013TestCase', 'ER2007TestCase', 'ESV2007TestCase', 'MixedBoundaryTestCase', 'Spe10Model1TestCase'] testcases = ['Dune::GDT::LinearElliptic::{}<{}>'.format(c, g) for c, g in itertools.product(casenames, grids)] -space_backends = [] -for s in ('fem', 'pdelab'): - try: - if cache['dune-{}'.format(s)]: - space_backends.extend([s]) - except KeyError: - pass - -if len(space_backends) == 0: - # prevent unusable iteration in template - permutations = [] -else: - permutations = itertools.product(testcases, space_backends, la_backends(cache)) - permutations = [(t,s,l, typeid_to_typedef_name('{}_{}_{}'.format(t, s, l))) for t, s, l in permutations] +permutations = itertools.product(testcases, ('gdt',), la_backends(cache)) +permutations = [(t,s,l, typeid_to_typedef_name('{}_{}_{}'.format(t, s, l))) for t, s, l in permutations] diff --git a/dune/gdt/test/linearelliptic/linearelliptic__swipdg_estimators.py b/dune/gdt/test/linearelliptic/linearelliptic__swipdg_estimators.py index 1b81b130dfde224c97f2d2f0548298b8028fc491..ae3cf9340304595a818b001055cba790776479ae 100644 --- a/dune/gdt/test/linearelliptic/linearelliptic__swipdg_estimators.py +++ b/dune/gdt/test/linearelliptic/linearelliptic__swipdg_estimators.py @@ -26,17 +26,5 @@ except KeyError: casenames.append('Spe10Model1TestCase') testcases = ['Dune::GDT::LinearElliptic::{}<{}>'.format(c, g) for c, g in itertools.product(casenames, grids)] -space_backends = [] -for s in ('fem',): - try: - if cache['dune-{}'.format(s)]: - space_backends.extend([s]) - except KeyError: - pass - -if len(grids) == 0 or len(space_backends) == 0: - # prevent unusable iteration in template - permutations = [] -else: - permutations = itertools.product(testcases, space_backends, la_backends(cache)) - permutations = [(t, s, l, typeid_to_typedef_name('{}_{}_{}'.format(t, s, l))) for t, s, l in permutations] +permutations = itertools.product(testcases, ('gdt',), la_backends(cache)) +permutations = [(t, s, l, typeid_to_typedef_name('{}_{}_{}'.format(t, s, l))) for t, s, l in permutations] diff --git a/dune/gdt/test/linearelliptic/mpi_linearelliptic__block_swipdg_discretization.py b/dune/gdt/test/linearelliptic/mpi_linearelliptic__block_swipdg_discretization.py index 79760b5cf72ac1e2aaf3129a14a7f2ae07f9892f..c76c2c234c82777ea562635ec0ef0e8938bfbe18 100644 --- a/dune/gdt/test/linearelliptic/mpi_linearelliptic__block_swipdg_discretization.py +++ b/dune/gdt/test/linearelliptic/mpi_linearelliptic__block_swipdg_discretization.py @@ -16,17 +16,5 @@ grids = ['Yasp2Grid'] casenames = ['ESV2007DdSubdomainsTestCase',] testcases = ['Dune::GDT::LinearElliptic::{}<{}>'.format(c, g) for c, g in itertools.product(casenames, grids)] -space_backends = [] -for s in ('pdelab',): - try: - if cache['dune-{}'.format(s)]: - space_backends.extend([s]) - except KeyError: - pass - -if len(space_backends) == 0 or len(la_backends(cache)) == 0: - # prevent unusable iteration in template - permutations = [] -else: - permutations = itertools.product(testcases, space_backends, ('istl_sparse', )) - permutations = [(t, s, l, typeid_to_typedef_name('{}_{}_{}'.format(t, s, l))) for t, s, l in permutations] +permutations = itertools.product(testcases, ('gdt',), ('istl_sparse', )) +permutations = [(t, s, l, typeid_to_typedef_name('{}_{}_{}'.format(t, s, l))) for t, s, l in permutations] diff --git a/dune/gdt/test/linearelliptic/mpi_linearelliptic__swipdg_discretization.py b/dune/gdt/test/linearelliptic/mpi_linearelliptic__swipdg_discretization.py index b9b8c753f024139962f26346b23cc49139044c18..50f21d95e8898720d05213be5cf03cd630189572 100644 --- a/dune/gdt/test/linearelliptic/mpi_linearelliptic__swipdg_discretization.py +++ b/dune/gdt/test/linearelliptic/mpi_linearelliptic__swipdg_discretization.py @@ -32,31 +32,9 @@ except KeyError: testcases = ['Dune::GDT::LinearElliptic::{}<{}>'.format(c, g) for c, g in itertools.product(casenames, grids)] if 'mpi' in __file__: - possible_spc_backends = ('pdelab',) + la = ('istl_sparse',) else: - possible_spc_backends = ('fem',) -space_backends = [] -for s in possible_spc_backends: - try: - if cache['dune-{}'.format(s)]: - space_backends.append(s) - except KeyError: - pass - -if len(space_backends) == 0: - # prevent unusable iteration in template - permutations = [] -else: - if 'mpi' in __file__: - la = ('istl_sparse',) - else: - la = la_backends(cache) - permutations = itertools.product(testcases, space_backends, la) - -def filter(t, s): - # pdelab has no DG impl for simplicial grids - if s == 'pdelab': - return 'AluSimplex' not in t - return True + la = la_backends(cache) +permutations = itertools.product(testcases, ('gdt',), la) -permutations = [(t, s, l, typeid_to_typedef_name('{}_{}_{}'.format(t, s, l))) for t, s, l in permutations if filter(t, s)] +permutations = [(t, s, l, typeid_to_typedef_name('{}_{}_{}'.format(t, s, l))) for t, s, l in permutations] diff --git a/dune/gdt/test/linearelliptic/swipdg-estimator-expectations/CMakeLists.txt b/dune/gdt/test/linearelliptic/swipdg-estimator-expectations/CMakeLists.txt index 8bb1e8dc025126ac99aee65cb2954b00cdc6dd9a..3647153e46db72583e9f3e3c108f386530165f07 100644 --- a/dune/gdt/test/linearelliptic/swipdg-estimator-expectations/CMakeLists.txt +++ b/dune/gdt/test/linearelliptic/swipdg-estimator-expectations/CMakeLists.txt @@ -14,5 +14,6 @@ dune_add_library(swipdg_estimator_expectations SOURCES ao2013-2dalugrid.cxx esv2007-2dalugrid.cxx + esv2007-2dyaspgrid.cxx spe10-2dalugrid.cxx) diff --git a/dune/gdt/test/linearelliptic/swipdg-estimator-expectations/esv2007-2dyaspgrid.cxx b/dune/gdt/test/linearelliptic/swipdg-estimator-expectations/esv2007-2dyaspgrid.cxx new file mode 100644 index 0000000000000000000000000000000000000000..3279ade598b567fa844d2f91aea5707196575220 --- /dev/null +++ b/dune/gdt/test/linearelliptic/swipdg-estimator-expectations/esv2007-2dyaspgrid.cxx @@ -0,0 +1,111 @@ +// This file is part of the dune-gdt project: +// https://github.com/dune-community/dune-gdt +// Copyright 2010-2018 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 (2016 - 2017) +// Rene Milk (2016 - 2018) +// Tobias Leibner (2016) + +#include "config.h" + +#include <dune/grid/yaspgrid.hh> + +#include "../problems/ESV2007.hh" +#include "../swipdg-estimator-expectations.hh" + + +namespace Dune { +namespace GDT { +namespace Test { + + +// polorder 1 + +template <bool anything> +class LinearEllipticSwipdgEstimatorExpectations<LinearElliptic:: + ESV2007TestCase<YaspGrid<2, + EquidistantOffsetCoordinates<double, 2>>, + double, + 1>, + LinearElliptic::ChooseDiscretizer::swipdg, + 1, + anything> + : public internal::LinearEllipticSwipdgEstimatorExpectationsBase<1> +{ + typedef LinearElliptic::ESV2007TestCase<YaspGrid<2, EquidistantOffsetCoordinates<double, 2>>, double, 1> TestCaseType; + +public: + static std::vector<double> results(const TestCaseType& /*test_case*/, const std::string type) + { + if (type == "energy") { +#if DXT_DISABLE_LARGE_TESTS + return {}; +#else + return {2.77e-01, 1.39e-01, 6.98e-02, 3.50e-02}; +#endif + } else if (type == LinearElliptic::SwipdgFluxreconstrutionEstimators::local_nonconformity_ESV2007_id()) { +#if DXT_DISABLE_LARGE_TESTS + return {}; +#else + return {1.03e-01, 5.69e-02, 2.99e-02, 1.53e-02}; +#endif + } else if (type == LinearElliptic::SwipdgFluxreconstrutionEstimators::local_residual_ESV2007_id()) { +#if DXT_DISABLE_LARGE_TESTS + return {}; +#else + return {8.85e-02, 2.22e-02, 5.56e-03, 1.39e-03}; +#endif + } else if (type == LinearElliptic::SwipdgFluxreconstrutionEstimators::local_diffusive_flux_ESV2007_id()) { +#if DXT_DISABLE_LARGE_TESTS + return {}; +#else + return {4.42e-01, 2.23e-01, 1.12e-01, 5.64e-02}; +#endif + } else if (type == LinearElliptic::SwipdgFluxreconstrutionEstimators::ESV2007_id()) { +#if DXT_DISABLE_LARGE_TESTS + return {}; +#else + return {}; +#endif + } else if (type == "efficiency_" + LinearElliptic::SwipdgFluxreconstrutionEstimators::ESV2007_id()) { +#if DXT_DISABLE_LARGE_TESTS + return {}; +#else + return {1.91e+00, 1.79e+00, 1.73e+00, 1.70e+00}; +#endif + } else if (type == LinearElliptic::SwipdgFluxreconstrutionEstimators::ESV2007_alternative_summation_id()) { +#if DXT_DISABLE_LARGE_TESTS + return {}; +#else + return {}; +#endif + } else if (type + == "efficiency_" + + LinearElliptic::SwipdgFluxreconstrutionEstimators::ESV2007_alternative_summation_id()) { +#if DXT_DISABLE_LARGE_TESTS + return {}; +#else + return {2.87e+00, 3.96e+00, 5.51e+00, 7.72e+00}; +#endif + } else + EXPECT_TRUE(false) << "test results missing for type: " << type; + return {}; + } // ... results(...) +}; // LinearEllipticSwipdgEstimatorExpectations + + +template class + LinearEllipticSwipdgEstimatorExpectations<LinearElliptic:: + ESV2007TestCase<YaspGrid<2, EquidistantOffsetCoordinates<double, 2>>, + double, + 1>, + LinearElliptic::ChooseDiscretizer::swipdg, + 1>; + + +} // namespace Test +} // namespace GDT +} // namespace Dune diff --git a/dune/gdt/test/linearelliptic/swipdg-estimator-testcases.hh b/dune/gdt/test/linearelliptic/swipdg-estimator-testcases.hh index 0f40974e5505caa206117316cb895de678046f77..9c083efd8804e615fe01548e2439f5b8cc105480 100644 --- a/dune/gdt/test/linearelliptic/swipdg-estimator-testcases.hh +++ b/dune/gdt/test/linearelliptic/swipdg-estimator-testcases.hh @@ -78,6 +78,16 @@ extern template class LinearEllipticSwipdgEstimatorExpectations<LinearElliptic:: #endif // HAVE_DUNE_ALUGRID + +extern template class + LinearEllipticSwipdgEstimatorExpectations<LinearElliptic:: + ESV2007TestCase<YaspGrid<2, EquidistantOffsetCoordinates<double, 2>>, + double, + 1>, + LinearElliptic::ChooseDiscretizer::swipdg, + 1>; + + } // namespace Test } // namespace GDT } // namespace Dune diff --git a/dune/gdt/test/operators/darcy.hh b/dune/gdt/test/operators/darcy.hh index 6520eb4c6d98f63f6d889f47541a1d34a1f31d36..1602b867d338bbfee0b6f0cfb7d90620bc877ccf 100644 --- a/dune/gdt/test/operators/darcy.hh +++ b/dune/gdt/test/operators/darcy.hh @@ -22,9 +22,9 @@ #include <dune/gdt/projections.hh> #include <dune/gdt/operators/laplace.hh> #include <dune/gdt/operators/l2.hh> -#include <dune/gdt/spaces/cg/dune-fem-wrapper.hh> -#include <dune/gdt/spaces/fv/default.hh> -#include <dune/gdt/spaces/rt/dune-pdelab-wrapper.hh> +#include <dune/gdt/spaces/cg.hh> +#include <dune/gdt/spaces/fv.hh> +#include <dune/gdt/spaces/rt/default.hh> namespace Dune { namespace GDT { @@ -33,7 +33,7 @@ namespace Test { /** * \note This test assumes that DiscreteFunction, Operators::L2Projection, Products::L2, Products::H1Semi, - * DuneFemCgSpaceWrapper, DunePdelabRtSpaceWrapper and FvSpace work correctly. + * ContinuousLagrangeSpace, RaviartThomasSpace and FvSpace work correctly. * \todo This test is rather old and could be refactored in terms of the other operator tests. * \todo Missing ctor and make_darcy_operator tests. */ @@ -88,14 +88,14 @@ struct DarcyOperatorTest : public ::testing::Test RangeFieldType expected_result_(const std::string type, const FunctionType& desired_output, const GL& grid_layer) const { - if (std::is_base_of<DuneFemCgSpaceWrapper<GL, 1, RangeFieldType, dimDomain>, RangeSpaceType>::value) { + if (std::is_base_of<Dune::GDT::ContinuousLagrangeSpace<GL, 1, double>, RangeSpaceType>::value) { if (type == "l2") return 2.18e-16; else if (type == "h1") return 3.12e-15; else DUNE_THROW(Dune::XT::Common::Exceptions::internal_error, type); - } else if (std::is_base_of<DunePdelabRtSpaceWrapper<GL, 0, RangeFieldType, dimDomain>, RangeSpaceType>::value) { + } else if (std::is_base_of<RaviartThomasSpace<GL, 0, RangeFieldType>, RangeSpaceType>::value) { typedef FvSpace<GL, RangeFieldType, dimDomain> FvSpaceType; const FvSpaceType fv_space(grid_layer); VectorType fv_desired_output_vector(fv_space.mapper().size()); diff --git a/dune/gdt/test/operators/mpi_operators__elliptic__localizable_product.cc b/dune/gdt/test/operators/mpi_operators__elliptic__localizable_product.cc index 418a74974e37b4089e1ef24cbd07f3d828324708..d22e8e588f569435d5a52bbc01559654c91b590f 100644 --- a/dune/gdt/test/operators/mpi_operators__elliptic__localizable_product.cc +++ b/dune/gdt/test/operators/mpi_operators__elliptic__localizable_product.cc @@ -11,7 +11,7 @@ #include <dune/xt/common/test/main.hxx> // <- this one has to come first #include "elliptic.hh" -#include <dune/gdt/test/spaces/fv/default.hh> +#include <dune/gdt/test/spaces/fv.hh> using namespace Dune::GDT::Test; diff --git a/dune/gdt/test/operators/mpi_operators__elliptic__matrix_operator.cc b/dune/gdt/test/operators/mpi_operators__elliptic__matrix_operator.cc index 3f9481f4414c10184b21d099454acda7a6edf6cf..634be33adcf98d1978912244313c6a4ef8e7defb 100644 --- a/dune/gdt/test/operators/mpi_operators__elliptic__matrix_operator.cc +++ b/dune/gdt/test/operators/mpi_operators__elliptic__matrix_operator.cc @@ -11,34 +11,16 @@ #include <dune/xt/common/test/main.hxx> // <- this one has to come first +#include <dune/gdt/test/spaces/dg.hh> + #include "elliptic.hh" -#include <dune/gdt/test/spaces/fv/default.hh> -#include <dune/gdt/test/spaces/dg/fem.hh> -#include <dune/gdt/test/spaces/cg/pdelab.hh> using namespace Dune::GDT::Test; -#if HAVE_DUNE_FEM - -typedef testing::Types<SPACE_DG_FEM_YASPGRID(1, 1, 3), SPACE_DG_FEM_YASPGRID(2, 1, 3), SPACE_DG_FEM_YASPGRID(3, 1, 3)> - CubicSpaces; +typedef testing::Types<SPACE_DG_YASPGRID(1, 1, 3), SPACE_DG_YASPGRID(2, 1, 3), SPACE_DG_YASPGRID(3, 1, 3)> CubicSpaces; TYPED_TEST_CASE(EllipticMatrixOperatorTest, CubicSpaces); -#elif HAVE_DUNE_PDELAB // HAVE_DUNE_FEM - -typedef testing:: - Types<SPACE_CG_PDELAB_YASPGRID(1, 1, 1), SPACE_CG_PDELAB_YASPGRID(2, 1, 1), SPACE_CG_PDELAB_YASPGRID(3, 1, 1)> - LinearSpaces; -TYPED_TEST_CASE(EllipticMatrixOperatorTest, LinearSpaces); - -#else // HAVE_DUNE_FEM || HAVE_DUNE_PDELAB - -typedef testing::Types<SPACE_FV_YASPGRID(1, 1), SPACE_FV_YASPGRID(2, 1), SPACE_FV_YASPGRID(3, 1)> ConstantSpaces; -TYPED_TEST_CASE(EllipticMatrixOperatorTest, ConstantSpaces); - -#endif // HAVE_DUNE_FEM || HAVE_DUNE_PDELAB - TYPED_TEST(EllipticMatrixOperatorTest, constructible_by_ctor) { @@ -53,19 +35,10 @@ TYPED_TEST(EllipticMatrixOperatorTest, is_matrix_operator) this->is_matrix_operator(); } -#if HAVE_DUNE_FEM || HAVE_DUNE_PDELAB TYPED_TEST(EllipticMatrixOperatorTest, correct_for_constant_arguments) { this->correct_for_constant_arguments(6.90e-13); } -#else -TEST(DISABLED_EllipticMatrixOperatorTest, correct_for_constant_arguments) -{ - std::cerr << Dune::XT::Common::colorStringRed("Missing dependencies!") << std::endl; -} -#endif - -#if HAVE_DUNE_FEM TYPED_TEST(EllipticMatrixOperatorTest, correct_for_linear_arguments) { this->correct_for_linear_arguments(); @@ -74,13 +47,3 @@ TYPED_TEST(EllipticMatrixOperatorTest, correct_for_quadratic_arguments) { this->correct_for_quadratic_arguments(); } -#else // HAVE_DUNE_FEM -TEST(DISABLED_EllipticMatrixOperatorTest, correct_for_linear_arguments) -{ - std::cerr << Dune::XT::Common::colorStringRed("Missing dependencies!") << std::endl; -} -TEST(DISABLED_EllipticMatrixOperatorTest, correct_for_quadratic_arguments) -{ - std::cerr << Dune::XT::Common::colorStringRed("Missing dependencies!") << std::endl; -} -#endif // HAVE_DUNE_FEM diff --git a/dune/gdt/test/operators/mpi_operators__elliptic__operator.cc b/dune/gdt/test/operators/mpi_operators__elliptic__operator.cc index 6cc32feb29cfb332f598ad882665ef4c9da11d22..23d27159cb29da519bf083011bdc65d4a43a0872 100644 --- a/dune/gdt/test/operators/mpi_operators__elliptic__operator.cc +++ b/dune/gdt/test/operators/mpi_operators__elliptic__operator.cc @@ -11,7 +11,7 @@ #include <dune/xt/common/test/main.hxx> // <- this one has to come first #include "elliptic.hh" -#include <dune/gdt/test/spaces/fv/default.hh> +#include <dune/gdt/test/spaces/fv.hh> using namespace Dune::GDT::Test; diff --git a/dune/gdt/test/operators/mpi_operators__l2__localizable_product.cc b/dune/gdt/test/operators/mpi_operators__l2__localizable_product.cc index 125b3b4cd260291dc2089361a669f2eafd0249dc..0c1b9f43de16b148f294b4b316c11642d86589fe 100644 --- a/dune/gdt/test/operators/mpi_operators__l2__localizable_product.cc +++ b/dune/gdt/test/operators/mpi_operators__l2__localizable_product.cc @@ -11,7 +11,7 @@ #include <dune/xt/common/test/main.hxx> // <- this one has to come first #include "l2.hh" -#include <dune/gdt/test/spaces/fv/default.hh> +#include <dune/gdt/test/spaces/fv.hh> using namespace Dune::GDT::Test; diff --git a/dune/gdt/test/operators/mpi_operators__l2__matrix_operator.cc b/dune/gdt/test/operators/mpi_operators__l2__matrix_operator.cc index ec9dbd7d6541d8d087a7759d78aa53d7020fc977..b3ba5389f80d034e05a661ff86b4527dfbf4ea3b 100644 --- a/dune/gdt/test/operators/mpi_operators__l2__matrix_operator.cc +++ b/dune/gdt/test/operators/mpi_operators__l2__matrix_operator.cc @@ -11,34 +11,17 @@ #include <dune/xt/common/test/main.hxx> // <- this one has to come first +#include <dune/gdt/test/spaces/dg.hh> + #include "l2.hh" -#include <dune/gdt/test/spaces/cg/pdelab.hh> -#include <dune/gdt/test/spaces/dg/fem.hh> -#include <dune/gdt/test/spaces/fv/default.hh> using namespace Dune::GDT::Test; -#if HAVE_DUNE_FEM - -typedef testing::Types<SPACE_DG_FEM_YASPGRID(1, 1, 2), SPACE_DG_FEM_YASPGRID(2, 1, 2), SPACE_DG_FEM_YASPGRID(3, 1, 2)> +typedef testing::Types<SPACE_DG_YASPGRID(1, 1, 2), SPACE_DG_YASPGRID(2, 1, 2), SPACE_DG_YASPGRID(3, 1, 2)> QuadraticSpaces; TYPED_TEST_CASE(L2MatrixOperatorTest, QuadraticSpaces); -#elif HAVE_DUNE_PDELAB // HAVE_DUNE_FEM - -typedef testing:: - Types<SPACE_CG_PDELAB_YASPGRID(1, 1, 1), SPACE_CG_PDELAB_YASPGRID(2, 1, 1), SPACE_CG_PDELAB_YASPGRID(3, 1, 1)> - LinearSpaces; -TYPED_TEST_CASE(L2MatrixOperatorTest, LinearSpaces); - -#else // HAVE_DUNE_FEM || HAVE_DUNE_PDELAB - -typedef testing::Types<SPACE_FV_YASPGRID(1, 1), SPACE_FV_YASPGRID(2, 1), SPACE_FV_YASPGRID(3, 1)> ConstantSpaces; -TYPED_TEST_CASE(L2MatrixOperatorTest, ConstantSpaces); - -#endif // HAVE_DUNE_FEM || HAVE_DUNE_PDELAB - TYPED_TEST(L2MatrixOperatorTest, constructible_by_ctor) { @@ -57,27 +40,11 @@ TYPED_TEST(L2MatrixOperatorTest, correct_for_constant_arguments) const double rel_tol = this->space_.grid_layer().grid().comm().size() > 1 ? 1.5e-14 : 1.5e-13; this->correct_for_constant_arguments(rel_tol); } - -#if HAVE_DUNE_FEM || HAVE_DUNE_PDELAB TYPED_TEST(L2MatrixOperatorTest, correct_for_linear_arguments) { this->correct_for_linear_arguments(); } -#else -TEST(DISABLED_L2MatrixOperatorTest, correct_for_linear_arguments) -{ - std::cerr << Dune::XT::Common::colorStringRed("Missing dependencies!") << std::endl; -} -#endif - -#if HAVE_DUNE_FEM TYPED_TEST(L2MatrixOperatorTest, correct_for_quadratic_arguments) { this->correct_for_quadratic_arguments(); } -#else -TEST(DISABLED_L2MatrixOperatorTest, correct_for_quadratic_arguments) -{ - std::cerr << Dune::XT::Common::colorStringRed("Missing dependencies!") << std::endl; -} -#endif diff --git a/dune/gdt/test/operators/mpi_operators__l2__operator.cc b/dune/gdt/test/operators/mpi_operators__l2__operator.cc index 25009ec30cdf2e0c4729fcc6410132c2b8f23a45..11df7b10eabe7070097cecead62f393983ffabf1 100644 --- a/dune/gdt/test/operators/mpi_operators__l2__operator.cc +++ b/dune/gdt/test/operators/mpi_operators__l2__operator.cc @@ -11,7 +11,7 @@ #include <dune/xt/common/test/main.hxx> // <- this one has to come first #include "l2.hh" -#include <dune/gdt/test/spaces/fv/default.hh> +#include <dune/gdt/test/spaces/fv.hh> using namespace Dune::GDT::Test; diff --git a/dune/gdt/test/operators/mpi_operators__laplace__localizable_product.cc b/dune/gdt/test/operators/mpi_operators__laplace__localizable_product.cc index bc04922b160f5563e8e6944167a6ca0b8553dccf..9838f1c8d991acea1cf588d01863c813da80a6fa 100644 --- a/dune/gdt/test/operators/mpi_operators__laplace__localizable_product.cc +++ b/dune/gdt/test/operators/mpi_operators__laplace__localizable_product.cc @@ -11,7 +11,7 @@ #include <dune/xt/common/test/main.hxx> // <- this one has to come first #include "laplace.hh" -#include <dune/gdt/test/spaces/fv/default.hh> +#include <dune/gdt/test/spaces/fv.hh> using namespace Dune::GDT::Test; diff --git a/dune/gdt/test/operators/mpi_operators__laplace__matrix_operator.cc b/dune/gdt/test/operators/mpi_operators__laplace__matrix_operator.cc index 3c28168066fbe9cbef8a79b741f36098b483e43f..2e6a840741b5425c164635b260e49dc2239478f3 100644 --- a/dune/gdt/test/operators/mpi_operators__laplace__matrix_operator.cc +++ b/dune/gdt/test/operators/mpi_operators__laplace__matrix_operator.cc @@ -11,34 +11,16 @@ #include <dune/xt/common/test/main.hxx> // <- this one has to come first +#include <dune/gdt/test/spaces/dg.hh> + #include "laplace.hh" -#include <dune/gdt/test/spaces/fv/default.hh> -#include <dune/gdt/test/spaces/dg/fem.hh> -#include <dune/gdt/test/spaces/cg/pdelab.hh> using namespace Dune::GDT::Test; -#if HAVE_DUNE_FEM - -typedef testing::Types<SPACE_DG_FEM_YASPGRID(1, 1, 3), SPACE_DG_FEM_YASPGRID(2, 1, 3), SPACE_DG_FEM_YASPGRID(3, 1, 3)> - CubicSpaces; +typedef testing::Types<SPACE_DG_YASPGRID(1, 1, 3), SPACE_DG_YASPGRID(2, 1, 3), SPACE_DG_YASPGRID(3, 1, 3)> CubicSpaces; TYPED_TEST_CASE(LaplaceMatrixOperatorTest, CubicSpaces); -#elif HAVE_DUNE_PDELAB // HAVE_DUNE_FEM - -typedef testing:: - Types<SPACE_CG_PDELAB_YASPGRID(1, 1, 1), SPACE_CG_PDELAB_YASPGRID(2, 1, 1), SPACE_CG_PDELAB_YASPGRID(3, 1, 1)> - LinearSpaces; -TYPED_TEST_CASE(LaplaceMatrixOperatorTest, LinearSpaces); - -#else // HAVE_DUNE_FEM || HAVE_DUNE_PDELAB - -typedef testing::Types<SPACE_FV_YASPGRID(1, 1), SPACE_FV_YASPGRID(2, 1), SPACE_FV_YASPGRID(3, 1)> ConstantSpaces; -TYPED_TEST_CASE(LaplaceMatrixOperatorTest, ConstantSpaces); - -#endif // HAVE_DUNE_FEM || HAVE_DUNE_PDELAB - TYPED_TEST(LaplaceMatrixOperatorTest, constructible_by_ctor) { @@ -52,20 +34,10 @@ TYPED_TEST(LaplaceMatrixOperatorTest, is_matrix_operator) { this->is_matrix_operator(); } - -#if HAVE_DUNE_FEM || HAVE_DUNE_PDELAB TYPED_TEST(LaplaceMatrixOperatorTest, correct_for_constant_arguments) { this->correct_for_constant_arguments(); } -#else -TEST(DISABLED_LaplaceMatrixOperatorTest, correct_for_constant_arguments) -{ - std::cerr << Dune::XT::Common::colorStringRed("Missing dependencies!") << std::endl; -} -#endif - -#if HAVE_DUNE_FEM TYPED_TEST(LaplaceMatrixOperatorTest, correct_for_linear_arguments) { this->correct_for_linear_arguments(); @@ -74,13 +46,3 @@ TYPED_TEST(LaplaceMatrixOperatorTest, correct_for_quadratic_arguments) { this->correct_for_quadratic_arguments(); } -#else // HAVE_DUNE_FEM -TEST(DISABLED_LaplaceMatrixOperatorTest, correct_for_linear_arguments) -{ - std::cerr << Dune::XT::Common::colorStringRed("Missing dependencies!") << std::endl; -} -TEST(DISABLED_LaplaceMatrixOperatorTest, correct_for_quadratic_arguments) -{ - std::cerr << Dune::XT::Common::colorStringRed("Missing dependencies!") << std::endl; -} -#endif // HAVE_DUNE_FEM diff --git a/dune/gdt/test/operators/mpi_operators__laplace__operator.cc b/dune/gdt/test/operators/mpi_operators__laplace__operator.cc index 79366069dd8f0cd0aa99ba4e304a8adbf36f09e3..3200f18e586c7cd5d279f7bd5b96cd1f0ed2a3ed 100644 --- a/dune/gdt/test/operators/mpi_operators__laplace__operator.cc +++ b/dune/gdt/test/operators/mpi_operators__laplace__operator.cc @@ -11,7 +11,7 @@ #include <dune/xt/common/test/main.hxx> // <- this one has to come first #include "laplace.hh" -#include <dune/gdt/test/spaces/fv/default.hh> +#include <dune/gdt/test/spaces/fv.hh> using namespace Dune::GDT::Test; diff --git a/dune/gdt/test/operators/mpi_operators__weighted_l2__localizable_product.cc b/dune/gdt/test/operators/mpi_operators__weighted_l2__localizable_product.cc index 0da44709e874b2f23e62f0a50980a6a0d255de0e..0c4d26bb99968f7ba35ca1958462e72cb98dee6b 100644 --- a/dune/gdt/test/operators/mpi_operators__weighted_l2__localizable_product.cc +++ b/dune/gdt/test/operators/mpi_operators__weighted_l2__localizable_product.cc @@ -11,7 +11,7 @@ #include <dune/xt/common/test/main.hxx> // <- this one has to come first #include "weighted-l2.hh" -#include <dune/gdt/test/spaces/fv/default.hh> +#include <dune/gdt/test/spaces/fv.hh> using namespace Dune::GDT::Test; diff --git a/dune/gdt/test/operators/mpi_operators__weighted_l2__matrix_operator.cc b/dune/gdt/test/operators/mpi_operators__weighted_l2__matrix_operator.cc index 77ff93570dc619b38e965ce04cdc1b98dfc5547d..b0fbf4ede720092c4bf96c061acb94da0815867b 100644 --- a/dune/gdt/test/operators/mpi_operators__weighted_l2__matrix_operator.cc +++ b/dune/gdt/test/operators/mpi_operators__weighted_l2__matrix_operator.cc @@ -11,34 +11,17 @@ #include <dune/xt/common/test/main.hxx> // <- this one has to come first +#include <dune/gdt/test/spaces/dg.hh> + #include "weighted-l2.hh" -#include <dune/gdt/test/spaces/fv/default.hh> -#include <dune/gdt/test/spaces/dg/fem.hh> -#include <dune/gdt/test/spaces/cg/pdelab.hh> using namespace Dune::GDT::Test; -#if HAVE_DUNE_FEM - -typedef testing::Types<SPACE_DG_FEM_YASPGRID(1, 1, 2), SPACE_DG_FEM_YASPGRID(2, 1, 2), SPACE_DG_FEM_YASPGRID(3, 1, 2)> +typedef testing::Types<SPACE_DG_YASPGRID(1, 1, 2), SPACE_DG_YASPGRID(2, 1, 2), SPACE_DG_YASPGRID(3, 1, 2)> QuadraticSpaces; TYPED_TEST_CASE(WeightedL2MatrixOperatorTest, QuadraticSpaces); -#elif HAVE_DUNE_PDELAB // HAVE_DUNE_FEM - -typedef testing:: - Types<SPACE_CG_PDELAB_YASPGRID(1, 1, 1), SPACE_CG_PDELAB_YASPGRID(2, 1, 1), SPACE_CG_PDELAB_YASPGRID(3, 1, 1)> - LinearSpaces; -TYPED_TEST_CASE(WeightedL2MatrixOperatorTest, LinearSpaces); - -#else // HAVE_DUNE_FEM || HAVE_DUNE_PDELAB - -typedef testing::Types<SPACE_FV_YASPGRID(1, 1), SPACE_FV_YASPGRID(2, 1), SPACE_FV_YASPGRID(3, 1)> ConstantSpaces; -TYPED_TEST_CASE(WeightedL2MatrixOperatorTest, ConstantSpaces); - -#endif // HAVE_DUNE_FEM || HAVE_DUNE_PDELAB - TYPED_TEST(WeightedL2MatrixOperatorTest, constructible_by_ctor) { @@ -61,8 +44,6 @@ TYPED_TEST(WeightedL2MatrixOperatorTest, correct_for_constant_arguments) #endif this->correct_for_constant_arguments(this->dimDomain == 1 ? 2.2e-14 : (this->dimDomain == 2 ? 2.85e-14 : tolerance)); } - -#if HAVE_DUNE_FEM || HAVE_DUNE_PDELAB TYPED_TEST(WeightedL2MatrixOperatorTest, correct_for_linear_arguments) { #ifndef NDEBUG @@ -72,14 +53,6 @@ TYPED_TEST(WeightedL2MatrixOperatorTest, correct_for_linear_arguments) #endif this->correct_for_linear_arguments(this->dimDomain == 3 ? 2.67e-14 : tolerance); } -#else -TEST(DISABLED_WeightedL2MatrixOperatorTest, correct_for_linear_arguments) -{ - std::cerr << Dune::XT::Common::colorStringRed("Missing dependencies!") << std::endl; -} -#endif - -#if HAVE_DUNE_FEM TYPED_TEST(WeightedL2MatrixOperatorTest, correct_for_quadratic_arguments) { #ifndef NDEBUG @@ -89,9 +62,3 @@ TYPED_TEST(WeightedL2MatrixOperatorTest, correct_for_quadratic_arguments) #endif this->correct_for_quadratic_arguments(this->dimDomain == 3 ? 1.43e-14 : tolerance); } -#else -TEST(DISABLED_WeightedL2MatrixOperatorTest, correct_for_quadratic_arguments) -{ - std::cerr << Dune::XT::Common::colorStringRed("Missing dependencies!") << std::endl; -} -#endif diff --git a/dune/gdt/test/operators/mpi_operators__weighted_l2__operator.cc b/dune/gdt/test/operators/mpi_operators__weighted_l2__operator.cc index 95cb983cee0fa835c1e30a61aa9b44abcf927e5e..cecc40a21f476da4187e3799b88fef54bac161a3 100644 --- a/dune/gdt/test/operators/mpi_operators__weighted_l2__operator.cc +++ b/dune/gdt/test/operators/mpi_operators__weighted_l2__operator.cc @@ -11,7 +11,7 @@ #include <dune/xt/common/test/main.hxx> // <- this one has to come first #include "weighted-l2.hh" -#include <dune/gdt/test/spaces/fv/default.hh> +#include <dune/gdt/test/spaces/fv.hh> using namespace Dune::GDT::Test; diff --git a/dune/gdt/test/operators/operators__darcy.cc b/dune/gdt/test/operators/operators__darcy.cc index c7cc751480f79ad19be9adf6d23be3afcb38696e..ba2de05d1b13af121e399172ea9100f1e33bf882 100644 --- a/dune/gdt/test/operators/operators__darcy.cc +++ b/dune/gdt/test/operators/operators__darcy.cc @@ -11,18 +11,18 @@ #include <dune/xt/common/test/main.hxx> // <- This one has to come first (includes the config.h)! -#include <dune/gdt/test/spaces/cg/fem.hh> -#include <dune/gdt/test/spaces/rt/pdelab.hh> +#include <dune/gdt/test/spaces/cg.hh> +#include <dune/gdt/test/spaces/rt.hh> #include "darcy.hh" using namespace Dune::GDT::Test; -#if HAVE_DUNE_FEM && HAVE_DUNE_PDELAB && HAVE_DUNE_ALUGRID +#if HAVE_DUNE_ALUGRID typedef testing::Types< - /*std::pair< SPACE_CG_FEM_ALUCONFORMGRID(2, 1, 1), SPACE_CG_FEM_ALUCONFORMGRID(2, 2, 1) > // <- TODO: enable once #40 is resolved - ,*/ std::pair<SPACE_CG_FEM_ALUCONFORMGRID(2, 1, 1), SPACE_RT_PDELAB_ALUCONFORMGRID(2)>> + /*std::pair< SPACE_CG_ALUCONFORMGRID(2, 1, 1), SPACE_CG_ALUCONFORMGRID(2, 2, 1) > // <- TODO: enable once #40 is resolved + ,*/ std::pair<SPACE_CG_ALUCONFORMGRID(2, 1, 1), SPACE_RT_ALUCONFORMGRID(2)>> SpaceTypes; // this test cannot run in parallel ATM because the RT space does not have a parallel dof_comm setup @@ -33,7 +33,7 @@ TYPED_TEST(DarcyOperatorTest, produces_correct_results) } -#else // HAVE_DUNE_FEM && HAVE_DUNE_PDELAB && HAVE_DUNE_ALUGRID +#else // HAVE_DUNE_ALUGRID TEST(DISABLED_DarcyOperatorTest, produces_correct_results) @@ -41,4 +41,4 @@ TEST(DISABLED_DarcyOperatorTest, produces_correct_results) } -#endif // HAVE_DUNE_FEM && HAVE_DUNE_PDELAB && HAVE_DUNE_ALUGRID +#endif // HAVE_DUNE_ALUGRID diff --git a/dune/gdt/test/projections/mpi_projections__lagrange_and_global.py b/dune/gdt/test/projections/mpi_projections__lagrange_and_global.py index 9f61d47e97690bed39db33d54851f306eab17fca..d9e3aaaa6e4a62e16b4b944b397d3a3b1cf001e3 100644 --- a/dune/gdt/test/projections/mpi_projections__lagrange_and_global.py +++ b/dune/gdt/test/projections/mpi_projections__lagrange_and_global.py @@ -15,8 +15,4 @@ import spaces as sp cg = sp.CG(cache) spaces = cg.spaces names = cg.names -spaces_with_names = [] -for space, name in zip(spaces, names): - if 'mpi' in __file__ and 'FemCg' in name: - continue - spaces_with_names.append((space, name)) +spaces_with_names = zip(spaces, names) diff --git a/dune/gdt/test/projections/mpi_projections__lagrange_and_global.tpl b/dune/gdt/test/projections/mpi_projections__lagrange_and_global.tpl index 53c50f97dbc8015d3d9d0a0dccbe96cb3dc71273..19683e2c74d727eea3f59d8e2184c7b8eff40ca3 100644 --- a/dune/gdt/test/projections/mpi_projections__lagrange_and_global.tpl +++ b/dune/gdt/test/projections/mpi_projections__lagrange_and_global.tpl @@ -12,8 +12,7 @@ #include <dune/gdt/test/projections/lagrange.hh> #include <dune/gdt/test/projections/l2-global.hh> -#include <dune/gdt/test/spaces/cg/pdelab.hh> -#include <dune/gdt/test/spaces/cg/fem.hh> +#include <dune/gdt/test/spaces/cg.hh> using namespace Dune::GDT::Test; diff --git a/dune/gdt/test/projections/mpi_projections__local.tpl b/dune/gdt/test/projections/mpi_projections__local.tpl index 2f694050c229b83a8544973eab16e69c55f8e713..6d172a691280226488afa7bcf76697102d3f4ac1 100644 --- a/dune/gdt/test/projections/mpi_projections__local.tpl +++ b/dune/gdt/test/projections/mpi_projections__local.tpl @@ -15,13 +15,11 @@ #include <dune/gdt/test/grids.hh> #include <dune/gdt/test/projections/l2-local.hh> #include <dune/gdt/test/projections/l2.hh> -#include <dune/gdt/spaces/cg/dune-fem-wrapper.hh> -#include <dune/gdt/spaces/cg/dune-pdelab-wrapper.hh> -#include <dune/gdt/spaces/dg/dune-fem-wrapper.hh> -#include <dune/gdt/playground/spaces/dg/dune-functions-wrapper.hh> -#include <dune/gdt/spaces/fv/default.hh> -#include <dune/gdt/spaces/rt/dune-pdelab-wrapper.hh> -#include <dune/gdt/playground/spaces/dg/dune-pdelab-wrapper.hh> +#include <dune/gdt/spaces/cg.hh> +#include <dune/gdt/spaces/dg.hh> +#include <dune/gdt/spaces/fv.hh> +#include <dune/gdt/spaces/rt/default.hh> + using namespace Dune::GDT::Test; @@ -35,10 +33,10 @@ typedef L2LocalProjectionLocalizableOperatorTest<{{SpaceType}}> {% if 'FvSpace' in SpaceType %} const double {{Name}}_tolerance = 1.45e-1; -{% elif 'DunePdelabRtSpaceWrapper' in SpaceType %} - const auto {{Name}}_tolerance = pdelab_rt_tolerance<L2LocalProjectionOperatorTest_{{Name}}>(); -{% elif 'FemCg' in SpaceType %} - const auto {{Name}}_tolerance = fem_cg_tolerance<L2LocalProjectionOperatorTest_{{Name}}>(); +{% elif 'RaviartThomasSpace' in SpaceType %} + const auto {{Name}}_tolerance = rt_tolerance<L2LocalProjectionOperatorTest_{{Name}}>(); +{% elif 'ContinuousLagrangeSpace' in SpaceType %} + const auto {{Name}}_tolerance = cg_tolerance<L2LocalProjectionOperatorTest_{{Name}}>(); {% else %} const auto {{Name}}_tolerance = Dune::XT::Grid::is_alugrid<Dune::XT::Grid::extract_grid_t<typename {{SpaceType}}::GridLayerType>>::value ? L2LocalProjectionOperatorTest_{{Name}}::alugrid_tolerance diff --git a/dune/gdt/test/projections/mpi_projections_part_0_a.tpl b/dune/gdt/test/projections/mpi_projections_part_0_a.tpl index 772d2243707b23d33dd79d257bdc85d9037acde1..5c9aad90c7a04de4e816a5e72ba506aa8ce2ad5c 100644 --- a/dune/gdt/test/projections/mpi_projections_part_0_a.tpl +++ b/dune/gdt/test/projections/mpi_projections_part_0_a.tpl @@ -18,13 +18,12 @@ #include <dune/gdt/test/projections/lagrange.hh> #include <dune/gdt/test/projections/l2-global.hh> -#include <dune/gdt/playground/spaces/dg/dune-pdelab-wrapper.hh> -#include <dune/gdt/spaces/cg/dune-fem-wrapper.hh> -#include <dune/gdt/spaces/cg/dune-pdelab-wrapper.hh> -#include <dune/gdt/spaces/dg/dune-fem-wrapper.hh> -#include <dune/gdt/playground/spaces/dg/dune-functions-wrapper.hh> -#include <dune/gdt/spaces/fv/default.hh> -#include <dune/gdt/spaces/rt/dune-pdelab-wrapper.hh> + +#include <dune/gdt/spaces/cg.hh> + +#include <dune/gdt/spaces/dg.hh> +#include <dune/gdt/spaces/fv.hh> +#include <dune/gdt/spaces/rt/default.hh> #include <dune/gdt/test/projections/projections.hh> #include <dune/gdt/test/projections/l2.hh> @@ -39,7 +38,7 @@ TEST_F(ProjectionTest_{{Name}}, produces_correct_results) { {% if 'FvSpace' in SpaceType %} const double tolerance = 0.096226; - {% elif 'DunePdelabRtSpaceWrapper' in SpaceType %} + {% elif 'RaviartThomasSpace' in SpaceType %} const double tolerance = 0.0925927; {% else %} const auto tolerance = this->default_tolerance; diff --git a/dune/gdt/test/projections/mpi_projections_part_1_a.tpl b/dune/gdt/test/projections/mpi_projections_part_1_a.tpl index 95c26db3182392ca24582da7604d9d410df32693..4f494fc06ff781960064b4cf63f0c63b44409018 100644 --- a/dune/gdt/test/projections/mpi_projections_part_1_a.tpl +++ b/dune/gdt/test/projections/mpi_projections_part_1_a.tpl @@ -20,13 +20,12 @@ #include <dune/gdt/test/projections/lagrange.hh> #include <dune/gdt/test/projections/l2-global.hh> -#include <dune/gdt/playground/spaces/dg/dune-pdelab-wrapper.hh> -#include <dune/gdt/spaces/cg/dune-fem-wrapper.hh> -#include <dune/gdt/spaces/cg/dune-pdelab-wrapper.hh> -#include <dune/gdt/spaces/dg/dune-fem-wrapper.hh> -#include <dune/gdt/playground/spaces/dg/dune-functions-wrapper.hh> -#include <dune/gdt/spaces/fv/default.hh> -#include <dune/gdt/spaces/rt/dune-pdelab-wrapper.hh> + +#include <dune/gdt/spaces/cg.hh> + +#include <dune/gdt/spaces/dg.hh> +#include <dune/gdt/spaces/fv.hh> +#include <dune/gdt/spaces/rt/default.hh> #include <dune/gdt/test/projections/projections.hh> #include <dune/gdt/test/projections/l2.hh> @@ -55,7 +54,7 @@ TEST_F(L2ProjectionOperatorTest_{{Name}}, produces_correct_results) // RT : 0.0925927 {% if 'FvSpace' in SpaceType %} const double tolerance = 0.096226; - {% elif 'DunePdelabRtSpaceWrapper' in SpaceType %} + {% elif 'RaviartThomasSpace' in SpaceType %} const double tolerance = 0.0925927; {% else %} using Grid = Dune::XT::Grid::extract_grid_t<typename L2ProjectionOperatorTest_{{Name}}::GridLayerType>; diff --git a/dune/gdt/test/projections/mpi_projections_part_2_a.tpl b/dune/gdt/test/projections/mpi_projections_part_2_a.tpl index 279218cd2827e46179fd7d5b2c8ff06dbe0df76c..8009c72ba50f2917611e811e6c5ae25e467fd438 100644 --- a/dune/gdt/test/projections/mpi_projections_part_2_a.tpl +++ b/dune/gdt/test/projections/mpi_projections_part_2_a.tpl @@ -20,13 +20,12 @@ #include <dune/gdt/test/projections/lagrange.hh> #include <dune/gdt/test/projections/l2-global.hh> -#include <dune/gdt/playground/spaces/dg/dune-pdelab-wrapper.hh> -#include <dune/gdt/spaces/cg/dune-fem-wrapper.hh> -#include <dune/gdt/spaces/cg/dune-pdelab-wrapper.hh> -#include <dune/gdt/spaces/dg/dune-fem-wrapper.hh> -#include <dune/gdt/playground/spaces/dg/dune-functions-wrapper.hh> -#include <dune/gdt/spaces/fv/default.hh> -#include <dune/gdt/spaces/rt/dune-pdelab-wrapper.hh> + +#include <dune/gdt/spaces/cg.hh> + +#include <dune/gdt/spaces/dg.hh> +#include <dune/gdt/spaces/fv.hh> +#include <dune/gdt/spaces/rt/default.hh> #include <dune/gdt/test/projections/projections.hh> #include <dune/gdt/test/projections/l2.hh> @@ -50,7 +49,7 @@ TEST_F(L2ProjectionLocalizableOperatorTest_{{Name}}, produces_correct_results) // RT : 0.096226 {% if 'FvSpace' in SpaceType %} const double tolerance = 0.096226; - {% elif 'DunePdelabRtSpaceWrapper' in SpaceType %} + {% elif 'RaviartThomasSpace' in SpaceType %} const double tolerance = 0.0925927; {% else %} typedef Dune::XT::Grid::extract_grid_t<L2ProjectionLocalizableOperatorTest_{{Name}}::GridLayerType> Grid; diff --git a/dune/gdt/test/projections/projections.hh b/dune/gdt/test/projections/projections.hh index e47dcf0e3c17f32f7883a60e4177bebb8725d767..8a24ddb4a6a87d40b5daf72f7ca4b8543181dbfa 100644 --- a/dune/gdt/test/projections/projections.hh +++ b/dune/gdt/test/projections/projections.hh @@ -13,7 +13,7 @@ #include <dune/gdt/projections.hh> #include <dune/gdt/test/projections/base.hh> -#include <dune/gdt/test/spaces/cg/fem.hh> +#include <dune/gdt/test/spaces/cg.hh> namespace Dune { namespace GDT { diff --git a/dune/gdt/test/projections/projections_a.py b/dune/gdt/test/projections/projections_a.py index 3563270958231d37d7cb954f87ecf97fdcb26a8f..4cf77c9063e009f1aadda340c085a7553406385a 100644 --- a/dune/gdt/test/projections/projections_a.py +++ b/dune/gdt/test/projections/projections_a.py @@ -14,9 +14,4 @@ cg = sp.CG(cache) rt = sp.RT(cache) spaces = cg.spaces + rt.spaces names = cg.names + rt.names -spaces_with_names = [] -for space, name in zip(spaces, names): - if 'mpi' in __file__ and 'FemCg' in name: - continue - spaces_with_names.append((space, name)) - +spaces_with_names = zip(spaces, names) diff --git a/dune/gdt/test/prolongations/mpi_prolongations__lagrange_and_global.py b/dune/gdt/test/prolongations/mpi_prolongations__lagrange_and_global.py index cef8e3716c06032515e29e519c73a10779993a3b..3e02567775e99948bf70d25655a183944bc14b25 100644 --- a/dune/gdt/test/prolongations/mpi_prolongations__lagrange_and_global.py +++ b/dune/gdt/test/prolongations/mpi_prolongations__lagrange_and_global.py @@ -18,9 +18,4 @@ for sp, nm in zip(cg.spaces, cg.names): if not ('AluConform2dLevelGrid' in sp): spaces.append(sp) names.append(nm) -spaces_with_names = [] -for space, name in zip(spaces, names): - if 'mpi' in __file__ and 'FemCg' in name: - continue - spaces_with_names.append((space, name)) - +spaces_with_names = zip(spaces, names) diff --git a/dune/gdt/test/prolongations/mpi_prolongations__lagrange_and_global.tpl b/dune/gdt/test/prolongations/mpi_prolongations__lagrange_and_global.tpl index 3204ea51399af1f1ffdcb14b5f4b413078bd2f9c..d8cc4d318e54e29f82c56250e2a9b535285e3233 100644 --- a/dune/gdt/test/prolongations/mpi_prolongations__lagrange_and_global.tpl +++ b/dune/gdt/test/prolongations/mpi_prolongations__lagrange_and_global.tpl @@ -15,13 +15,12 @@ #include <dune/gdt/test/grids.hh> #include <dune/gdt/test/prolongations/l2-global.hh> #include <dune/gdt/test/prolongations/lagrange.hh> -#include <dune/gdt/spaces/cg/dune-fem-wrapper.hh> -#include <dune/gdt/spaces/cg/dune-pdelab-wrapper.hh> -#include <dune/gdt/spaces/dg/dune-fem-wrapper.hh> -#include <dune/gdt/playground/spaces/dg/dune-functions-wrapper.hh> -#include <dune/gdt/spaces/fv/default.hh> -#include <dune/gdt/spaces/rt/dune-pdelab-wrapper.hh> -#include <dune/gdt/playground/spaces/dg/dune-pdelab-wrapper.hh> +#include <dune/gdt/spaces/cg.hh> + +#include <dune/gdt/spaces/dg.hh> +#include <dune/gdt/spaces/fv.hh> +#include <dune/gdt/spaces/rt/default.hh> + using namespace Dune::GDT::Test; @@ -40,10 +39,10 @@ typedef L2GlobalProlongationLocalizableOperatorTest<{{SpaceType}}> {% if 'FvSpace' in SpaceType %} const double {{Name}}_tolerance = 1.45e-1; -{% elif 'DunePdelabRtSpaceWrapper' in SpaceType %} - const auto {{Name}}_tolerance = pdelab_rt_tolerance<L2GlobalProlongationOperatorTest_{{Name}}>(); -{% elif 'FemCg' in SpaceType %} - const auto {{Name}}_tolerance = fem_cg_tolerance<L2GlobalProlongationOperatorTest_{{Name}}>(); +{% elif 'RaviartThomasSpace' in SpaceType %} + const auto {{Name}}_tolerance = rt_tolerance<L2GlobalProlongationOperatorTest_{{Name}}>(); +{% elif 'ContinuousLagrangeSpace' in SpaceType %} + const auto {{Name}}_tolerance = cg_tolerance<L2GlobalProlongationOperatorTest_{{Name}}>(); {% else %} const auto {{Name}}_tolerance = Dune::XT::Grid::is_alugrid<Dune::XT::Grid::extract_grid_t<typename {{SpaceType}}::GridLayerType>>::value ? L2GlobalProlongationOperatorTest_{{Name}}::alugrid_tolerance diff --git a/dune/gdt/test/prolongations/mpi_prolongations__local.py b/dune/gdt/test/prolongations/mpi_prolongations__local.py index 68d844847d9fc8a4096aa60391a61e79ab0b09c8..3b2c08ec835d0729653135033a4395f19e865ae2 100644 --- a/dune/gdt/test/prolongations/mpi_prolongations__local.py +++ b/dune/gdt/test/prolongations/mpi_prolongations__local.py @@ -17,7 +17,7 @@ rt = sp.RT(cache, base=LevelGrids) spaces = [] names = [] for sp, nm in zip(dg.spaces + fv.spaces + rt.spaces, dg.names + fv.names + rt.names): - if not ('Rt' in sp and 'Pdelab' in sp and 'Alu' in sp and 'LevelGridView' in sp): + if not ('RaviartThomasSpace' in sp and 'Alu' in sp and 'LevelGridView' in sp): spaces.append(sp) names.append(nm) spaces_with_names = zip(spaces, names) diff --git a/dune/gdt/test/prolongations/mpi_prolongations__local.tpl b/dune/gdt/test/prolongations/mpi_prolongations__local.tpl index 7c26171de0c9946481936e6f005649027e2e5038..04e6daead1f8d6d22fa9975f2e83c4ae4aa8980c 100644 --- a/dune/gdt/test/prolongations/mpi_prolongations__local.tpl +++ b/dune/gdt/test/prolongations/mpi_prolongations__local.tpl @@ -15,13 +15,12 @@ #include <dune/gdt/test/grids.hh> #include <dune/gdt/test/prolongations/l2-local.hh> #include <dune/gdt/test/prolongations/l2.hh> -#include <dune/gdt/spaces/cg/dune-fem-wrapper.hh> -#include <dune/gdt/spaces/cg/dune-pdelab-wrapper.hh> -#include <dune/gdt/spaces/dg/dune-fem-wrapper.hh> -#include <dune/gdt/playground/spaces/dg/dune-functions-wrapper.hh> -#include <dune/gdt/spaces/fv/default.hh> -#include <dune/gdt/spaces/rt/dune-pdelab-wrapper.hh> -#include <dune/gdt/playground/spaces/dg/dune-pdelab-wrapper.hh> +#include <dune/gdt/spaces/cg.hh> + +#include <dune/gdt/spaces/dg.hh> +#include <dune/gdt/spaces/fv.hh> +#include <dune/gdt/spaces/rt/default.hh> + using namespace Dune::GDT::Test; @@ -35,10 +34,10 @@ typedef L2LocalProlongationLocalizableOperatorTest<{{SpaceType}}> {% if 'FvSpace' in SpaceType %} const double {{Name}}_tolerance = 1.45e-1; -{% elif 'DunePdelabRtSpaceWrapper' in SpaceType %} - const auto {{Name}}_tolerance = pdelab_rt_tolerance<L2LocalProlongationOperatorTest_{{Name}}>(); -{% elif 'FemCg' in SpaceType %} - const auto {{Name}}_tolerance = fem_cg_tolerance<L2LocalProlongationOperatorTest_{{Name}}>(); +{% elif 'RaviartThomasSpace' in SpaceType %} + const auto {{Name}}_tolerance = rt_tolerance<L2LocalProlongationOperatorTest_{{Name}}>(); +{% elif 'ContinuousLagrangeSpace' in SpaceType %} + const auto {{Name}}_tolerance = cg_tolerance<L2LocalProlongationOperatorTest_{{Name}}>(); {% else %} const auto {{Name}}_tolerance = Dune::XT::Grid::is_alugrid<Dune::XT::Grid::extract_grid_t<{{SpaceType}}::GridLayerType>>::value ? L2LocalProlongationOperatorTest_{{Name}}::alugrid_tolerance diff --git a/dune/gdt/test/prolongations/mpi_prolongations_cg_dg.py b/dune/gdt/test/prolongations/mpi_prolongations_cg_dg.py index e398f606e3af23ceabbd30e17771b117dc56c0cd..31559c1dd66cf1517d5ba4b405184a3e4da3bc3f 100644 --- a/dune/gdt/test/prolongations/mpi_prolongations_cg_dg.py +++ b/dune/gdt/test/prolongations/mpi_prolongations_cg_dg.py @@ -19,8 +19,4 @@ for sp, nm in zip(cg.spaces + dg.spaces, cg.names + dg.names): if not ('AluConform2dLevelGrid' in sp): spaces.append(sp) names.append(nm) -spaces_with_names = [] -for space, name in zip(spaces, names): - if 'mpi' in __file__ and 'FemCg' in name: - continue - spaces_with_names.append((space, name)) +spaces_with_names = zip(spaces, names) diff --git a/dune/gdt/test/prolongations/mpi_prolongations_cg_dg.tpl b/dune/gdt/test/prolongations/mpi_prolongations_cg_dg.tpl index a32a9adc950f65091e09233f7d4c2c9fa32a6248..af27e6f16fe3f55962beecbe9b5a47a696af29ac 100644 --- a/dune/gdt/test/prolongations/mpi_prolongations_cg_dg.tpl +++ b/dune/gdt/test/prolongations/mpi_prolongations_cg_dg.tpl @@ -15,13 +15,12 @@ #include <dune/gdt/test/grids.hh> #include <dune/gdt/test/prolongations/prolongations.hh> #include <dune/gdt/test/prolongations/l2.hh> -#include <dune/gdt/spaces/cg/dune-fem-wrapper.hh> -#include <dune/gdt/spaces/cg/dune-pdelab-wrapper.hh> -#include <dune/gdt/spaces/dg/dune-fem-wrapper.hh> -#include <dune/gdt/playground/spaces/dg/dune-functions-wrapper.hh> -#include <dune/gdt/spaces/fv/default.hh> -#include <dune/gdt/spaces/rt/dune-pdelab-wrapper.hh> -#include <dune/gdt/playground/spaces/dg/dune-pdelab-wrapper.hh> +#include <dune/gdt/spaces/cg.hh> + +#include <dune/gdt/spaces/dg.hh> +#include <dune/gdt/spaces/fv.hh> +#include <dune/gdt/spaces/rt/default.hh> + using namespace Dune::GDT::Test; @@ -37,10 +36,10 @@ typedef L2ProlongationLocalizableOperatorTest<{{SpaceType}}> {% if 'FvSpace' in SpaceType %} const double {{Name}}_tolerance = 1.45e-1; -{% elif 'DunePdelabRtSpaceWrapper' in SpaceType %} - const auto {{Name}}_tolerance = pdelab_rt_tolerance<L2ProlongationOperatorTest_{{Name}}>(); -{% elif 'FemCg' in SpaceType %} - const auto {{Name}}_tolerance = fem_cg_tolerance<L2ProlongationOperatorTest_{{Name}}>(); +{% elif 'RaviartThomasSpace' in SpaceType %} + const auto {{Name}}_tolerance = rt_tolerance<L2ProlongationOperatorTest_{{Name}}>(); +{% elif 'ContinuousLagrangeSpace' in SpaceType %} + const auto {{Name}}_tolerance = cg_tolerance<L2ProlongationOperatorTest_{{Name}}>(); {% else %} const auto {{Name}}_tolerance = Dune::XT::Grid::is_alugrid<Dune::XT::Grid::extract_grid_t<typename {{SpaceType}}::GridLayerType>>::value ? L2ProlongationOperatorTest_{{Name}}::alugrid_tolerance : L2ProlongationOperatorTest_{{Name}}::default_tolerance; {% endif %} diff --git a/dune/gdt/test/spaces.py b/dune/gdt/test/spaces.py index e537a30caaad4644cd12bfb46e76ab0d12f84565..ee6dd788ed0f883c3bfdbffa33403a61e8ee35af 100644 --- a/dune/gdt/test/spaces.py +++ b/dune/gdt/test/spaces.py @@ -14,32 +14,20 @@ from dune.xt.codegen import typeid_to_typedef_name from grids import LeafGrids, LevelGrids -def CG(cache, base=LeafGrids): +def CG(cache, base=LeafGrids, orders=range(1,2)): cg = base(cache) - cg.fem_grids = [cg.yasp_part_fmt.format(1)] + [s.format(d) for s, d in itertools.product(cg.all_parts_fmt, cg.world_dim)] - cg.pdelab_grids = [cg.yasp_view_fmt.format(1)] + [s.format(d) for s, d in itertools.product(cg.all_views_fmt, cg.world_dim)] - cg.fem = ['Dune::GDT::DuneFemCgSpaceWrapper<{}, 1, double, 1>'.format(grid) - for grid in cg.fem_grids] if cache['dune-fem'] else [] - cg.pdelab = ['Dune::GDT::DunePdelabCgSpaceWrapper<{}, 1, double, 1>'.format(grid) - for grid in cg.pdelab_grids] if cache['dune-fem'] else [] - cg.spaces = cg.fem + cg.pdelab + cg.grids = [cg.yasp_view_fmt.format(1)] + [s.format(d) for s, d in itertools.product(cg.all_views_fmt, cg.world_dim)] + cg.spaces = ['Dune::GDT::ContinuousLagrangeSpace<{}, {}>'.format(grid, order) + for grid, order in itertools.product(cg.grids, orders)] cg.names = [typeid_to_typedef_name(sp) for sp in cg.spaces] return cg def DG(cache, base=LeafGrids): dg = base(cache) - cg = CG(cache, base=base) - dg.fem_grids = cg.fem_grids - dg.functions_grids = [s.format(d) for s, d in itertools.product(cg.all_views_fmt, cg.world_dim)] - dg.pdelab_grids = [dg.yasp_view_fmt.format(1)] + [s.format(d) for s, d in itertools.product([dg.alu_cube_view_fmt, dg.yasp_view_fmt], dg.world_dim)] - dg.fem = ['Dune::GDT::DuneFemDgSpaceWrapper<{}, 1, double, 1>'.format(grid) - for grid in dg.fem_grids] if cache['dune-fem'] else [] - dg.functions = ['Dune::GDT::DuneFunctionsDgSpaceWrapper<{}, 1, double, 1>'.format(grid) - for grid in dg.functions_grids] if cache['dune-functions'] else [] - dg.pdelab = ['Dune::GDT::DunePdelabDgSpaceWrapper<{}, 1, double, 1>'.format(grid) - for grid in dg.pdelab_grids] if cache['dune-pdelab'] else [] - dg.spaces = dg.fem + dg.functions + dg.pdelab + dg.grids = [dg.yasp_view_fmt.format(1)] + [s.format(d) for s, d in itertools.product(dg.all_views_fmt, dg.world_dim)] + dg.spaces = ['Dune::GDT::DiscontinuousLagrangeSpace<{}, 1, double>'.format(grid) + for grid in dg.grids] dg.names = [typeid_to_typedef_name(sp) for sp in dg.spaces] return dg @@ -48,7 +36,7 @@ def FV(cache, base=LeafGrids, rdim=None): fv = base(cache) cg = CG(cache, base=base) fv.rdim = rdim or [1, 2, 3] - fv.grids = cg.pdelab_grids + fv.grids = cg.grids fv.spaces = ['Dune::GDT::FvSpace<{}, double, {}>'.format(g, d) for g, d in itertools.product(fv.grids, fv.rdim)] fv.names = [typeid_to_typedef_name(sp) for sp in fv.spaces] return fv @@ -56,11 +44,12 @@ def FV(cache, base=LeafGrids, rdim=None): def RT(cache, base=LeafGrids): rt = base(cache) - rt.spaces = ['Dune::GDT::DunePdelabRtSpaceWrapper<{}, 0, double, {}>'.format(s.format(d), d) + rt.spaces = ['Dune::GDT::RaviartThomasSpace<{}, 0>'.format(s.format(d)) for s, d in itertools.product(rt.all_views_fmt, rt.world_dim)] rt.names = [typeid_to_typedef_name(sp) for sp in rt.spaces] return rt + if __name__ == '__dxt_codegen__': # this is executed from spaces.tpl itself cg = CG(cache) diff --git a/dune/gdt/test/spaces.tpl b/dune/gdt/test/spaces.tpl index fdc9e72b71bccb66ae1e6a48aee2af660bed11e5..03b6a9d32d81ee2198546cd3f473c25d74d4fb97 100644 --- a/dune/gdt/test/spaces.tpl +++ b/dune/gdt/test/spaces.tpl @@ -12,29 +12,18 @@ #include <dune/xt/grid/type_traits.hh> -#include <dune/gdt/test/grids.hh> -#include <dune/gdt/spaces/cg/dune-fem-wrapper.hh> -#include <dune/gdt/spaces/cg/dune-pdelab-wrapper.hh> -#include <dune/gdt/spaces/dg/dune-fem-wrapper.hh> -#include <dune/gdt/spaces/fv/default.hh> -#include <dune/gdt/spaces/rt/dune-pdelab-wrapper.hh> -#include <dune/gdt/playground/spaces/dg/dune-pdelab-wrapper.hh> -#include <dune/gdt/playground/spaces/dg/dune-functions-wrapper.hh> +#include <dune/gdt/test/spaces/base.hh> +#include <dune/gdt/spaces/cg.hh> +#include <dune/gdt/spaces/dg.hh> +#include <dune/gdt/spaces/fv.hh> +#include <dune/gdt/spaces/rt/default.hh> -#include <dune/gdt/test/spaces/cg.hh> -#include <dune/gdt/test/spaces/dg.hh> -#include <dune/gdt/test/spaces/fv.hh> -#include <dune/gdt/test/spaces/rt.hh> +#include <dune/gdt/test/grids.hh> // clang-format off {% for SpaceType,Name in config.spaces_with_names %} -{% if 'DunePdelabRtSpaceWrapper' in SpaceType %} - typedef RT_Space<{{SpaceType}}> TestType_{{Name}}; -{% else %} - typedef SpaceBase<{{SpaceType}}> - TestType_{{Name}}; -{% endif %} +typedef SpaceBase<{{SpaceType}}> TestType_{{Name}}; TEST_F(TestType_{{Name}}, fulfills_interface) { @@ -53,41 +42,5 @@ TEST_F(TestType_{{Name}}, check_for_correct_copy) this->check_for_correct_copy(); } -{% if 'DunePdelabRtSpaceWrapper' in SpaceType %} - TEST_F(TestType_{{Name}}, matches_raviart_thomas_signature) - { - this->matches_raviart_thomas_signature(); - } - - {% if 'simplex' in Name and '::conforming' in Name %} - TEST_F(RT_Space_{{Name}}, fulfills_raviart_thomas_2d_simplicial_interface) - { - this->fulfills_raviart_thomas_2d_simplicial_interface(); - } - {% endif %} - -{% endif %} - -{% if 'CgSpaceWrapper' in SpaceType %} - typedef P1Q1_CG_Space<{{SpaceType}}> P1Q1_CG_Space_{{Name}}; - TEST_F(P1Q1_CG_Space_{{Name}}, fulfills_cg_interface) - { - this->fulfills_continuous_interface(); - } - TEST_F(P1Q1_CG_Space_{{Name}}, maps_correctly) - { - this->maps_correctly(); - } -{% endif %} - -{% if 'DgSpaceWrapper' in SpaceType %} - typedef P1Q1_DG_Space<{{SpaceType}}> P1Q1_DG_Space_{{Name}}; - TEST_F(P1Q1_DG_Space_{{Name}}, fulfills_dg_interface) - { - this->maps_correctly(); - } -{% endif %} - - {% endfor %} // clang-format on diff --git a/dune/gdt/test/spaces/base.hh b/dune/gdt/test/spaces/base.hh index 6d9800b31039e967efb77644be5023f481033a54..8a1b165251d68240cbdd3e0a309239ed7c5835b8 100644 --- a/dune/gdt/test/spaces/base.hh +++ b/dune/gdt/test/spaces/base.hh @@ -355,7 +355,8 @@ public: static const size_t i_dimRangeCols = InterfaceType::dimRangeCols; typedef typename InterfaceType::RangeType I_RangeType; typedef typename InterfaceType::JacobianRangeType I_JacobianRangeType; - static_assert(std::is_same<derived_type, BaseFunctionSetType>::value, "Types do not match!"); + //! TODO no longer true for new spaces? + // static_assert(std::is_same<derived_type, BaseFunctionSetType>::value, "Types do not match!"); static_assert(std::is_same<I_BackendType, D_BackendType>::value, "Types do not match!"); static_assert(std::is_same<I_EntityType, D_EntityType>::value, "Types do not match!"); static_assert(std::is_same<I_DomainFieldType, D_DomainFieldType>::value, "Types do not match!"); @@ -386,8 +387,6 @@ public: // the size has already been checked in fulfills_interface() above // * as the interface InterfaceType& i_base_function_set = static_cast<InterfaceType&>(d_base_function_set); - const I_BackendType& i_backend = i_base_function_set.backend(); - EXPECT_EQ(&d_backend, &i_backend); size_t i_order = i_base_function_set.order(); EXPECT_EQ(i_order, d_order); } // walk the grid diff --git a/dune/gdt/test/spaces/cg.hh b/dune/gdt/test/spaces/cg.hh index 3731569b5e57d23059923a92d281cbaf4ef3c56e..315444e0637ae08fb83c771c2ea44317aae6408f 100644 --- a/dune/gdt/test/spaces/cg.hh +++ b/dune/gdt/test/spaces/cg.hh @@ -5,154 +5,49 @@ // or GPL-2.0+ (http://opensource.org/licenses/gpl-license) // with "runtime exception" (http://www.dune-project.org/license.html) // Authors: -// Felix Schindler (2013 - 2017) -// Rene Milk (2014, 2016 - 2017) +// Felix Schindler (2014 - 2017) +// Rene Milk (2016 - 2017) // Tobias Leibner (2014, 2016) -#ifndef DUNE_GDT_TEST_SPACES_CG_HH -#define DUNE_GDT_TEST_SPACES_CG_HH +#ifndef DUNE_GDT_TEST_SPACES_CG_DEFAULT_HH +#define DUNE_GDT_TEST_SPACES_CG_DEFAULT_HH -#include <boost/numeric/conversion/cast.hpp> +#include <dune/xt/grid/type_traits.hh> +#include <dune/gdt/test/grids.hh> +#include <dune/gdt/spaces/cg.hh> -#include <dune/common/typetraits.hh> -#include <dune/common/fvector.hh> -#include <dune/xt/common/print.hh> -#include <dune/xt/common/ranges.hh> -#include <dune/xt/grid/walker.hh> -#include <dune/xt/grid/type_traits.hh> +#define SPACE_CG_YASPGRID(dd, rr, pp) Dune::GDT::ContinuousLagrangeSpace<Yasp##dd##dLeafGridViewType, pp, double> + +#define SPACE_CG_YASPGRID_LEVEL(dd, rr, pp) Dune::GDT::ContinuousLagrangeSpace<Yasp##dd##dLevelGridViewType, pp, double> + +#define SPACES_CG_LEVEL(pp) \ + SPACE_CG_YASPGRID_LEVEL(1, 1, pp) \ + , SPACE_CG_YASPGRID_LEVEL(2, 1, pp), SPACE_CG_YASPGRID_LEVEL(3, 1, pp) + + +#if HAVE_DUNE_ALUGRID + + +#define SPACE_CG_ALUCONFORMGRID(dd, rr, pp) \ + Dune::GDT::ContinuousLagrangeSpace<AluConform##dd##dLeafGridViewType, pp, double> + +#define SPACE_CG_ALUCUBEGRID(dd, rr, pp) Dune::GDT::ContinuousLagrangeSpace<AluCube##dd##dLeafGridViewType, pp, double> + +#define SPACES_CG_ALUGRID(pp) \ + SPACE_CG_ALUCONFORMGRID(2, 1, pp) \ + , SPACE_CG_ALUCONFORMGRID(3, 1, pp), SPACE_CG_ALUCUBEGRID(2, 1, pp), SPACE_CG_ALUCUBEGRID(3, 1, pp) + + +#define SPACE_CG_ALUCUBEGRID_LEVEL(dd, rr, pp) \ + Dune::GDT::ContinuousLagrangeSpace<AluCube##dd##dLevelGridViewType, pp, double> + +#define SPACES_CG_ALUGRID_LEVEL(pp) \ + SPACE_CG_ALUCUBEGRID_LEVEL(2, 1, pp) \ + , SPACE_CG_ALUCUBEGRID_LEVEL(3, 1, pp) + + +#endif // HAVE_DUNE_ALUGRID + -#include <dune/gdt/spaces/cg/dune-fem-wrapper.hh> -#include <dune/gdt/spaces/cg/dune-pdelab-wrapper.hh> -#include <dune/gdt/spaces/mapper/interfaces.hh> -#include <dune/gdt/spaces/basefunctionset/interface.hh> - -#include "base.hh" - - -template <class SpaceType> -class CG_Space : public SpaceBase<SpaceType> -{ -}; - - -template <class SpaceType> -struct P1Q1_CG_Space : public SpaceBase<SpaceType> -{ - typedef typename SpaceType::GridLayerType GridLayerType; - using GridType = Dune::XT::Grid::extract_grid_t<typename SpaceType::GridLayerType>; - static const size_t dimDomain = GridType::dimension; - typedef typename GridType::ctype DomainFieldType; - typedef Dune::FieldVector<DomainFieldType, dimDomain> DomainType; - - static std::vector<DomainFieldType> convert_vector(const DomainType& source) - { - std::vector<DomainFieldType> ret(dimDomain, DomainFieldType(0)); - for (size_t ii = 0; ii < dimDomain; ++ii) - ret[ii] = source[ii]; - return ret; - } - - template <class T, size_t d, size_t r, size_t rC> - void matches_signature(const Dune::GDT::CgSpaceInterface<T, d, r, rC>& /*space*/) - { - static_assert(std::is_same<typename SpaceType::Traits, T>::value, ""); - static_assert(d == SpaceType::dimDomain, ""); - static_assert(r == SpaceType::dimRange, ""); - static_assert(rC == SpaceType::dimRangeCols, ""); - } - - void fulfills_continuous_interface() - { - - matches_signature(this->space_); - const auto entity_ptr = this->space_.grid_layer().template begin<0>(); - const auto& entity = *entity_ptr; - const auto basis = this->space_.base_function_set(entity); - std::vector<DomainType> lagrange_points = this->space_.lagrange_points(entity); - EXPECT_EQ(lagrange_points.size(), basis.size()); - typedef Dune::XT::Grid::extract_intersection_t<typename SpaceType::GridLayerType> IntersectionType; - typedef typename SpaceType::RangeFieldType RangeFieldType DUNE_UNUSED; - Dune::XT::Grid::AllDirichletBoundaryInfo<IntersectionType> boundary_info; - std::set<size_t> local_dirichlet_DoFs DUNE_UNUSED = this->space_.local_dirichlet_DoFs(entity, boundary_info); - Dune::GDT::DirichletConstraints<IntersectionType> dirichlet_constraints_set( - boundary_info, this->space_.mapper().size(), true); - Dune::GDT::DirichletConstraints<IntersectionType> dirichlet_constraints_clear( - boundary_info, this->space_.mapper().size(), false); - this->space_.local_constraints(entity, dirichlet_constraints_set); - this->space_.local_constraints(entity, dirichlet_constraints_clear); - } - - void maps_correctly() - { - using namespace Dune::XT; - // walk the grid to create a map of all vertices - std::map<std::vector<DomainFieldType>, std::set<size_t>> vertex_to_indices_map; - const auto entity_end_it = this->space_.grid_layer().template end<0>(); - for (auto entity_it = this->space_.grid_layer().template begin<0>(); entity_it != entity_end_it; ++entity_it) { - const auto& entity = *entity_it; - for (auto cc : Dune::XT::Common::value_range(entity.subEntities(dimDomain))) { - const auto vertex = entity.template subEntity<dimDomain>(cc); - const DomainType vertex_center = vertex.geometry().center(); - vertex_to_indices_map[convert_vector(vertex_center)] = std::set<size_t>(); - } - } - - // walk the grid again to find all DoF ids - auto functor = [&](const Dune::XT::Grid::extract_entity_t<GridLayerType>& entity) { - const size_t num_vertices = entity.subEntities(dimDomain); - const auto basis = this->space_.base_function_set(entity); - EXPECT_EQ(basis.size(), num_vertices); - for (size_t cc = 0; cc < num_vertices; ++cc) { - const auto vertex = entity.template subEntity<dimDomain>(boost::numeric_cast<int>(cc)); - const DomainType vertex_center = vertex.geometry().center(); - // find the local basis function which corresponds to this vertex - const auto basis_values = basis.evaluate(entity.geometry().local(vertex_center)); - EXPECT_EQ(basis_values.size(), num_vertices); - size_t ones = 0; - size_t zeros = 0; - size_t failures = 0; - size_t local_DoF_index = 0; - for (size_t ii = 0; ii < basis.size(); ++ii) { - if (Common::FloatCmp::eq(basis_values[ii][0], typename SpaceType::RangeFieldType(1))) { - local_DoF_index = ii; - ++ones; - } else if (Common::FloatCmp::eq(basis_values[ii][0] + 1.0, typename SpaceType::RangeFieldType(1))) - ++zeros; - else - ++failures; - } - if (ones != 1 || zeros != (basis.size() - 1) || failures > 0) { - std::stringstream ss; - ss << "ones = " << ones << ", zeros = " << zeros << ", failures = " << failures - << ", num_vertices = " << num_vertices << ", entity " << this->space_.grid_layer().indexSet().index(entity) - << ", vertex " << cc << ": [ " << vertex_center << "], "; - Dune::XT::Common::print(basis_values, "basis_values", ss); - EXPECT_TRUE(false) << ss.str(); - } - // now we know that the local DoF index of this vertex is ii - const size_t global_DoF_index = this->space_.mapper().mapToGlobal(entity, local_DoF_index); - vertex_to_indices_map[convert_vector(vertex_center)].insert(global_DoF_index); - } - }; - Dune::XT::Grid::Walker<GridLayerType> walker(this->space_.grid_layer()); - walker.append(functor); - walker.walk(); - // check that all vertices have indeed one and only one global DoF id and that the numbering is consecutive - std::set<size_t> global_DoF_indices; - for (const auto& entry : vertex_to_indices_map) { - const auto vertex_ids = entry.second; - EXPECT_EQ(vertex_ids.size(), 1); - global_DoF_indices.insert(*(vertex_ids.begin())); - } - EXPECT_EQ(vertex_to_indices_map.size(), global_DoF_indices.size()); - size_t count = 0; - for (const auto& global_DoF_id : global_DoF_indices) { - EXPECT_EQ(global_DoF_id, count); - ++count; - } - } // ... maps_correctly() -}; // struct P1Q1_CG_Space - - -#endif // DUNE_GDT_TEST_SPACES_CG_HH +#endif // DUNE_GDT_TEST_SPACES_CG_DEFAULT_HH diff --git a/dune/gdt/test/spaces/cg/fem.hh b/dune/gdt/test/spaces/cg/fem.hh deleted file mode 100644 index 764a266af27a72ca62f0d2ce8ffd6e0c4627b485..0000000000000000000000000000000000000000 --- a/dune/gdt/test/spaces/cg/fem.hh +++ /dev/null @@ -1,67 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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 (2014 - 2017) -// Rene Milk (2016 - 2017) -// Tobias Leibner (2014, 2016) - -#ifndef DUNE_GDT_TEST_SPACES_CG_FEM_HH -#define DUNE_GDT_TEST_SPACES_CG_FEM_HH - -#include <dune/gdt/spaces/cg/dune-fem-wrapper.hh> - -#include <dune/gdt/test/grids.hh> - -#include <dune/xt/grid/type_traits.hh> - -#if HAVE_DUNE_FEM - - -#define SPACE_CG_FEM_YASPGRID(dd, rr, pp) Dune::GDT::DuneFemCgSpaceWrapper<Yasp##dd##dLeafGridPartType, pp, double, rr> - -#define SPACES_CG_FEM(pp) \ - SPACE_CG_FEM_YASPGRID(1, 1, pp), SPACE_CG_FEM_YASPGRID(2, 1, pp), SPACE_CG_FEM_YASPGRID(3, 1, pp) - -#define SPACE_CG_FEM_YASPGRID_LEVEL(dd, rr, pp) \ - Dune::GDT::DuneFemCgSpaceWrapper<Yasp##dd##dLevelGridPartType, pp, double, rr> - -#define SPACES_CG_FEM_LEVEL(pp) \ - SPACE_CG_FEM_YASPGRID_LEVEL(1, 1, pp), SPACE_CG_FEM_YASPGRID_LEVEL(2, 1, pp), SPACE_CG_FEM_YASPGRID_LEVEL(3, 1, pp) - - -#if HAVE_DUNE_ALUGRID - - -#define SPACE_CG_FEM_ALUCONFORMGRID(dd, rr, pp) \ - Dune::GDT::DuneFemCgSpaceWrapper<AluConform##dd##dLeafGridPartType, pp, double, rr> - -#define SPACE_CG_FEM_ALUCUBEGRID(dd, rr, pp) \ - Dune::GDT::DuneFemCgSpaceWrapper<AluCube##dd##dLeafGridPartType, pp, double, rr> - -#define SPACES_CG_FEM_ALUGRID(pp) \ - SPACE_CG_FEM_ALUCONFORMGRID(2, 1, pp) \ - , SPACE_CG_FEM_ALUCONFORMGRID(3, 1, pp), SPACE_CG_FEM_ALUCUBEGRID(2, 1, pp), SPACE_CG_FEM_ALUCUBEGRID(3, 1, pp) - - -#define SPACE_CG_FEM_ALUCONFORMGRID_LEVEL(dd, rr, pp) \ - Dune::GDT::DuneFemCgSpaceWrapper<AluConform##dd##dLevelGridPartType, pp, double, rr> - -#define SPACE_CG_FEM_ALUCUBEGRID_LEVEL(dd, rr, pp) \ - Dune::GDT::DuneFemCgSpaceWrapper<AluCube##dd##dLevelGridPartType, pp, double, rr> - -#define SPACES_CG_FEM_ALUGRID_LEVEL(pp) \ - SPACE_CG_FEM_ALUCONFORMGRID_LEVEL(2, 1, pp) \ - , SPACE_CG_FEM_ALUCONFORMGRID_LEVEL(3, 1, pp), SPACE_CG_FEM_ALUCUBEGRID_LEVEL(2, 1, pp), \ - SPACE_CG_FEM_ALUCUBEGRID_LEVEL(3, 1, pp) - - -#endif // HAVE_DUNE_ALUGRID - -#endif // HAVE_DUNE_FEM - - -#endif // DUNE_GDT_TEST_SPACES_CG_FEM_HH diff --git a/dune/gdt/test/spaces/cg/pdelab.hh b/dune/gdt/test/spaces/cg/pdelab.hh deleted file mode 100644 index 2a868b3b1850681457e21c5c1e2b1426dedd1e32..0000000000000000000000000000000000000000 --- a/dune/gdt/test/spaces/cg/pdelab.hh +++ /dev/null @@ -1,67 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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 (2014 - 2017) -// Rene Milk (2016 - 2017) -// Tobias Leibner (2014, 2016) - -#ifndef DUNE_GDT_TEST_SPACES_CG_PDELAB_HH -#define DUNE_GDT_TEST_SPACES_CG_PDELAB_HH - -#include <dune/xt/grid/type_traits.hh> - -#include <dune/gdt/spaces/cg/dune-pdelab-wrapper.hh> - -#include <dune/gdt/test/grids.hh> - -#include <dune/xt/grid/type_traits.hh> - -#if HAVE_DUNE_PDELAB - - -#define SPACE_CG_PDELAB_YASPGRID(dd, rr, pp) \ - Dune::GDT::DunePdelabCgSpaceWrapper<Yasp##dd##dLeafGridViewType, pp, double, rr> - -#define SPACES_CG_PDELAB(pp) \ - SPACE_CG_PDELAB_YASPGRID(1, 1, pp), SPACE_CG_PDELAB_YASPGRID(2, 1, pp), SPACE_CG_PDELAB_YASPGRID(3, 1, pp) - -#define SPACE_CG_PDELAB_YASPGRID_LEVEL(dd, rr, pp) \ - Dune::GDT::DunePdelabCgSpaceWrapper<Yasp##dd##dLevelGridViewType, pp, double, rr> - -#define SPACES_CG_PDELAB_LEVEL(pp) \ - SPACE_CG_PDELAB_YASPGRID_LEVEL(1, 1, pp) \ - , SPACE_CG_PDELAB_YASPGRID_LEVEL(2, 1, pp), SPACE_CG_PDELAB_YASPGRID_LEVEL(3, 1, pp) - - -#if HAVE_DUNE_ALUGRID - - -#define SPACE_CG_PDELAB_ALUCONFORMGRID(dd, rr, pp) \ - Dune::GDT::DunePdelabCgSpaceWrapper<AluConform##dd##dLeafGridViewType, pp, double, rr> - -#define SPACE_CG_PDELAB_ALUCUBEGRID(dd, rr, pp) \ - Dune::GDT::DunePdelabCgSpaceWrapper<AluCube##dd##dLeafGridViewType, pp, double, rr> - -#define SPACES_CG_PDELAB_ALUGRID(pp) \ - SPACE_CG_PDELAB_ALUCONFORMGRID(2, 1, pp) \ - , SPACE_CG_PDELAB_ALUCONFORMGRID(3, 1, pp), SPACE_CG_PDELAB_ALUCUBEGRID(2, 1, pp), \ - SPACE_CG_PDELAB_ALUCUBEGRID(3, 1, pp) - - -#define SPACE_CG_PDELAB_ALUCUBEGRID_LEVEL(dd, rr, pp) \ - Dune::GDT::DunePdelabCgSpaceWrapper<AluCube##dd##dLevelGridViewType, pp, double, rr> - -#define SPACES_CG_PDELAB_ALUGRID_LEVEL(pp) \ - SPACE_CG_PDELAB_ALUCUBEGRID_LEVEL(2, 1, pp) \ - , SPACE_CG_PDELAB_ALUCUBEGRID_LEVEL(3, 1, pp) - - -#endif // HAVE_DUNE_ALUGRID -#endif // HAVE_DUNE_PDELAB - - -#endif // DUNE_GDT_TEST_SPACES_CG_PDELAB_HH diff --git a/dune/gdt/test/spaces/dg.hh b/dune/gdt/test/spaces/dg.hh index bd2d5ec01c47fa21e6d513d6abff0a2743b997f9..aa946d7b1d8bfad3b7f663504a67ff337fa61978 100644 --- a/dune/gdt/test/spaces/dg.hh +++ b/dune/gdt/test/spaces/dg.hh @@ -6,115 +6,50 @@ // with "runtime exception" (http://www.dune-project.org/license.html) // Authors: // Felix Schindler (2014 - 2017) -// Rene Milk (2014, 2016 - 2017) - -#ifndef DUNE_GDT_TEST_SPACES_DG_HH -#define DUNE_GDT_TEST_SPACES_DG_HH - -#include <boost/numeric/conversion/cast.hpp> - -#include <dune/xt/common/print.hh> -#include <dune/xt/common/ranges.hh> - -#include "base.hh" - - -template <class SpaceType> -class DG_Space : public SpaceBase<SpaceType> -{ -}; - - -template <class SpaceType> -struct P1Q1_DG_Space : public SpaceBase<SpaceType> -{ - typedef typename SpaceType::GridLayerType GridLayerType; - using GridType = Dune::XT::Grid::extract_grid_t<typename SpaceType::GridLayerType>; - static const size_t dimDomain = GridType::dimension; - typedef typename GridType::ctype DomainFieldType; - typedef Dune::FieldVector<DomainFieldType, dimDomain> DomainType; - - static std::vector<DomainFieldType> convert_vector(const DomainType& source) - { - std::vector<DomainFieldType> ret(dimDomain, DomainFieldType(0)); - for (size_t ii = 0; ii < dimDomain; ++ii) - ret[ii] = source[ii]; - return ret; - } - - void maps_correctly() - { - using namespace Dune::XT; - // walk the grid to create a map of all vertices - std::map<std::vector<DomainFieldType>, std::pair<std::set<size_t>, size_t>> vertex_to_indices_map; - const auto entity_end_it = this->space_.grid_layer().template end<0>(); - for (auto entity_it = this->space_.grid_layer().template begin<0>(); entity_it != entity_end_it; ++entity_it) { - const auto& entity = *entity_it; - for (auto cc : Dune::XT::Common::value_range(entity.subEntities(dimDomain))) { - const auto vertex = entity.template subEntity<dimDomain>(cc); - const DomainType vertex_center = vertex.geometry().center(); - vertex_to_indices_map[convert_vector(vertex_center)].first = std::set<size_t>(); - ++vertex_to_indices_map[convert_vector(vertex_center)].second; - } - } - // walk the grid again to find all DoF ids - for (auto entity_it = this->space_.grid_layer().template begin<0>(); entity_it != entity_end_it; ++entity_it) { - const auto& entity = *entity_it; - const size_t num_vertices = entity.subEntities(dimDomain); - const auto basis = this->space_.base_function_set(entity); - EXPECT_EQ(basis.size(), num_vertices); - for (size_t cc = 0; cc < num_vertices; ++cc) { - const auto vertex = entity.template subEntity<dimDomain>(boost::numeric_cast<int>(cc)); - const DomainType vertex_center = vertex.geometry().center(); - // find the local basis function which corresponds to this vertex - const auto basis_values = basis.evaluate(entity.geometry().local(vertex_center)); - EXPECT_EQ(basis_values.size(), num_vertices); - size_t ones = 0; - size_t zeros = 0; - size_t failures = 0; - size_t local_DoF_index = 0; - for (size_t ii = 0; ii < basis.size(); ++ii) { - if (Common::FloatCmp::eq(basis_values[ii][0], typename SpaceType::RangeFieldType(1))) { - local_DoF_index = ii; - ++ones; - } else if (Common::FloatCmp::eq(basis_values[ii][0] + 1, typename SpaceType::RangeFieldType(1))) - ++zeros; - else - ++failures; - } - if (ones != 1 || zeros != (basis.size() - 1) || failures > 0) { - std::stringstream ss; - ss << "ones = " << ones << ", zeros = " << zeros << ", failures = " << failures - << ", num_vertices = " << num_vertices << ", entity " << this->space_.grid_layer().indexSet().index(entity) - << ", vertex " << cc << ": [ " << vertex_center << "], "; - Dune::XT::Common::print(basis_values, "basis_values", ss); - EXPECT_TRUE(false) << ss.str(); - } - // now we know that the local DoF index of this vertex is ii - const size_t global_DoF_index = this->space_.mapper().mapToGlobal(entity, local_DoF_index); - vertex_to_indices_map[convert_vector(vertex_center)].first.insert(global_DoF_index); - } - } - // check that each vertex has the appropiate number of associated DoF ids and that the numbering is consecutive - std::set<size_t> global_DoF_indices; - for (const auto& entry : vertex_to_indices_map) { - const auto vertex_ids = entry.second.first; - for (auto vertex_ids_it = vertex_ids.begin(); vertex_ids_it != vertex_ids.end(); ++vertex_ids_it) - global_DoF_indices.insert(*vertex_ids_it); - } - size_t count = 0; - for (const auto& global_DoF_id : global_DoF_indices) { - EXPECT_EQ(global_DoF_id, count); - ++count; - } - for (const auto& entry : vertex_to_indices_map) { - const auto vertex_ids = entry.second.first; - size_t number_of_associated_DoF_ids = vertex_ids.size(); - size_t number_of_adjacent_entitys = entry.second.second; - EXPECT_EQ(number_of_associated_DoF_ids, number_of_adjacent_entitys); - } - } // ... maps_correctly() -}; // struct P1Q1_DG_Space - - -#endif // DUNE_GDT_TEST_SPACES_DG_HH +// Rene Milk (2016) +// Tobias Leibner (2014, 2016) + +#ifndef DUNE_GDT_TEST_SPACES_DG_DEFAULT_HH +#define DUNE_GDT_TEST_SPACES_DG_DEFAULT_HH + +#include <dune/gdt/spaces/dg.hh> +#include <dune/gdt/test/grids.hh> + + +#define SPACE_DG_YASPGRID(dd, rr, pp) Dune::GDT::DiscontinuousLagrangeSpace<Yasp##dd##dLeafGridViewType, pp, double> + +#define SPACE_DG_YASPGRID_LEVEL(dd, rr, pp) \ + Dune::GDT::DiscontinuousLagrangeSpace<Yasp##dd##dLevelGridViewType, pp, double> + +#define SPACES_DG_LEVEL(pp) \ + SPACE_DG_YASPGRID_LEVEL(1, 1, pp), SPACE_DG_YASPGRID_LEVEL(2, 1, pp), SPACE_DG_YASPGRID_LEVEL(3, 1, pp) + + +#if HAVE_DUNE_ALUGRID + + +#define SPACE_DG_ALUCONFORMGRID(dd, rr, pp) \ + Dune::GDT::DiscontinuousLagrangeSpace<AluConform##dd##dLeafGridViewType, pp, double> + +#define SPACE_DG_ALUCUBEGRID(dd, rr, pp) \ + Dune::GDT::DiscontinuousLagrangeSpace<AluCube##dd##dLeafGridViewType, pp, double> + +#define SPACES_DG_ALUGRID(pp) \ + SPACE_DG_ALUCONFORMGRID(2, 1, pp) \ + , SPACE_DG_ALUCONFORMGRID(3, 1, pp), SPACE_DG_ALUCUBEGRID(2, 1, pp), SPACE_DG_ALUCUBEGRID(3, 1, pp) + + +#define SPACE_DG_ALUCONFORMGRID_LEVEL(dd, rr, pp) \ + Dune::GDT::DiscontinuousLagrangeSpace<AluConform##dd##dLevelGridViewType, pp, double> + +#define SPACE_DG_ALUCUBEGRID_LEVEL(dd, rr, pp) \ + Dune::GDT::DiscontinuousLagrangeSpace<AluCube##dd##dLevelGridViewType, pp, double> + +#define SPACES_DG_ALUGRID_LEVEL(pp) \ + SPACE_DG_ALUCONFORMGRID_LEVEL(2, 1, pp) \ + , SPACE_DG_ALUCONFORMGRID_LEVEL(3, 1, pp), SPACE_DG_ALUCUBEGRID_LEVEL(2, 1, pp), SPACE_DG_ALUCUBEGRID_LEVEL(3, 1, pp) + + +#endif // HAVE_DUNE_ALUGRID + +#endif // DUNE_GDT_TEST_SPACES_DG_DEFAULT_HH diff --git a/dune/gdt/test/spaces/dg/fem.hh b/dune/gdt/test/spaces/dg/fem.hh deleted file mode 100644 index 17d61d0d3699ffa232a6428bbf6003a4669ec0eb..0000000000000000000000000000000000000000 --- a/dune/gdt/test/spaces/dg/fem.hh +++ /dev/null @@ -1,63 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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 (2014 - 2017) -// Rene Milk (2016) -// Tobias Leibner (2014, 2016) - -#ifndef DUNE_GDT_TEST_SPACES_DG_FEM_HH -#define DUNE_GDT_TEST_SPACES_DG_FEM_HH - -#include <dune/gdt/spaces/dg/dune-fem-wrapper.hh> - -#include <dune/gdt/test/grids.hh> - -#if HAVE_DUNE_FEM - - -#define SPACE_DG_FEM_YASPGRID(dd, rr, pp) Dune::GDT::DuneFemDgSpaceWrapper<Yasp##dd##dLeafGridPartType, pp, double, rr> - -#define SPACES_DG_FEM(pp) \ - SPACE_DG_FEM_YASPGRID(1, 1, pp), SPACE_DG_FEM_YASPGRID(2, 1, pp), SPACE_DG_FEM_YASPGRID(3, 1, pp) - -#define SPACE_DG_FEM_YASPGRID_LEVEL(dd, rr, pp) \ - Dune::GDT::DuneFemDgSpaceWrapper<Yasp##dd##dLevelGridPartType, pp, double, rr> - -#define SPACES_DG_FEM_LEVEL(pp) \ - SPACE_DG_FEM_YASPGRID_LEVEL(1, 1, pp), SPACE_DG_FEM_YASPGRID_LEVEL(2, 1, pp), SPACE_DG_FEM_YASPGRID_LEVEL(3, 1, pp) - - -#if HAVE_DUNE_ALUGRID - - -#define SPACE_DG_FEM_ALUCONFORMGRID(dd, rr, pp) \ - Dune::GDT::DuneFemDgSpaceWrapper<AluConform##dd##dLeafGridPartType, pp, double, rr> - -#define SPACE_DG_FEM_ALUCUBEGRID(dd, rr, pp) \ - Dune::GDT::DuneFemDgSpaceWrapper<AluCube##dd##dLeafGridPartType, pp, double, rr> - -#define SPACES_DG_FEM_ALUGRID(pp) \ - SPACE_DG_FEM_ALUCONFORMGRID(2, 1, pp) \ - , SPACE_DG_FEM_ALUCONFORMGRID(3, 1, pp), SPACE_DG_FEM_ALUCUBEGRID(2, 1, pp), SPACE_DG_FEM_ALUCUBEGRID(3, 1, pp) - - -#define SPACE_DG_FEM_ALUCONFORMGRID_LEVEL(dd, rr, pp) \ - Dune::GDT::DuneFemDgSpaceWrapper<AluConform##dd##dLevelGridPartType, pp, double, rr> - -#define SPACE_DG_FEM_ALUCUBEGRID_LEVEL(dd, rr, pp) \ - Dune::GDT::DuneFemDgSpaceWrapper<AluCube##dd##dLevelGridPartType, pp, double, rr> - -#define SPACES_DG_FEM_ALUGRID_LEVEL(pp) \ - SPACE_DG_FEM_ALUCONFORMGRID_LEVEL(2, 1, pp) \ - , SPACE_DG_FEM_ALUCONFORMGRID_LEVEL(3, 1, pp), SPACE_DG_FEM_ALUCUBEGRID_LEVEL(2, 1, pp), \ - SPACE_DG_FEM_ALUCUBEGRID_LEVEL(3, 1, pp) - - -#endif // HAVE_DUNE_ALUGRID -#endif // HAVE_DUNE_FEM - -#endif // DUNE_GDT_TEST_SPACES_DG_FEM_HH diff --git a/dune/gdt/test/spaces/dg/pdelab.hh b/dune/gdt/test/spaces/dg/pdelab.hh deleted file mode 100644 index 0ad196251e6b9f8f20724b80568a18f4c093e491..0000000000000000000000000000000000000000 --- a/dune/gdt/test/spaces/dg/pdelab.hh +++ /dev/null @@ -1,58 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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 (2014 - 2017) -// Rene Milk (2016) -// Tobias Leibner (2014, 2016) - -#ifndef DUNE_GDT_TEST_SPACES_DG_PDELAB_HH -#define DUNE_GDT_TEST_SPACES_DG_PDELAB_HH - -#include <dune/gdt/playground/spaces/dg/dune-pdelab-wrapper.hh> - -#include <dune/gdt/test/grids.hh> - -#if HAVE_DUNE_PDELAB - - -#define SPACE_DG_PDELAB_YASPGRID(dd, rr, pp) \ - Dune::GDT::DunePdelabDgSpaceWrapper<Yasp##dd##dLeafGridViewType, pp, double, rr> - -#define SPACES_DG_PDELAB(pp) \ - SPACE_DG_PDELAB_YASPGRID(1, 1, pp), SPACE_DG_PDELAB_YASPGRID(2, 1, pp), SPACE_DG_PDELAB_YASPGRID(3, 1, pp) - -#define SPACE_DG_PDELAB_YASPGRID_LEVEL(dd, rr, pp) \ - Dune::GDT::DunePdelabDgSpaceWrapper<Yasp##dd##dLevelGridViewType, pp, double, rr> - -#define SPACES_DG_PDELAB_LEVEL(pp) \ - SPACE_DG_PDELAB_YASPGRID_LEVEL(1, 1, pp) \ - , SPACE_DG_PDELAB_YASPGRID_LEVEL(2, 1, pp), SPACE_DG_PDELAB_YASPGRID_LEVEL(3, 1, pp) - - -#if HAVE_DUNE_ALUGRID - - -#define SPACE_DG_PDELAB_ALUCUBEGRID(dd, rr, pp) \ - Dune::GDT::DunePdelabDgSpaceWrapper<AluCube##dd##dLeafGridViewType, pp, double, rr> - -#define SPACES_DG_PDELAB_ALUGRID(pp) \ - SPACE_DG_PDELAB_ALUCUBEGRID(2, 1, pp) \ - , SPACE_DG_PDELAB_ALUCUBEGRID(3, 1, pp) - - -#define SPACE_DG_PDELAB_ALUCUBEGRID_LEVEL(dd, rr, pp) \ - Dune::GDT::DunePdelabDgSpaceWrapper<AluCube##dd##dLevelGridViewType, pp, double, rr> - -#define SPACES_DG_PDELAB_ALUGRID_LEVEL(pp) \ - SPACE_DG_PDELAB_ALUCUBEGRID_LEVEL(2, 1, pp) \ - , SPACE_DG_PDELAB_ALUCUBEGRID_LEVEL(3, 1, pp) - - -#endif // HAVE_DUNE_ALUGRID -#endif // HAVE_DUNE_PDELAB - -#endif // DUNE_GDT_TEST_SPACES_DG_PDELAB_HH diff --git a/dune/gdt/test/spaces/fv.hh b/dune/gdt/test/spaces/fv.hh index 9a5907c14670f9cc35fc631a1ea26eec1f7d7266..07cb87dcb29b571fc7aee391f60ca15bd3cee758 100644 --- a/dune/gdt/test/spaces/fv.hh +++ b/dune/gdt/test/spaces/fv.hh @@ -5,18 +5,46 @@ // or GPL-2.0+ (http://opensource.org/licenses/gpl-license) // with "runtime exception" (http://www.dune-project.org/license.html) // Authors: -// Felix Schindler (2014, 2016 - 2017) +// Felix Schindler (2014 - 2017) +// Rene Milk (2016) +// Tobias Leibner (2014, 2016) -#ifndef DUNE_GDT_TEST_SPACES_FV_HH -#define DUNE_GDT_TEST_SPACES_FV_HH +#ifndef DUNE_GDT_TEST_SPACES_FV_DEFAULT_HH +#define DUNE_GDT_TEST_SPACES_FV_DEFAULT_HH -#include "base.hh" +#include <dune/gdt/spaces/fv.hh> +#include <dune/gdt/test/grids.hh> -template <class SpaceType> -class FV_Space : public SpaceBase<SpaceType> -{ -}; +#define SPACE_FV_YASPGRID(dd, rr) Dune::GDT::FvSpace<Yasp##dd##dLeafGridViewType, double, rr> -#endif // DUNE_GDT_TEST_SPACES_FV_HH +#define SPACES_FV \ + SPACE_FV_YASPGRID(1, 1) \ + , SPACE_FV_YASPGRID(1, 2), SPACE_FV_YASPGRID(1, 3), SPACE_FV_YASPGRID(2, 1), SPACE_FV_YASPGRID(2, 2), \ + SPACE_FV_YASPGRID(2, 3), SPACE_FV_YASPGRID(3, 1), SPACE_FV_YASPGRID(3, 2), SPACE_FV_YASPGRID(3, 3) + +#define SPACE_FV_YASPGRID_LEVEL(dd, rr) Dune::GDT::FvSpace<Yasp##dd##dLevelGridViewType, double, rr> + +#if HAVE_DUNE_ALUGRID + +#define SPACE_FV_ALUCONFORMGRID(dd, rr) Dune::GDT::FvSpace<AluConform##dd##dLeafGridViewType, double, rr> + +#define SPACE_FV_ALUCUBEGRID(dd, rr) Dune::GDT::FvSpace<AluCube##dd##dLeafGridViewType, double, rr> + +#define SPACES_FV_ALUGRID \ + SPACE_FV_ALUCONFORMGRID(2, 1) \ + , SPACE_FV_ALUCONFORMGRID(2, 2), SPACE_FV_ALUCONFORMGRID(2, 3), SPACE_FV_ALUCONFORMGRID(3, 1), \ + SPACE_FV_ALUCONFORMGRID(3, 2), SPACE_FV_ALUCONFORMGRID(3, 3), SPACE_FV_ALUCUBEGRID(2, 1), \ + SPACE_FV_ALUCUBEGRID(2, 2), SPACE_FV_ALUCUBEGRID(2, 3), SPACE_FV_ALUCUBEGRID(3, 1), SPACE_FV_ALUCUBEGRID(3, 2), \ + SPACE_FV_ALUCUBEGRID(3, 3) + + +#define SPACE_FV_ALUCONFORMGRID_LEVEL(dd, rr) Dune::GDT::FvSpace<AluConform##dd##dLevelGridViewType, double, rr> + +#define SPACE_FV_ALUCUBEGRID_LEVEL(dd, rr) Dune::GDT::FvSpace<AluCube##dd##dLevelGridViewType, double, rr> + +#endif // HAVE_DUNE_ALUGRID + + +#endif // DUNE_GDT_TEST_SPACES_FV_DEFAULT_HH diff --git a/dune/gdt/test/spaces/fv/default.hh b/dune/gdt/test/spaces/fv/default.hh deleted file mode 100644 index 172f3da6a35f451f5df88bb9cd52cf73baf25597..0000000000000000000000000000000000000000 --- a/dune/gdt/test/spaces/fv/default.hh +++ /dev/null @@ -1,50 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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 (2014 - 2017) -// Rene Milk (2016) -// Tobias Leibner (2014, 2016) - -#ifndef DUNE_GDT_TEST_SPACES_FV_DEFAULT_HH -#define DUNE_GDT_TEST_SPACES_FV_DEFAULT_HH - -#include <dune/gdt/spaces/fv/default.hh> - -#include <dune/gdt/test/grids.hh> - - -#define SPACE_FV_YASPGRID(dd, rr) Dune::GDT::FvSpace<Yasp##dd##dLeafGridViewType, double, rr> - -#define SPACES_FV \ - SPACE_FV_YASPGRID(1, 1) \ - , SPACE_FV_YASPGRID(1, 2), SPACE_FV_YASPGRID(1, 3), SPACE_FV_YASPGRID(2, 1), SPACE_FV_YASPGRID(2, 2), \ - SPACE_FV_YASPGRID(2, 3), SPACE_FV_YASPGRID(3, 1), SPACE_FV_YASPGRID(3, 2), SPACE_FV_YASPGRID(3, 3) - -#define SPACE_FV_YASPGRID_LEVEL(dd, rr) Dune::GDT::FvSpace<Yasp##dd##dLevelGridViewType, double, rr> - -#if HAVE_DUNE_ALUGRID - -#define SPACE_FV_ALUCONFORMGRID(dd, rr) Dune::GDT::FvSpace<AluConform##dd##dLeafGridViewType, double, rr> - -#define SPACE_FV_ALUCUBEGRID(dd, rr) Dune::GDT::FvSpace<AluCube##dd##dLeafGridViewType, double, rr> - -#define SPACES_FV_ALUGRID \ - SPACE_FV_ALUCONFORMGRID(2, 1) \ - , SPACE_FV_ALUCONFORMGRID(2, 2), SPACE_FV_ALUCONFORMGRID(2, 3), SPACE_FV_ALUCONFORMGRID(3, 1), \ - SPACE_FV_ALUCONFORMGRID(3, 2), SPACE_FV_ALUCONFORMGRID(3, 3), SPACE_FV_ALUCUBEGRID(2, 1), \ - SPACE_FV_ALUCUBEGRID(2, 2), SPACE_FV_ALUCUBEGRID(2, 3), SPACE_FV_ALUCUBEGRID(3, 1), SPACE_FV_ALUCUBEGRID(3, 2), \ - SPACE_FV_ALUCUBEGRID(3, 3) - - -#define SPACE_FV_ALUCONFORMGRID_LEVEL(dd, rr) Dune::GDT::FvSpace<AluConform##dd##dLevelGridViewType, double, rr> - -#define SPACE_FV_ALUCUBEGRID_LEVEL(dd, rr) Dune::GDT::FvSpace<AluCube##dd##dLevelGridViewType, double, rr> - -#endif // HAVE_DUNE_ALUGRID - - -#endif // DUNE_GDT_TEST_SPACES_FV_DEFAULT_HH diff --git a/dune/gdt/test/spaces/rt.hh b/dune/gdt/test/spaces/rt.hh index a66062b77402b680c869ef687b09079ad8f81305..0983d6efbb2798b1e0eab26e99e75761d7ce23a0 100644 --- a/dune/gdt/test/spaces/rt.hh +++ b/dune/gdt/test/spaces/rt.hh @@ -7,49 +7,47 @@ // Authors: // Felix Schindler (2014 - 2017) // Rene Milk (2016 - 2017) -// Tobias Leibner (2016) +// Tobias Leibner (2014, 2016) #ifndef DUNE_GDT_TEST_SPACES_RT_HH #define DUNE_GDT_TEST_SPACES_RT_HH -#include <dune/common/unused.hh> +#include <dune/xt/grid/type_traits.hh> -#include <dune/xt/common/ranges.hh> +#include <dune/gdt/spaces/rt/default.hh> -#include <dune/gdt/spaces/rt/interface.hh> +#include <dune/gdt/test/grids.hh> -#include "base.hh" +#include <dune/xt/grid/type_traits.hh> +#define SPACE_RT_YASPGRID(dd) Dune::GDT::RaviartThomasSpace<Yasp##dd##dLeafGridViewType, 0, double> -template <class SpaceType> -class RT_Space : public SpaceBase<SpaceType> -{ - template <class T, size_t d, size_t r, size_t rC> - void matches_signature(const Dune::GDT::RtSpaceInterface<T, d, r, rC>& /*space*/) - { - static_assert(Dune::GDT::is_rt_space<SpaceType>::value, ""); - static_assert(std::is_same<typename SpaceType::Traits, T>::value, ""); - static_assert(d == SpaceType::dimDomain, ""); - static_assert(r == SpaceType::dimRange, ""); - static_assert(rC == SpaceType::dimRangeCols, ""); - } +#define SPACES_RT SPACE_RT_YASPGRID(2), SPACE_RT_YASPGRID(3) -public: - virtual ~RT_Space() - { - } +#define SPACE_RT_YASPGRID_LEVEL(dd) Dune::GDT::RaviartThomasSpace<Yasp##dd##dLevelGridViewType, 0, double> - void matches_raviart_thomas_signature() - { - matches_signature(this->space_); - } +#define SPACES_RT_LEVEL SPACE_RT_YASPGRID_LEVEL(2), SPACE_RT_YASPGRID_LEVEL(3) - void fulfills_raviart_thomas_2d_simplicial_interface() - { - for (const auto& entity : elements(this->space_.grid_layer())) - auto local_DoF_indices DUNE_UNUSED = this->space_.local_DoF_indices(entity); - } -}; +#if HAVE_DUNE_ALUGRID + +#define SPACE_RT_ALUCONFORMGRID(dd) Dune::GDT::RaviartThomasSpace<AluConform##dd##dLeafGridViewType, 0, double> + +#define SPACE_RT_ALUCUBEGRID(dd) Dune::GDT::RaviartThomasSpace<AluCube##dd##dLeafGridViewType, 0, double> + +#define SPACES_RT_ALUGRID \ + SPACE_RT_ALUCONFORMGRID(2) \ + , SPACE_RT_ALUCUBEGRID(2), SPACE_RT_ALUCUBEGRID(3) + + +#define SPACE_RT_ALUCONFORMGRID_LEVEL(dd) Dune::GDT::RaviartThomasSpace<AluConform##dd##dLevelGridViewType, 0, double> + +#define SPACE_RT_ALUCUBEGRID_LEVEL(dd) Dune::GDT::RaviartThomasSpace<AluCube##dd##dLevelGridViewType, 0, double> + +#define SPACES_RT_ALUGRID_LEVEL \ + SPACE_RT_ALUCONFORMGRID_LEVEL(2) \ + , SPACE_RT_ALUCUBEGRID_LEVEL(2), SPACE_RT_ALUCUBEGRID_LEVEL(3) + +#endif // HAVE_DUNE_ALUGRID #endif // DUNE_GDT_TEST_SPACES_RT_HH diff --git a/dune/gdt/test/spaces/rt/pdelab.hh b/dune/gdt/test/spaces/rt/pdelab.hh deleted file mode 100644 index 2522573c34ab691f5dd4267bb05c0e819764fc45..0000000000000000000000000000000000000000 --- a/dune/gdt/test/spaces/rt/pdelab.hh +++ /dev/null @@ -1,58 +0,0 @@ -// This file is part of the dune-gdt project: -// https://github.com/dune-community/dune-gdt -// Copyright 2010-2018 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 (2014 - 2017) -// Rene Milk (2016 - 2017) -// Tobias Leibner (2014, 2016) - -#ifndef DUNE_GDT_TEST_SPACES_RT_PDELAB_HH -#define DUNE_GDT_TEST_SPACES_RT_PDELAB_HH - -#include <dune/xt/grid/type_traits.hh> - -#include <dune/gdt/spaces/rt/dune-pdelab-wrapper.hh> - -#include <dune/gdt/test/grids.hh> - -#include <dune/xt/grid/type_traits.hh> - -#define SPACE_RT_PDELAB_YASPGRID(dd) Dune::GDT::DunePdelabRtSpaceWrapper<Yasp##dd##dLeafGridViewType, 0, double, dd> - -#define SPACES_RT_PDELAB SPACE_RT_PDELAB_YASPGRID(2), SPACE_RT_PDELAB_YASPGRID(3) - -#define SPACE_RT_PDELAB_YASPGRID_LEVEL(dd) \ - Dune::GDT::DunePdelabRtSpaceWrapper<Yasp##dd##dLevelGridViewType, 0, double, dd> - -#define SPACES_RT_PDELAB_LEVEL SPACE_RT_PDELAB_YASPGRID_LEVEL(2), SPACE_RT_PDELAB_YASPGRID_LEVEL(3) - -#if HAVE_DUNE_ALUGRID - -#define SPACE_RT_PDELAB_ALUCONFORMGRID(dd) \ - Dune::GDT::DunePdelabRtSpaceWrapper<AluConform##dd##dLeafGridViewType, 0, double, dd> - -#define SPACE_RT_PDELAB_ALUCUBEGRID(dd) \ - Dune::GDT::DunePdelabRtSpaceWrapper<AluCube##dd##dLeafGridViewType, 0, double, dd> - -#define SPACES_RT_PDELAB_ALUGRID \ - SPACE_RT_PDELAB_ALUCONFORMGRID(2) \ - , SPACE_RT_PDELAB_ALUCUBEGRID(2), SPACE_RT_PDELAB_ALUCUBEGRID(3) - - -#define SPACE_RT_PDELAB_ALUCONFORMGRID_LEVEL(dd) \ - Dune::GDT::DunePdelabRtSpaceWrapper<AluConform##dd##dLevelGridViewType, 0, double, dd> - -#define SPACE_RT_PDELAB_ALUCUBEGRID_LEVEL(dd) \ - Dune::GDT::DunePdelabRtSpaceWrapper<AluCube##dd##dLevelGridViewType, 0, double, dd> - -#define SPACES_RT_PDELAB_ALUGRID_LEVEL \ - SPACE_RT_PDELAB_ALUCONFORMGRID_LEVEL(2) \ - , SPACE_RT_PDELAB_ALUCUBEGRID_LEVEL(2), SPACE_RT_PDELAB_ALUCUBEGRID_LEVEL(3) - -#endif // HAVE_DUNE_ALUGRID - - -#endif // DUNE_GDT_TEST_SPACES_RT_PDELAB_HH diff --git a/dune/gdt/test/spaces/spaces_cg.cc b/dune/gdt/test/spaces/spaces_cg.cc new file mode 100644 index 0000000000000000000000000000000000000000..a650fc10a1c3ad4a924da973f15a1646c618a6be --- /dev/null +++ b/dune/gdt/test/spaces/spaces_cg.cc @@ -0,0 +1,745 @@ +// 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 <dune/xt/common/test/main.hxx> // <- this one has to come first (includes the config.h)! + +#include <algorithm> +#include <memory> +#include <tuple> + +#include <dune/geometry/quadraturerules.hh> +#include <dune/geometry/referenceelements.hh> +#include <dune/geometry/refinement.hh> + +#include <dune/grid/common/rangegenerators.hh> + +#include <dune/xt/common/fvector.hh> +#include <dune/xt/common/numeric_cast.hh> +#include <dune/xt/grid/gridprovider/cube.hh> + +#include <dune/gdt/spaces/cg.hh> + + +template <class GridLayerType, int p> +struct ContinuousLagrangeSpace : public ::testing::Test +{ + using SpaceType = Dune::GDT::ContinuousLagrangeSpace<GridLayerType, p>; + using D = typename SpaceType::DomainFieldType; + static const constexpr size_t d = SpaceType::dimDomain; + + virtual std::shared_ptr<GridLayerType> grid_layer() = 0; + + std::shared_ptr<SpaceType> space; + + ~ContinuousLagrangeSpace() = default; + + void SetUp() override final + { + ASSERT_TRUE(grid_layer() != nullptr && grid_layer() != 0); + space = std::shared_ptr<SpaceType>(new SpaceType(*grid_layer())); + } + + void TearDown() override final + { + space.reset(); + } + + void basis_exists_on_each_element_with_correct_size() + { + ASSERT_TRUE(grid_layer() != nullptr && grid_layer() != 0); + ASSERT_TRUE(space != nullptr && space != 0); + for (auto&& element : elements(*grid_layer())) + EXPECT_EQ(Dune::numLagrangePoints(element.geometry().type().id(), d, p), + space->base_function_set(element).size()); + } + + void basis_exists_on_each_element_with_correct_order() + { + ASSERT_TRUE(grid_layer() != nullptr && grid_layer() != 0); + ASSERT_TRUE(space != nullptr && space != 0); + for (auto&& element : elements(*grid_layer())) + EXPECT_EQ(p, space->base_function_set(element).order()); + } + + void mapper_reports_correct_num_DoFs_on_each_element() + { + ASSERT_TRUE(grid_layer() != nullptr && grid_layer() != 0); + ASSERT_TRUE(space != nullptr && space != 0); + for (auto&& element : elements(*grid_layer())) + EXPECT_EQ(Dune::numLagrangePoints(element.geometry().type().id(), d, p), space->mapper().numDofs(element)); + } + + void mapper_reports_correct_max_num_DoFs() + { + ASSERT_TRUE(grid_layer() != nullptr && grid_layer() != 0); + ASSERT_TRUE(space != nullptr && space != 0); + size_t max_num_dofs = 0; + for (auto&& element : elements(*grid_layer())) + max_num_dofs = std::max(max_num_dofs, space->mapper().numDofs(element)); + EXPECT_LE(max_num_dofs, space->mapper().maxNumDofs()); + } + + void mapper_maps_correctly() + { + ASSERT_TRUE(grid_layer() != nullptr && grid_layer() != 0); + ASSERT_TRUE(space != nullptr && space != 0); + // collect all global ids that are associated with a global lagrange point + std::map<Dune::FieldVector<D, d>, std::set<size_t>, Dune::XT::Common::FieldVectorLess> + global_lagrange_point_to_global_indices_map; + for (auto&& element : elements(*grid_layer())) { + const auto global_indices = space->mapper().globalIndices(element); + EXPECT_LE(space->mapper().numDofs(element), global_indices.size()); + const auto lagrange_points = space->lagrange_points(element); + EXPECT_EQ(lagrange_points.size(), space->mapper().numDofs(element)); + for (size_t ii = 0; ii < lagrange_points.size(); ++ii) { + const auto global_lagrange_point = element.geometry().global(lagrange_points[ii]); + const auto global_index = space->mapper().mapToGlobal(element, ii); + EXPECT_EQ(global_indices[ii], global_index); + global_lagrange_point_to_global_indices_map[global_lagrange_point].insert(global_index); + } + } + // check that all global lagrange points have indeed one and only one global DoF id ... + std::set<size_t> global_DoF_indices; + for (const auto& entry : global_lagrange_point_to_global_indices_map) { + const auto global_DoF_indices_per_point = entry.second; + EXPECT_EQ(global_DoF_indices_per_point.size(), 1); + global_DoF_indices.insert(*(global_DoF_indices_per_point.begin())); + } + EXPECT_EQ(global_lagrange_point_to_global_indices_map.size(), global_DoF_indices.size()); + // ... and that the numbering is consecutive + size_t count = 0; + for (const auto& global_DoF_id : global_DoF_indices) { + EXPECT_EQ(global_DoF_id, count); + ++count; + } + EXPECT_EQ(global_DoF_indices.size(), space->mapper().size()); + } // ... mapper_maps_correctly(...) + + void lagrange_points_exist_on_each_element_with_correct_size() + { + ASSERT_TRUE(grid_layer() != nullptr && grid_layer() != 0); + ASSERT_TRUE(space != nullptr && space != 0); + for (auto&& element : elements(*grid_layer())) + EXPECT_EQ(Dune::numLagrangePoints(element.geometry().type().id(), d, p), space->lagrange_points(element).size()); + } + + void basis_is_lagrange_basis() + { + ASSERT_TRUE(grid_layer() != nullptr && grid_layer() != 0); + ASSERT_TRUE(space != nullptr && space != 0); + for (auto&& element : elements(*grid_layer())) { + const auto basis = space->base_function_set(element); + const auto lagrange_points = space->lagrange_points(element); + EXPECT_EQ(lagrange_points.size(), basis.size()); + for (size_t ii = 0; ii < lagrange_points.size(); ++ii) { + const auto values = basis.evaluate(lagrange_points[ii]); + for (size_t jj = 0; jj < basis.size(); ++jj) { + EXPECT_TRUE(Dune::XT::Common::FloatCmp::eq(values[jj][0], ii == jj ? 1. : 0.)) + << "lagrange_points[" << ii << "] = " << lagrange_points[ii] + << "\nbasis.evaluate(lagrange_points[ii]) = " << values; + } + } + } + } // ... basis_is_lagrange_basis(...) + + void basis_jacobians_seem_to_be_correct() + { + ASSERT_TRUE(grid_layer() != nullptr && grid_layer() != 0); + ASSERT_TRUE(space != nullptr && space != 0); + for (auto&& element : elements(*grid_layer())) { + const auto& reference_element = Dune::ReferenceElements<D, d>::general(element.geometry().type()); + const auto basis = space->base_function_set(element); + const double h = 1e-6; + for (const auto& quadrature_point : Dune::QuadratureRules<D, d>::rule(element.geometry().type(), basis.order())) { + const auto& xx = quadrature_point.position(); + const auto& J_inv_T = element.geometry().jacobianInverseTransposed(xx); + const auto jacobians = basis.jacobian(xx); + EXPECT_EQ(basis.size(), jacobians.size()); + const auto values_xx = basis.evaluate(xx); + EXPECT_EQ(basis.size(), values_xx.size()); + auto approximate_jacobians = jacobians; + // compute approximate partial derivatives + for (size_t dd = 0; dd < d; ++dd) { + // try to find a suitable x + h + auto xx_plus_h = xx; + xx_plus_h[dd] += h; + if (!reference_element.checkInside(xx_plus_h)) { + xx_plus_h[dd] -= 2. * h; + } + ASSERT_TRUE(reference_element.checkInside(xx_plus_h)) << "xx_plus_h = " << xx_plus_h + << " is not inside the reference element!"; + const auto values_xx_plus_h = basis.evaluate(xx_plus_h); + EXPECT_EQ(basis.size(), values_xx_plus_h.size()); + for (size_t ii = 0; ii < basis.size(); ++ii) { + approximate_jacobians[ii][0][dd] = (values_xx_plus_h[ii] - values_xx[ii]) / (xx_plus_h[dd] - xx[dd]); + if (xx_plus_h[dd] - xx[dd] < 0) + approximate_jacobians[ii][0][dd] *= -1.; + } + } + // transform + auto tmp_jac = approximate_jacobians[0][0]; + for (size_t ii = 0; ii < basis.size(); ++ii) { + J_inv_T.mv(approximate_jacobians[ii][0], tmp_jac); + approximate_jacobians[ii][0] = tmp_jac; + } + // check + for (size_t ii = 0; ii < basis.size(); ++ii) + EXPECT_TRUE(Dune::XT::Common::FloatCmp::eq(jacobians[ii][0], approximate_jacobians[ii][0], 1e-4, 1e-4)) + << "ii = " << ii << "\njacobians[ii][0] = " << jacobians[ii][0] << "\n" + << "approximate_jacobians[ii][0] = " << approximate_jacobians[ii][0] << "\n" + << "absolue L_infty error: " << (jacobians[ii][0] - approximate_jacobians[ii][0]).infinity_norm() << "\n" + << "relative L_infty error: " + << (jacobians[ii][0] - approximate_jacobians[ii][0]).infinity_norm() / jacobians[ii][0].infinity_norm(); + } + } + } // ... basis_jacobians_seem_to_be_correct(...) +}; // struct ContinuousLagrangeSpace + + +template <class G, int p> +struct ContinuousLagrangeSpaceOnSimplicialLeafView + : public ContinuousLagrangeSpace<typename Dune::XT::Grid::GridProvider<G>::LeafGridViewType, p> +{ + using GridProviderType = Dune::XT::Grid::GridProvider<G>; + using LeafGridViewType = typename GridProviderType::LeafGridViewType; + + GridProviderType grid_provider; + std::shared_ptr<LeafGridViewType> leaf_view; + + ContinuousLagrangeSpaceOnSimplicialLeafView() // (i) negative coordinates and not the same as the reference + : grid_provider(Dune::XT::Grid::make_cube_grid<G>(-1.5, -1, 3).grid_ptr()) // element, + { // (ii) at least 3 elements to have fully inner ones, + grid_provider.global_refine(1); // (iii) refine at least once to obtain all kinds of orientations + leaf_view = std::make_shared<LeafGridViewType>(grid_provider.leaf_view()); + } + + ~ContinuousLagrangeSpaceOnSimplicialLeafView() = default; + + std::shared_ptr<LeafGridViewType> grid_layer() override final + { + return leaf_view; + } +}; // struct ContinuousLagrangeSpaceOnSimplicialLeafView + + +using SimplicialGrids = ::testing::Types<ONED_1D, + YASP_1D_EQUIDISTANT_OFFSET +#if HAVE_DUNE_ALUGRID + , + ALU_2D_SIMPLEX_CONFORMING, + ALU_2D_SIMPLEX_NONCONFORMING +#endif +#if HAVE_DUNE_UGGRID || HAVE_UG + , + UG_2D +#endif +#if HAVE_DUNE_ALUGRID + , + ALU_3D_SIMPLEX_CONFORMING, + ALU_3D_SIMPLEX_NONCONFORMING +#endif +#if HAVE_DUNE_UGGRID || HAVE_UG + , + UG_3D +#endif + >; + + +template <class G> +using Order1SimplicialContinuousLagrangeSpace = ContinuousLagrangeSpaceOnSimplicialLeafView<G, 1>; +TYPED_TEST_CASE(Order1SimplicialContinuousLagrangeSpace, SimplicialGrids); +TYPED_TEST(Order1SimplicialContinuousLagrangeSpace, basis_exists_on_each_element_with_correct_size) +{ + this->basis_exists_on_each_element_with_correct_size(); +} +TYPED_TEST(Order1SimplicialContinuousLagrangeSpace, basis_exists_on_each_element_with_correct_order) +{ + this->basis_exists_on_each_element_with_correct_order(); +} +TYPED_TEST(Order1SimplicialContinuousLagrangeSpace, mapper_reports_correct_num_DoFs_on_each_element) +{ + this->mapper_reports_correct_num_DoFs_on_each_element(); +} +TYPED_TEST(Order1SimplicialContinuousLagrangeSpace, mapper_reports_correct_max_num_DoFs) +{ + this->mapper_reports_correct_max_num_DoFs(); +} +TYPED_TEST(Order1SimplicialContinuousLagrangeSpace, mapper_maps_correctly) +{ + this->mapper_maps_correctly(); +} +TYPED_TEST(Order1SimplicialContinuousLagrangeSpace, lagrange_points_exist_on_each_element_with_correct_size) +{ + this->lagrange_points_exist_on_each_element_with_correct_size(); +} +TYPED_TEST(Order1SimplicialContinuousLagrangeSpace, basis_is_lagrange_basis) +{ + this->basis_is_lagrange_basis(); +} +TYPED_TEST(Order1SimplicialContinuousLagrangeSpace, basis_jacobians_seem_to_be_correct) +{ + this->basis_jacobians_seem_to_be_correct(); +} + + +template <class G> +using Order2SimplicialContinuousLagrangeSpace = ContinuousLagrangeSpaceOnSimplicialLeafView<G, 2>; +TYPED_TEST_CASE(Order2SimplicialContinuousLagrangeSpace, SimplicialGrids); +TYPED_TEST(Order2SimplicialContinuousLagrangeSpace, basis_exists_on_each_element_with_correct_size) +{ + this->basis_exists_on_each_element_with_correct_size(); +} +TYPED_TEST(Order2SimplicialContinuousLagrangeSpace, basis_exists_on_each_element_with_correct_order) +{ + this->basis_exists_on_each_element_with_correct_order(); +} +TYPED_TEST(Order2SimplicialContinuousLagrangeSpace, mapper_reports_correct_num_DoFs_on_each_element) +{ + this->mapper_reports_correct_num_DoFs_on_each_element(); +} +TYPED_TEST(Order2SimplicialContinuousLagrangeSpace, mapper_reports_correct_max_num_DoFs) +{ + this->mapper_reports_correct_max_num_DoFs(); +} +TYPED_TEST(Order2SimplicialContinuousLagrangeSpace, mapper_maps_correctly) +{ + this->mapper_maps_correctly(); +} +TYPED_TEST(Order2SimplicialContinuousLagrangeSpace, lagrange_points_exist_on_each_element_with_correct_size) +{ + this->lagrange_points_exist_on_each_element_with_correct_size(); +} +TYPED_TEST(Order2SimplicialContinuousLagrangeSpace, basis_is_lagrange_basis) +{ + this->basis_is_lagrange_basis(); +} +TYPED_TEST(Order2SimplicialContinuousLagrangeSpace, basis_jacobians_seem_to_be_correct) +{ + this->basis_jacobians_seem_to_be_correct(); +} + + +template <class G, int p> +struct ContinuousLagrangeSpaceOnCubicLeafView + : public ContinuousLagrangeSpace<typename Dune::XT::Grid::GridProvider<G>::LeafGridViewType, p> +{ + using GridProviderType = Dune::XT::Grid::GridProvider<G>; + using LeafGridViewType = typename GridProviderType::LeafGridViewType; + + std::shared_ptr<GridProviderType> grid_provider; + std::shared_ptr<LeafGridViewType> leaf_view; + + ContinuousLagrangeSpaceOnCubicLeafView() + { + using D = typename G::ctype; + static const constexpr size_t d = G::dimension; + Dune::FieldVector<D, d> lower_left(-1.5); // (i) negative coordinates and not the same as the reference element + Dune::FieldVector<D, d> upper_right(-1.); + std::array<unsigned int, d> num_elements; // (ii) at least 3 elements to have fully inner ones + std::fill(num_elements.begin(), num_elements.end(), 3); + grid_provider = std::make_shared<GridProviderType>( + Dune::StructuredGridFactory<G>::createCubeGrid(lower_left, upper_right, num_elements)); + leaf_view = std::make_shared<LeafGridViewType>(grid_provider->leaf_view()); + } + + ~ContinuousLagrangeSpaceOnCubicLeafView() = default; + + std::shared_ptr<LeafGridViewType> grid_layer() override final + { + return leaf_view; + } +}; // struct ContinuousLagrangeSpaceOnCubicLeafView + + +using CubicGrids = ::testing::Types<YASP_2D_EQUIDISTANT_OFFSET +#if HAVE_DUNE_ALUGRID + , + ALU_2D_CUBE +#endif +#if HAVE_DUNE_UGGRID || HAVE_UG + , + UG_2D +#endif + , + YASP_3D_EQUIDISTANT_OFFSET +#if HAVE_DUNE_ALUGRID + , + ALU_3D_CUBE +#endif +#if HAVE_DUNE_UGGRID || HAVE_UG + , + UG_3D +#endif + >; + +template <class G> +using Order1CubicContinuousLagrangeSpace = ContinuousLagrangeSpaceOnCubicLeafView<G, 1>; +TYPED_TEST_CASE(Order1CubicContinuousLagrangeSpace, CubicGrids); +TYPED_TEST(Order1CubicContinuousLagrangeSpace, basis_exists_on_each_element_with_correct_size) +{ + this->basis_exists_on_each_element_with_correct_size(); +} +TYPED_TEST(Order1CubicContinuousLagrangeSpace, basis_exists_on_each_element_with_correct_order) +{ + this->basis_exists_on_each_element_with_correct_order(); +} +TYPED_TEST(Order1CubicContinuousLagrangeSpace, mapper_reports_correct_num_DoFs_on_each_element) +{ + this->mapper_reports_correct_num_DoFs_on_each_element(); +} +TYPED_TEST(Order1CubicContinuousLagrangeSpace, mapper_reports_correct_max_num_DoFs) +{ + this->mapper_reports_correct_max_num_DoFs(); +} +TYPED_TEST(Order1CubicContinuousLagrangeSpace, mapper_maps_correctly) +{ + this->mapper_maps_correctly(); +} +TYPED_TEST(Order1CubicContinuousLagrangeSpace, lagrange_points_exist_on_each_element_with_correct_size) +{ + this->lagrange_points_exist_on_each_element_with_correct_size(); +} +TYPED_TEST(Order1CubicContinuousLagrangeSpace, basis_is_lagrange_basis) +{ + this->basis_is_lagrange_basis(); +} +TYPED_TEST(Order1CubicContinuousLagrangeSpace, basis_jacobians_seem_to_be_correct) +{ + this->basis_jacobians_seem_to_be_correct(); +} + + +template <class G> +using Order2CubicContinuousLagrangeSpace = ContinuousLagrangeSpaceOnCubicLeafView<G, 2>; +TYPED_TEST_CASE(Order2CubicContinuousLagrangeSpace, CubicGrids); +TYPED_TEST(Order2CubicContinuousLagrangeSpace, basis_exists_on_each_element_with_correct_size) +{ + this->basis_exists_on_each_element_with_correct_size(); +} +TYPED_TEST(Order2CubicContinuousLagrangeSpace, basis_exists_on_each_element_with_correct_order) +{ + this->basis_exists_on_each_element_with_correct_order(); +} +TYPED_TEST(Order2CubicContinuousLagrangeSpace, mapper_reports_correct_num_DoFs_on_each_element) +{ + this->mapper_reports_correct_num_DoFs_on_each_element(); +} +TYPED_TEST(Order2CubicContinuousLagrangeSpace, mapper_reports_correct_max_num_DoFs) +{ + this->mapper_reports_correct_max_num_DoFs(); +} +TYPED_TEST(Order2CubicContinuousLagrangeSpace, mapper_maps_correctly) +{ + this->mapper_maps_correctly(); +} +TYPED_TEST(Order2CubicContinuousLagrangeSpace, lagrange_points_exist_on_each_element_with_correct_size) +{ + this->lagrange_points_exist_on_each_element_with_correct_size(); +} +TYPED_TEST(Order2CubicContinuousLagrangeSpace, basis_is_lagrange_basis) +{ + this->basis_is_lagrange_basis(); +} +TYPED_TEST(Order2CubicContinuousLagrangeSpace, basis_jacobians_seem_to_be_correct) +{ + this->basis_jacobians_seem_to_be_correct(); +} + + +template <class G, int p> +struct ContinuousLagrangeSpaceOnPrismLeafView + : public ContinuousLagrangeSpace<typename Dune::XT::Grid::GridProvider<G>::LeafGridViewType, p> +{ + using GridProviderType = Dune::XT::Grid::GridProvider<G>; + using LeafGridViewType = typename GridProviderType::LeafGridViewType; + + std::shared_ptr<GridProviderType> grid_provider; + std::shared_ptr<LeafGridViewType> leaf_view; + + ContinuousLagrangeSpaceOnPrismLeafView() + { + using D = typename G::ctype; + static const constexpr size_t d = G::dimension; + if (d == 3) { + Dune::GridFactory<G> factory; + for (auto&& vertex : {Dune::XT::Common::FieldVector<D, d>({-1., -1.5, -1.5}), + Dune::XT::Common::FieldVector<D, d>({-1., -1., -1.5}), + Dune::XT::Common::FieldVector<D, d>({-1.5, -1.5, -1.5}), + Dune::XT::Common::FieldVector<D, d>({-1., -1.5, -1.}), + Dune::XT::Common::FieldVector<D, d>({-1., -1., -1.}), + Dune::XT::Common::FieldVector<D, d>({-1.5, -1.5, -1.})}) { + factory.insertVertex(vertex); + } + factory.insertElement(Dune::GeometryType(Dune::GeometryType::prism, 3), {0, 1, 2, 3, 4, 5}); + grid_provider = std::make_shared<GridProviderType>(factory.createGrid()); + grid_provider->global_refine(1); + leaf_view = std::make_shared<LeafGridViewType>(grid_provider->leaf_view()); + } else { + // cannot use ASSERT_... in a ctor + EXPECT_TRUE(false) << "Does not make sense in " << d << "d!\n" + << "=> ALL OTHER TESTS WILL FAIL FOR THIS GRID!!!"; + grid_provider = nullptr; + leaf_view = nullptr; + } + } // ContinuousLagrangeSpaceOnPrismLeafView(...) + + ~ContinuousLagrangeSpaceOnPrismLeafView() = default; + + std::shared_ptr<LeafGridViewType> grid_layer() override final + { + return leaf_view; + } +}; // struct ContinuousLagrangeSpaceOnPrismLeafView + + +#if HAVE_DUNE_UGGRID || HAVE_UG + + +using PrismGrids = ::testing::Types<UG_3D>; + +template <class G> +using Order1PrismContinuousLagrangeSpace = ContinuousLagrangeSpaceOnPrismLeafView<G, 1>; +TYPED_TEST_CASE(Order1PrismContinuousLagrangeSpace, PrismGrids); +TYPED_TEST(Order1PrismContinuousLagrangeSpace, basis_exists_on_each_element_with_correct_size) +{ + this->basis_exists_on_each_element_with_correct_size(); +} +TYPED_TEST(Order1PrismContinuousLagrangeSpace, basis_exists_on_each_element_with_correct_order) +{ + this->basis_exists_on_each_element_with_correct_order(); +} +TYPED_TEST(Order1PrismContinuousLagrangeSpace, mapper_reports_correct_num_DoFs_on_each_element) +{ + this->mapper_reports_correct_num_DoFs_on_each_element(); +} +TYPED_TEST(Order1PrismContinuousLagrangeSpace, mapper_reports_correct_max_num_DoFs) +{ + this->mapper_reports_correct_max_num_DoFs(); +} +TYPED_TEST(Order1PrismContinuousLagrangeSpace, mapper_maps_correctly) +{ + this->mapper_maps_correctly(); +} +TYPED_TEST(Order1PrismContinuousLagrangeSpace, lagrange_points_exist_on_each_element_with_correct_size) +{ + this->lagrange_points_exist_on_each_element_with_correct_size(); +} +TYPED_TEST(Order1PrismContinuousLagrangeSpace, basis_is_lagrange_basis) +{ + this->basis_is_lagrange_basis(); +} +TYPED_TEST(Order1PrismContinuousLagrangeSpace, basis_jacobians_seem_to_be_correct) +{ + this->basis_jacobians_seem_to_be_correct(); +} + + +template <class G> +using Order2PrismContinuousLagrangeSpace = ContinuousLagrangeSpaceOnPrismLeafView<G, 2>; +TYPED_TEST_CASE(Order2PrismContinuousLagrangeSpace, PrismGrids); +TYPED_TEST(Order2PrismContinuousLagrangeSpace, basis_exists_on_each_element_with_correct_size) +{ + this->basis_exists_on_each_element_with_correct_size(); +} +TYPED_TEST(Order2PrismContinuousLagrangeSpace, basis_exists_on_each_element_with_correct_order) +{ + this->basis_exists_on_each_element_with_correct_order(); +} +TYPED_TEST(Order2PrismContinuousLagrangeSpace, mapper_reports_correct_num_DoFs_on_each_element) +{ + this->mapper_reports_correct_num_DoFs_on_each_element(); +} +TYPED_TEST(Order2PrismContinuousLagrangeSpace, mapper_reports_correct_max_num_DoFs) +{ + this->mapper_reports_correct_max_num_DoFs(); +} +TYPED_TEST(Order2PrismContinuousLagrangeSpace, mapper_maps_correctly) +{ + this->mapper_maps_correctly(); +} +TYPED_TEST(Order2PrismContinuousLagrangeSpace, lagrange_points_exist_on_each_element_with_correct_size) +{ + this->lagrange_points_exist_on_each_element_with_correct_size(); +} +TYPED_TEST(Order2PrismContinuousLagrangeSpace, basis_is_lagrange_basis) +{ + this->basis_is_lagrange_basis(); +} +TYPED_TEST(Order2PrismContinuousLagrangeSpace, basis_jacobians_seem_to_be_correct) +{ + this->basis_jacobians_seem_to_be_correct(); +} + + +template <class G, int p> +struct ContinuousLagrangeSpaceOnMixedLeafView + : public ContinuousLagrangeSpace<typename Dune::XT::Grid::GridProvider<G>::LeafGridViewType, p> +{ + using GridProviderType = Dune::XT::Grid::GridProvider<G>; + using LeafGridViewType = typename GridProviderType::LeafGridViewType; + + std::shared_ptr<GridProviderType> grid_provider; + std::shared_ptr<LeafGridViewType> leaf_view; + + ContinuousLagrangeSpaceOnMixedLeafView() + { + using D = typename G::ctype; + static const constexpr size_t d = G::dimension; + switch (d) { + case 1: { + // cannot use ASSERT_... in a ctor + EXPECT_TRUE(false) << "Does not make sense in 1d (all cubes are simplices)!\n" + << "=> ALL OTHER TESTS WILL FAIL FOR THIS GRID!!!"; + grid_provider = nullptr; + leaf_view = nullptr; + break; + } + case 2: { + Dune::GridFactory<G> factory; + for (auto&& vertex : {Dune::XT::Common::FieldVector<D, d>({-1., -1.5}), + Dune::XT::Common::FieldVector<D, d>({-1., -1.25}), + Dune::XT::Common::FieldVector<D, d>({-1., -1.}), + Dune::XT::Common::FieldVector<D, d>({-1.5, -1.5}), + Dune::XT::Common::FieldVector<D, d>({-1.5, -1.25}), + Dune::XT::Common::FieldVector<D, d>({-1.5, -1.}), + Dune::XT::Common::FieldVector<D, d>({-1.75, -1.25})}) { + factory.insertVertex(vertex); + } + factory.insertElement(Dune::GeometryType(Dune::GeometryType::cube, 2), {3, 0, 4, 1}); + factory.insertElement(Dune::GeometryType(Dune::GeometryType::cube, 2), {4, 1, 5, 2}); + factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex, 2), {4, 6, 3}); + factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex, 2), {4, 5, 6}); + grid_provider = std::make_shared<GridProviderType>(factory.createGrid()); + grid_provider->global_refine(1); + leaf_view = std::make_shared<LeafGridViewType>(grid_provider->leaf_view()); + break; + } + case 3: { + Dune::GridFactory<G> factory; + for (auto&& vertex : {Dune::XT::Common::FieldVector<D, d>({-1., -1.5, -1.}), + Dune::XT::Common::FieldVector<D, d>({-1., -1.25, -1.}), + Dune::XT::Common::FieldVector<D, d>({-1., -1., -1.}), + Dune::XT::Common::FieldVector<D, d>({-1.5, -1.5, -1.}), + Dune::XT::Common::FieldVector<D, d>({-1.5, -1.25, -1.}), + Dune::XT::Common::FieldVector<D, d>({-1.5, -1., -1.}), + Dune::XT::Common::FieldVector<D, d>({-1., -1.5, -1.5}), + Dune::XT::Common::FieldVector<D, d>({-1., -1.25, -1.5}), + Dune::XT::Common::FieldVector<D, d>({-1., -1., -1.5}), + Dune::XT::Common::FieldVector<D, d>({-1.5, -1.5, -1.5}), + Dune::XT::Common::FieldVector<D, d>({-1.5, -1.25, -1.5}), + Dune::XT::Common::FieldVector<D, d>({-1.5, -1., -1.5}), + Dune::XT::Common::FieldVector<D, d>({-1.75, -1.25, -1.})}) { + factory.insertVertex(vertex); + } + factory.insertElement(Dune::GeometryType(Dune::GeometryType::cube, 3), {3, 0, 4, 1, 9, 6, 10, 7}); + factory.insertElement(Dune::GeometryType(Dune::GeometryType::cube, 3), {4, 1, 5, 2, 10, 7, 11, 8}); + factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex, 3), {4, 12, 3, 10}); + factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex, 3), {4, 5, 12, 10}); + grid_provider = std::make_shared<GridProviderType>(factory.createGrid()); + grid_provider->global_refine(1); + leaf_view = std::make_shared<LeafGridViewType>(grid_provider->leaf_view()); + break; + } + default: { + // cannot use ASSERT_... in a ctor + EXPECT_TRUE(false) << "Not implemented yet for dimension " << d << "!\n" + << "=> ALL OTHER TESTS WILL FAIL FOR THIS GRID!!!"; + grid_provider = nullptr; + leaf_view = nullptr; + } + } + } // ContinuousLagrangeSpaceOnMixedLeafView(...) + + ~ContinuousLagrangeSpaceOnMixedLeafView() = default; + + std::shared_ptr<LeafGridViewType> grid_layer() override final + { + return leaf_view; + } +}; // struct ContinuousLagrangeSpaceOnMixedLeafView + + +// The mapper does not work in 3d. +using MixedGrids = ::testing::Types<UG_2D>; + +template <class G> +using Order1MixedContinuousLagrangeSpace = ContinuousLagrangeSpaceOnMixedLeafView<G, 1>; +TYPED_TEST_CASE(Order1MixedContinuousLagrangeSpace, MixedGrids); +TYPED_TEST(Order1MixedContinuousLagrangeSpace, basis_exists_on_each_element_with_correct_size) +{ + this->basis_exists_on_each_element_with_correct_size(); +} +TYPED_TEST(Order1MixedContinuousLagrangeSpace, basis_exists_on_each_element_with_correct_order) +{ + this->basis_exists_on_each_element_with_correct_order(); +} +TYPED_TEST(Order1MixedContinuousLagrangeSpace, mapper_reports_correct_num_DoFs_on_each_element) +{ + this->mapper_reports_correct_num_DoFs_on_each_element(); +} +TYPED_TEST(Order1MixedContinuousLagrangeSpace, mapper_reports_correct_max_num_DoFs) +{ + this->mapper_reports_correct_max_num_DoFs(); +} +TYPED_TEST(Order1MixedContinuousLagrangeSpace, mapper_maps_correctly) +{ + this->mapper_maps_correctly(); +} +TYPED_TEST(Order1MixedContinuousLagrangeSpace, lagrange_points_exist_on_each_element_with_correct_size) +{ + this->lagrange_points_exist_on_each_element_with_correct_size(); +} +TYPED_TEST(Order1MixedContinuousLagrangeSpace, basis_is_lagrange_basis) +{ + this->basis_is_lagrange_basis(); +} +TYPED_TEST(Order1MixedContinuousLagrangeSpace, basis_jacobians_seem_to_be_correct) +{ + this->basis_jacobians_seem_to_be_correct(); +} + + +template <class G> +using Order2MixedContinuousLagrangeSpace = ContinuousLagrangeSpaceOnMixedLeafView<G, 2>; +TYPED_TEST_CASE(Order2MixedContinuousLagrangeSpace, MixedGrids); +TYPED_TEST(Order2MixedContinuousLagrangeSpace, basis_exists_on_each_element_with_correct_size) +{ + this->basis_exists_on_each_element_with_correct_size(); +} +TYPED_TEST(Order2MixedContinuousLagrangeSpace, basis_exists_on_each_element_with_correct_order) +{ + this->basis_exists_on_each_element_with_correct_order(); +} +TYPED_TEST(Order2MixedContinuousLagrangeSpace, mapper_reports_correct_num_DoFs_on_each_element) +{ + this->mapper_reports_correct_num_DoFs_on_each_element(); +} +TYPED_TEST(Order2MixedContinuousLagrangeSpace, mapper_reports_correct_max_num_DoFs) +{ + this->mapper_reports_correct_max_num_DoFs(); +} +TYPED_TEST(Order2MixedContinuousLagrangeSpace, mapper_maps_correctly) +{ + this->mapper_maps_correctly(); +} +TYPED_TEST(Order2MixedContinuousLagrangeSpace, lagrange_points_exist_on_each_element_with_correct_size) +{ + this->lagrange_points_exist_on_each_element_with_correct_size(); +} +TYPED_TEST(Order2MixedContinuousLagrangeSpace, basis_is_lagrange_basis) +{ + this->basis_is_lagrange_basis(); +} +TYPED_TEST(Order2MixedContinuousLagrangeSpace, basis_jacobians_seem_to_be_correct) +{ + this->basis_jacobians_seem_to_be_correct(); +} + + +#endif // HAVE_DUNE_UGGRID || HAVE_UG diff --git a/dune/gdt/test/spaces/spaces_dg.cc b/dune/gdt/test/spaces/spaces_dg.cc new file mode 100644 index 0000000000000000000000000000000000000000..b7330db0be2bb882ad75eff4d44ad50d10371e25 --- /dev/null +++ b/dune/gdt/test/spaces/spaces_dg.cc @@ -0,0 +1,894 @@ +// 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 (2018) + +#include <dune/xt/common/test/main.hxx> // <- this one has to come first (includes the config.h)! + +#include <algorithm> +#include <memory> +#include <tuple> + +#include <dune/geometry/quadraturerules.hh> +#include <dune/geometry/referenceelements.hh> +#include <dune/geometry/refinement.hh> + +#include <dune/grid/common/rangegenerators.hh> + +#include <dune/xt/common/fvector.hh> +#include <dune/xt/common/numeric_cast.hh> +#include <dune/xt/grid/gridprovider/cube.hh> + +#include <dune/gdt/spaces/dg.hh> + + +template <class GridLayerType, int p> +struct DiscontinuousLagrangeSpace : public ::testing::Test +{ + using SpaceType = Dune::GDT::DiscontinuousLagrangeSpace<GridLayerType, p>; + using D = typename SpaceType::DomainFieldType; + static const constexpr size_t d = SpaceType::dimDomain; + + virtual std::shared_ptr<GridLayerType> grid_layer() = 0; + + std::shared_ptr<SpaceType> space; + + ~DiscontinuousLagrangeSpace() = default; + + void SetUp() override final + { + ASSERT_TRUE(grid_layer() != nullptr && grid_layer() != 0); + space = std::shared_ptr<SpaceType>(new SpaceType(*grid_layer())); + } + + void TearDown() override final + { + space.reset(); + } + + void basis_exists_on_each_element_with_correct_size() + { + ASSERT_TRUE(grid_layer() != nullptr && grid_layer() != 0); + ASSERT_TRUE(space != nullptr && space != 0); + for (auto&& element : elements(*grid_layer())) + EXPECT_EQ(Dune::numLagrangePoints(element.geometry().type().id(), d, p), + space->base_function_set(element).size()); + } + + void basis_exists_on_each_element_with_correct_order() + { + ASSERT_TRUE(grid_layer() != nullptr && grid_layer() != 0); + ASSERT_TRUE(space != nullptr && space != 0); + for (auto&& element : elements(*grid_layer())) + EXPECT_EQ(p, space->base_function_set(element).order()); + } + + void mapper_reports_correct_num_DoFs_on_each_element() + { + ASSERT_TRUE(grid_layer() != nullptr && grid_layer() != 0); + ASSERT_TRUE(space != nullptr && space != 0); + for (auto&& element : elements(*grid_layer())) + EXPECT_EQ(Dune::numLagrangePoints(element.geometry().type().id(), d, p), space->mapper().numDofs(element)); + } + + void mapper_reports_correct_max_num_DoFs() + { + ASSERT_TRUE(grid_layer() != nullptr && grid_layer() != 0); + ASSERT_TRUE(space != nullptr && space != 0); + size_t max_num_dofs = 0; + for (auto&& element : elements(*grid_layer())) + max_num_dofs = std::max(max_num_dofs, space->mapper().numDofs(element)); + EXPECT_LE(max_num_dofs, space->mapper().maxNumDofs()); + } + + void mapper_maps_correctly() + { + ASSERT_TRUE(grid_layer() != nullptr && grid_layer() != 0); + ASSERT_TRUE(space != nullptr && space != 0); + // we want to check that the numbering is consecutive and that each global index exists only once + std::set<size_t> global_indices; + // we test both call variants + std::set<size_t> map_to_global; + for (auto&& element : Dune::elements(*grid_layer())) { + for (const auto& global_index : space->mapper().globalIndices(element)) + global_indices.insert(global_index); + for (size_t ii = 0; ii < space->mapper().numDofs(element); ++ii) + map_to_global.insert(space->mapper().mapToGlobal(element, ii)); + } + // check for consecutive numbering + EXPECT_EQ(0, *global_indices.begin()); + EXPECT_EQ(global_indices.size() - 1, *global_indices.rbegin()); + EXPECT_EQ(0, *map_to_global.begin()); + EXPECT_EQ(map_to_global.size() - 1, *map_to_global.rbegin()); + // check that the mapper is of the same opinion + EXPECT_EQ(space->mapper().size(), global_indices.size()); + EXPECT_EQ(space->mapper().size(), map_to_global.size()); + // check that each global index is unique + for (const auto& global_index : global_indices) + EXPECT_EQ(1, global_indices.count(global_index)); + for (const auto& global_index : map_to_global) + EXPECT_EQ(1, map_to_global.count(global_index)); + } // ... mapper_maps_correctly(...) + + void lagrange_points_exist_on_each_element_with_correct_size() + { + ASSERT_TRUE(grid_layer() != nullptr && grid_layer() != 0); + ASSERT_TRUE(space != nullptr && space != 0); + for (auto&& element : elements(*grid_layer())) + EXPECT_EQ(Dune::numLagrangePoints(element.geometry().type().id(), d, p), space->lagrange_points(element).size()); + } + + void basis_is_lagrange_basis() + { + ASSERT_TRUE(grid_layer() != nullptr && grid_layer() != 0); + ASSERT_TRUE(space != nullptr && space != 0); + double tolerance = 1e-15; + for (auto&& element : elements(*grid_layer())) { + const auto basis = space->base_function_set(element); + const auto lagrange_points = space->lagrange_points(element); + EXPECT_EQ(lagrange_points.size(), basis.size()); + for (size_t ii = 0; ii < lagrange_points.size(); ++ii) { + const auto values = basis.evaluate(lagrange_points[ii]); + for (size_t jj = 0; jj < basis.size(); ++jj) { + ASSERT_TRUE(Dune::XT::Common::FloatCmp::eq(values[jj][0], ii == jj ? 1. : 0., tolerance, tolerance)) + << "lagrange_points[" << ii << "] = " << lagrange_points[ii] + << "\nbasis.evaluate(lagrange_points[ii]) = " << values; + } + } + } + } // ... basis_is_lagrange_basis(...) + + void basis_jacobians_seem_to_be_correct() + { + ASSERT_TRUE(grid_layer() != nullptr && grid_layer() != 0); + ASSERT_TRUE(space != nullptr && space != 0); + for (auto&& element : elements(*grid_layer())) { + const auto& reference_element = Dune::ReferenceElements<D, d>::general(element.geometry().type()); + const auto basis = space->base_function_set(element); + const double h = 1e-6; + for (const auto& quadrature_point : Dune::QuadratureRules<D, d>::rule(element.geometry().type(), basis.order())) { + const auto& xx = quadrature_point.position(); + const auto& J_inv_T = element.geometry().jacobianInverseTransposed(xx); + const auto jacobians = basis.jacobian(xx); + EXPECT_EQ(basis.size(), jacobians.size()); + const auto values_xx = basis.evaluate(xx); + EXPECT_EQ(basis.size(), values_xx.size()); + auto approximate_jacobians = jacobians; + // compute approximate partial derivatives + for (size_t dd = 0; dd < d; ++dd) { + // try to find a suitable x + h + auto xx_plus_h = xx; + xx_plus_h[dd] += h; + if (!reference_element.checkInside(xx_plus_h)) { + xx_plus_h[dd] -= 2. * h; + } + ASSERT_TRUE(reference_element.checkInside(xx_plus_h)) << "xx_plus_h = " << xx_plus_h + << " is not inside the reference element!"; + const auto values_xx_plus_h = basis.evaluate(xx_plus_h); + EXPECT_EQ(basis.size(), values_xx_plus_h.size()); + for (size_t ii = 0; ii < basis.size(); ++ii) { + approximate_jacobians[ii][0][dd] = (values_xx_plus_h[ii] - values_xx[ii]) / (xx_plus_h[dd] - xx[dd]); + if (xx_plus_h[dd] - xx[dd] < 0) + approximate_jacobians[ii][0][dd] *= -1.; + } + } + // transform + auto tmp_jac = approximate_jacobians[0][0]; + for (size_t ii = 0; ii < basis.size(); ++ii) { + J_inv_T.mv(approximate_jacobians[ii][0], tmp_jac); + approximate_jacobians[ii][0] = tmp_jac; + } + // check + double tolerance = 1e-4; + for (size_t ii = 0; ii < basis.size(); ++ii) + EXPECT_TRUE( + Dune::XT::Common::FloatCmp::eq(jacobians[ii][0], approximate_jacobians[ii][0], tolerance, tolerance)) + << "ii = " << ii << "\njacobians[ii][0] = " << jacobians[ii][0] << "\n" + << "approximate_jacobians[ii][0] = " << approximate_jacobians[ii][0] << "\n" + << "absolue L_infty error: " << (jacobians[ii][0] - approximate_jacobians[ii][0]).infinity_norm() << "\n" + << "relative L_infty error: " + << (jacobians[ii][0] - approximate_jacobians[ii][0]).infinity_norm() / jacobians[ii][0].infinity_norm(); + } + } + } // ... basis_jacobians_seem_to_be_correct(...) +}; // struct DiscontinuousLagrangeSpace + + +template <class G, int p> +struct DiscontinuousLagrangeSpaceOnSimplicialLeafView + : public DiscontinuousLagrangeSpace<typename Dune::XT::Grid::GridProvider<G>::LeafGridViewType, p> +{ + using GridProviderType = Dune::XT::Grid::GridProvider<G>; + using LeafGridViewType = typename GridProviderType::LeafGridViewType; + + GridProviderType grid_provider; + std::shared_ptr<LeafGridViewType> leaf_view; + + DiscontinuousLagrangeSpaceOnSimplicialLeafView() // (i) negative coordinates and not the same as the reference + : grid_provider(Dune::XT::Grid::make_cube_grid<G>(-1.5, -1, 3).grid_ptr()) // element, + { // (ii) at least 3 elements to have fully inner ones, + grid_provider.global_refine(1); // (iii) refine at least once to obtain all kinds of orientations + leaf_view = std::make_shared<LeafGridViewType>(grid_provider.leaf_view()); + } + + ~DiscontinuousLagrangeSpaceOnSimplicialLeafView() = default; + + std::shared_ptr<LeafGridViewType> grid_layer() override final + { + return leaf_view; + } +}; // struct DiscontinuousLagrangeSpaceOnSimplicialLeafView + + +using SimplicialGrids = ::testing::Types<ONED_1D, + YASP_1D_EQUIDISTANT_OFFSET +#if HAVE_DUNE_ALUGRID + , + ALU_2D_SIMPLEX_CONFORMING, + ALU_2D_SIMPLEX_NONCONFORMING +#endif +#if HAVE_DUNE_UGGRID || HAVE_UG + , + UG_2D +#endif +#if HAVE_DUNE_ALUGRID + , + ALU_3D_SIMPLEX_CONFORMING, + ALU_3D_SIMPLEX_NONCONFORMING +#endif +#if HAVE_DUNE_UGGRID || HAVE_UG + , + UG_3D +#endif + >; + + +template <class G> +using Order0SimplicialDiscontinuousLagrangeSpace = DiscontinuousLagrangeSpaceOnSimplicialLeafView<G, 0>; +TYPED_TEST_CASE(Order0SimplicialDiscontinuousLagrangeSpace, SimplicialGrids); +TYPED_TEST(Order0SimplicialDiscontinuousLagrangeSpace, basis_exists_on_each_element_with_correct_size) +{ + this->basis_exists_on_each_element_with_correct_size(); +} +TYPED_TEST(Order0SimplicialDiscontinuousLagrangeSpace, basis_exists_on_each_element_with_correct_order) +{ + this->basis_exists_on_each_element_with_correct_order(); +} +TYPED_TEST(Order0SimplicialDiscontinuousLagrangeSpace, mapper_reports_correct_num_DoFs_on_each_element) +{ + this->mapper_reports_correct_num_DoFs_on_each_element(); +} +TYPED_TEST(Order0SimplicialDiscontinuousLagrangeSpace, mapper_reports_correct_max_num_DoFs) +{ + this->mapper_reports_correct_max_num_DoFs(); +} +TYPED_TEST(Order0SimplicialDiscontinuousLagrangeSpace, mapper_maps_correctly) +{ + this->mapper_maps_correctly(); +} +TYPED_TEST(Order0SimplicialDiscontinuousLagrangeSpace, lagrange_points_exist_on_each_element_with_correct_size) +{ + this->lagrange_points_exist_on_each_element_with_correct_size(); +} +TYPED_TEST(Order0SimplicialDiscontinuousLagrangeSpace, basis_is_lagrange_basis) +{ + this->basis_is_lagrange_basis(); +} +TYPED_TEST(Order0SimplicialDiscontinuousLagrangeSpace, basis_jacobians_seem_to_be_correct) +{ + this->basis_jacobians_seem_to_be_correct(); +} + + +template <class G> +using Order1SimplicialDiscontinuousLagrangeSpace = DiscontinuousLagrangeSpaceOnSimplicialLeafView<G, 1>; +TYPED_TEST_CASE(Order1SimplicialDiscontinuousLagrangeSpace, SimplicialGrids); +TYPED_TEST(Order1SimplicialDiscontinuousLagrangeSpace, basis_exists_on_each_element_with_correct_size) +{ + this->basis_exists_on_each_element_with_correct_size(); +} +TYPED_TEST(Order1SimplicialDiscontinuousLagrangeSpace, basis_exists_on_each_element_with_correct_order) +{ + this->basis_exists_on_each_element_with_correct_order(); +} +TYPED_TEST(Order1SimplicialDiscontinuousLagrangeSpace, mapper_reports_correct_num_DoFs_on_each_element) +{ + this->mapper_reports_correct_num_DoFs_on_each_element(); +} +TYPED_TEST(Order1SimplicialDiscontinuousLagrangeSpace, mapper_reports_correct_max_num_DoFs) +{ + this->mapper_reports_correct_max_num_DoFs(); +} +TYPED_TEST(Order1SimplicialDiscontinuousLagrangeSpace, mapper_maps_correctly) +{ + this->mapper_maps_correctly(); +} +TYPED_TEST(Order1SimplicialDiscontinuousLagrangeSpace, lagrange_points_exist_on_each_element_with_correct_size) +{ + this->lagrange_points_exist_on_each_element_with_correct_size(); +} +TYPED_TEST(Order1SimplicialDiscontinuousLagrangeSpace, basis_is_lagrange_basis) +{ + this->basis_is_lagrange_basis(); +} +TYPED_TEST(Order1SimplicialDiscontinuousLagrangeSpace, basis_jacobians_seem_to_be_correct) +{ + this->basis_jacobians_seem_to_be_correct(); +} + + +template <class G> +using Order2SimplicialDiscontinuousLagrangeSpace = DiscontinuousLagrangeSpaceOnSimplicialLeafView<G, 2>; +TYPED_TEST_CASE(Order2SimplicialDiscontinuousLagrangeSpace, SimplicialGrids); +TYPED_TEST(Order2SimplicialDiscontinuousLagrangeSpace, basis_exists_on_each_element_with_correct_size) +{ + this->basis_exists_on_each_element_with_correct_size(); +} +TYPED_TEST(Order2SimplicialDiscontinuousLagrangeSpace, basis_exists_on_each_element_with_correct_order) +{ + this->basis_exists_on_each_element_with_correct_order(); +} +TYPED_TEST(Order2SimplicialDiscontinuousLagrangeSpace, mapper_reports_correct_num_DoFs_on_each_element) +{ + this->mapper_reports_correct_num_DoFs_on_each_element(); +} +TYPED_TEST(Order2SimplicialDiscontinuousLagrangeSpace, mapper_reports_correct_max_num_DoFs) +{ + this->mapper_reports_correct_max_num_DoFs(); +} +TYPED_TEST(Order2SimplicialDiscontinuousLagrangeSpace, mapper_maps_correctly) +{ + this->mapper_maps_correctly(); +} +TYPED_TEST(Order2SimplicialDiscontinuousLagrangeSpace, lagrange_points_exist_on_each_element_with_correct_size) +{ + this->lagrange_points_exist_on_each_element_with_correct_size(); +} +TYPED_TEST(Order2SimplicialDiscontinuousLagrangeSpace, basis_is_lagrange_basis) +{ + this->basis_is_lagrange_basis(); +} +TYPED_TEST(Order2SimplicialDiscontinuousLagrangeSpace, basis_jacobians_seem_to_be_correct) +{ + this->basis_jacobians_seem_to_be_correct(); +} + + +template <class G, int p> +struct DiscontinuousLagrangeSpaceOnCubicLeafView + : public DiscontinuousLagrangeSpace<typename Dune::XT::Grid::GridProvider<G>::LeafGridViewType, p> +{ + using GridProviderType = Dune::XT::Grid::GridProvider<G>; + using LeafGridViewType = typename GridProviderType::LeafGridViewType; + + std::shared_ptr<GridProviderType> grid_provider; + std::shared_ptr<LeafGridViewType> leaf_view; + + DiscontinuousLagrangeSpaceOnCubicLeafView() + { + using D = typename G::ctype; + static const constexpr size_t d = G::dimension; + Dune::FieldVector<D, d> lower_left(-1.5); // (i) negative coordinates and not the same as the reference element + Dune::FieldVector<D, d> upper_right(-1.); + std::array<unsigned int, d> num_elements; // (ii) at least 3 elements to have fully inner ones + std::fill(num_elements.begin(), num_elements.end(), 3); + grid_provider = std::make_shared<GridProviderType>( + Dune::StructuredGridFactory<G>::createCubeGrid(lower_left, upper_right, num_elements)); + leaf_view = std::make_shared<LeafGridViewType>(grid_provider->leaf_view()); + } + + ~DiscontinuousLagrangeSpaceOnCubicLeafView() = default; + + std::shared_ptr<LeafGridViewType> grid_layer() override final + { + return leaf_view; + } +}; // struct DiscontinuousLagrangeSpaceOnCubicLeafView + + +using CubicGrids = ::testing::Types<YASP_2D_EQUIDISTANT_OFFSET +#if HAVE_DUNE_ALUGRID + , + ALU_2D_CUBE +#endif +#if HAVE_DUNE_UGGRID || HAVE_UG + , + UG_2D +#endif + , + YASP_3D_EQUIDISTANT_OFFSET +#if HAVE_DUNE_ALUGRID + , + ALU_3D_CUBE +#endif +#if HAVE_DUNE_UGGRID || HAVE_UG + , + UG_3D +#endif + >; + + +template <class G> +using Order0CubicDiscontinuousLagrangeSpace = DiscontinuousLagrangeSpaceOnCubicLeafView<G, 0>; +TYPED_TEST_CASE(Order0CubicDiscontinuousLagrangeSpace, CubicGrids); +TYPED_TEST(Order0CubicDiscontinuousLagrangeSpace, basis_exists_on_each_element_with_correct_size) +{ + this->basis_exists_on_each_element_with_correct_size(); +} +TYPED_TEST(Order0CubicDiscontinuousLagrangeSpace, basis_exists_on_each_element_with_correct_order) +{ + this->basis_exists_on_each_element_with_correct_order(); +} +TYPED_TEST(Order0CubicDiscontinuousLagrangeSpace, mapper_reports_correct_num_DoFs_on_each_element) +{ + this->mapper_reports_correct_num_DoFs_on_each_element(); +} +TYPED_TEST(Order0CubicDiscontinuousLagrangeSpace, mapper_reports_correct_max_num_DoFs) +{ + this->mapper_reports_correct_max_num_DoFs(); +} +TYPED_TEST(Order0CubicDiscontinuousLagrangeSpace, mapper_maps_correctly) +{ + this->mapper_maps_correctly(); +} +TYPED_TEST(Order0CubicDiscontinuousLagrangeSpace, lagrange_points_exist_on_each_element_with_correct_size) +{ + this->lagrange_points_exist_on_each_element_with_correct_size(); +} +TYPED_TEST(Order0CubicDiscontinuousLagrangeSpace, basis_is_lagrange_basis) +{ + this->basis_is_lagrange_basis(); +} +TYPED_TEST(Order0CubicDiscontinuousLagrangeSpace, basis_jacobians_seem_to_be_correct) +{ + this->basis_jacobians_seem_to_be_correct(); +} + + +template <class G> +using Order1CubicDiscontinuousLagrangeSpace = DiscontinuousLagrangeSpaceOnCubicLeafView<G, 1>; +TYPED_TEST_CASE(Order1CubicDiscontinuousLagrangeSpace, CubicGrids); +TYPED_TEST(Order1CubicDiscontinuousLagrangeSpace, basis_exists_on_each_element_with_correct_size) +{ + this->basis_exists_on_each_element_with_correct_size(); +} +TYPED_TEST(Order1CubicDiscontinuousLagrangeSpace, basis_exists_on_each_element_with_correct_order) +{ + this->basis_exists_on_each_element_with_correct_order(); +} +TYPED_TEST(Order1CubicDiscontinuousLagrangeSpace, mapper_reports_correct_num_DoFs_on_each_element) +{ + this->mapper_reports_correct_num_DoFs_on_each_element(); +} +TYPED_TEST(Order1CubicDiscontinuousLagrangeSpace, mapper_reports_correct_max_num_DoFs) +{ + this->mapper_reports_correct_max_num_DoFs(); +} +TYPED_TEST(Order1CubicDiscontinuousLagrangeSpace, mapper_maps_correctly) +{ + this->mapper_maps_correctly(); +} +TYPED_TEST(Order1CubicDiscontinuousLagrangeSpace, lagrange_points_exist_on_each_element_with_correct_size) +{ + this->lagrange_points_exist_on_each_element_with_correct_size(); +} +TYPED_TEST(Order1CubicDiscontinuousLagrangeSpace, basis_is_lagrange_basis) +{ + this->basis_is_lagrange_basis(); +} +TYPED_TEST(Order1CubicDiscontinuousLagrangeSpace, basis_jacobians_seem_to_be_correct) +{ + this->basis_jacobians_seem_to_be_correct(); +} + + +template <class G> +using Order2CubicDiscontinuousLagrangeSpace = DiscontinuousLagrangeSpaceOnCubicLeafView<G, 2>; +TYPED_TEST_CASE(Order2CubicDiscontinuousLagrangeSpace, CubicGrids); +TYPED_TEST(Order2CubicDiscontinuousLagrangeSpace, basis_exists_on_each_element_with_correct_size) +{ + this->basis_exists_on_each_element_with_correct_size(); +} +TYPED_TEST(Order2CubicDiscontinuousLagrangeSpace, basis_exists_on_each_element_with_correct_order) +{ + this->basis_exists_on_each_element_with_correct_order(); +} +TYPED_TEST(Order2CubicDiscontinuousLagrangeSpace, mapper_reports_correct_num_DoFs_on_each_element) +{ + this->mapper_reports_correct_num_DoFs_on_each_element(); +} +TYPED_TEST(Order2CubicDiscontinuousLagrangeSpace, mapper_reports_correct_max_num_DoFs) +{ + this->mapper_reports_correct_max_num_DoFs(); +} +TYPED_TEST(Order2CubicDiscontinuousLagrangeSpace, mapper_maps_correctly) +{ + this->mapper_maps_correctly(); +} +TYPED_TEST(Order2CubicDiscontinuousLagrangeSpace, lagrange_points_exist_on_each_element_with_correct_size) +{ + this->lagrange_points_exist_on_each_element_with_correct_size(); +} +TYPED_TEST(Order2CubicDiscontinuousLagrangeSpace, basis_is_lagrange_basis) +{ + this->basis_is_lagrange_basis(); +} +TYPED_TEST(Order2CubicDiscontinuousLagrangeSpace, basis_jacobians_seem_to_be_correct) +{ + this->basis_jacobians_seem_to_be_correct(); +} + + +template <class G, int p> +struct DiscontinuousLagrangeSpaceOnPrismLeafView + : public DiscontinuousLagrangeSpace<typename Dune::XT::Grid::GridProvider<G>::LeafGridViewType, p> +{ + using GridProviderType = Dune::XT::Grid::GridProvider<G>; + using LeafGridViewType = typename GridProviderType::LeafGridViewType; + + std::shared_ptr<GridProviderType> grid_provider; + std::shared_ptr<LeafGridViewType> leaf_view; + + DiscontinuousLagrangeSpaceOnPrismLeafView() + { + using D = typename G::ctype; + static const constexpr size_t d = G::dimension; + if (d == 3) { + Dune::GridFactory<G> factory; + for (auto&& vertex : {Dune::XT::Common::FieldVector<D, d>({-1., -1.5, -1.5}), + Dune::XT::Common::FieldVector<D, d>({-1., -1., -1.5}), + Dune::XT::Common::FieldVector<D, d>({-1.5, -1.5, -1.5}), + Dune::XT::Common::FieldVector<D, d>({-1., -1.5, -1.}), + Dune::XT::Common::FieldVector<D, d>({-1., -1., -1.}), + Dune::XT::Common::FieldVector<D, d>({-1.5, -1.5, -1.})}) { + factory.insertVertex(vertex); + } + factory.insertElement(Dune::GeometryType(Dune::GeometryType::prism, 3), {0, 1, 2, 3, 4, 5}); + grid_provider = std::make_shared<GridProviderType>(factory.createGrid()); + grid_provider->global_refine(1); + leaf_view = std::make_shared<LeafGridViewType>(grid_provider->leaf_view()); + } else { + // cannot use ASSERT_... in a ctor + EXPECT_TRUE(false) << "Does not make sense in " << d << "d!\n" + << "=> ALL OTHER TESTS WILL FAIL FOR THIS GRID!!!"; + grid_provider = nullptr; + leaf_view = nullptr; + } + } // DiscontinuousLagrangeSpaceOnPrismLeafView(...) + + ~DiscontinuousLagrangeSpaceOnPrismLeafView() = default; + + std::shared_ptr<LeafGridViewType> grid_layer() override final + { + return leaf_view; + } +}; // struct DiscontinuousLagrangeSpaceOnPrismLeafView + + +using PrismGrids = ::testing::Types< +#if HAVE_DUNE_UGGRID || HAVE_UG + UG_3D +#endif + >; + + +template <class G> +using Order0PrismDiscontinuousLagrangeSpace = DiscontinuousLagrangeSpaceOnPrismLeafView<G, 0>; +TYPED_TEST_CASE(Order0PrismDiscontinuousLagrangeSpace, PrismGrids); +TYPED_TEST(Order0PrismDiscontinuousLagrangeSpace, basis_exists_on_each_element_with_correct_size) +{ + this->basis_exists_on_each_element_with_correct_size(); +} +TYPED_TEST(Order0PrismDiscontinuousLagrangeSpace, basis_exists_on_each_element_with_correct_order) +{ + this->basis_exists_on_each_element_with_correct_order(); +} +TYPED_TEST(Order0PrismDiscontinuousLagrangeSpace, mapper_reports_correct_num_DoFs_on_each_element) +{ + this->mapper_reports_correct_num_DoFs_on_each_element(); +} +TYPED_TEST(Order0PrismDiscontinuousLagrangeSpace, mapper_reports_correct_max_num_DoFs) +{ + this->mapper_reports_correct_max_num_DoFs(); +} +TYPED_TEST(Order0PrismDiscontinuousLagrangeSpace, mapper_maps_correctly) +{ + this->mapper_maps_correctly(); +} +TYPED_TEST(Order0PrismDiscontinuousLagrangeSpace, lagrange_points_exist_on_each_element_with_correct_size) +{ + this->lagrange_points_exist_on_each_element_with_correct_size(); +} +TYPED_TEST(Order0PrismDiscontinuousLagrangeSpace, basis_is_lagrange_basis) +{ + this->basis_is_lagrange_basis(); +} +TYPED_TEST(Order0PrismDiscontinuousLagrangeSpace, basis_jacobians_seem_to_be_correct) +{ + this->basis_jacobians_seem_to_be_correct(); +} + + +template <class G> +using Order1PrismDiscontinuousLagrangeSpace = DiscontinuousLagrangeSpaceOnPrismLeafView<G, 1>; +TYPED_TEST_CASE(Order1PrismDiscontinuousLagrangeSpace, PrismGrids); +TYPED_TEST(Order1PrismDiscontinuousLagrangeSpace, basis_exists_on_each_element_with_correct_size) +{ + this->basis_exists_on_each_element_with_correct_size(); +} +TYPED_TEST(Order1PrismDiscontinuousLagrangeSpace, basis_exists_on_each_element_with_correct_order) +{ + this->basis_exists_on_each_element_with_correct_order(); +} +TYPED_TEST(Order1PrismDiscontinuousLagrangeSpace, mapper_reports_correct_num_DoFs_on_each_element) +{ + this->mapper_reports_correct_num_DoFs_on_each_element(); +} +TYPED_TEST(Order1PrismDiscontinuousLagrangeSpace, mapper_reports_correct_max_num_DoFs) +{ + this->mapper_reports_correct_max_num_DoFs(); +} +TYPED_TEST(Order1PrismDiscontinuousLagrangeSpace, mapper_maps_correctly) +{ + this->mapper_maps_correctly(); +} +TYPED_TEST(Order1PrismDiscontinuousLagrangeSpace, lagrange_points_exist_on_each_element_with_correct_size) +{ + this->lagrange_points_exist_on_each_element_with_correct_size(); +} +TYPED_TEST(Order1PrismDiscontinuousLagrangeSpace, basis_is_lagrange_basis) +{ + this->basis_is_lagrange_basis(); +} +TYPED_TEST(Order1PrismDiscontinuousLagrangeSpace, basis_jacobians_seem_to_be_correct) +{ + this->basis_jacobians_seem_to_be_correct(); +} + + +template <class G> +using Order2PrismDiscontinuousLagrangeSpace = DiscontinuousLagrangeSpaceOnPrismLeafView<G, 2>; +TYPED_TEST_CASE(Order2PrismDiscontinuousLagrangeSpace, PrismGrids); +TYPED_TEST(Order2PrismDiscontinuousLagrangeSpace, basis_exists_on_each_element_with_correct_size) +{ + this->basis_exists_on_each_element_with_correct_size(); +} +TYPED_TEST(Order2PrismDiscontinuousLagrangeSpace, basis_exists_on_each_element_with_correct_order) +{ + this->basis_exists_on_each_element_with_correct_order(); +} +TYPED_TEST(Order2PrismDiscontinuousLagrangeSpace, mapper_reports_correct_num_DoFs_on_each_element) +{ + this->mapper_reports_correct_num_DoFs_on_each_element(); +} +TYPED_TEST(Order2PrismDiscontinuousLagrangeSpace, mapper_reports_correct_max_num_DoFs) +{ + this->mapper_reports_correct_max_num_DoFs(); +} +TYPED_TEST(Order2PrismDiscontinuousLagrangeSpace, mapper_maps_correctly) +{ + this->mapper_maps_correctly(); +} +TYPED_TEST(Order2PrismDiscontinuousLagrangeSpace, lagrange_points_exist_on_each_element_with_correct_size) +{ + this->lagrange_points_exist_on_each_element_with_correct_size(); +} +TYPED_TEST(Order2PrismDiscontinuousLagrangeSpace, basis_is_lagrange_basis) +{ + this->basis_is_lagrange_basis(); +} +TYPED_TEST(Order2PrismDiscontinuousLagrangeSpace, basis_jacobians_seem_to_be_correct) +{ + this->basis_jacobians_seem_to_be_correct(); +} + + +template <class G, int p> +struct DiscontinuousLagrangeSpaceOnMixedLeafView + : public DiscontinuousLagrangeSpace<typename Dune::XT::Grid::GridProvider<G>::LeafGridViewType, p> +{ + using GridProviderType = Dune::XT::Grid::GridProvider<G>; + using LeafGridViewType = typename GridProviderType::LeafGridViewType; + + std::shared_ptr<GridProviderType> grid_provider; + std::shared_ptr<LeafGridViewType> leaf_view; + + DiscontinuousLagrangeSpaceOnMixedLeafView() + { + using D = typename G::ctype; + static const constexpr size_t d = G::dimension; + switch (d) { + case 1: { + // cannot use ASSERT_... in a ctor + EXPECT_TRUE(false) << "Does not make sense in 1d (all cubes are simplices)!\n" + << "=> ALL OTHER TESTS WILL FAIL FOR THIS GRID!!!"; + grid_provider = nullptr; + leaf_view = nullptr; + break; + } + case 2: { + Dune::GridFactory<G> factory; + for (auto&& vertex : {Dune::XT::Common::FieldVector<D, d>({-1., -1.5}), + Dune::XT::Common::FieldVector<D, d>({-1., -1.25}), + Dune::XT::Common::FieldVector<D, d>({-1., -1.}), + Dune::XT::Common::FieldVector<D, d>({-1.5, -1.5}), + Dune::XT::Common::FieldVector<D, d>({-1.5, -1.25}), + Dune::XT::Common::FieldVector<D, d>({-1.5, -1.}), + Dune::XT::Common::FieldVector<D, d>({-1.75, -1.25})}) { + factory.insertVertex(vertex); + } + factory.insertElement(Dune::GeometryType(Dune::GeometryType::cube, 2), {3, 0, 4, 1}); + factory.insertElement(Dune::GeometryType(Dune::GeometryType::cube, 2), {4, 1, 5, 2}); + factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex, 2), {4, 6, 3}); + factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex, 2), {4, 5, 6}); + grid_provider = std::make_shared<GridProviderType>(factory.createGrid()); + grid_provider->global_refine(1); + leaf_view = std::make_shared<LeafGridViewType>(grid_provider->leaf_view()); + break; + } + case 3: { + Dune::GridFactory<G> factory; + for (auto&& vertex : {Dune::XT::Common::FieldVector<D, d>({-1., -1.5, -1.}), + Dune::XT::Common::FieldVector<D, d>({-1., -1.25, -1.}), + Dune::XT::Common::FieldVector<D, d>({-1., -1., -1.}), + Dune::XT::Common::FieldVector<D, d>({-1.5, -1.5, -1.}), + Dune::XT::Common::FieldVector<D, d>({-1.5, -1.25, -1.}), + Dune::XT::Common::FieldVector<D, d>({-1.5, -1., -1.}), + Dune::XT::Common::FieldVector<D, d>({-1., -1.5, -1.5}), + Dune::XT::Common::FieldVector<D, d>({-1., -1.25, -1.5}), + Dune::XT::Common::FieldVector<D, d>({-1., -1., -1.5}), + Dune::XT::Common::FieldVector<D, d>({-1.5, -1.5, -1.5}), + Dune::XT::Common::FieldVector<D, d>({-1.5, -1.25, -1.5}), + Dune::XT::Common::FieldVector<D, d>({-1.5, -1., -1.5}), + Dune::XT::Common::FieldVector<D, d>({-1.75, -1.25, -1.})}) { + factory.insertVertex(vertex); + } + factory.insertElement(Dune::GeometryType(Dune::GeometryType::cube, 3), {3, 0, 4, 1, 9, 6, 10, 7}); + factory.insertElement(Dune::GeometryType(Dune::GeometryType::cube, 3), {4, 1, 5, 2, 10, 7, 11, 8}); + factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex, 3), {4, 12, 3, 10}); + factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex, 3), {4, 5, 12, 10}); + grid_provider = std::make_shared<GridProviderType>(factory.createGrid()); + grid_provider->global_refine(1); + leaf_view = std::make_shared<LeafGridViewType>(grid_provider->leaf_view()); + break; + } + default: { + // cannot use ASSERT_... in a ctor + EXPECT_TRUE(false) << "Not implemented yet for dimension " << d << "!\n" + << "=> ALL OTHER TESTS WILL FAIL FOR THIS GRID!!!"; + grid_provider = nullptr; + leaf_view = nullptr; + } + } + } // DiscontinuousLagrangeSpaceOnMixedLeafView(...) + + ~DiscontinuousLagrangeSpaceOnMixedLeafView() = default; + + std::shared_ptr<LeafGridViewType> grid_layer() override final + { + return leaf_view; + } +}; // struct DiscontinuousLagrangeSpaceOnMixedLeafView + + +using MixedGrids = ::testing::Types< +#if HAVE_DUNE_UGGRID || HAVE_UG + UG_2D, + UG_3D +#endif + >; + + +template <class G> +using Order0MixedDiscontinuousLagrangeSpace = DiscontinuousLagrangeSpaceOnMixedLeafView<G, 0>; +TYPED_TEST_CASE(Order0MixedDiscontinuousLagrangeSpace, MixedGrids); +TYPED_TEST(Order0MixedDiscontinuousLagrangeSpace, basis_exists_on_each_element_with_correct_size) +{ + this->basis_exists_on_each_element_with_correct_size(); +} +TYPED_TEST(Order0MixedDiscontinuousLagrangeSpace, basis_exists_on_each_element_with_correct_order) +{ + this->basis_exists_on_each_element_with_correct_order(); +} +TYPED_TEST(Order0MixedDiscontinuousLagrangeSpace, mapper_reports_correct_num_DoFs_on_each_element) +{ + this->mapper_reports_correct_num_DoFs_on_each_element(); +} +TYPED_TEST(Order0MixedDiscontinuousLagrangeSpace, mapper_reports_correct_max_num_DoFs) +{ + this->mapper_reports_correct_max_num_DoFs(); +} +TYPED_TEST(Order0MixedDiscontinuousLagrangeSpace, mapper_maps_correctly) +{ + this->mapper_maps_correctly(); +} +TYPED_TEST(Order0MixedDiscontinuousLagrangeSpace, lagrange_points_exist_on_each_element_with_correct_size) +{ + this->lagrange_points_exist_on_each_element_with_correct_size(); +} +TYPED_TEST(Order0MixedDiscontinuousLagrangeSpace, basis_is_lagrange_basis) +{ + this->basis_is_lagrange_basis(); +} +TYPED_TEST(Order0MixedDiscontinuousLagrangeSpace, basis_jacobians_seem_to_be_correct) +{ + this->basis_jacobians_seem_to_be_correct(); +} + + +template <class G> +using Order1MixedDiscontinuousLagrangeSpace = DiscontinuousLagrangeSpaceOnMixedLeafView<G, 1>; +TYPED_TEST_CASE(Order1MixedDiscontinuousLagrangeSpace, MixedGrids); +TYPED_TEST(Order1MixedDiscontinuousLagrangeSpace, basis_exists_on_each_element_with_correct_size) +{ + this->basis_exists_on_each_element_with_correct_size(); +} +TYPED_TEST(Order1MixedDiscontinuousLagrangeSpace, basis_exists_on_each_element_with_correct_order) +{ + this->basis_exists_on_each_element_with_correct_order(); +} +TYPED_TEST(Order1MixedDiscontinuousLagrangeSpace, mapper_reports_correct_num_DoFs_on_each_element) +{ + this->mapper_reports_correct_num_DoFs_on_each_element(); +} +TYPED_TEST(Order1MixedDiscontinuousLagrangeSpace, mapper_reports_correct_max_num_DoFs) +{ + this->mapper_reports_correct_max_num_DoFs(); +} +TYPED_TEST(Order1MixedDiscontinuousLagrangeSpace, mapper_maps_correctly) +{ + this->mapper_maps_correctly(); +} +TYPED_TEST(Order1MixedDiscontinuousLagrangeSpace, lagrange_points_exist_on_each_element_with_correct_size) +{ + this->lagrange_points_exist_on_each_element_with_correct_size(); +} +TYPED_TEST(Order1MixedDiscontinuousLagrangeSpace, basis_is_lagrange_basis) +{ + this->basis_is_lagrange_basis(); +} +TYPED_TEST(Order1MixedDiscontinuousLagrangeSpace, basis_jacobians_seem_to_be_correct) +{ + this->basis_jacobians_seem_to_be_correct(); +} + + +template <class G> +using Order2MixedDiscontinuousLagrangeSpace = DiscontinuousLagrangeSpaceOnMixedLeafView<G, 2>; +TYPED_TEST_CASE(Order2MixedDiscontinuousLagrangeSpace, MixedGrids); +TYPED_TEST(Order2MixedDiscontinuousLagrangeSpace, basis_exists_on_each_element_with_correct_size) +{ + this->basis_exists_on_each_element_with_correct_size(); +} +TYPED_TEST(Order2MixedDiscontinuousLagrangeSpace, basis_exists_on_each_element_with_correct_order) +{ + this->basis_exists_on_each_element_with_correct_order(); +} +TYPED_TEST(Order2MixedDiscontinuousLagrangeSpace, mapper_reports_correct_num_DoFs_on_each_element) +{ + this->mapper_reports_correct_num_DoFs_on_each_element(); +} +TYPED_TEST(Order2MixedDiscontinuousLagrangeSpace, mapper_reports_correct_max_num_DoFs) +{ + this->mapper_reports_correct_max_num_DoFs(); +} +TYPED_TEST(Order2MixedDiscontinuousLagrangeSpace, mapper_maps_correctly) +{ + this->mapper_maps_correctly(); +} +TYPED_TEST(Order2MixedDiscontinuousLagrangeSpace, lagrange_points_exist_on_each_element_with_correct_size) +{ + this->lagrange_points_exist_on_each_element_with_correct_size(); +} +TYPED_TEST(Order2MixedDiscontinuousLagrangeSpace, basis_is_lagrange_basis) +{ + this->basis_is_lagrange_basis(); +} +TYPED_TEST(Order2MixedDiscontinuousLagrangeSpace, basis_jacobians_seem_to_be_correct) +{ + this->basis_jacobians_seem_to_be_correct(); +} diff --git a/dune/gdt/test/spaces/spaces_rt.cc b/dune/gdt/test/spaces/spaces_rt.cc new file mode 100644 index 0000000000000000000000000000000000000000..5a729987e54b86e8a453294d677802bc1d547e99 --- /dev/null +++ b/dune/gdt/test/spaces/spaces_rt.cc @@ -0,0 +1,535 @@ +// 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 (2018) + +#include <dune/xt/common/test/main.hxx> // <- this one has to come first (includes the config.h)! + +#include <algorithm> +#include <memory> +#include <tuple> + +#include <dune/geometry/quadraturerules.hh> +#include <dune/geometry/referenceelements.hh> +#include <dune/geometry/refinement.hh> + +#include <dune/grid/common/rangegenerators.hh> + +#include <dune/xt/common/fvector.hh> +#include <dune/xt/common/numeric_cast.hh> +#include <dune/xt/grid/gridprovider/cube.hh> + +#include <dune/gdt/spaces/rt/default.hh> + + +template <class GridLayerType, int p> +struct RtSpace : public ::testing::Test +{ + static_assert(p == 0, "The space cannot handle higher orders (yet)!"); + using SpaceType = Dune::GDT::RaviartThomasSpace<GridLayerType, p>; + using D = typename SpaceType::DomainFieldType; + static const constexpr size_t d = SpaceType::dimDomain; + + virtual std::shared_ptr<GridLayerType> grid_layer() = 0; + + std::shared_ptr<SpaceType> space; + + ~RtSpace() = default; + + void SetUp() override final + { + ASSERT_NE(grid_layer(), nullptr); + space = std::shared_ptr<SpaceType>(new SpaceType(*grid_layer())); + } + + void TearDown() override final + { + space.reset(); + } + + void basis_exists_on_each_element_with_correct_size() + { + ASSERT_NE(grid_layer(), nullptr); + ASSERT_NE(space, nullptr); + for (auto&& element : elements(*grid_layer())) { + const auto& reference_element = Dune::ReferenceElements<D, d>::general(element.geometry().type()); + EXPECT_EQ(reference_element.size(1), space->base_function_set(element).size()); + } + } + + void basis_exists_on_each_element_with_correct_order() + { + ASSERT_NE(grid_layer(), nullptr); + ASSERT_NE(space, nullptr); + for (auto&& element : elements(*grid_layer())) + EXPECT_EQ(1, space->base_function_set(element).order()); + } + + void mapper_reports_correct_num_DoFs_on_each_element() + { + ASSERT_NE(grid_layer(), nullptr); + ASSERT_NE(space, nullptr); + for (auto&& element : elements(*grid_layer())) { + const auto& reference_element = Dune::ReferenceElements<D, d>::general(element.geometry().type()); + EXPECT_EQ(reference_element.size(1), space->mapper().numDofs(element)); + } + } + + void mapper_reports_correct_max_num_DoFs() + { + ASSERT_NE(grid_layer(), nullptr); + ASSERT_NE(space, nullptr); + size_t max_num_dofs = 0; + for (auto&& element : elements(*grid_layer())) + max_num_dofs = std::max(max_num_dofs, space->mapper().numDofs(element)); + EXPECT_LE(max_num_dofs, space->mapper().maxNumDofs()); + } + + void mapper_maps_correctly() + { + ASSERT_NE(grid_layer(), nullptr); + ASSERT_NE(space, nullptr); + // collect all global ids that are associated with a global lagrange point + std::map<Dune::FieldVector<D, d>, std::set<size_t>, Dune::XT::Common::FieldVectorLess> + global_intersection_centers_to_global_indices_map; + for (auto&& element : elements(*grid_layer())) { + const auto global_indices = space->mapper().globalIndices(element); + EXPECT_LE(space->mapper().numDofs(element), global_indices.size()); + const auto intersection_to_DoF_map = space->local_DoF_indices(element); + EXPECT_EQ(intersection_to_DoF_map.size(), space->mapper().numDofs(element)); + for (auto&& intersection : intersections(*grid_layer(), element)) { + const auto intersection_index = intersection.indexInInside(); + const auto local_DoF_index = intersection_to_DoF_map[intersection_index]; + const auto global_index = space->mapper().mapToGlobal(element, local_DoF_index); + EXPECT_EQ(global_indices[local_DoF_index], global_index); + global_intersection_centers_to_global_indices_map[intersection.geometry().center()].insert(global_index); + } + } + // check that all intersections have indeed one and only one global DoF id ... + std::set<size_t> global_DoF_indices; + for (const auto& entry : global_intersection_centers_to_global_indices_map) { + const auto global_DoF_indices_per_intersection = entry.second; + EXPECT_EQ(global_DoF_indices_per_intersection.size(), 1); + global_DoF_indices.insert(*(global_DoF_indices_per_intersection.begin())); + } + EXPECT_EQ(global_intersection_centers_to_global_indices_map.size(), global_DoF_indices.size()); + // ... and that the numbering is consecutive + size_t count = 0; + for (const auto& global_DoF_id : global_DoF_indices) { + EXPECT_EQ(global_DoF_id, count); + ++count; + } + EXPECT_EQ(global_DoF_indices.size(), space->mapper().size()); + } // ... mapper_maps_correctly(...) + + void local_DoF_indices_exist_on_each_element_with_correct_size() + { + ASSERT_NE(grid_layer(), nullptr); + ASSERT_NE(space, nullptr); + for (auto&& element : elements(*grid_layer())) { + const auto& reference_element = Dune::ReferenceElements<D, d>::general(element.geometry().type()); + EXPECT_EQ(reference_element.size(1), space->local_DoF_indices(element).size()); + } + } + + void basis_is_rt_basis() + { + ASSERT_NE(grid_layer(), nullptr); + ASSERT_NE(space, nullptr); + Dune::GDT::ZeroOrderScalarDiscontinuousMapper<GridLayerType> entity_indices(*grid_layer()); + for (auto&& element : elements(*grid_layer())) { + const auto basis = space->base_function_set(element); + const auto intersection_to_DoF_index_map = space->local_DoF_indices(element); + for (auto&& intersection : intersections(*grid_layer(), element)) { + const auto xx_in_element_coordinates = intersection.geometry().center(); + const auto xx_in_reference_element_coordinates = element.geometry().local(xx_in_element_coordinates); + const auto xx_in_reference_intersection_coordinates = + intersection.geometryInInside().local(xx_in_reference_element_coordinates); + const auto normal = intersection.integrationOuterNormal(xx_in_reference_intersection_coordinates); + const auto basis_values = basis.evaluate(xx_in_reference_element_coordinates); + const auto intersection_index = intersection.indexInInside(); + const auto DoF_index = intersection_to_DoF_index_map[intersection_index]; + double switch_ = 1; + if (intersection.neighbor() + && entity_indices.mapToGlobal(element, 0) < entity_indices.mapToGlobal(intersection.outside(), 0)) + switch_ *= -1.; + for (size_t ii = 0; ii < basis.size(); ++ii) + EXPECT_TRUE(Dune::XT::Common::FloatCmp::eq( + (ii == DoF_index ? 1. : 0.) * switch_, basis_values[ii] * normal, 1e-14, 1e-14)) + << "ii = " << ii << "\nDoF_index = " << DoF_index << "\nii == DoF_index ? 1. : 0. " + << (ii == DoF_index ? 1. : 0.) << "\nbasis_values[ii] * normal = " << basis_values[ii] * normal; + } + } + } // ... basis_is_rt_basis(...) + + void basis_jacobians_seem_to_be_correct() + { + ASSERT_NE(grid_layer(), nullptr); + ASSERT_NE(space, nullptr); + ASSERT_TRUE(false) << "continue here"; + // for (auto&& element : elements(*grid_layer())) { + // const auto& reference_element = Dune::ReferenceElements<D, d>::general(element.geometry().type()); + // const auto basis = space->base_function_set(element); + // const double h = 1e-6; + // for (const auto& quadrature_point : Dune::QuadratureRules<D, d>::rule(element.geometry().type(), + // basis.order())) { + // const auto& xx = quadrature_point.position(); + // const auto& J_inv_T = element.geometry().jacobianInverseTransposed(xx); + // const auto jacobians = basis.jacobian(xx); + // EXPECT_EQ(basis.size(), jacobians.size()); + // const auto values_xx = basis.evaluate(xx); + // EXPECT_EQ(basis.size(), values_xx.size()); + // auto approximate_jacobians = jacobians; + // // compute approximate partial derivatives + // for (size_t dd = 0; dd < d; ++dd) { + // // try to find a suitable x + h + // auto xx_plus_h = xx; + // xx_plus_h[dd] += h; + // if (!reference_element.checkInside(xx_plus_h)) { + // xx_plus_h[dd] -= 2. * h; + // } + // ASSERT_TRUE(reference_element.checkInside(xx_plus_h)) << "xx_plus_h = " << xx_plus_h + // << " is not inside the reference element!"; + // const auto values_xx_plus_h = basis.evaluate(xx_plus_h); + // EXPECT_EQ(basis.size(), values_xx_plus_h.size()); + // for (size_t ii = 0; ii < basis.size(); ++ii) { + // approximate_jacobians[ii][0][dd] = (values_xx_plus_h[ii] - values_xx[ii]) / (xx_plus_h[dd] - xx[dd]); + // if (xx_plus_h[dd] - xx[dd] < 0) + // approximate_jacobians[ii][0][dd] *= -1.; + // } + // } + // // transform + // auto tmp_jac = approximate_jacobians[0][0]; + // for (size_t ii = 0; ii < basis.size(); ++ii) { + // J_inv_T.mv(approximate_jacobians[ii][0], tmp_jac); + // approximate_jacobians[ii][0] = tmp_jac; + // } + // // check + // for (size_t ii = 0; ii < basis.size(); ++ii) + // EXPECT_TRUE(Dune::XT::Common::FloatCmp::eq(jacobians[ii][0], approximate_jacobians[ii][0], 1e-4, 1e-4)) + // << "ii = " << ii << "\njacobians[ii][0] = " << jacobians[ii][0] << "\n" + // << "approximate_jacobians[ii][0] = " << approximate_jacobians[ii][0] << "\n" + // << "absolue L_infty error: " << (jacobians[ii][0] - approximate_jacobians[ii][0]).infinity_norm() << + // "\n" + // << "relative L_infty error: " + // << (jacobians[ii][0] - approximate_jacobians[ii][0]).infinity_norm() / + // jacobians[ii][0].infinity_norm(); + // } + // } + } // ... basis_jacobians_seem_to_be_correct(...) +}; // struct RtSpace + + +template <class G, int p> +struct RtSpaceOnSimplicialLeafView : public RtSpace<typename Dune::XT::Grid::GridProvider<G>::LeafGridViewType, p> +{ + using GridProviderType = Dune::XT::Grid::GridProvider<G>; + using LeafGridViewType = typename GridProviderType::LeafGridViewType; + + GridProviderType grid_provider; + std::shared_ptr<LeafGridViewType> leaf_view; + + RtSpaceOnSimplicialLeafView() // (i) negative coordinates and not the same as the reference + : grid_provider(Dune::XT::Grid::make_cube_grid<G>(-1.5, -1, 3).grid_ptr()) // element, + { // (ii) at least 3 elements to have fully inner ones, + grid_provider.global_refine(1); // (iii) refine at least once to obtain all kinds of orientations + leaf_view = std::make_shared<LeafGridViewType>(grid_provider.leaf_view()); + } + + ~RtSpaceOnSimplicialLeafView() = default; + + std::shared_ptr<LeafGridViewType> grid_layer() override final + { + return leaf_view; + } +}; // struct RtSpaceOnSimplicialLeafView + + +using SimplicialGrids = ::testing::Types<ONED_1D, + YASP_1D_EQUIDISTANT_OFFSET +#if HAVE_DUNE_ALUGRID + , + ALU_2D_SIMPLEX_CONFORMING, + ALU_2D_SIMPLEX_NONCONFORMING +#endif +// UG does not work until we have the virtual interfaces for the finite elements. +//#if HAVE_DUNE_UGGRID || HAVE_UG +// , +// UG_2D +//#endif +#if HAVE_DUNE_ALUGRID + , + ALU_3D_SIMPLEX_CONFORMING, + ALU_3D_SIMPLEX_NONCONFORMING +#endif + // s.a. + //#if HAVE_DUNE_UGGRID || HAVE_UG + // , + // UG_3D + //#endif + >; + + +template <class G> +using Order0SimplicialRtSpace = RtSpaceOnSimplicialLeafView<G, 0>; +TYPED_TEST_CASE(Order0SimplicialRtSpace, SimplicialGrids); +TYPED_TEST(Order0SimplicialRtSpace, basis_exists_on_each_element_with_correct_size) +{ + this->basis_exists_on_each_element_with_correct_size(); +} +TYPED_TEST(Order0SimplicialRtSpace, basis_exists_on_each_element_with_correct_order) +{ + this->basis_exists_on_each_element_with_correct_order(); +} +TYPED_TEST(Order0SimplicialRtSpace, mapper_reports_correct_num_DoFs_on_each_element) +{ + this->mapper_reports_correct_num_DoFs_on_each_element(); +} +TYPED_TEST(Order0SimplicialRtSpace, mapper_reports_correct_max_num_DoFs) +{ + this->mapper_reports_correct_max_num_DoFs(); +} +TYPED_TEST(Order0SimplicialRtSpace, mapper_maps_correctly) +{ + this->mapper_maps_correctly(); +} +TYPED_TEST(Order0SimplicialRtSpace, local_DoF_indices_exist_on_each_element_with_correct_size) +{ + this->local_DoF_indices_exist_on_each_element_with_correct_size(); +} +TYPED_TEST(Order0SimplicialRtSpace, basis_is_rt_basis) +{ + this->basis_is_rt_basis(); +} +// TYPED_TEST(Order0SimplicialRtSpace, basis_jacobians_seem_to_be_correct) +//{ +// this->basis_jacobians_seem_to_be_correct(); +//} + + +template <class G, int p> +struct RtSpaceOnCubicLeafView : public RtSpace<typename Dune::XT::Grid::GridProvider<G>::LeafGridViewType, p> +{ + using GridProviderType = Dune::XT::Grid::GridProvider<G>; + using LeafGridViewType = typename GridProviderType::LeafGridViewType; + + std::shared_ptr<GridProviderType> grid_provider; + std::shared_ptr<LeafGridViewType> leaf_view; + + RtSpaceOnCubicLeafView() + { + using D = typename G::ctype; + static const constexpr size_t d = G::dimension; + Dune::FieldVector<D, d> lower_left(-1.5); // (i) negative coordinates and not the same as the reference element + Dune::FieldVector<D, d> upper_right(-1.); + std::array<unsigned int, d> num_elements; // (ii) at least 3 elements to have fully inner ones + std::fill(num_elements.begin(), num_elements.end(), 3); + grid_provider = std::make_shared<GridProviderType>( + Dune::StructuredGridFactory<G>::createCubeGrid(lower_left, upper_right, num_elements)); + leaf_view = std::make_shared<LeafGridViewType>(grid_provider->leaf_view()); + } + + ~RtSpaceOnCubicLeafView() = default; + + std::shared_ptr<LeafGridViewType> grid_layer() override final + { + return leaf_view; + } +}; // struct RtSpaceOnCubicLeafView + + +using CubicGrids = ::testing::Types<YASP_2D_EQUIDISTANT_OFFSET +#if HAVE_DUNE_ALUGRID + , + ALU_2D_CUBE +#endif + //// s.a. + //#if HAVE_DUNE_UGGRID || HAVE_UG + // , + // UG_2D + //#endif + , + YASP_3D_EQUIDISTANT_OFFSET +#if HAVE_DUNE_ALUGRID + , + ALU_3D_CUBE +#endif + //// s.a. + //#if HAVE_DUNE_UGGRID || HAVE_UG + // , + // UG_3D + //#endif + >; + +template <class G> +using Order0CubicRtSpace = RtSpaceOnCubicLeafView<G, 0>; +TYPED_TEST_CASE(Order0CubicRtSpace, CubicGrids); +TYPED_TEST(Order0CubicRtSpace, basis_exists_on_each_element_with_correct_size) +{ + this->basis_exists_on_each_element_with_correct_size(); +} +TYPED_TEST(Order0CubicRtSpace, basis_exists_on_each_element_with_correct_order) +{ + this->basis_exists_on_each_element_with_correct_order(); +} +TYPED_TEST(Order0CubicRtSpace, mapper_reports_correct_num_DoFs_on_each_element) +{ + this->mapper_reports_correct_num_DoFs_on_each_element(); +} +TYPED_TEST(Order0CubicRtSpace, mapper_reports_correct_max_num_DoFs) +{ + this->mapper_reports_correct_max_num_DoFs(); +} +TYPED_TEST(Order0CubicRtSpace, mapper_maps_correctly) +{ + this->mapper_maps_correctly(); +} +TYPED_TEST(Order0CubicRtSpace, local_DoF_indices_exist_on_each_element_with_correct_size) +{ + this->local_DoF_indices_exist_on_each_element_with_correct_size(); +} +TYPED_TEST(Order0CubicRtSpace, basis_is_rt_basis) +{ + this->basis_is_rt_basis(); +} +// TYPED_TEST(Order0CubicRtSpace, basis_jacobians_seem_to_be_correct) +//{ +// this->basis_jacobians_seem_to_be_correct(); +//} + + +//// The space cannot handle mixed views (yet)! +// template <class G, int p> +// struct RtSpaceOnMixedLeafView : public RtSpace<typename Dune::XT::Grid::GridProvider<G>::LeafGridViewType, p> +//{ +// using GridProviderType = Dune::XT::Grid::GridProvider<G>; +// using LeafGridViewType = typename GridProviderType::LeafGridViewType; + +// std::shared_ptr<GridProviderType> grid_provider; +// std::shared_ptr<LeafGridViewType> leaf_view; + +// RtSpaceOnMixedLeafView() +// { +// using D = typename G::ctype; +// static const constexpr size_t d = G::dimension; +// switch (d) { +// case 1: { +// // cannot use ASSERT_... in a ctor +// EXPECT_TRUE(false) << "Does not make sense in 1d (all cubes are simplices)!\n" +// << "=> ALL OTHER TESTS WILL FAIL FOR THIS GRID!!!"; +// grid_provider = nullptr; +// leaf_view = nullptr; +// break; +// } +// case 2: { +// Dune::GridFactory<G> factory; +// for (auto&& vertex : {Dune::XT::Common::FieldVector<D, d>({-1., -1.5}), +// Dune::XT::Common::FieldVector<D, d>({-1., -1.25}), +// Dune::XT::Common::FieldVector<D, d>({-1., -1.}), +// Dune::XT::Common::FieldVector<D, d>({-1.5, -1.5}), +// Dune::XT::Common::FieldVector<D, d>({-1.5, -1.25}), +// Dune::XT::Common::FieldVector<D, d>({-1.5, -1.}), +// Dune::XT::Common::FieldVector<D, d>({-1.75, -1.25})}) { +// factory.insertVertex(vertex); +// } +// factory.insertElement(Dune::GeometryType(Dune::GeometryType::cube, 2), {3, 0, 4, 1}); +// factory.insertElement(Dune::GeometryType(Dune::GeometryType::cube, 2), {4, 1, 5, 2}); +// factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex, 2), {4, 6, 3}); +// factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex, 2), {4, 5, 6}); +// grid_provider = std::make_shared<GridProviderType>(factory.createGrid()); +// grid_provider->global_refine(1); +// leaf_view = std::make_shared<LeafGridViewType>(grid_provider->leaf_view()); +// break; +// } +// case 3: { +// Dune::GridFactory<G> factory; +// for (auto&& vertex : {Dune::XT::Common::FieldVector<D, d>({-1., -1.5, -1.}), +// Dune::XT::Common::FieldVector<D, d>({-1., -1.25, -1.}), +// Dune::XT::Common::FieldVector<D, d>({-1., -1., -1.}), +// Dune::XT::Common::FieldVector<D, d>({-1.5, -1.5, -1.}), +// Dune::XT::Common::FieldVector<D, d>({-1.5, -1.25, -1.}), +// Dune::XT::Common::FieldVector<D, d>({-1.5, -1., -1.}), +// Dune::XT::Common::FieldVector<D, d>({-1., -1.5, -1.5}), +// Dune::XT::Common::FieldVector<D, d>({-1., -1.25, -1.5}), +// Dune::XT::Common::FieldVector<D, d>({-1., -1., -1.5}), +// Dune::XT::Common::FieldVector<D, d>({-1.5, -1.5, -1.5}), +// Dune::XT::Common::FieldVector<D, d>({-1.5, -1.25, -1.5}), +// Dune::XT::Common::FieldVector<D, d>({-1.5, -1., -1.5}), +// Dune::XT::Common::FieldVector<D, d>({-1.75, -1.25, -1.})}) { +// factory.insertVertex(vertex); +// } +// factory.insertElement(Dune::GeometryType(Dune::GeometryType::cube, 3), {3, 0, 4, 1, 9, 6, 10, 7}); +// factory.insertElement(Dune::GeometryType(Dune::GeometryType::cube, 3), {4, 1, 5, 2, 10, 7, 11, 8}); +// factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex, 3), {4, 12, 3, 10}); +// factory.insertElement(Dune::GeometryType(Dune::GeometryType::simplex, 3), {4, 5, 12, 10}); +// grid_provider = std::make_shared<GridProviderType>(factory.createGrid()); +// grid_provider->global_refine(1); +// leaf_view = std::make_shared<LeafGridViewType>(grid_provider->leaf_view()); +// break; +// } +// default: { +// // cannot use ASSERT_... in a ctor +// EXPECT_TRUE(false) << "Not implemented yet for dimension " << d << "!\n" +// << "=> ALL OTHER TESTS WILL FAIL FOR THIS GRID!!!"; +// grid_provider = nullptr; +// leaf_view = nullptr; +// } +// } +// } // RtSpaceOnMixedLeafView(...) + +// ~RtSpaceOnMixedLeafView() = default; + +// std::shared_ptr<LeafGridViewType> grid_layer() override final +// { +// return leaf_view; +// } +//}; // struct RtSpaceOnMixedLeafView + + +// using MixedGrids = ::testing::Types< +//#ifHAVE_DUNE_UGGRID || HAVE_UG +// UG_2D, +// UG_3D +//#endif +// >; + + +// template <class G> +// using Order0MixedRtSpace = RtSpaceOnMixedLeafView<G, 0>; +// TYPED_TEST_CASE(Order0MixedRtSpace, MixedGrids); +// TYPED_TEST(Order0MixedRtSpace, basis_exists_on_each_element_with_correct_size) +//{ +// this->basis_exists_on_each_element_with_correct_size(); +//} +// TYPED_TEST(Order0MixedRtSpace, basis_exists_on_each_element_with_correct_order) +//{ +// this->basis_exists_on_each_element_with_correct_order(); +//} +// TYPED_TEST(Order0MixedRtSpace, mapper_reports_correct_num_DoFs_on_each_element) +//{ +// this->mapper_reports_correct_num_DoFs_on_each_element(); +//} +// TYPED_TEST(Order0MixedRtSpace, mapper_reports_correct_max_num_DoFs) +//{ +// this->mapper_reports_correct_max_num_DoFs(); +//} +// TYPED_TEST(Order0MixedRtSpace, mapper_maps_correctly) +//{ +// this->mapper_maps_correctly(); +//} +// TYPED_TEST(Order0MixedRtSpace, local_DoF_indices_exist_on_each_element_with_correct_size) +//{ +// this->local_DoF_indices_exist_on_each_element_with_correct_size(); +//} +// TYPED_TEST(Order0MixedRtSpace, basis_is_rt_basis) +//{ +// this->basis_is_rt_basis(); +//} +// TYPED_TEST(Order0MixedRtSpace, basis_jacobians_seem_to_be_correct) +//{ +// this->basis_jacobians_seem_to_be_correct(); +//} diff --git a/examples/parallel_discretizations/block_swipdg.cc b/examples/parallel_discretizations/block_swipdg.cc index 10aa0a0a52a857d05f853bba56f7b4fddc16edc2..97f02f5eb2041d97ad8dd540a7b29f660e148096 100644 --- a/examples/parallel_discretizations/block_swipdg.cc +++ b/examples/parallel_discretizations/block_swipdg.cc @@ -280,38 +280,20 @@ int main(int argc, char** argv) switch (DXTC_CONFIG_GET("global.problem", 0)) { case 0: - single_run<GDT::Backends::pdelab, + single_run<GDT::Backends::gdt, GDT::LinearElliptic::ER2007TestCase<GridType>, GDT::LinearElliptic::ER2007DdSubdomainsTestCase<GridType>>(); break; case 1: - single_run<GDT::Backends::pdelab, + single_run<GDT::Backends::gdt, GDT::LinearElliptic::ESV2007TestCase<GridType>, GDT::LinearElliptic::ESV2007DdSubdomainsTestCase<GridType>>(); break; case 2: - single_run<GDT::Backends::pdelab, + single_run<GDT::Backends::gdt, GDT::LinearElliptic::ER2007TestCase<GridType>, GDT::LinearElliptic::ER2007DdSubdomainsTestCase<GridType>>(); - single_run<GDT::Backends::pdelab, - GDT::LinearElliptic::ESV2007TestCase<GridType>, - GDT::LinearElliptic::ESV2007DdSubdomainsTestCase<GridType>>(); - break; - case 3: - single_run<GDT::Backends::fem, - GDT::LinearElliptic::ER2007TestCase<GridType>, - GDT::LinearElliptic::ER2007DdSubdomainsTestCase<GridType>>(); - break; - case 4: - single_run<GDT::Backends::fem, - GDT::LinearElliptic::ESV2007TestCase<GridType>, - GDT::LinearElliptic::ESV2007DdSubdomainsTestCase<GridType>>(); - break; - case 5: - single_run<GDT::Backends::fem, - GDT::LinearElliptic::ER2007TestCase<GridType>, - GDT::LinearElliptic::ER2007DdSubdomainsTestCase<GridType>>(); - single_run<GDT::Backends::fem, + single_run<GDT::Backends::gdt, GDT::LinearElliptic::ESV2007TestCase<GridType>, GDT::LinearElliptic::ESV2007DdSubdomainsTestCase<GridType>>(); break; diff --git a/examples/parallel_discretizations/block_swipdg.ini b/examples/parallel_discretizations/block_swipdg.ini index 60d40d42342089df3f16ab1c8d7a7660aedeab88..3821b4b31e05d200400cb4e3905a1be8907a4490 100644 --- a/examples/parallel_discretizations/block_swipdg.ini +++ b/examples/parallel_discretizations/block_swipdg.ini @@ -36,8 +36,7 @@ overlap = 1 calc_error = 1 visualize = 1 intersection_vis = 0 -# with pdelab: 0: ER2007, 1: ESV2007, 2: both -# with fem: 3: ER2007, 4: ESV2007, 5: both +# 0: ER2007, 1: ESV2007, 2: both problem = 1 block = 1 ipdg = 1 diff --git a/python/dune/gdt/__init__.py b/python/dune/gdt/__init__.py index c9a5e3d0c06afa270284a4c6650048c35c2f14cd..6e8e525d482a8ee1e94dd56ce7f88b7752c33c45 100644 --- a/python/dune/gdt/__init__.py +++ b/python/dune/gdt/__init__.py @@ -96,6 +96,3 @@ def init_mpi(args=list()): init_mpi_method(args) -HAVE_DUNE_FEM = np.any(['FemP1Space' in var for var in globals().keys()]) -HAVE_DUNE_PDELAB = np.any(['PdelabP1Space' in var for var in globals().keys()]) -