From f8664fc5823823e3fbb7d1cc46f56c6e663c975c Mon Sep 17 00:00:00 2001
From: Maziar Veyskarami <maziar.veyskarami@iws.uni-stuttgart.de>
Date: Fri, 3 Apr 2020 11:57:02 +0200
Subject: [PATCH] [ex-properties][propertiesheader] move properties to property
 header

---
 exercises/exercise-properties/main.cc       |  4 +-
 exercises/exercise-properties/problem.hh    | 64 +--------------
 exercises/exercise-properties/properties.hh | 89 +++++++++++++++++++++
 3 files changed, 93 insertions(+), 64 deletions(-)
 create mode 100644 exercises/exercise-properties/properties.hh

diff --git a/exercises/exercise-properties/main.cc b/exercises/exercise-properties/main.cc
index 91a44609..fd52d8d8 100644
--- a/exercises/exercise-properties/main.cc
+++ b/exercises/exercise-properties/main.cc
@@ -32,8 +32,6 @@
 #include <dune/grid/io/file/vtk.hh>
 #include <dune/istl/io.hh>
 
-#include "problem.hh"
-
 #include <dumux/common/properties.hh>
 #include <dumux/common/parameters.hh>
 #include <dumux/common/valgrind.hh>
@@ -52,6 +50,8 @@
 #include <dumux/io/vtkoutputmodule.hh>
 #include <dumux/io/grid/gridmanager.hh>
 
+#include "properties.hh"
+
 /*!
  * \brief Provides an interface for customizing error messages associated with
  *        reading in parameters.
diff --git a/exercises/exercise-properties/problem.hh b/exercises/exercise-properties/problem.hh
index cb488159..668e76aa 100644
--- a/exercises/exercise-properties/problem.hh
+++ b/exercises/exercise-properties/problem.hh
@@ -18,75 +18,15 @@
  *****************************************************************************/
 /*!
  * \ingroup TwoPTests
- * \brief The properties for the incompressible 2p test
+ * \brief The incompressible 2p test problem for exercise-properties
  */
 #ifndef DUMUX_INCOMPRESSIBLE_TWOP_TEST_PROBLEM_HH
 #define DUMUX_INCOMPRESSIBLE_TWOP_TEST_PROBLEM_HH
 
-#include <dune/grid/yaspgrid.hh>
-
-#include <dumux/discretization/box.hh>
-#include <dumux/discretization/cctpfa.hh>
-#include <dumux/discretization/ccmpfa.hh>
-
-#include <dumux/material/components/trichloroethene.hh>
-#include <dumux/material/components/simpleh2o.hh>
-#include <dumux/material/fluidsystems/1pliquid.hh>
-#include <dumux/material/fluidsystems/2pimmiscible.hh>
-
 #include <dumux/porousmediumflow/problem.hh>
