From 1b3b66bf21b367342b0f0416712a630664b804de Mon Sep 17 00:00:00 2001
From: Timo Koch <timo.koch@iws.uni-stuttgart.de>
Date: Thu, 26 Apr 2018 10:44:19 +0200
Subject: [PATCH] [pmflow] Add problem constructor getting the spatial params

---
 dumux/porousmediumflow/problem.hh | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/dumux/porousmediumflow/problem.hh b/dumux/porousmediumflow/problem.hh
index 06c58cbb8f..3d5054f5a2 100644
--- a/dumux/porousmediumflow/problem.hh
+++ b/dumux/porousmediumflow/problem.hh
@@ -52,22 +52,37 @@ public:
     using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams);
 
     /*!
-     * \brief The constructor
+     * \brief Constructor
      *
      * \param fvGridGeometry The finite volume grid geometry
+     * \param spatialParams The spatial parameter class
      * \param paramGroup The parameter group in which to look for runtime parameters first (default is "")
      */
-    PorousMediumFlowProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry, const std::string& paramGroup = "")
+    PorousMediumFlowProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry,
+                            std::shared_ptr<SpatialParams> spatialParams,
+                            const std::string& paramGroup = "")
     : ParentType(fvGridGeometry, paramGroup)
     , gravity_(0.0)
-    , spatialParams_(std::make_shared<SpatialParams>(this->asImp_()))
+    , spatialParams_(spatialParams)
     {
-        // TODO: spatial params init?
         const bool enableGravity = getParamFromGroup<bool>(paramGroup, "Problem.EnableGravity");
         if (enableGravity)
             gravity_[dimWorld-1]  = -9.81;
     }
 
+    /*!
+     * \brief (Delegating) constructor, constructing the spatial parameters
+     *
+     * \param fvGridGeometry The finite volume grid geometry
+     * \param paramGroup The parameter group in which to look for runtime parameters first (default is "")
+     */
+    PorousMediumFlowProblem(std::shared_ptr<const FVGridGeometry> fvGridGeometry,
+                            const std::string& paramGroup = "")
+    : PorousMediumFlowProblem(fvGridGeometry,
+                              std::make_shared<SpatialParams>(this->asImp_()),
+                              paramGroup)
+    {}
+
     /*!
      * \name Physical parameters for porous media problems
      */
-- 
GitLab