From 486b7fe044187fbb6598cc386af29589a77d6820 Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt <kilian.weishaupt@iws.uni-stuttgart.de> Date: Thu, 11 Jan 2018 07:32:12 +0100 Subject: [PATCH] [localAssembly] make bool implicit a template argument for base classes --- dumux/assembly/boxlocalassembler.hh | 24 +++++----------- dumux/assembly/cclocalassembler.hh | 39 ++++++++------------------ dumux/assembly/fvlocalassemblerbase.hh | 5 ++-- 3 files changed, 20 insertions(+), 48 deletions(-) diff --git a/dumux/assembly/boxlocalassembler.hh b/dumux/assembly/boxlocalassembler.hh index 1bc3f59c16..e407740aa4 100644 --- a/dumux/assembly/boxlocalassembler.hh +++ b/dumux/assembly/boxlocalassembler.hh @@ -44,10 +44,10 @@ namespace Dumux { * \tparam Assembler the assembler type * \tparam Assembler The acutal Implementation */ -template<class TypeTag, class Assembler, class Implementation> -class BoxLocalAssemblerBase : public FVLocalAssemblerBase<TypeTag, Assembler, Implementation> +template<class TypeTag, class Assembler, class Implementation, bool implicit> +class BoxLocalAssemblerBase : public FVLocalAssemblerBase<TypeTag, Assembler, Implementation, implicit> { - using ParentType = FVLocalAssemblerBase<TypeTag, Assembler, Implementation>; + using ParentType = FVLocalAssemblerBase<TypeTag, Assembler, Implementation, implicit>; using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using JacobianMatrix = typename GET_PROP_TYPE(TypeTag, JacobianMatrix); using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables); @@ -147,10 +147,6 @@ public: { return this->evalLocalStorageResidual(); } - - constexpr bool isImplicit() const - { return Implementation::isImplicit(); } - }; /*! @@ -172,10 +168,10 @@ class BoxLocalAssembler; template<class TypeTag, class Assembler> class BoxLocalAssembler<TypeTag, Assembler, DiffMethod::numeric, /*implicit=*/true> : public BoxLocalAssemblerBase<TypeTag, Assembler, - BoxLocalAssembler<TypeTag, Assembler, DiffMethod::numeric, true> > + BoxLocalAssembler<TypeTag, Assembler, DiffMethod::numeric, true>, true> { using ThisType = BoxLocalAssembler<TypeTag, Assembler, DiffMethod::numeric, true>; - using ParentType = BoxLocalAssemblerBase<TypeTag, Assembler, ThisType>; + using ParentType = BoxLocalAssemblerBase<TypeTag, Assembler, ThisType, true>; using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Element = typename GET_PROP_TYPE(TypeTag, GridView)::template Codim<0>::Entity; using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); @@ -196,9 +192,6 @@ public: using ParentType::ParentType; - static constexpr bool isImplicit() - { return true; } - /*! * \brief Computes the derivatives with respect to the given element and adds them * to the global matrix. @@ -299,10 +292,10 @@ public: template<class TypeTag, class Assembler> class BoxLocalAssembler<TypeTag, Assembler, DiffMethod::numeric, /*implicit=*/false> : public BoxLocalAssemblerBase<TypeTag, Assembler, - BoxLocalAssembler<TypeTag, Assembler, DiffMethod::numeric, false> > + BoxLocalAssembler<TypeTag, Assembler, DiffMethod::numeric, false>, false> { using ThisType = BoxLocalAssembler<TypeTag, Assembler, DiffMethod::numeric, false>; - using ParentType = BoxLocalAssemblerBase<TypeTag, Assembler, ThisType>; + using ParentType = BoxLocalAssemblerBase<TypeTag, Assembler, ThisType, false>; using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using Element = typename GET_PROP_TYPE(TypeTag, GridView)::template Codim<0>::Entity; using SolutionVector = typename GET_PROP_TYPE(TypeTag, SolutionVector); @@ -323,9 +316,6 @@ public: using ParentType::ParentType; - static constexpr bool isImplicit() - { return false; } - /*! * \brief Computes the derivatives with respect to the given element and adds them * to the global matrix. diff --git a/dumux/assembly/cclocalassembler.hh b/dumux/assembly/cclocalassembler.hh index 53beaaef33..a10d358e17 100644 --- a/dumux/assembly/cclocalassembler.hh +++ b/dumux/assembly/cclocalassembler.hh @@ -49,10 +49,10 @@ namespace Dumux { * \tparam TypeTag the TypeTag * \tparam Assembler the assembler type */ -template<class TypeTag, class Assembler, class Implementation> -class CCLocalAssemblerBase : public FVLocalAssemblerBase<TypeTag, Assembler, Implementation> +template<class TypeTag, class Assembler, class Implementation, bool implicit> +class CCLocalAssemblerBase : public FVLocalAssemblerBase<TypeTag, Assembler, Implementation, implicit> { - using ParentType = FVLocalAssemblerBase<TypeTag, Assembler, Implementation>; + using ParentType = FVLocalAssemblerBase<TypeTag, Assembler, Implementation, implicit>; using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using JacobianMatrix = typename GET_PROP_TYPE(TypeTag, JacobianMatrix); using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables); @@ -106,9 +106,6 @@ public: { return this->evalLocalStorageResidual()[0]; } - - constexpr bool isImplicit() const - { return Implementation::isImplicit(); } }; /*! @@ -130,10 +127,10 @@ class CCLocalAssembler; template<class TypeTag, class Assembler> class CCLocalAssembler<TypeTag, Assembler, DiffMethod::numeric, /*implicit=*/true> : public CCLocalAssemblerBase<TypeTag, Assembler, - CCLocalAssembler<TypeTag, Assembler, DiffMethod::numeric, true> > + CCLocalAssembler<TypeTag, Assembler, DiffMethod::numeric, true>, true > { using ThisType = CCLocalAssembler<TypeTag, Assembler, DiffMethod::numeric, true>; - using ParentType = CCLocalAssemblerBase<TypeTag, Assembler, ThisType>; + using ParentType = CCLocalAssemblerBase<TypeTag, Assembler, ThisType, true>; using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using LocalResidualValues = typename GET_PROP_TYPE(TypeTag, NumEqVector); using Element = typename GET_PROP_TYPE(TypeTag, GridView)::template Codim<0>::Entity; @@ -153,11 +150,6 @@ class CCLocalAssembler<TypeTag, Assembler, DiffMethod::numeric, /*implicit=*/tru public: - struct IsImplicit { static constexpr bool value = true; }; - - static constexpr bool isImplicit() - { return true; } - using ParentType::ParentType; /*! @@ -302,10 +294,10 @@ public: template<class TypeTag, class Assembler> class CCLocalAssembler<TypeTag, Assembler, DiffMethod::numeric, /*implicit=*/false> : public CCLocalAssemblerBase<TypeTag, Assembler, - CCLocalAssembler<TypeTag, Assembler, DiffMethod::numeric, false> > + CCLocalAssembler<TypeTag, Assembler, DiffMethod::numeric, false>, false> { using ThisType = CCLocalAssembler<TypeTag, Assembler, DiffMethod::numeric, false>; - using ParentType = CCLocalAssemblerBase<TypeTag, Assembler, ThisType>; + using ParentType = CCLocalAssemblerBase<TypeTag, Assembler, ThisType, false>; using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using LocalResidualValues = typename GET_PROP_TYPE(TypeTag, NumEqVector); using Element = typename GET_PROP_TYPE(TypeTag, GridView)::template Codim<0>::Entity; @@ -322,9 +314,6 @@ class CCLocalAssembler<TypeTag, Assembler, DiffMethod::numeric, /*implicit=*/fal public: using ParentType::ParentType; - static constexpr bool isImplicit() - { return false; } - /*! * \brief Computes the derivatives with respect to the given element and adds them * to the global matrix. @@ -417,10 +406,10 @@ public: template<class TypeTag, class Assembler> class CCLocalAssembler<TypeTag, Assembler, DiffMethod::analytic, /*implicit=*/true> : public CCLocalAssemblerBase<TypeTag, Assembler, - CCLocalAssembler<TypeTag, Assembler, DiffMethod::analytic, true> > + CCLocalAssembler<TypeTag, Assembler, DiffMethod::analytic, true>, true> { using ThisType = CCLocalAssembler<TypeTag, Assembler, DiffMethod::analytic, true>; - using ParentType = CCLocalAssemblerBase<TypeTag, Assembler, ThisType>; + using ParentType = CCLocalAssemblerBase<TypeTag, Assembler, ThisType, true>; using LocalResidualValues = typename GET_PROP_TYPE(TypeTag, NumEqVector); using JacobianMatrix = typename GET_PROP_TYPE(TypeTag, JacobianMatrix); using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables); @@ -428,9 +417,6 @@ class CCLocalAssembler<TypeTag, Assembler, DiffMethod::analytic, /*implicit=*/tr public: using ParentType::ParentType; - static constexpr bool isImplicit() - { return true; } - /*! * \brief Computes the derivatives with respect to the given element and adds them * to the global matrix. @@ -499,10 +485,10 @@ public: template<class TypeTag, class Assembler> class CCLocalAssembler<TypeTag, Assembler, DiffMethod::analytic, /*implicit=*/false> : public CCLocalAssemblerBase<TypeTag, Assembler, - CCLocalAssembler<TypeTag, Assembler, DiffMethod::analytic, false> > + CCLocalAssembler<TypeTag, Assembler, DiffMethod::analytic, false>, false> { using ThisType = CCLocalAssembler<TypeTag, Assembler, DiffMethod::analytic, false>; - using ParentType = CCLocalAssemblerBase<TypeTag, Assembler, ThisType>; + using ParentType = CCLocalAssemblerBase<TypeTag, Assembler, ThisType, false>; using LocalResidualValues = typename GET_PROP_TYPE(TypeTag, NumEqVector); using JacobianMatrix = typename GET_PROP_TYPE(TypeTag, JacobianMatrix); using GridVariables = typename GET_PROP_TYPE(TypeTag, GridVariables); @@ -510,9 +496,6 @@ class CCLocalAssembler<TypeTag, Assembler, DiffMethod::analytic, /*implicit=*/fa public: using ParentType::ParentType; - static constexpr bool isImplicit() - { return false; } - /*! * \brief Computes the derivatives with respect to the given element and adds them * to the global matrix. diff --git a/dumux/assembly/fvlocalassemblerbase.hh b/dumux/assembly/fvlocalassemblerbase.hh index 77c8f119a7..3343b4a874 100644 --- a/dumux/assembly/fvlocalassemblerbase.hh +++ b/dumux/assembly/fvlocalassemblerbase.hh @@ -47,7 +47,7 @@ namespace Dumux { * \tparam TypeTag the TypeTag * \tparam Assembler the assembler type */ -template<class TypeTag, class Assembler, class Implementation> +template<class TypeTag, class Assembler, class Implementation, bool implicit> class FVLocalAssemblerBase { using Problem = typename GET_PROP_TYPE(TypeTag, Problem); @@ -222,8 +222,7 @@ public: { return gridVolVars.volVars(scv); } constexpr bool isImplicit() const - { return Implementation::isImplicit(); } - // { return Implementation::IsImplicit::value; } + { return implicit; } protected: Implementation &asImp_() -- GitLab