From 4c63774824a69fda563ee0229da39c2e43880c92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Milk?= <rene.milk@wwu.de> Date: Sun, 25 Feb 2018 22:39:19 +0100 Subject: [PATCH] remove /re-=use some dune-fem related code --- dune/xt/functions/affine.hh | 13 -- dune/xt/functions/femadapter.hh | 144 ------------------- dune/xt/functions/interfaces.lib.hh | 8 +- python/dune/xt/functions/ESV2007.bindings.hh | 5 - python/dune/xt/functions/interfaces.pbh | 2 - 5 files changed, 2 insertions(+), 170 deletions(-) delete mode 100644 dune/xt/functions/femadapter.hh diff --git a/dune/xt/functions/affine.hh b/dune/xt/functions/affine.hh index a91450f2a..9aa3b9321 100644 --- a/dune/xt/functions/affine.hh +++ b/dune/xt/functions/affine.hh @@ -129,19 +129,6 @@ public: AffineFunctionBase(const ThisType& other) = default; -// if HAVE_DUNE_FEM is true, GlobalFunctionInterface is derived from Fem::Function which has a deleted copy assignment -// operator -#if HAVE_DUNE_FEM - ThisType& operator=(const ThisType& other) - { - A_ = other.A_; - b_ = other.b_; - name_ = other.name_; - b_zero_ = other.b_zero_; - return *this; - } -#endif - const std::vector<MatrixType>& A() const { return A_; diff --git a/dune/xt/functions/femadapter.hh b/dune/xt/functions/femadapter.hh deleted file mode 100644 index 939d77f41..000000000 --- a/dune/xt/functions/femadapter.hh +++ /dev/null @@ -1,144 +0,0 @@ -// This file is part of the dune-xt-functions project: -// https://github.com/dune-community/dune-xt-functions -// Copyright 2009-2018 dune-xt-functions 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 (2013 - 2018) -// Tobias Leibner (2014, 2017) - -#ifndef DUNE_XT_FUNCTIONS_FEMADAPTER -#define DUNE_XT_FUNCTIONS_FEMADAPTER - -#include <dune/xt/common/memory.hh> - -#include <dune/xt/functions/interfaces.hh> - -#if HAVE_DUNE_FEM - -namespace Dune { -namespace XT { -namespace Functions { - - -template <class DiscreteFunctionType> -class FemAdapterFunction - : public LocalizableFunctionInterface<typename DiscreteFunctionType::EntityType, - typename DiscreteFunctionType::DomainFieldType, - DiscreteFunctionType::DiscreteFunctionSpaceType::dimDomain, - typename DiscreteFunctionType::RangeFieldType, - DiscreteFunctionType::DiscreteFunctionSpaceType::dimRange, - 1> -{ - typedef LocalizableFunctionInterface<typename DiscreteFunctionType::EntityType, - typename DiscreteFunctionType::DomainFieldType, - DiscreteFunctionType::DiscreteFunctionSpaceType::dimDomain, - typename DiscreteFunctionType::RangeFieldType, - DiscreteFunctionType::DiscreteFunctionSpaceType::dimRange, - 1> - BaseType; - typedef FemAdapterFunction<DiscreteFunctionType> ThisType; - - class Localfunction : public LocalfunctionInterface<typename DiscreteFunctionType::EntityType, - typename DiscreteFunctionType::DomainFieldType, - DiscreteFunctionType::DiscreteFunctionSpaceType::dimDomain, - typename DiscreteFunctionType::RangeFieldType, - DiscreteFunctionType::DiscreteFunctionSpaceType::dimRange, - 1> - { - typedef LocalfunctionInterface<typename DiscreteFunctionType::EntityType, - typename DiscreteFunctionType::DomainFieldType, - DiscreteFunctionType::DiscreteFunctionSpaceType::dimDomain, - typename DiscreteFunctionType::RangeFieldType, - DiscreteFunctionType::DiscreteFunctionSpaceType::dimRange, - 1> - BaseType; - - public: - typedef typename BaseType::EntityType EntityType; - - typedef typename BaseType::DomainType DomainType; - typedef typename BaseType::RangeType RangeType; - typedef typename BaseType::JacobianRangeType JacobianRangeType; - - Localfunction(const DiscreteFunctionType& df, const EntityType& ent) - : BaseType(ent) - , wrapped_localfunction_(df.localFunction(ent)) - { - } - - Localfunction(const Localfunction& /*other*/) = delete; - - Localfunction& operator=(const Localfunction& /*other*/) = delete; - - virtual size_t order(const XT::Common::Parameter& /*mu*/ = {}) const override - { - // being a dune-fem datatype, the wrapped funcitons _really_ do not process the mu - return wrapped_localfunction_.order(); - } - - virtual void evaluate(const DomainType& xx, RangeType& ret, const Common::Parameter& /*mu*/ = {}) const override - { - wrapped_localfunction_.evaluate(xx, ret); - } - - virtual void - jacobian(const DomainType& xx, JacobianRangeType& ret, const Common::Parameter& /*mu*/ = {}) const override - { - wrapped_localfunction_.jacobian(xx, ret); - } - - private: - typedef typename DiscreteFunctionType::LocalFunctionType WrappedLocalfunctionType; - WrappedLocalfunctionType wrapped_localfunction_; - }; // class Localfunction - -public: - typedef typename BaseType::EntityType EntityType; - typedef typename BaseType::LocalfunctionType LocalfunctionType; - - FemAdapterFunction(const DiscreteFunctionType& df) - : df_(df) - { - } - - static std::string static_id() - { - return BaseType::static_id() + ".femadapter"; - } - - virtual ThisType* copy() const override - { - return new ThisType(*this); - } - - virtual std::string type() const override - { - return BaseType::static_id() + ".femadapter"; - } - - virtual std::string name() const override - { - return df_.name(); - } - - //! this intentionally hides - virtual std::unique_ptr<LocalfunctionType> local_function(const EntityType& entity) const - { - return Common::make_unique<Localfunction>(df_, entity); - } // ... local_function(...) - -private: - const DiscreteFunctionType& df_; -}; // class CheckerboardFunction - - -} // namespace Functions -} // namespace XT -} // namespace Dune - -#endif // if HAVE_DUNE_FEM - -#endif // DUNE_XT_FUNCTIONS_FEMADAPTER diff --git a/dune/xt/functions/interfaces.lib.hh b/dune/xt/functions/interfaces.lib.hh index 65b09bd5d..677673468 100644 --- a/dune/xt/functions/interfaces.lib.hh +++ b/dune/xt/functions/interfaces.lib.hh @@ -16,7 +16,6 @@ #if DUNE_XT_WITH_PYTHON_BINDINGS -#if HAVE_DUNE_FEM #define _DUNE_XT_FUNCTIONS_INTERFACE_LIB_VISUALIZE_DD_SUBDOMAIN(_p, _G, _t, _b, _R, _r, _rC) \ _p void Dune::XT::Functions::LocalizableFunctionInterface< \ typename _G::template Codim<0>::Entity, \ @@ -31,9 +30,6 @@ const std::string, \ const bool, \ const VTK::OutputType) const -#else -#define _DUNE_XT_FUNCTIONS_INTERFACE_LIB_VISUALIZE_DD_SUBDOMAIN(_p, _G, _t, _b, _R, _r, _rC) -#endif #define _DUNE_XT_FUNCTIONS_INTERFACE_LIB_VISUALIZE(_p, _G, _t, _b, _R, _r, _rC) \ _p void Dune::XT::Functions::LocalizableFunctionInterface<typename _G::template Codim<0>::Entity, \ @@ -50,10 +46,10 @@ #if HAVE_DUNE_FEM #define _DUNE_XT_FUNCTIONS_INTERFACE_LIB_VISUALIZE_PART(_p, _G, _R, _r, _rC) \ - _DUNE_XT_FUNCTIONS_INTERFACE_LIB_VISUALIZE(_p, _G, adaptive_leaf, part, _R, _r, _rC); \ + _DUNE_XT_FUNCTIONS_INTERFACE_LIB_VISUALIZE(_p, _G, adaptive_leaf, view, _R, _r, _rC); \ _DUNE_XT_FUNCTIONS_INTERFACE_LIB_VISUALIZE(_p, _G, leaf, part, _R, _r, _rC); \ _DUNE_XT_FUNCTIONS_INTERFACE_LIB_VISUALIZE(_p, _G, level, part, _R, _r, _rC); \ - _DUNE_XT_FUNCTIONS_INTERFACE_LIB_VISUALIZE_DD_SUBDOMAIN(_p, _G, dd_subdomain, part, _R, _r, _rC) + _DUNE_XT_FUNCTIONS_INTERFACE_LIB_VISUALIZE_DD_SUBDOMAIN(_p, _G, dd_subdomain, view, _R, _r, _rC) #else #define _DUNE_XT_FUNCTIONS_INTERFACE_LIB_VISUALIZE_PART(_p, _G, _R, _r, _rC) #endif diff --git a/python/dune/xt/functions/ESV2007.bindings.hh b/python/dune/xt/functions/ESV2007.bindings.hh index 3f3863ebd..fd3758a14 100644 --- a/python/dune/xt/functions/ESV2007.bindings.hh +++ b/python/dune/xt/functions/ESV2007.bindings.hh @@ -91,7 +91,6 @@ class CutoffFunction "poincare_constant"_a = 1.0 / (M_PIl * M_PIl), "name"_a = type_single_diffusion::static_id(), py::keep_alive<0, 2>()); -#if HAVE_DUNE_FEM m.def(std::string(make_name + "_single_diffusion_to_1x1").c_str(), [](const Grid::GridProvider<G, XT::Grid::DD::SubdomainGrid<G>>& /*grid*/, const ScalarFunction& diffusion, @@ -102,8 +101,6 @@ class CutoffFunction "poincare_constant"_a = 1.0 / (M_PIl * M_PIl), "name"_a = type_single_diffusion::static_id(), py::keep_alive<0, 2>()); -#endif // HAVE_DUNE_FEM - m.def(std::string(make_name + "_diffusion_factor_and_tensor_to_1x1").c_str(), [](const Grid::GridProvider<G>& /*grid*/, const ScalarFunction& diffusion_factor, @@ -117,7 +114,6 @@ class CutoffFunction "name"_a = type::static_id(), py::keep_alive<0, 2>(), py::keep_alive<0, 3>()); -#if HAVE_DUNE_FEM m.def(std::string(make_name + "_diffusion_factor_and_tensor_to_1x1").c_str(), [](const Grid::GridProvider<G, XT::Grid::DD::SubdomainGrid<G>>& /*grid*/, const ScalarFunction& diffusion_factor, @@ -131,7 +127,6 @@ class CutoffFunction "name"_a = type::static_id(), py::keep_alive<0, 2>(), py::keep_alive<0, 3>()); -#endif // HAVE_DUNE_FEM } }; // struct helper<true, ...> diff --git a/python/dune/xt/functions/interfaces.pbh b/python/dune/xt/functions/interfaces.pbh index 03b7befa9..421121a9b 100644 --- a/python/dune/xt/functions/interfaces.pbh +++ b/python/dune/xt/functions/interfaces.pbh @@ -221,7 +221,6 @@ bind_LocalizableFunctionInterface(pybind11::module& m, const std::string& grid_i "level"_a = -1, "path"_a, "subsampling"_a = true); -#if HAVE_DUNE_FEM c.def("visualize", [](const C& self, const Grid::GridProvider<G, Grid::DD::SubdomainGrid<G>>& dd_grid_provider, @@ -260,7 +259,6 @@ bind_LocalizableFunctionInterface(pybind11::module& m, const std::string& grid_i "level_or_subdomain"_a = -1, "path"_a, "subsampling"_a = true); -#endif // HAVE_DUNE_FEM internal::Divergence<G>::addbind(m, c); -- GitLab