-#include <dumux/porousmediumflow/2p/model.hh>
-#include <dumux/porousmediumflow/2p/incompressiblelocalresidual.hh>
-
-#include "spatialparams.hh"
-
-// TODO: dumux-course-task 3
-// Include the local residual header
+#include <dumux/common/properties.hh>
 
 namespace Dumux {
-// forward declarations
-template<class TypeTag> class TwoPTestProblem;
-
-namespace Properties {
-// Create new type tags
-namespace TTag {
-struct TwoPIncompressible { using InheritsFrom = std::tuple<TwoP>; };
-struct TwoPIncompressibleTpfa { using InheritsFrom = std::tuple<TwoPIncompressible, CCTpfaModel>; };
-} // end namespace TTag
-
-// Set the grid type
-template<class TypeTag>
-struct Grid<TypeTag, TTag::TwoPIncompressible> { using type = Dune::YaspGrid<2>; };
-
-// Set the problem type
-template<class TypeTag>
-struct Problem<TypeTag, TTag::TwoPIncompressible> { using type = TwoPTestProblem<TypeTag>; };
-
-// TODO: dumux-course-task 3
-// Use MyLocalResidual as LocalResidual
-
-
-// Set the fluid system
-template<class TypeTag>
-struct FluidSystem<TypeTag, TTag::TwoPIncompressible>
-{
-    using Scalar = GetPropType<TypeTag, Properties::Scalar>;
-    using WettingPhase = FluidSystems::OnePLiquid<Scalar, Components::SimpleH2O<Scalar> >;
-    using NonwettingPhase = FluidSystems::OnePLiquid<Scalar, Components::Trichloroethene<Scalar> >;
-    using type = FluidSystems::TwoPImmiscible<Scalar, WettingPhase, NonwettingPhase>;
-};
-
-// Set the spatial parameters
-template<class TypeTag>
-struct SpatialParams<TypeTag, TTag::TwoPIncompressible>
-{
-private:
-    using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
-    using Scalar = GetPropType<TypeTag, Properties::Scalar>;
-public:
-    using type = TwoPTestSpatialParams<FVGridGeometry, Scalar>;
-};
-} // end namespace Properties
 
 /*!
  * \ingroup TwoPTests
diff --git a/exercises/exercise-properties/properties.hh b/exercises/exercise-properties/properties.hh
new file mode 100644
index 00000000..d8beb946
--- /dev/null
+++ b/exercises/exercise-properties/properties.hh
@@ -0,0 +1,89 @@
+// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+// vi: set et ts=4 sw=4 sts=4:
+/*****************************************************************************
+ *   See the file COPYING for full copying permissions.                      *
+ *                                                                           *
+ *   This program is free software: you can redistribute it and/or modify    *
+ *   it under the terms of the GNU General Public License as published by    *
+ *   the Free Software Foundation, either version 2 of the License, or       *
+ *   (at your option) any later version.                                     *
+ *                                                                           *
+ *   This program is distributed in the hope that it will be useful,         *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of          *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the            *
+ *   GNU General Public License for more details.                            *
+ *                                                                           *
+ *   You should have received a copy of the GNU General Public License       *
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.   *
+ *****************************************************************************/
+/*!
+ * \ingroup TwoPTests
+ * \brief The properties file for exercise-properties
+ */
+#ifndef DUMUX_EX_PROPERTIES_HH
+#define DUMUX_EX_PROPERTIES_HH
+
+#include <dune/grid/yaspgrid.hh>
+
+#include <dumux/discretization/box.hh>
+#include <dumux/discretization/cctpfa.hh>
+#include <dumux/discretization/ccmpfa.hh>
+
+#include <dumux/material/components/trichloroethene.hh>
+#include <dumux/material/components/simpleh2o.hh>
+#include <dumux/material/fluidsystems/1pliquid.hh>
+#include <dumux/material/fluidsystems/2pimmiscible.hh>
+
+#include <dumux/porousmediumflow/2p/model.hh>
+#include <dumux/porousmediumflow/2p/incompressiblelocalresidual.hh>
+
+#include "spatialparams.hh"
+#include "problem.hh"
+
+// TODO: dumux-course-task 3
+// Include the local residual header
+
+namespace Dumux::Properties {
+
+// Create new type tags
+namespace TTag {
+struct TwoPIncompressible { using InheritsFrom = std::tuple<TwoP>; };
+struct TwoPIncompressibleTpfa { using InheritsFrom = std::tuple<TwoPIncompressible, CCTpfaModel>; };
+} // end namespace TTag
+
+// Set the grid type
+template<class TypeTag>
+struct Grid<TypeTag, TTag::TwoPIncompressible> { using type = Dune::YaspGrid<2>; };
+
+// Set the problem type
+template<class TypeTag>
+struct Problem<TypeTag, TTag::TwoPIncompressible> { using type = TwoPTestProblem<TypeTag>; };
+
+// TODO: dumux-course-task 3
+// Use MyLocalResidual as LocalResidual
+
+
+// Set the fluid system
+template<class TypeTag>
+struct FluidSystem<TypeTag, TTag::TwoPIncompressible>
+{
+    using Scalar = GetPropType<TypeTag, Properties::Scalar>;
+    using WettingPhase = FluidSystems::OnePLiquid<Scalar, Components::SimpleH2O<Scalar> >;
+    using NonwettingPhase = FluidSystems::OnePLiquid<Scalar, Components::Trichloroethene<Scalar> >;
+    using type = FluidSystems::TwoPImmiscible<Scalar, WettingPhase, NonwettingPhase>;
+};
+
+// Set the spatial parameters
+template<class TypeTag>
+struct SpatialParams<TypeTag, TTag::TwoPIncompressible>
+{
+private:
+    using FVGridGeometry = GetPropType<TypeTag, Properties::GridGeometry>;
+    using Scalar = GetPropType<TypeTag, Properties::Scalar>;
+public:
+    using type = TwoPTestSpatialParams<FVGridGeometry, Scalar>;
+};
+
+} // end namespace Dumux::Properties
+
+#endif
-- 
GitLab