From 9ec29767175d9492ea6910ebe12efde64169a731 Mon Sep 17 00:00:00 2001 From: Benjamin Faigle <benjamin.faigle@posteo.de> Date: Thu, 28 Jul 2011 13:58:56 +0000 Subject: [PATCH] removed Implementation templates reworked some property names git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@6323 2fb0f335-1f38-0410-981e-8018bf24f1b0 --- dumux/decoupled/2p2c/2p2cproblem.hh | 13 +++++++++++-- dumux/decoupled/2p2c/2p2cproperties.hh | 18 +++++++++++------- dumux/decoupled/2p2c/dec2p2cfluidstate.hh | 7 ++++--- dumux/decoupled/2p2c/pseudo1p2cfluidstate.hh | 1 - test/decoupled/2p2c/test_dec2p2cproblem.hh | 9 ++++----- .../2p2c/test_multiphysics2p2cproblem.hh | 7 +++---- 6 files changed, 33 insertions(+), 22 deletions(-) diff --git a/dumux/decoupled/2p2c/2p2cproblem.hh b/dumux/decoupled/2p2c/2p2cproblem.hh index 0520304394..ca7bc053ad 100644 --- a/dumux/decoupled/2p2c/2p2cproblem.hh +++ b/dumux/decoupled/2p2c/2p2cproblem.hh @@ -44,10 +44,11 @@ namespace Dumux * only the functions of the currently used formulation has to be specified * in the specific problem. */ -template<class TypeTag, class Implementation> +template<class TypeTag> class IMPETProblem2P2C : public IMPETProblem<TypeTag> { typedef IMPETProblem<TypeTag> ParentType; + typedef typename GET_PROP_TYPE(TypeTag, PTAG(Problem)) Implementation; typedef typename GET_PROP_TYPE(TypeTag, PTAG(TimeManager)) TimeManager; @@ -203,7 +204,15 @@ public: // \} private: - GlobalPosition gravity_; + //! Returns the implementation of the problem (i.e. static polymorphism) + Implementation &asImp_() + { return *static_cast<Implementation *>(this); } + + //! \copydoc Dumux::IMPETProblem::asImp_() + const Implementation &asImp_() const + { return *static_cast<const Implementation *>(this); } + + GlobalPosition gravity_; // fluids and material properties SpatialParameters* spatialParameters_; diff --git a/dumux/decoupled/2p2c/2p2cproperties.hh b/dumux/decoupled/2p2c/2p2cproperties.hh index dbf2d9ab22..883526e16a 100644 --- a/dumux/decoupled/2p2c/2p2cproperties.hh +++ b/dumux/decoupled/2p2c/2p2cproperties.hh @@ -47,10 +47,10 @@ template<class TypeTag> class VariableClass2P2C; template<class TypeTag> -class DecTwoPTwoCFluidState; +class DecoupledTwoPTwoCFluidState; template <class TypeTag> -struct TwoPTwoCIndices; +struct DecoupledTwoPTwoCIndices; //////////////////////////////// // properties @@ -76,7 +76,7 @@ NEW_PROP_TAG( PressureFormulation); //!< The formulation of the model NEW_PROP_TAG( SaturationFormulation); //!< The formulation of the model NEW_PROP_TAG( VelocityFormulation); //!< The formulation of the model NEW_PROP_TAG( EnableCompressibility);// ! Returns whether compressibility is allowed -NEW_PROP_TAG(EnableCapillarity); //!< Returns whether capillarity is regarded +NEW_PROP_TAG( EnableCapillarity); //!< Returns whether capillarity is regarded NEW_PROP_TAG( BoundaryMobility ); NEW_PROP_TAG( NumDensityTransport ); NEW_PROP_TAG( FluidSystem ); @@ -87,7 +87,7 @@ NEW_PROP_TAG( EnableMultiPointFluxApproximationOnAdaptiveGrids ); // Two-point f ////////////////////////////////////////////////////////////////// SET_PROP(DecoupledTwoPTwoC, TwoPTwoCIndices) { - typedef TwoPTwoCIndices<TypeTag> type; + typedef DecoupledTwoPTwoCIndices<TypeTag> type; }; SET_INT_PROP(DecoupledTwoPTwoC, NumEq, 2); @@ -143,7 +143,7 @@ SET_BOOL_PROP(DecoupledTwoPTwoC, EnableCapillarity, false); SET_PROP_DEFAULT(BoundaryMobility) { - static const int value = TwoPTwoCIndices<TypeTag>::satDependent; + static const int value = DecoupledTwoPTwoCIndices<TypeTag>::satDependent; }; SET_PROP_DEFAULT(NumDensityTransport) { @@ -152,7 +152,7 @@ SET_PROP_DEFAULT(NumDensityTransport) SET_TYPE_PROP(DecoupledTwoPTwoC, Variables, VariableClass2P2C<TypeTag>); -SET_TYPE_PROP(DecoupledTwoPTwoC, FluidState, DecTwoPTwoCFluidState<TypeTag>); +SET_TYPE_PROP(DecoupledTwoPTwoC, FluidState, DecoupledTwoPTwoCFluidState<TypeTag>); SET_BOOL_PROP(DecoupledTwoPTwoC, EnableMultiPointFluxApproximationOnAdaptiveGrids, false); @@ -165,12 +165,16 @@ SET_BOOL_PROP(DecoupledTwoPTwoC, EnableMultiPointFluxApproximationOnAdaptiveGrid * distinguishing between given composition or saturation on the boundary. */ template <class TypeTag> -struct TwoPTwoCIndices : DecoupledTwoPCommonIndices<TypeTag> +struct DecoupledTwoPTwoCIndices : DecoupledTwoPCommonIndices<TypeTag> { private: typedef typename GET_PROP_TYPE(TypeTag, PTAG(FluidSystem)) FluidSystem; public: + // Component indices + static const int wCompIdx = FluidSystem::wCompIdx; //!< Index of the wetting phase in a phase vector + static const int nCompIdx = FluidSystem::nCompIdx; //!< Index of the non-wetting phase in a phase vector + // BoundaryCondition flags static const int satDependent = 0; static const int permDependent = 1; diff --git a/dumux/decoupled/2p2c/dec2p2cfluidstate.hh b/dumux/decoupled/2p2c/dec2p2cfluidstate.hh index bd9072678f..99c7916252 100644 --- a/dumux/decoupled/2p2c/dec2p2cfluidstate.hh +++ b/dumux/decoupled/2p2c/dec2p2cfluidstate.hh @@ -40,10 +40,10 @@ namespace Dumux * \tparam TypeTag The property Type Tag */ template <class TypeTag> -class DecTwoPTwoCFluidState : public FluidState<typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)), - DecTwoPTwoCFluidState<TypeTag> > +class DecoupledTwoPTwoCFluidState : public FluidState<typename GET_PROP_TYPE(TypeTag, + PTAG(Scalar)), DecoupledTwoPTwoCFluidState<TypeTag> > { - typedef DecTwoPTwoCFluidState<TypeTag> ThisType; + typedef DecoupledTwoPTwoCFluidState<TypeTag> ThisType; typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar; typedef typename GET_PROP_TYPE(TypeTag, PTAG(FluidSystem)) FluidSystem; @@ -322,6 +322,7 @@ public: return phasePressure_[nPhaseIdx]*moleFrac(nPhaseIdx, wCompIdx); else DUNE_THROW(Dune::NotImplemented, "component not found in fluidState!"); + return 0; } /*! diff --git a/dumux/decoupled/2p2c/pseudo1p2cfluidstate.hh b/dumux/decoupled/2p2c/pseudo1p2cfluidstate.hh index 2e3849e249..017b2938b6 100644 --- a/dumux/decoupled/2p2c/pseudo1p2cfluidstate.hh +++ b/dumux/decoupled/2p2c/pseudo1p2cfluidstate.hh @@ -42,7 +42,6 @@ template <class TypeTag> class PseudoOnePTwoCFluidState : public FluidState<typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)), PseudoOnePTwoCFluidState<TypeTag> > { - typedef DecTwoPTwoCFluidState<TypeTag> ThisType; typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar; typedef typename GET_PROP_TYPE(TypeTag, PTAG(FluidSystem)) FluidSystem; diff --git a/test/decoupled/2p2c/test_dec2p2cproblem.hh b/test/decoupled/2p2c/test_dec2p2cproblem.hh index fabed20759..51d2e23c66 100644 --- a/test/decoupled/2p2c/test_dec2p2cproblem.hh +++ b/test/decoupled/2p2c/test_dec2p2cproblem.hh @@ -53,7 +53,7 @@ class TestDecTwoPTwoCProblem; // Specify the properties namespace Properties { -NEW_TYPE_TAG(TestDecTwoPTwoCProblem, INHERITS_FROM(DecoupledTwoPTwoC/*, Transport*/)); +NEW_TYPE_TAG(TestDecTwoPTwoCProblem, INHERITS_FROM(DecoupledTwoPTwoC)); // Set the grid type SET_PROP(TestDecTwoPTwoCProblem, Grid) @@ -115,7 +115,7 @@ public: // Enable gravity SET_BOOL_PROP(TestDecTwoPTwoCProblem, EnableGravity, true); -SET_INT_PROP(DecoupledTwoPTwoC, +SET_INT_PROP(TestDecTwoPTwoCProblem, BoundaryMobility, GET_PROP_TYPE(TypeTag, PTAG(TwoPTwoCIndices))::satDependent); SET_SCALAR_PROP(TestDecTwoPTwoCProblem, CFLFactor, 0.8); @@ -136,10 +136,9 @@ SET_SCALAR_PROP(TestDecTwoPTwoCProblem, CFLFactor, 0.8); * specified by programm arguments. */ template<class TypeTag = TTAG(TestDecTwoPTwoCProblem)> -class TestDecTwoPTwoCProblem: public IMPETProblem2P2C<TypeTag, TestDecTwoPTwoCProblem<TypeTag> > +class TestDecTwoPTwoCProblem: public IMPETProblem2P2C<TypeTag> { -typedef TestDecTwoPTwoCProblem<TypeTag> ThisType; -typedef IMPETProblem2P2C<TypeTag, ThisType> ParentType; +typedef IMPETProblem2P2C<TypeTag> ParentType; typedef typename GET_PROP_TYPE(TypeTag, PTAG(GridView)) GridView; typedef typename GET_PROP_TYPE(TypeTag, PTAG(TimeManager)) TimeManager; typedef typename GET_PROP_TYPE(TypeTag, PTAG(TwoPTwoCIndices)) Indices; diff --git a/test/decoupled/2p2c/test_multiphysics2p2cproblem.hh b/test/decoupled/2p2c/test_multiphysics2p2cproblem.hh index 7fde8a3fd3..b3e564d0b7 100644 --- a/test/decoupled/2p2c/test_multiphysics2p2cproblem.hh +++ b/test/decoupled/2p2c/test_multiphysics2p2cproblem.hh @@ -53,7 +53,7 @@ class TestMultTwoPTwoCProblem; // Specify the properties namespace Properties { -NEW_TYPE_TAG(TestMultTwoPTwoCProblem, INHERITS_FROM(DecoupledTwoPTwoC/*, Transport*/)); +NEW_TYPE_TAG(TestMultTwoPTwoCProblem, INHERITS_FROM(DecoupledTwoPTwoC)); // Set the grid type SET_PROP(TestMultTwoPTwoCProblem, Grid) @@ -141,10 +141,9 @@ SET_SCALAR_PROP(TestMultTwoPTwoCProblem, CFLFactor, 0.8); * specified by programm arguments. */ template<class TypeTag = TTAG(TestMultTwoPTwoCProblem)> -class TestMultTwoPTwoCProblem: public IMPETProblem2P2C<TypeTag, TestMultTwoPTwoCProblem<TypeTag> > +class TestMultTwoPTwoCProblem: public IMPETProblem2P2C<TypeTag> { -typedef TestMultTwoPTwoCProblem<TypeTag> ThisType; -typedef IMPETProblem2P2C<TypeTag, ThisType> ParentType; +typedef IMPETProblem2P2C<TypeTag> ParentType; typedef typename GET_PROP_TYPE(TypeTag, PTAG(GridView)) GridView; typedef typename GET_PROP_TYPE(TypeTag, PTAG(TimeManager)) TimeManager; typedef typename GET_PROP_TYPE(TypeTag, PTAG(TwoPTwoCIndices)) Indices; -- GitLab