From 206047ad4e3621ff2700160d13632a484bc53b99 Mon Sep 17 00:00:00 2001
From: Ivan Buntic <st116086@stud.uni-stuttgart.de>
Date: Fri, 17 Sep 2021 15:02:49 +0200
Subject: [PATCH] [disc][linear] Use discretization tag instead of enum as
 template argument.

---
 dumux/linear/linearsolvertraits.hh | 18 +++++++++---------
 test/linear/test_linearsolver.cc   |  3 ++-
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/dumux/linear/linearsolvertraits.hh b/dumux/linear/linearsolvertraits.hh
index 99eca749c1..146e63b40c 100644
--- a/dumux/linear/linearsolvertraits.hh
+++ b/dumux/linear/linearsolvertraits.hh
@@ -37,12 +37,12 @@
 namespace Dumux {
 
 //! The implementation is specialized for the different discretizations
-template<class GridGeometry, DiscretizationMethod discMethod>
+template<class GridGeometry, class DiscretizationMethod>
 struct LinearSolverTraitsImpl;
 
 //! The type traits required for using the IstlFactoryBackend
 template<class GridGeometry>
-using LinearSolverTraits = LinearSolverTraitsImpl<GridGeometry, GridGeometry::discMethod>;
+using LinearSolverTraits = LinearSolverTraitsImpl<GridGeometry, typename GridGeometry::DiscretizationMethod>;
 
 //! sequential solver traits
 template<class MType, class VType>
@@ -109,7 +109,7 @@ struct LinearSolverTraitsBase
 
 //! Box: use overlapping or non-overlapping model depending on the grid
 template<class GridGeometry>
-struct LinearSolverTraitsImpl<GridGeometry, DiscretizationMethod::box>
+struct LinearSolverTraitsImpl<GridGeometry, DiscretizationMethods::Box>
 : public LinearSolverTraitsBase<GridGeometry>
 {
     using DofMapper = typename GridGeometry::VertexMapper;
@@ -124,7 +124,7 @@ struct LinearSolverTraitsImpl<GridGeometry, DiscretizationMethod::box>
 
 //! Cell-centered tpfa: use overlapping model
 template<class GridGeometry>
-struct LinearSolverTraitsImpl<GridGeometry, DiscretizationMethod::cctpfa>
+struct LinearSolverTraitsImpl<GridGeometry, DiscretizationMethods::CCTpfa>
 : public LinearSolverTraitsBase<GridGeometry>
 {
     using DofMapper = typename GridGeometry::ElementMapper;
@@ -139,7 +139,7 @@ struct LinearSolverTraitsImpl<GridGeometry, DiscretizationMethod::cctpfa>
 
 //! Face-centered staggered: use overlapping model
 template<class GridGeometry>
-struct LinearSolverTraitsImpl<GridGeometry, DiscretizationMethod::fcstaggered>
+struct LinearSolverTraitsImpl<GridGeometry, DiscretizationMethods::FCStaggered>
 : public LinearSolverTraitsBase<GridGeometry>
 {
     class DofMapper
@@ -180,13 +180,13 @@ struct LinearSolverTraitsImpl<GridGeometry, DiscretizationMethod::fcstaggered>
 
 //! Cell-centered mpfa: use overlapping model
 template<class GridGeometry>
-struct LinearSolverTraitsImpl<GridGeometry, DiscretizationMethod::ccmpfa>
-: public LinearSolverTraitsImpl<GridGeometry, DiscretizationMethod::cctpfa> {};
+struct LinearSolverTraitsImpl<GridGeometry, DiscretizationMethods::CCMpfa>
+: public LinearSolverTraitsImpl<GridGeometry, DiscretizationMethods::CCTpfa> {};
 
 //! staggered: use overlapping model
 template<class GridGeometry>
-struct LinearSolverTraitsImpl<GridGeometry, DiscretizationMethod::staggered>
-: public LinearSolverTraitsImpl<GridGeometry, DiscretizationMethod::cctpfa> {};
+struct LinearSolverTraitsImpl<GridGeometry, DiscretizationMethods::Staggered>
+: public LinearSolverTraitsImpl<GridGeometry, DiscretizationMethods::CCTpfa> {};
 
 } // end namespace Dumux
 
diff --git a/test/linear/test_linearsolver.cc b/test/linear/test_linearsolver.cc
index 0893455a19..67e51b9111 100644
--- a/test/linear/test_linearsolver.cc
+++ b/test/linear/test_linearsolver.cc
@@ -31,7 +31,8 @@ struct MockGridGeometry
     using GridView = Dune::YaspGrid<2>::LeafGridView;
     using DofMapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView>;
     using VertexMapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView>;
-    static constexpr auto discMethod = DiscretizationMethod::box;
+    using DiscretizationMethod = DiscretizationMethods::Box;
+    static constexpr DiscretizationMethod discMethod{};
 };
 
 template<class M, class X, class V>
-- 
GitLab