From 2e0668790fa475b44d26dc9e7a2ab31300f423a9 Mon Sep 17 00:00:00 2001 From: Timo Koch <timo.koch@iws.uni-stuttgart.de> Date: Thu, 18 Jan 2018 11:00:32 +0100 Subject: [PATCH] [test][box] Make FVGridGeometry test independent of TypeTag --- test/discretization/box/CMakeLists.txt | 2 +- test/discretization/box/test_boxfvgeometry.cc | 46 ++++++++----------- 2 files changed, 19 insertions(+), 29 deletions(-) diff --git a/test/discretization/box/CMakeLists.txt b/test/discretization/box/CMakeLists.txt index 767f3bf40f..91a9d142ad 100644 --- a/test/discretization/box/CMakeLists.txt +++ b/test/discretization/box/CMakeLists.txt @@ -1,6 +1,6 @@ dune_add_test(NAME test_boxfvgeometry SOURCES test_boxfvgeometry.cc - COMPILE_DEFINITIONS ENABLE_CACHING=false) + COMPILE_DEFINITIONS ENABLE_CACHING=false) dune_add_test(NAME test_boxfvgeometry_caching SOURCES test_boxfvgeometry.cc diff --git a/test/discretization/box/test_boxfvgeometry.cc b/test/discretization/box/test_boxfvgeometry.cc index 4e8041d0d2..570b78a8f2 100644 --- a/test/discretization/box/test_boxfvgeometry.cc +++ b/test/discretization/box/test_boxfvgeometry.cc @@ -27,54 +27,44 @@ #include <utility> #include <dune/common/test/iteratortest.hh> +#include <dune/common/fvector.hh> #include <dune/grid/utility/structuredgridfactory.hh> #include <dune/grid/yaspgrid.hh> -#include <dune/grid/common/mcmgmapper.hh> -#include <dumux/common/properties.hh> -#include <dumux/discretization/box/properties.hh> - -namespace Dumux -{ - -namespace Properties -{ -NEW_TYPE_TAG(TestBoxFVGeometry, INHERITS_FROM(BoxModel)); - -SET_TYPE_PROP(TestBoxFVGeometry, Scalar, double); -SET_TYPE_PROP(TestBoxFVGeometry, Grid, Dune::YaspGrid<3>); -SET_BOOL_PROP(TestBoxFVGeometry, EnableFVGridGeometryCache, ENABLE_CACHING); -} - -} +#include <dumux/discretization/box/fvgridgeometry.hh> +#ifndef DOXYGEN +namespace Dumux { +namespace Detail { template<class T> class NoopFunctor { public: NoopFunctor() {} void operator()(const T& t){} }; +} // end namespace Detail +} // end namespace Dumux +#endif int main (int argc, char *argv[]) try { + using namespace Dumux; + // maybe initialize mpi Dune::MPIHelper::instance(argc, argv); std::cout << "Checking the FVGeometries, SCVs and SCV faces" << std::endl; - // aliases - using TypeTag = TTAG(TestBoxFVGeometry); - using Grid = typename GET_PROP_TYPE(TypeTag, Grid); - using GridView = typename Grid::LeafGridView; + using Grid = Dune::YaspGrid<3>; - constexpr int dim = GridView::dimension; - constexpr int dimworld = GridView::dimensionworld; + constexpr int dim = Grid::dimension; + constexpr int dimworld = Grid::dimensionworld; - using GlobalPosition = Dune::FieldVector<typename GridView::ctype, dimworld>; - using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView; + using GlobalPosition = Dune::FieldVector<typename Grid::ctype, dimworld>; + using FVGridGeometry = BoxFVGridGeometry<double, typename Grid::LeafGridView, ENABLE_CACHING>; + using FVElementGeometry = typename FVGridGeometry::LocalView; using SubControlVolume = typename FVElementGeometry::SubControlVolume; using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace; - using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry); // make a grid GlobalPosition lower(0.0); @@ -95,7 +85,7 @@ int main (int argc, char *argv[]) try fvGeometry.bind(element); auto range = scvs(fvGeometry); - NoopFunctor<SubControlVolume> op; + Detail::NoopFunctor<SubControlVolume> op; if(0 != testForwardIterator(range.begin(), range.end(), op)) DUNE_THROW(Dune::Exception, "Iterator does not fulfill the forward iterator concept"); @@ -105,7 +95,7 @@ int main (int argc, char *argv[]) try } auto range2 = scvfs(fvGeometry); - NoopFunctor<SubControlVolumeFace> op2; + Detail::NoopFunctor<SubControlVolumeFace> op2; if(0 != testForwardIterator(range2.begin(), range2.end(), op2)) DUNE_THROW(Dune::Exception, "Iterator does not fulfill the forward iterator concept"); -- GitLab