From e323d1c413fc30467129f1d5af2cf3ba4886a63b Mon Sep 17 00:00:00 2001
From: Andreas Lauser <and@poware.org>
Date: Fri, 23 Sep 2011 15:34:32 +0000
Subject: [PATCH] box models, 2p box model: reduce the number of opaque
 properties considerably

leads to more informative output of Dumux::Properties::print<TypeTag>()

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@6656 2fb0f335-1f38-0410-981e-8018bf24f1b0
---
 dumux/boxmodels/2p/2ppropertydefaults.hh      |  18 +--
 dumux/boxmodels/common/boxpropertydefaults.hh | 113 +++++-------------
 dumux/common/basicproperties.hh               |   3 +-
 dumux/common/parameters.hh                    |   2 +-
 test/boxmodels/2p/lensproblem.hh              |   5 +-
 5 files changed, 41 insertions(+), 100 deletions(-)

diff --git a/dumux/boxmodels/2p/2ppropertydefaults.hh b/dumux/boxmodels/2p/2ppropertydefaults.hh
index 841636448c..9ec3216402 100644
--- a/dumux/boxmodels/2p/2ppropertydefaults.hh
+++ b/dumux/boxmodels/2p/2ppropertydefaults.hh
@@ -72,23 +72,17 @@ SET_TYPE_PROP(BoxTwoP, FluxVariables, TwoPFluxVariables<TypeTag>);
 SET_SCALAR_PROP(BoxTwoP, MassUpwindWeight, 1.0);
 
 //! The indices required by the isothermal 2p model
-SET_PROP(BoxTwoP, TwoPIndices)
-{
-    typedef TwoPIndices<GET_PROP_VALUE(TypeTag, PTAG(Formulation)), 0> type;
-};
+SET_TYPE_PROP(BoxTwoP, 
+              TwoPIndices, 
+              TwoPIndices<GET_PROP_VALUE(TypeTag, PTAG(Formulation)), 0>);
 
 /*!
  * \brief Set the property for the material parameters by extracting
  *        it from the material law.
  */
-SET_PROP(BoxTwoP, MaterialLawParams)
-{
-private:
-    typedef typename GET_PROP_TYPE(TypeTag, PTAG(MaterialLaw)) MaterialLaw;
-
-public:
-    typedef typename MaterialLaw::Params type;
-};
+SET_TYPE_PROP(BoxTwoP, 
+              MaterialLawParams, 
+              typename GET_PROP_TYPE(TypeTag, PTAG(MaterialLaw))::Params);
 
 SET_TYPE_PROP(BoxTwoP, FluidSystem, FluidSystem2P<TypeTag>);
 
diff --git a/dumux/boxmodels/common/boxpropertydefaults.hh b/dumux/boxmodels/common/boxpropertydefaults.hh
index 83daa94705..f1517d599b 100644
--- a/dumux/boxmodels/common/boxpropertydefaults.hh
+++ b/dumux/boxmodels/common/boxpropertydefaults.hh
@@ -58,68 +58,36 @@ SET_TYPE_PROP(BoxModel, TimeManager, Dumux::TimeManager<TypeTag>);
 //////////////////////////////////////////////////////////////////
 
 //! Use the leaf grid view if not defined otherwise
-SET_PROP(BoxModel, GridView)
-{
-private:
-    typedef typename GET_PROP_TYPE(TypeTag, PTAG(Grid)) Grid;
-
-public:
-    typedef typename Grid::LeafGridView type;
-};
+SET_TYPE_PROP(BoxModel, 
+              GridView,
+              typename GET_PROP_TYPE(TypeTag, PTAG(Grid))::LeafGridView);
 
 //! Set the default for the FVElementGeometry
-SET_PROP(BoxModel, FVElementGeometry)
-{
-    typedef Dumux::BoxFVElementGeometry<TypeTag>  type;
-};
+SET_TYPE_PROP(BoxModel, FVElementGeometry, Dumux::BoxFVElementGeometry<TypeTag>);
 
 //! Set the default for the ElementBoundaryTypes
-SET_PROP(BoxModel, ElementBoundaryTypes)
-{ typedef Dumux::BoxElementBoundaryTypes<TypeTag> type; };
+SET_TYPE_PROP(BoxModel, ElementBoundaryTypes, Dumux::BoxElementBoundaryTypes<TypeTag>);
 
 //! use the plain newton method for the box scheme by default
