From a5b7e3e6379ba2f2ff57791186a15c0c52b0791a Mon Sep 17 00:00:00 2001
From: Timo Koch <timo.koch@iws.uni-stuttgart.de>
Date: Tue, 3 Nov 2015 18:02:33 +0100
Subject: [PATCH] [test][common] Remove usage of ParameterTree and char*

Return an std::string. Don't use the parameter tree directly.
Parameters are registered when using the macro. Thus our summary
output with unused parameters only works when using our macro.
---
 test/common/generalproblem/generallensproblem.hh | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/test/common/generalproblem/generallensproblem.hh b/test/common/generalproblem/generallensproblem.hh
index 8d48c9370f..7bbc220d8a 100644
--- a/test/common/generalproblem/generallensproblem.hh
+++ b/test/common/generalproblem/generallensproblem.hh
@@ -195,8 +195,6 @@ class GeneralLensProblem : public GET_PROP_TYPE(TypeTag, ProblemBaseClass)
     typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables;
     typedef typename GET_PROP_TYPE(TypeTag, BoundaryTypes) BoundaryTypes;
     typedef typename GET_PROP_TYPE(TypeTag, TimeManager) TimeManager;
-    typedef typename GET_PROP(TypeTag, ParameterTree) ParameterTree;
-
     typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
     typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition;
 
@@ -249,17 +247,10 @@ public:
      *
      * This is used as a prefix for files generated by the simulation.
      */
-    const char *name() const
+    const std::string name() const
     {
-        if (ParameterTree::tree().hasKey("Problem.OutputfileName"))
-        {
-            std::string fileName(GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, std::string, Problem, OutputfileName));
-            return fileName.c_str();
-        }
-        else
-        {
-            return "test_generalproblem2p";
-        }
+        try { return GET_RUNTIME_PARAM_FROM_GROUP(TypeTag, std::string, Problem, OutputfileName); }
+        catch (...) { return "test_generalproblem2p"; }
     }
 
     /*!
-- 
GitLab