From 33f511f245e9191cdad50d9bfabacb08487e548b Mon Sep 17 00:00:00 2001
From: Bernd Flemisch <bernd@iws.uni-stuttgart.de>
Date: Tue, 27 Jan 2015 10:23:05 +0000
Subject: [PATCH] [parameters] allow the same parameter name within different
 groups

So far, it was not allowed
- to have the same parameter name within more than one group,

- to deduct the same parameter name from more than one property.

I assume historical reasons for this. In the early years, there were no
groups at all and these measures should facilitate an easy migration
from without groups to groups. Since this migration has been done for
quite a while now, there are no reasons for keeping these restrictions.
Even more so, since they are rather contradictory to the group concept.
Moreover, assigning a parameter to the wrong group will result in being
listed as "unused parameter" at a very prominent position.

Reviewed by gruenich.



git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@14131 2fb0f335-1f38-0410-981e-8018bf24f1b0
---
 dumux/common/parameters.hh | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

diff --git a/dumux/common/parameters.hh b/dumux/common/parameters.hh
index ff5754aa45..d0fffa8c90 100644
--- a/dumux/common/parameters.hh
+++ b/dumux/common/parameters.hh
@@ -193,7 +193,7 @@ void print(std::ostream &os = std::cout)
 
     if (hasDeprecatedKeys_<TypeTag>(tree)) 
     {
-        os << "# DEPRECATED Run-time specified parameters:" << std::endl;
+        os << "# DEPRECATED run-time specified parameters:" << std::endl;
         drt.report(os);
         os << "# Replace by:" << std::endl;
         unrt.report(os);
@@ -207,7 +207,7 @@ void print(std::ostream &os = std::cout)
 
     if (unusedParams.size() > 0)
     {
-        os << "# UNUSED PARAMETERS:" << std::endl;
+        os << "# UNUSED parameters:" << std::endl;
         for (auto it = unusedParams.begin(); it != unusedParams.end(); ++it)
         {
             os << *it << " = \"" << tree.get(*it, "") << "\"" << std::endl;
@@ -294,21 +294,7 @@ private:
         else
             b = &(it->second);
 
-        if (b->groupName != groupName) {
-            DUNE_THROW(Dune::InvalidStateException,
-                       "GET_*_PARAM for parameter '" << paramName
-                       << "' called for at least two different groups ('"
-                       << b->groupName << "' and '" << groupName << "')");
-        }
-
-        if (b->propertyName != propertyName) {
-            DUNE_THROW(Dune::InvalidStateException,
-                       "GET_*_PARAM for parameter '" << paramName
-                       << "' called for at least two different properties ('"
-                       << b->propertyName << "' and '" << propertyName << "')");
-        }
-
-        if (b->paramTypeName != paramTypeName) {
+        if (b->paramTypeName != paramTypeName && b->groupName == groupName) {
             DUNE_THROW(Dune::InvalidStateException,
                        "GET_*_PARAM for parameter '" << paramName << "' in group '"
                        << groupName << "' called with at least two different types ("
-- 
GitLab