diff --git a/dumux/freeflow/navierstokes/mass/1p/localresidual.hh b/dumux/freeflow/navierstokes/mass/1p/localresidual.hh index ac52de9827d5d60d9ec3f0e717f0dde63e375e77..5f42190ff3f8fd212ebc7a1b640e6e14287ce6fc 100644 --- a/dumux/freeflow/navierstokes/mass/1p/localresidual.hh +++ b/dumux/freeflow/navierstokes/mass/1p/localresidual.hh @@ -16,6 +16,7 @@ #include <dumux/common/numeqvector.hh> #include <dumux/common/properties.hh> +#include <dumux/discretization/defaultlocaloperator.hh> namespace Dumux { @@ -34,9 +35,10 @@ struct ImplementsAuxiliaryFluxNavierStokesMassOneP * \brief Element-wise calculation of the Navier-Stokes residual for single-phase flow. */ template<class TypeTag> -class NavierStokesMassOnePLocalResidual : public GetPropType<TypeTag, Properties::BaseLocalResidual> +class NavierStokesMassOnePLocalResidual +: public DiscretizationDefaultLocalOperator<TypeTag> { - using ParentType = GetPropType<TypeTag, Properties::BaseLocalResidual>; + using ParentType = DiscretizationDefaultLocalOperator<TypeTag>; using GridVariables = GetPropType<TypeTag, Properties::GridVariables>; using GridVolumeVariables = typename GridVariables::GridVolumeVariables; using ElementVolumeVariables = typename GridVolumeVariables::LocalView; diff --git a/dumux/freeflow/navierstokes/mass/1pnc/localresidual.hh b/dumux/freeflow/navierstokes/mass/1pnc/localresidual.hh index 7479c268ea2a4cdb4cde728f70b67e697fb2ef3c..272a84968b3d9de27e4f1bcb196a60c103d5944b 100644 --- a/dumux/freeflow/navierstokes/mass/1pnc/localresidual.hh +++ b/dumux/freeflow/navierstokes/mass/1pnc/localresidual.hh @@ -15,6 +15,7 @@ #include <dumux/common/numeqvector.hh> #include <dumux/common/properties.hh> #include <dumux/discretization/method.hh> +#include <dumux/discretization/defaultlocaloperator.hh> namespace Dumux { @@ -23,9 +24,10 @@ namespace Dumux { * \brief Element-wise calculation of the Navier-Stokes residual for multicomponent single-phase flow. */ template<class TypeTag> -class NavierStokesMassOnePNCLocalResidual : public GetPropType<TypeTag, Properties::BaseLocalResidual> +class NavierStokesMassOnePNCLocalResidual +: public DiscretizationDefaultLocalOperator<TypeTag> { - using ParentType = GetPropType<TypeTag, Properties::BaseLocalResidual>; + using ParentType = DiscretizationDefaultLocalOperator<TypeTag>; using GridVariables = GetPropType<TypeTag, Properties::GridVariables>; using GridVolumeVariables = typename GridVariables::GridVolumeVariables; diff --git a/dumux/freeflow/navierstokes/momentum/cvfe/localresidual.hh b/dumux/freeflow/navierstokes/momentum/cvfe/localresidual.hh index 251d129ae23f6ed4f54c492b061dbecd5bf2fec8..a92ec5bcb3b435690090aad59a5453148542e1ee 100644 --- a/dumux/freeflow/navierstokes/momentum/cvfe/localresidual.hh +++ b/dumux/freeflow/navierstokes/momentum/cvfe/localresidual.hh @@ -31,9 +31,9 @@ namespace Dumux { */ template<class TypeTag> class NavierStokesMomentumCVFELocalResidual -: public GetPropType<TypeTag, Properties::BaseLocalResidual> +: public CVFELocalResidual<TypeTag> { - using ParentType = GetPropType<TypeTag, Properties::BaseLocalResidual>; + using ParentType = CVFELocalResidual<TypeTag>; using GridVariables = GetPropType<TypeTag, Properties::GridVariables>; @@ -45,7 +45,6 @@ class NavierStokesMomentumCVFELocalResidual using ElementFluxVariablesCache = typename GridFluxVariablesCache::LocalView; using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using Implementation = GetPropType<TypeTag, Properties::LocalResidual>; using Problem = GetPropType<TypeTag, Properties::Problem>; using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using FVElementGeometry = typename GridGeometry::LocalView; diff --git a/dumux/freeflow/navierstokes/momentum/localresidual.hh b/dumux/freeflow/navierstokes/momentum/localresidual.hh index cb946954bf6d2d036d4251f9179c8715bec0825f..63141be740da791bb44396fad789aabaede92b2a 100644 --- a/dumux/freeflow/navierstokes/momentum/localresidual.hh +++ b/dumux/freeflow/navierstokes/momentum/localresidual.hh @@ -298,14 +298,6 @@ public: // Default: Neither the scvf itself nor a lateral one considers a Neumann flux. We just calculate the flux as normal. return this->asImp().computeFlux(problem, element, fvGeometry, elemVolVars, scvf, elemFluxVarsCache, elemBcTypes); } - - //! Returns the implementation of the problem (i.e. static polymorphism) - Implementation &asImp_() - { return *static_cast<Implementation *>(this); } - - //! \copydoc asImp_() - const Implementation &asImp_() const - { return *static_cast<const Implementation *>(this); } }; } // end namespace Dumux diff --git a/dumux/freeflow/navierstokes/staggered/localresidual.hh b/dumux/freeflow/navierstokes/staggered/localresidual.hh index ca1970af30ba081a304c9ad0a7899952c389226c..88681eed94dd72e3c035214f04438ad8b1aec967 100644 --- a/dumux/freeflow/navierstokes/staggered/localresidual.hh +++ b/dumux/freeflow/navierstokes/staggered/localresidual.hh @@ -12,6 +12,8 @@ #ifndef DUMUX_STAGGERED_NAVIERSTOKES_LOCAL_RESIDUAL_HH #define DUMUX_STAGGERED_NAVIERSTOKES_LOCAL_RESIDUAL_HH +#include <type_traits> + #include <dune/common/hybridutilities.hh> #include <dumux/common/properties.hh> @@ -362,14 +364,6 @@ private: } } } - - //! Returns the implementation of the problem (i.e. static polymorphism) - Implementation &asImp_() - { return *static_cast<Implementation *>(this); } - - //! \copydoc asImp_() - const Implementation &asImp_() const - { return *static_cast<const Implementation *>(this); } }; } // end namespace Dumux diff --git a/dumux/freeflow/shallowwater/localresidual.hh b/dumux/freeflow/shallowwater/localresidual.hh index 6593923a7465d5c86bc2f44a821eb856fd5ad947..f4aa2fdb519643cd0dfdd22d0371922d2a1aed84 100644 --- a/dumux/freeflow/shallowwater/localresidual.hh +++ b/dumux/freeflow/shallowwater/localresidual.hh @@ -15,6 +15,7 @@ #include <dumux/common/parameters.hh> #include <dumux/common/properties.hh> #include <dumux/common/numeqvector.hh> +#include <dumux/discretization/defaultlocaloperator.hh> namespace Dumux{ @@ -24,16 +25,17 @@ namespace Dumux{ */ template<class TypeTag> class ShallowWaterResidual -: public GetPropType<TypeTag, Properties::BaseLocalResidual> +: public DiscretizationDefaultLocalOperator<TypeTag> { - using ParentType = GetPropType<TypeTag, Properties::BaseLocalResidual>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using ParentType = DiscretizationDefaultLocalOperator<TypeTag>; using Problem = GetPropType<TypeTag, Properties::Problem>; - using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView; + using GridView = typename GridGeometry::GridView; using NumEqVector = Dumux::NumEqVector<GetPropType<TypeTag, Properties::PrimaryVariables>>; using VolumeVariables = GetPropType<TypeTag, Properties::VolumeVariables>; using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView; using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView; - using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView; + using FVElementGeometry = typename GridGeometry::LocalView; using SubControlVolume = typename FVElementGeometry::SubControlVolume; using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using Element = typename GridView::template Codim<0>::Entity; diff --git a/dumux/geomechanics/elastic/localresidual.hh b/dumux/geomechanics/elastic/localresidual.hh index 491027e8fc4f26538ebe527950a85696c6035326..276176fbc3bb53d4f10b89ea4025f6df0e0ae7ce 100644 --- a/dumux/geomechanics/elastic/localresidual.hh +++ b/dumux/geomechanics/elastic/localresidual.hh @@ -17,6 +17,7 @@ #include <dumux/common/properties.hh> #include <dumux/common/parameters.hh> #include <dumux/common/numeqvector.hh> +#include <dumux/discretization/defaultlocaloperator.hh> namespace Dumux { @@ -26,16 +27,18 @@ namespace Dumux { * using the elastic model considering linear elasticity. */ template<class TypeTag> -class ElasticLocalResidual : public GetPropType<TypeTag, Properties::BaseLocalResidual> +class ElasticLocalResidual +: public DiscretizationDefaultLocalOperator<TypeTag> { - using ParentType = GetPropType<TypeTag, Properties::BaseLocalResidual>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using ParentType = DiscretizationDefaultLocalOperator<TypeTag>; - using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView; + using GridView = typename GridGeometry::GridView; using Element = typename GridView::template Codim<0>::Entity; using Problem = GetPropType<TypeTag, Properties::Problem>; using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; - using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView; + using FVElementGeometry = typename GridGeometry::LocalView; using SubControlVolume = typename FVElementGeometry::SubControlVolume; using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using NumEqVector = Dumux::NumEqVector<GetPropType<TypeTag, Properties::PrimaryVariables>>; diff --git a/dumux/geomechanics/hyperelastic/localresidual.hh b/dumux/geomechanics/hyperelastic/localresidual.hh index 96bd23d0a1d4b4c721954e9a5526e5165c9af926..295227b7884f997b0d9912e9a5f8a2618c340346 100644 --- a/dumux/geomechanics/hyperelastic/localresidual.hh +++ b/dumux/geomechanics/hyperelastic/localresidual.hh @@ -21,6 +21,7 @@ #include <dumux/common/properties.hh> #include <dumux/common/numeqvector.hh> #include <dumux/discretization/extrusion.hh> +#include <dumux/discretization/defaultlocaloperator.hh> namespace Dumux { @@ -50,9 +51,9 @@ static constexpr bool hasAcceleration() */ template<class TypeTag> class HyperelasticLocalResidual -: public GetPropType<TypeTag, Properties::BaseLocalResidual> +: public DiscretizationDefaultLocalOperator<TypeTag> { - using ParentType = GetPropType<TypeTag, Properties::BaseLocalResidual>; + using ParentType = DiscretizationDefaultLocalOperator<TypeTag>; using Scalar = GetPropType<TypeTag, Properties::Scalar>; using Problem = GetPropType<TypeTag, Properties::Problem>; using NumEqVector = Dumux::NumEqVector<GetPropType<TypeTag, Properties::PrimaryVariables>>; diff --git a/dumux/linear/helmholtzoperator.hh b/dumux/linear/helmholtzoperator.hh index cd56984d21f9da7bde4cc1c198704a981737a707..934f2f31ee1db5464140e861aae1c14f144ae49a 100644 --- a/dumux/linear/helmholtzoperator.hh +++ b/dumux/linear/helmholtzoperator.hh @@ -16,6 +16,7 @@ #include <dumux/common/properties.hh> #include <dumux/common/numeqvector.hh> #include <dumux/discretization/cellcentered/tpfa/computetransmissibility.hh> +#include <dumux/discretization/defaultlocaloperator.hh> #include <dumux/common/boundarytypes.hh> #include <dumux/common/fvproblem.hh> #include <dumux/assembly/fvassembler.hh> @@ -43,9 +44,9 @@ private: template<class TypeTag> class HelmholtzModelLocalResidual -: public GetPropType<TypeTag, Properties::BaseLocalResidual> +: public Dumux::DiscretizationDefaultLocalOperator<TypeTag> { - using ParentType = GetPropType<TypeTag, Properties::BaseLocalResidual>; + using ParentType = Dumux::DiscretizationDefaultLocalOperator<TypeTag>; using Scalar = GetPropType<TypeTag, Properties::Scalar>; using Problem = GetPropType<TypeTag, Properties::Problem>; using NumEqVector = Dumux::NumEqVector<GetPropType<TypeTag, Properties::PrimaryVariables>>; diff --git a/dumux/porousmediumflow/3p3c/localresidual.hh b/dumux/porousmediumflow/3p3c/localresidual.hh index d8e50388044fa5e972d9d6a3e81106fec0cff2c8..89e7285aa946d027352057833c15f92fd90b6baa 100644 --- a/dumux/porousmediumflow/3p3c/localresidual.hh +++ b/dumux/porousmediumflow/3p3c/localresidual.hh @@ -16,6 +16,7 @@ #include <dumux/common/properties.hh> #include <dumux/common/numeqvector.hh> +#include <dumux/discretization/defaultlocaloperator.hh> #include <dumux/flux/referencesystemformulation.hh> namespace Dumux @@ -26,19 +27,21 @@ namespace Dumux * using the three-phase three-component fully implicit model. */ template<class TypeTag> -class ThreePThreeCLocalResidual : public GetPropType<TypeTag, Properties::BaseLocalResidual> +class ThreePThreeCLocalResidual +: public DiscretizationDefaultLocalOperator<TypeTag> { - using ParentType = GetPropType<TypeTag, Properties::BaseLocalResidual>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using ParentType = DiscretizationDefaultLocalOperator<TypeTag>; using Problem = GetPropType<TypeTag, Properties::Problem>; using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView; + using FVElementGeometry = typename GridGeometry::LocalView; using SubControlVolume = typename FVElementGeometry::SubControlVolume; using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using NumEqVector = Dumux::NumEqVector<GetPropType<TypeTag, Properties::PrimaryVariables>>; using FluxVariables = GetPropType<TypeTag, Properties::FluxVariables>; using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView; using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; - using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView; + using GridView = typename GridGeometry::GridView; using Element = typename GridView::template Codim<0>::Entity; using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView; using VolumeVariables = GetPropType<TypeTag, Properties::VolumeVariables>; diff --git a/dumux/porousmediumflow/3pwateroil/localresidual.hh b/dumux/porousmediumflow/3pwateroil/localresidual.hh index 55f612713cef8dedcf2e71ad9b6bbd9073750238..b92397b28e1de7d4fe7b83f0836afb5b42c1fbff 100644 --- a/dumux/porousmediumflow/3pwateroil/localresidual.hh +++ b/dumux/porousmediumflow/3pwateroil/localresidual.hh @@ -16,6 +16,7 @@ #include <dumux/common/properties.hh> #include <dumux/common/numeqvector.hh> +#include <dumux/discretization/defaultlocaloperator.hh> #include <dumux/flux/referencesystemformulation.hh> namespace Dumux { @@ -25,20 +26,22 @@ namespace Dumux { * using the ThreePWaterOil fully implicit model. */ template<class TypeTag> -class ThreePWaterOilLocalResidual : public GetPropType<TypeTag, Properties::BaseLocalResidual> +class ThreePWaterOilLocalResidual +: public DiscretizationDefaultLocalOperator<TypeTag> { protected: - using ParentType = GetPropType<TypeTag, Properties::BaseLocalResidual>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using ParentType = DiscretizationDefaultLocalOperator<TypeTag>; using Problem = GetPropType<TypeTag, Properties::Problem>; using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView; + using FVElementGeometry = typename GridGeometry::LocalView; using SubControlVolume = typename FVElementGeometry::SubControlVolume; using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using NumEqVector = Dumux::NumEqVector<GetPropType<TypeTag, Properties::PrimaryVariables>>; using FluxVariables = GetPropType<TypeTag, Properties::FluxVariables>; using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView; using Indices = typename GetPropType<TypeTag, Properties::ModelTraits>::Indices; - using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView; + using GridView = typename GridGeometry::GridView; using Element = typename GridView::template Codim<0>::Entity; using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView; using VolumeVariables = GetPropType<TypeTag, Properties::VolumeVariables>; diff --git a/dumux/porousmediumflow/compositional/localresidual.hh b/dumux/porousmediumflow/compositional/localresidual.hh index 0674a9d92e37fcf4bae1da73bfb94374dff278bf..332a1ecbef80157b02658902a5c0b7fb20488cdb 100644 --- a/dumux/porousmediumflow/compositional/localresidual.hh +++ b/dumux/porousmediumflow/compositional/localresidual.hh @@ -19,6 +19,7 @@ #include <dumux/common/properties.hh> #include <dumux/common/numeqvector.hh> #include <dumux/discretization/method.hh> +#include <dumux/discretization/defaultlocaloperator.hh> #include <dumux/flux/referencesystemformulation.hh> namespace Dumux { @@ -29,19 +30,20 @@ namespace Dumux { * using compositional fully implicit model. */ template<class TypeTag> -class CompositionalLocalResidual: public GetPropType<TypeTag, Properties::BaseLocalResidual> +class CompositionalLocalResidual +: public DiscretizationDefaultLocalOperator<TypeTag> { - using ParentType = GetPropType<TypeTag, Properties::BaseLocalResidual>; - using Implementation = GetPropType<TypeTag, Properties::LocalResidual>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using ParentType = DiscretizationDefaultLocalOperator<TypeTag>; using Scalar = GetPropType<TypeTag, Properties::Scalar>; using Problem = GetPropType<TypeTag, Properties::Problem>; - using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView; + using FVElementGeometry = typename GridGeometry::LocalView; using SubControlVolume = typename FVElementGeometry::SubControlVolume; using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; using NumEqVector = Dumux::NumEqVector<GetPropType<TypeTag, Properties::PrimaryVariables>>; using FluxVariables = GetPropType<TypeTag, Properties::FluxVariables>; using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView; - using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView; + using GridView = typename GridGeometry::GridView; using Element = typename GridView::template Codim<0>::Entity; using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView; using VolumeVariables = GetPropType<TypeTag, Properties::VolumeVariables>; @@ -223,13 +225,6 @@ public: return flux; } - -protected: - Implementation *asImp_() - { return static_cast<Implementation *> (this); } - - const Implementation *asImp_() const - { return static_cast<const Implementation *> (this); } }; } // end namespace Dumux diff --git a/dumux/porousmediumflow/immiscible/localresidual.hh b/dumux/porousmediumflow/immiscible/localresidual.hh index f4bc32b909af39639b6af5a0d4dc7e518b969039..c7bc887780830fd0dd3e6e86436f6dd2d38dd4c9 100644 --- a/dumux/porousmediumflow/immiscible/localresidual.hh +++ b/dumux/porousmediumflow/immiscible/localresidual.hh @@ -15,6 +15,7 @@ #include <dumux/common/properties.hh> #include <dumux/common/numeqvector.hh> +#include <dumux/discretization/defaultlocaloperator.hh> namespace Dumux { @@ -24,9 +25,11 @@ namespace Dumux { * using the n-phase immiscible fully implicit models. */ template<class TypeTag> -class ImmiscibleLocalResidual : public GetPropType<TypeTag, Properties::BaseLocalResidual> +class ImmiscibleLocalResidual +: public DiscretizationDefaultLocalOperator<TypeTag> { - using ParentType = GetPropType<TypeTag, Properties::BaseLocalResidual>; + using ThisType = ImmiscibleLocalResidual<TypeTag>; + using ParentType = DiscretizationDefaultLocalOperator<TypeTag>; using Scalar = GetPropType<TypeTag, Properties::Scalar>; using Problem = GetPropType<TypeTag, Properties::Problem>; using NumEqVector = Dumux::NumEqVector<GetPropType<TypeTag, Properties::PrimaryVariables>>; @@ -34,10 +37,11 @@ class ImmiscibleLocalResidual : public GetPropType<TypeTag, Properties::BaseLoca using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView; using FluxVariables = GetPropType<TypeTag, Properties::FluxVariables>; using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView; - using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using FVElementGeometry = typename GridGeometry::LocalView; using SubControlVolume = typename FVElementGeometry::SubControlVolume; using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; - using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView; + using GridView = typename GridGeometry::GridView; using Element = typename GridView::template Codim<0>::Entity; using EnergyLocalResidual = GetPropType<TypeTag, Properties::EnergyLocalResidual>; @@ -56,9 +60,6 @@ public: * \param problem the problem * \param scv The sub control volume * \param volVars The current or previous volVars - * \note This function should not include the source and sink terms. - * \note The volVars can be different to allow computing - * the implicit euler time derivative here */ NumEqVector computeStorage(const Problem& problem, const SubControlVolume& scv, diff --git a/dumux/porousmediumflow/mineralization/localresidual.hh b/dumux/porousmediumflow/mineralization/localresidual.hh index db7964d62053c9e7074df97878b3e65d47edae26..1ee364f16d85df087ed70d13e2e036eb780064a5 100644 --- a/dumux/porousmediumflow/mineralization/localresidual.hh +++ b/dumux/porousmediumflow/mineralization/localresidual.hh @@ -25,7 +25,7 @@ namespace Dumux * using a one/two-phase n-component mineralization model. */ template<class TypeTag> -class MineralizationLocalResidual: public CompositionalLocalResidual<TypeTag> +class MineralizationLocalResidual : public CompositionalLocalResidual<TypeTag> { using ParentType = CompositionalLocalResidual<TypeTag>; using NumEqVector = Dumux::NumEqVector<GetPropType<TypeTag, Properties::PrimaryVariables>>; diff --git a/dumux/porousmediumflow/richards/localresidual.hh b/dumux/porousmediumflow/richards/localresidual.hh index ad29ccc4fec2cecea51f874e609f81f645ec15dd..09b00eeaab7f93784fe973bf85078f5cd13db7a3 100644 --- a/dumux/porousmediumflow/richards/localresidual.hh +++ b/dumux/porousmediumflow/richards/localresidual.hh @@ -20,6 +20,7 @@ #include <dumux/common/numeqvector.hh> #include <dumux/discretization/method.hh> #include <dumux/discretization/extrusion.hh> +#include <dumux/discretization/defaultlocaloperator.hh> #include <dumux/flux/referencesystemformulation.hh> namespace Dumux::Detail { @@ -42,11 +43,11 @@ namespace Dumux { * using the Richards fully implicit models. */ template<class TypeTag> -class RichardsLocalResidual : public GetPropType<TypeTag, Properties::BaseLocalResidual> +class RichardsLocalResidual +: public DiscretizationDefaultLocalOperator<TypeTag> { - using Implementation = GetPropType<TypeTag, Properties::LocalResidual>; - - using ParentType = GetPropType<TypeTag, Properties::BaseLocalResidual>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using ParentType = DiscretizationDefaultLocalOperator<TypeTag>; using Scalar = GetPropType<TypeTag, Properties::Scalar>; using Problem = GetPropType<TypeTag, Properties::Problem>; using NumEqVector = Dumux::NumEqVector<GetPropType<TypeTag, Properties::PrimaryVariables>>; @@ -54,7 +55,6 @@ class RichardsLocalResidual : public GetPropType<TypeTag, Properties::BaseLocalR using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView; using FluxVariables = GetPropType<TypeTag, Properties::FluxVariables>; using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView; - using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using FVElementGeometry = typename GridGeometry::LocalView; using Extrusion = Extrusion_t<GridGeometry>; using SubControlVolume = typename GridGeometry::SubControlVolume; @@ -464,13 +464,6 @@ public: ) problem.addRobinFluxDerivatives(derivativeMatrices, element, fvGeometry, curElemVolVars, elemFluxVarsCache, scvf); } - -private: - Implementation *asImp_() - { return static_cast<Implementation *> (this); } - - const Implementation *asImp_() const - { return static_cast<const Implementation *> (this); } }; } // end namespace Dumux diff --git a/dumux/porousmediumflow/richardsextended/localresidual.hh b/dumux/porousmediumflow/richardsextended/localresidual.hh index b63c091abe6cd659db72b6f6f3c975219c80cbc4..8148c917fb57fea613377820d818a68bfb8adb3b 100644 --- a/dumux/porousmediumflow/richardsextended/localresidual.hh +++ b/dumux/porousmediumflow/richardsextended/localresidual.hh @@ -32,8 +32,6 @@ namespace Dumux { template<class TypeTag> class ExtendedRichardsLocalResidual : public RichardsLocalResidual<TypeTag> { - using Implementation = GetPropType<TypeTag, Properties::LocalResidual>; - using ParentType = RichardsLocalResidual<TypeTag>; using Scalar = GetPropType<TypeTag, Properties::Scalar>; using Problem = GetPropType<TypeTag, Properties::Problem>; diff --git a/dumux/porousmediumflow/solidenergy/localresidual.hh b/dumux/porousmediumflow/solidenergy/localresidual.hh index d9a2f15ed18eb976553012f5394c97af219a69aa..a508c090754120956bd1a007cdf69973ac5fe094 100644 --- a/dumux/porousmediumflow/solidenergy/localresidual.hh +++ b/dumux/porousmediumflow/solidenergy/localresidual.hh @@ -14,6 +14,7 @@ #include <dumux/common/properties.hh> #include <dumux/common/numeqvector.hh> +#include <dumux/discretization/defaultlocaloperator.hh> namespace Dumux { @@ -22,9 +23,11 @@ namespace Dumux { * \brief Element-wise calculation of the residual */ template<class TypeTag> -class SolidEnergyLocalResidual : public GetPropType<TypeTag, Properties::BaseLocalResidual> +class SolidEnergyLocalResidual +: public DiscretizationDefaultLocalOperator<TypeTag> { - using ParentType = GetPropType<TypeTag, Properties::BaseLocalResidual>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using ParentType = DiscretizationDefaultLocalOperator<TypeTag>; using Scalar = GetPropType<TypeTag, Properties::Scalar>; using Problem = GetPropType<TypeTag, Properties::Problem>; using NumEqVector = Dumux::NumEqVector<GetPropType<TypeTag, Properties::PrimaryVariables>>; @@ -32,10 +35,10 @@ class SolidEnergyLocalResidual : public GetPropType<TypeTag, Properties::BaseLoc using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView; using FluxVariables = GetPropType<TypeTag, Properties::FluxVariables>; using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView; - using FVElementGeometry = typename GetPropType<TypeTag, Properties::GridGeometry>::LocalView; + using FVElementGeometry = typename GridGeometry::LocalView; using SubControlVolume = typename FVElementGeometry::SubControlVolume; using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; - using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView; + using GridView = typename GridGeometry::GridView; using Element = typename GridView::template Codim<0>::Entity; public: diff --git a/dumux/porousmediumflow/tracer/localresidual.hh b/dumux/porousmediumflow/tracer/localresidual.hh index 6f41bac1479d80ab180ab7bfd466323a0f5fa3c8..07f49958eb7aa2c6b6c1e5f35f13fe99037b804d 100644 --- a/dumux/porousmediumflow/tracer/localresidual.hh +++ b/dumux/porousmediumflow/tracer/localresidual.hh @@ -21,6 +21,7 @@ #include <dumux/common/numeqvector.hh> #include <dumux/discretization/method.hh> #include <dumux/discretization/extrusion.hh> +#include <dumux/discretization/defaultlocaloperator.hh> #include <dumux/flux/referencesystemformulation.hh> namespace Dumux { @@ -31,12 +32,13 @@ namespace Dumux { * using fully implicit tracer model. */ template<class TypeTag> -class TracerLocalResidual: public GetPropType<TypeTag, Properties::BaseLocalResidual> +class TracerLocalResidual +: public DiscretizationDefaultLocalOperator<TypeTag> { - using ParentType = GetPropType<TypeTag, Properties::BaseLocalResidual>; + using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; + using ParentType = DiscretizationDefaultLocalOperator<TypeTag>; using Problem = GetPropType<TypeTag, Properties::Problem>; using Scalar = GetPropType<TypeTag, Properties::Scalar>; - using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; using FVElementGeometry = typename GridGeometry::LocalView; using SubControlVolume = typename GridGeometry::SubControlVolume; using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace; @@ -44,7 +46,7 @@ class TracerLocalResidual: public GetPropType<TypeTag, Properties::BaseLocalResi using NumEqVector = Dumux::NumEqVector<GetPropType<TypeTag, Properties::PrimaryVariables>>; using FluxVariables = GetPropType<TypeTag, Properties::FluxVariables>; using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView; - using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView; + using GridView = typename GridGeometry::GridView; using Element = typename GridView::template Codim<0>::Entity; using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView; using VolumeVariables = GetPropType<TypeTag, Properties::VolumeVariables>; diff --git a/examples/cahn_hilliard/doc/model.md b/examples/cahn_hilliard/doc/model.md index 3fdad2164fa0665bb227584c84646c1c55f07e61..ea351a428bc063904aec8313ce03d6a76520b704 100644 --- a/examples/cahn_hilliard/doc/model.md +++ b/examples/cahn_hilliard/doc/model.md @@ -35,6 +35,7 @@ We start in `model.hh` with the necessary header includes: #include <dumux/common/properties.hh> #include <dumux/common/numeqvector.hh> #include <dumux/discretization/method.hh> +#include <dumux/discretization/defaultlocaloperator.hh> ``` </details> @@ -151,16 +152,16 @@ Let's have a look at the class implementation. <summary><b>Click to hide/show the file documentation</b> (or inspect the [source code](../model.hh))</summary> -The class `CahnHilliardModelLocalResidual` inherits from a base class set in -the model properties, depending on the discretization scheme. +The class `CahnHilliardModelLocalResidual` inherits from a base class +which is determined depending on the discretization scheme. See [examples/diffusion/doc/model.hh](https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/blob/master/examples/diffusion/doc/main.md) -for details on the `BaseLocalResidual`. +for details. ```cpp namespace Dumux { template<class TypeTag> class CahnHilliardModelLocalResidual -: public GetPropType<TypeTag, Properties::BaseLocalResidual> +: public DiscretizationDefaultLocalOperator<TypeTag> { ``` diff --git a/examples/cahn_hilliard/model.hh b/examples/cahn_hilliard/model.hh index 774f283710cdb3070422a691044f2f4a2c066417..0ff39f233907977536af72f90023b255f9079ba9 100644 --- a/examples/cahn_hilliard/model.hh +++ b/examples/cahn_hilliard/model.hh @@ -34,6 +34,7 @@ #include <dumux/common/properties.hh> #include <dumux/common/numeqvector.hh> #include <dumux/discretization/method.hh> +#include <dumux/discretization/defaultlocaloperator.hh> // [[/details]] // // ## 1. Property Tag @@ -129,18 +130,19 @@ private: // // [[content]] // -// The class `CahnHilliardModelLocalResidual` inherits from a base class set in -// the model properties, depending on the discretization scheme. +// The class `CahnHilliardModelLocalResidual` inherits from a base class +// which is determined depending on the discretization scheme. // See [examples/diffusion/doc/model.hh](https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/blob/master/examples/diffusion/doc/main.md) -// for details on the `BaseLocalResidual`. +// for details. namespace Dumux { template<class TypeTag> class CahnHilliardModelLocalResidual -: public GetPropType<TypeTag, Properties::BaseLocalResidual> +: public DiscretizationDefaultLocalOperator<TypeTag> { // [[exclude]] - // the base local residual is selected depending on the chosen discretization scheme - using ParentType = GetPropType<TypeTag, Properties::BaseLocalResidual>; + // the base local operator is selected depending on the chosen discretization scheme + using ParentType = DiscretizationDefaultLocalOperator<TypeTag>; + using Scalar = GetPropType<TypeTag, Properties::Scalar>; using Problem = GetPropType<TypeTag, Properties::Problem>; using NumEqVector = Dumux::NumEqVector<GetPropType<TypeTag, Properties::PrimaryVariables>>; diff --git a/examples/diffusion/doc/model.md b/examples/diffusion/doc/model.md index 428e248bb1c78d1dab2d62928c8ecce134093a78..0ff2d93613ce23ab183e0e905d8df82c2c90c2a9 100644 --- a/examples/diffusion/doc/model.md +++ b/examples/diffusion/doc/model.md @@ -28,6 +28,7 @@ We start in `model.hh` with the necessary header includes: #include <dumux/common/numeqvector.hh> #include <dumux/common/volumevariables.hh> #include <dumux/discretization/method.hh> +#include <dumux/discretization/defaultlocaloperator.hh> ``` </details> @@ -68,19 +69,20 @@ Let's have a look at the class implementation. <summary><b>Click to hide/show the file documentation</b> (or inspect the [source code](../model.hh))</summary> -The class `DiffusionModelLocalResidual` inherits from something called `BaseLocalResidual`. +The class `DiffusionModelLocalResidual` inherits from something called `DiscretizationDefaultLocalOperator`. This base class differs depending on the chosen discretization scheme. For the box method -(which is a control-volume finite element scheme) used in this example, the property -`BaseLocalResidual` is specialized to `CVFELocalResidual<TypeTag>` +(which is a control-volume finite element scheme) used in this example, +`DiscretizationDefaultLocalOperator` is specialized to `CVFELocalResidual` in [dumux/discretization/box.hh](https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/blob/master/dumux/discretization/box.hh). -Since this local residual only works with control-volume finite element schemes due to -the flux implementation, we could have also chosen to inherit from `public CVFELocalResidual<TypeTag>`. +Since the following implementation only works with control-volume finite element schemes due to +the chosen flux implementation, we could have also chosen to +directly inherit from `public CVFELocalResidual<TypeTag>`. ```cpp namespace Dumux { template<class TypeTag> class DiffusionModelLocalResidual -: public GetPropType<TypeTag, Properties::BaseLocalResidual> +: public DiscretizationDefaultLocalOperator<TypeTag> { ``` diff --git a/examples/diffusion/model.hh b/examples/diffusion/model.hh index fe1818064969008e5dd36ba23b7e9c80d1e9f182..67de18c74c851486fa9fb1cb92b7cf2ca9a67fc6 100644 --- a/examples/diffusion/model.hh +++ b/examples/diffusion/model.hh @@ -26,6 +26,7 @@ #include <dumux/common/numeqvector.hh> #include <dumux/common/volumevariables.hh> #include <dumux/discretization/method.hh> +#include <dumux/discretization/defaultlocaloperator.hh> // [[/details]] // // ## 1. Property Tag @@ -55,21 +56,23 @@ struct DiffusionModel {}; // // [[content]] // -// The class `DiffusionModelLocalResidual` inherits from something called `BaseLocalResidual`. +// The class `DiffusionModelLocalResidual` inherits from something called `DiscretizationDefaultLocalOperator`. // This base class differs depending on the chosen discretization scheme. For the box method -// (which is a control-volume finite element scheme) used in this example, the property -// `BaseLocalResidual` is specialized to `CVFELocalResidual<TypeTag>` +// (which is a control-volume finite element scheme) used in this example, +// `DiscretizationDefaultLocalOperator` is specialized to `CVFELocalResidual` // in [dumux/discretization/box.hh](https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/blob/master/dumux/discretization/box.hh). -// Since this local residual only works with control-volume finite element schemes due to -// the flux implementation, we could have also chosen to inherit from `public CVFELocalResidual<TypeTag>`. +// Since the following implementation only works with control-volume finite element schemes due to +// the chosen flux implementation, we could have also chosen to +// directly inherit from `public CVFELocalResidual<TypeTag>`. namespace Dumux { template<class TypeTag> class DiffusionModelLocalResidual -: public GetPropType<TypeTag, Properties::BaseLocalResidual> +: public DiscretizationDefaultLocalOperator<TypeTag> { // [[exclude]] - // the base local residual is selected depending on the chosen discretization scheme - using ParentType = GetPropType<TypeTag, Properties::BaseLocalResidual>; + // the base local operator is selected depending on the chosen discretization scheme + using ParentType = DiscretizationDefaultLocalOperator<TypeTag>; + using Scalar = GetPropType<TypeTag, Properties::Scalar>; using Problem = GetPropType<TypeTag, Properties::Problem>; using NumEqVector = Dumux::NumEqVector<GetPropType<TypeTag, Properties::PrimaryVariables>>;