diff --git a/src/amdis/Assembler.hpp b/src/amdis/Assembler.hpp index be425fc992ef0572b5ee97d008a0a03696c84c05..8473ac32278e44489042ffa87e253b582653c7cf 100644 --- a/src/amdis/Assembler.hpp +++ b/src/amdis/Assembler.hpp @@ -8,7 +8,7 @@ #include <amdis/DirichletBC.hpp> #include <amdis/LinearAlgebra.hpp> -#include <amdis/LocalAssemblerBase.hpp> +#include <amdis/LocalAssemblerList.hpp> #include <amdis/common/Mpl.hpp> #include <amdis/common/TypeDefs.hpp> diff --git a/src/amdis/ProblemStat.hpp b/src/amdis/ProblemStat.hpp index 9352089e83f137088cde0b6136cc5d3922baf007..47e5a63684e9b3e17221be5ce6e2f43e1c70caa1 100644 --- a/src/amdis/ProblemStat.hpp +++ b/src/amdis/ProblemStat.hpp @@ -19,6 +19,7 @@ #include <amdis/Flag.hpp> #include <amdis/Initfile.hpp> #include <amdis/LinearAlgebra.hpp> +#include <amdis/LocalAssemblerList.hpp> #include <amdis/Marker.hpp> #include <amdis/Mesh.hpp> #include <amdis/ProblemStatBase.hpp> diff --git a/src/amdis/common/TupleUtility.hpp b/src/amdis/common/TupleUtility.hpp index 202622fd4704e49da37365d8f22434fa7110a2cb..0a6f1c03b475fef208d86ded0960f5c212d24fd0 100644 --- a/src/amdis/common/TupleUtility.hpp +++ b/src/amdis/common/TupleUtility.hpp @@ -31,7 +31,7 @@ namespace AMDiS { static_assert(std::tuple_size<Tuple>::value == sizeof...(args), "Nr. of argument != tuple-size"); - return {std::forward<Args>(args)...}; + return Tuple{std::forward<Args>(args)...}; } }; @@ -43,7 +43,7 @@ namespace AMDiS { static_assert(std::tuple_size<Tuple>::value == 0, "Construction of empty tuples with empty argument list only!"); - return {}; + return Tuple{}; } }; diff --git a/src/amdis/gridfunctions/AnalyticGridFunction.hpp b/src/amdis/gridfunctions/AnalyticGridFunction.hpp index 40bd3918e5dddd827416051b1edea394e30073e1..c40e5af1b748b6f2821d84458814c8f3a43dc258 100644 --- a/src/amdis/gridfunctions/AnalyticGridFunction.hpp +++ b/src/amdis/gridfunctions/AnalyticGridFunction.hpp @@ -25,6 +25,8 @@ namespace AMDiS using Geometry = typename LocalContext::Geometry; + enum { hasDerivative = true }; + public: AnalyticLocalFunction(Function const& fct) : fct_{fct} @@ -100,6 +102,8 @@ namespace AMDiS using Domain = typename EntitySet::GlobalCoordinate; using Range = std::decay_t<std::result_of_t<Function(Domain)>>; + enum { hasDerivative = true }; + private: using Element = typename EntitySet::Element; using LocalDomain = typename EntitySet::LocalCoordinate; diff --git a/src/amdis/gridfunctions/ConstantGridFunction.hpp b/src/amdis/gridfunctions/ConstantGridFunction.hpp index 978f8a5b3baade57e88ebeb50dbfcffdeba959de..275da96fbd7e114572c8ef65427a7a9e708cb23d 100644 --- a/src/amdis/gridfunctions/ConstantGridFunction.hpp +++ b/src/amdis/gridfunctions/ConstantGridFunction.hpp @@ -27,6 +27,8 @@ namespace AMDiS using Geometry = typename LocalContext::Geometry; + enum { hasDerivative = true }; + public: ConstantLocalFunction(T const& value) : value_(value) @@ -97,6 +99,8 @@ namespace AMDiS using LocalDomain = typename EntitySet::LocalCoordinate; using Range = Underlying_t<T>; + enum { hasDerivative = false }; + public: using LocalFunction = ConstantLocalFunction<Range(LocalDomain), Element, T>; diff --git a/src/amdis/gridfunctions/DOFVectorView.hpp b/src/amdis/gridfunctions/DOFVectorView.hpp index 91ddcb186c14982733f57582c417e4a3142a0783..e71139e6cf220778070202bbcc276c99a885aec1 100644 --- a/src/amdis/gridfunctions/DOFVectorView.hpp +++ b/src/amdis/gridfunctions/DOFVectorView.hpp @@ -49,6 +49,7 @@ namespace AMDiS template <class Block> using Flat = Dune::Functions::FlatVectorBackend<Block>; + enum { hasDerivative = false }; public: // a local view on the gradients @@ -59,6 +60,8 @@ namespace AMDiS using Domain = LocalDomain; using Range = DerivativeRange; + enum { hasDerivative = false }; + private: using LocalBasisView = typename GlobalBasis::LocalView; using LocalIndexSet = typename GlobalBasis::LocalIndexSet; @@ -135,6 +138,8 @@ namespace AMDiS using Domain = typename DOFVectorConstView::LocalDomain; using Range = typename DOFVectorConstView::Range; + enum { hasDerivative = true }; + private: using LocalBasisView = typename GlobalBasis::LocalView; using LocalIndexSet = typename GlobalBasis::LocalIndexSet; diff --git a/src/amdis/gridfunctions/DerivativeGridFunction.hpp b/src/amdis/gridfunctions/DerivativeGridFunction.hpp index 87fccfb829e0865d42ccd21355e38e69f01be67c..e4c0adc7f64304342260e00b5f0aa3d5f4bee75c 100644 --- a/src/amdis/gridfunctions/DerivativeGridFunction.hpp +++ b/src/amdis/gridfunctions/DerivativeGridFunction.hpp @@ -32,6 +32,8 @@ namespace AMDiS using DerivativeTraits = Dune::Functions::DefaultDerivativeTraits<RawSignature>; using LocalFunction = std::decay_t<decltype(derivative(localFunction(std::declval<GridFunction>())))>; + enum { hasDerivative = false }; + public: /// The Range of the derivative of the GridFunction using Range = typename DerivativeTraits::Range; @@ -58,9 +60,9 @@ namespace AMDiS } /// Return the derivative-localFunction of the GridFunction. - LocalFunction localFunction() const + friend LocalFunction localFunction(DerivativeGridFunction const& gf) { - return derivative(localFunction(gridFct_)); + return derivative(localFunction(gf.gridFct_)); } /// Return the \ref EntitySet of the \ref GridFunction. @@ -74,16 +76,10 @@ namespace AMDiS }; - template <class GF> - auto localFunction(DerivativeGridFunction<GF> const& gf) - { - return gf.localFunction(); - } - - +#ifndef DOXYGEN template <class GridFct, class LocalFct = decltype(localFunction(std::declval<GridFct>())), - REQUIRES(not Concepts::HasDerivative<GridFct>)> + REQUIRES(not GridFct::hasDerivative)> auto derivative(GridFct const& gridFct) { static_assert(Concepts::HasDerivative<LocalFct>, "derivative(LocalFunction) not defined!"); @@ -91,7 +87,6 @@ namespace AMDiS } -#ifndef DOXYGEN template <class Expr> struct DerivativePreGridFunction { diff --git a/src/amdis/gridfunctions/FunctorGridFunction.hpp b/src/amdis/gridfunctions/FunctorGridFunction.hpp index f315805309841ebb234f760ca964b50303a37bd7..8b12ab2546c0e7580fc5067164c363560494bcf7 100644 --- a/src/amdis/gridfunctions/FunctorGridFunction.hpp +++ b/src/amdis/gridfunctions/FunctorGridFunction.hpp @@ -9,7 +9,6 @@ #include <amdis/common/IndexSeq.hpp> #include <amdis/common/Loops.hpp> #include <amdis/common/Mpl.hpp> -#include <amdis/utility/Tuple.hpp> #include <amdis/gridfunctions/GridFunctionConcepts.hpp> namespace AMDiS @@ -47,6 +46,8 @@ namespace AMDiS using Range = R; using Domain = D; + enum { hasDerivative = true }; + template <class LocalFct> struct LocalFunctionWrapper { @@ -90,7 +91,7 @@ namespace AMDiS Range operator()(Domain const& x) const { using Dune::Std::apply; - return apply([&](auto&&... localFct) { return fct_(localFct(x)...); }, localFcts_); + return apply([&](auto&&... localFct) { return fct_((*localFct)(x)...); }, localFcts_); } public: @@ -187,6 +188,8 @@ namespace AMDiS /// The set of entities this grid-function binds to using EntitySet = typename Impl::EntitySetType<GridFunctions...>::type; + enum { hasDerivative = false }; + private: template <class GridFct> using LocalFct = std::decay_t<decltype(localFunction(std::declval<GridFct>()))>; @@ -234,7 +237,7 @@ namespace AMDiS template <class F, class... GFs> auto localFunction(FunctorGridFunction<F,GFs...> const& gf) { - return gt.localFunction(); + return gf.localFunction(); } diff --git a/test/TupleUtilityTest.cpp b/test/TupleUtilityTest.cpp index 4f40c2c374d07aa36432f8b08f376e5037f310ac..9d99c3baf104c2e3e7e2025c1c505677dd2d6eeb 100644 --- a/test/TupleUtilityTest.cpp +++ b/test/TupleUtilityTest.cpp @@ -14,13 +14,13 @@ int main() using TupleInt = std::tuple<int,int>; using Tuple2 = std::tuple<TupleDouble,TupleInt>; - Tuple1 u = {1.3, 2}; + Tuple1 u{1.3, 2}; auto v = constructTuple<Tuple1>(1.5); auto w = foldTuples<Tuple2>(u,v); - AMDIS_TEST(u == Tuple1({1.3, 2})); - AMDIS_TEST(v == Tuple1({1.5, 1})); - AMDIS_TEST(w == Tuple2( {{1.3, 1.5}, {2, 1}} )); + AMDIS_TEST((u == Tuple1{1.3, 2})); + AMDIS_TEST((v == Tuple1{1.5, 1})); + AMDIS_TEST((w == Tuple2{TupleDouble{1.3, 1.5}, TupleDouble{2, 1}} )); return report_errors(); } \ No newline at end of file