-SET_PROP(BoxModel, NewtonMethod)
-{public:
-    typedef Dumux::NewtonMethod<TypeTag> type;
-};
+SET_TYPE_PROP(BoxModel, NewtonMethod, Dumux::NewtonMethod<TypeTag>);
 
 //! use the plain newton controller for the box scheme by default
-SET_PROP(BoxModel, NewtonController)
-{public:
-    typedef Dumux::NewtonController<TypeTag> type;
-};
+SET_TYPE_PROP(BoxModel, NewtonController, Dumux::NewtonController<TypeTag>);
 
 //! Mapper for the grid view's vertices.
-SET_PROP(BoxModel, VertexMapper)
-{private:
-    typedef typename GET_PROP_TYPE(TypeTag, PTAG(GridView)) GridView;
-
-    template<int dim>
-    struct VertexLayout {
-        bool contains (Dune::GeometryType gt) const
-        { return gt.dim() == 0; }
-    };
-public:
-    typedef Dune::MultipleCodimMultipleGeomTypeMapper<GridView, VertexLayout> type;
-};
+SET_TYPE_PROP(BoxModel,
+              VertexMapper, 
+              Dune::MultipleCodimMultipleGeomTypeMapper<typename GET_PROP_TYPE(TypeTag, PTAG(GridView)),
+                                                        Dune::MCMGVertexLayout>);
 
 //! Mapper for the grid view's elements.
-SET_PROP(BoxModel, ElementMapper)
-{private:
-    typedef typename GET_PROP_TYPE(TypeTag, PTAG(GridView)) GridView;
-
-    template<int dim>
-    struct ElementLayout {
-        bool contains (Dune::GeometryType gt) const
-        { return gt.dim() == dim; }
-    };
-public:
-    typedef Dune::MultipleCodimMultipleGeomTypeMapper<GridView, ElementLayout> type;
-};
+SET_TYPE_PROP(BoxModel,
+              ElementMapper, 
+              Dune::MultipleCodimMultipleGeomTypeMapper<typename GET_PROP_TYPE(TypeTag, PTAG(GridView)),
+                                                        Dune::MCMGElementLayout>);
 
 //! Mapper for the degrees of freedoms.
-SET_PROP(BoxModel, DofMapper)
-{ typedef typename GET_PROP_TYPE(TypeTag, PTAG(VertexMapper)) type; };
+SET_TYPE_PROP(BoxModel, DofMapper, typename GET_PROP_TYPE(TypeTag, PTAG(VertexMapper)));
 
 //! The local jacobian operator for the box scheme
 SET_TYPE_PROP(BoxModel, LocalJacobian, Dumux::BoxLocalJacobian<TypeTag>);
@@ -127,29 +95,24 @@ SET_TYPE_PROP(BoxModel, LocalJacobian, Dumux::BoxLocalJacobian<TypeTag>);
 /*!
  * \brief The type of a solution for the whole grid at a fixed time.
  */
-SET_PROP(BoxModel, SolutionVector)
-{ private:
-    typedef typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)) Scalar;
-    enum { numEq = GET_PROP_VALUE(TypeTag, PTAG(NumEq)) };
-public:
-    typedef Dune::BlockVector<Dune::FieldVector<Scalar, numEq> > type;
-};
+SET_TYPE_PROP(BoxModel, 
+              SolutionVector,
+              Dune::BlockVector<typename GET_PROP_TYPE(TypeTag, PTAG(PrimaryVariables))>);
 
 /*!
  * \brief The type of a solution for a whole element.
  */
-SET_PROP(BoxModel, ElementSolutionVector)
-{ private:
-    typedef typename GET_PROP_TYPE(TypeTag, PTAG(PrimaryVariables)) PrimaryVariables;
-public:
-    typedef Dune::BlockVector<PrimaryVariables> type;
-};
+SET_TYPE_PROP(BoxModel, 
+              ElementSolutionVector,
+              Dune::BlockVector<typename GET_PROP_TYPE(TypeTag, PTAG(PrimaryVariables))>);
 
 /*!
  * \brief A vector of primary variables.
  */
