From 7550844d2149a5a08ba23245c862c3485e549904 Mon Sep 17 00:00:00 2001
From: Timo Koch <timo.koch@iws.uni-stuttgart.de>
Date: Sun, 3 Dec 2017 15:54:43 +0100
Subject: [PATCH] [test][box] Fix fvgeometry test

---
 test/discretization/box/CMakeLists.txt        |  8 +++-
 test/discretization/box/test_boxfvgeometry.cc | 44 +++----------------
 2 files changed, 13 insertions(+), 39 deletions(-)

diff --git a/test/discretization/box/CMakeLists.txt b/test/discretization/box/CMakeLists.txt
index 540f1e01a9..126a0a22d1 100644
--- a/test/discretization/box/CMakeLists.txt
+++ b/test/discretization/box/CMakeLists.txt
@@ -1,2 +1,6 @@
-add_dumux_test(test_boxfvgeometry test_boxfvgeometry test_boxfvgeometry.cc
-               ${CMAKE_CURRENT_BINARY_DIR}/test_boxfvgeometry)
+dune_add_test(SOURCES test_boxfvgeometry.cc)
+
+#install sources
+install(FILES
+test_boxfvgeometry.cc
+DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dumux/test/discretization/box)
diff --git a/test/discretization/box/test_boxfvgeometry.cc b/test/discretization/box/test_boxfvgeometry.cc
index b40cc5508d..517f39e913 100644
--- a/test/discretization/box/test_boxfvgeometry.cc
+++ b/test/discretization/box/test_boxfvgeometry.cc
@@ -31,44 +31,17 @@
 #include <dune/grid/yaspgrid.hh>
 #include <dune/grid/common/mcmgmapper.hh>
 
-#include <dumux/implicit/box/properties.hh>
+#include <dumux/common/basicproperties.hh>
+#include <dumux/discretization/box/properties.hh>
 
 namespace Dumux
 {
 
-template<class TypeTag>
-class MockProblem
-{
-    using ElementMapper = typename GET_PROP_TYPE(TypeTag, ElementMapper);
-    using VertexMapper = typename GET_PROP_TYPE(TypeTag, VertexMapper);
-    using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
-public:
-    MockProblem(const GridView& gridView) : elementMapper_(gridView), vertexMapper_(gridView)  {}
-
-    const ElementMapper& elementMapper() const
-    { return elementMapper_; }
-
-    const VertexMapper& vertexMapper() const
-    { return vertexMapper_; }
-
-    template<class Element, class Intersection>
-    bool isInteriorBoundary(const Element& e, const Intersection& i) const
-    { return false; }
-
-    std::vector<unsigned int> getAdditionalDofDependencies(unsigned int index) const
-    { return std::vector<unsigned int>(); }
-private:
-    ElementMapper elementMapper_;
-    VertexMapper vertexMapper_;
-};
-
 namespace Properties
 {
-NEW_TYPE_TAG(TestFVGeometry, INHERITS_FROM(BoxModel));
+NEW_TYPE_TAG(TestFVGeometry, INHERITS_FROM(BoxModel, NumericModel));
 
 SET_TYPE_PROP(TestFVGeometry, Grid, Dune::YaspGrid<3>);
-
-SET_TYPE_PROP(TestFVGeometry, Problem, Dumux::MockProblem<TypeTag>);
 }
 
 }
@@ -100,7 +73,6 @@ int main (int argc, char *argv[]) try
     using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume);
     using SubControlVolumeFace = typename GET_PROP_TYPE(TypeTag, SubControlVolumeFace);
     using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
-    using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
 
     // make a grid
     GlobalPosition lower(0.0);
@@ -109,17 +81,15 @@ int main (int argc, char *argv[]) try
     std::shared_ptr<Grid> grid = Dune::StructuredGridFactory<Grid>::createCubeGrid(lower, upper, els);
     auto leafGridView = grid->leafGridView();
 
-    Problem problem(leafGridView);
-
-    FVGridGeometry global(leafGridView);
-    global.update(problem);
+    FVGridGeometry fvGridGeometry(leafGridView);
+    fvGridGeometry.update();
 
     // iterate over elements. For every element get fv geometry and loop over scvs and scvfaces
     for (const auto& element : elements(leafGridView))
     {
-        auto eIdx = problem.elementMapper().index(element);
+        auto eIdx = fvGridGeometry.elementMapper().index(element);
         std::cout << std::endl << "Checking fvGeometry of element " << eIdx << std::endl;
-        auto fvGeometry = localView(global);
+        auto fvGeometry = localView(fvGridGeometry);
         fvGeometry.bind(element);
 
         auto range = scvs(fvGeometry);
-- 
GitLab