-SET_PROP(BoxModel, PrimaryVariables)
-{ typedef typename GET_PROP_TYPE(TypeTag, PTAG(SolutionVector))::block_type type; };
+SET_TYPE_PROP(BoxModel, 
+              PrimaryVariables, 
+              Dune::FieldVector<typename GET_PROP_TYPE(TypeTag, PTAG(Scalar)),
+                                GET_PROP_VALUE(TypeTag, PTAG(NumEq))>);
 
 /*!
  * \brief The volume variable class.
@@ -166,12 +129,9 @@ SET_TYPE_PROP(BoxModel, ElementVolumeVariables, Dumux::BoxElementVolumeVariables
 /*!
  * \brief Boundary types at a single degree of freedom.
  */
-SET_PROP(BoxModel, BoundaryTypes)
-{ private:
-    enum { numEq = GET_PROP_VALUE(TypeTag, PTAG(NumEq)) };
-public:
-    typedef Dumux::BoundaryTypes<numEq>  type;
-};
+SET_TYPE_PROP(BoxModel, 
+              BoundaryTypes, 
+              Dumux::BoundaryTypes<GET_PROP_VALUE(TypeTag, PTAG(NumEq))>);
 
 /*!
  * \brief Assembler for the global jacobian matrix.
@@ -217,22 +177,13 @@ SET_TYPE_PROP(BoxModel, LinearSolver, Dumux::BoxBiCGStabILU0Solver<TypeTag> );
 // that the initial value for the delta vector u is quite
 // close to the final value, a reduction of 6 orders of
 // magnitude in the defect should be sufficient...
-SET_PROP(BoxModel, LinearSolverResidualReduction)
-{public:
-    static constexpr double value = 1e-6;
-};
+SET_SCALAR_PROP(BoxModel, LinearSolverResidualReduction, 1e-6);
 
 //! set the default number of maximum iterations for the linear solver
-SET_PROP(BoxModel, LinearSolverMaxIterations)
-{public:
-    static constexpr int value = 250;
-};
+SET_INT_PROP(BoxModel, LinearSolverMaxIterations, 250);
 
 //! set number of equations of the mathematical model as default
-SET_PROP_DEFAULT(LinearSolverBlockSize)
-{public:
-    static constexpr int value = GET_PROP_VALUE(TypeTag, PTAG(NumEq));
-};
+SET_INT_PROP(BoxModel, LinearSolverBlockSize, GET_PROP_VALUE(TypeTag, PTAG(NumEq)));
 
 } // namespace Properties
 } // namespace Dumux
diff --git a/dumux/common/basicproperties.hh b/dumux/common/basicproperties.hh
index 608836546a..923fdce840 100644
--- a/dumux/common/basicproperties.hh
+++ b/dumux/common/basicproperties.hh
@@ -105,8 +105,7 @@ SET_PROP(NumericModel, ParameterTree)
 };
 
 // use the global group as default for the model's parameter group 
-SET_PROP(NumericModel, ModelParameterGroup) 
-{ static const char *value() { return ""; }; };
+SET_STRING_PROP(NumericModel, ModelParameterGroup, "");
 
 } // namespace Properties
 } // namespace Dumux
diff --git a/dumux/common/parameters.hh b/dumux/common/parameters.hh
index 496a979214..a6abfa6920 100644
--- a/dumux/common/parameters.hh
+++ b/dumux/common/parameters.hh
@@ -308,7 +308,7 @@ private:
             canonicalName.insert(0, groupName);
         }
 
-        std::string modelParamGroup(GET_PROP(TypeTag, PTAG(ModelParameterGroup))::value());
+        std::string modelParamGroup(GET_PROP_VALUE(TypeTag, PTAG(ModelParameterGroup)));
         // prefix the parameter with the parameter group of the
         // model. this allows things like sub-model specific parameters like
         //
diff --git a/test/boxmodels/2p/lensproblem.hh b/test/boxmodels/2p/lensproblem.hh
index 21c47dca36..dab4dc78d7 100644
--- a/test/boxmodels/2p/lensproblem.hh
+++ b/test/boxmodels/2p/lensproblem.hh
@@ -65,10 +65,7 @@ SET_TYPE_PROP(LensProblem, Grid, Dune::YaspGrid<2>);
 #endif
 
 // Set the problem property
-SET_PROP(LensProblem, Problem)
-{
-    typedef Dumux::LensProblem<TypeTag> type;
-};
+SET_TYPE_PROP(LensProblem, Problem, Dumux::LensProblem<TypeTag>);
 
 // Set the wetting phase
 SET_PROP(LensProblem, WettingPhase)
-- 
GitLab