From dc90cb934b515a80d538ffe379384161a544b136 Mon Sep 17 00:00:00 2001 From: Robert Kloefkorn Date: Thu, 10 Sep 2015 15:55:54 +0200 Subject: [PATCH] CartesianIndexMapper: use the CartesianIndexMapper to applied the mapping from the Cartesian coordinate to the flat index and vice versa. --- examples/problems/lensgridmanager.hh | 41 ++++++++++++++++------------ 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/examples/problems/lensgridmanager.hh b/examples/problems/lensgridmanager.hh index e3582c8ac..1d433d9d0 100644 --- a/examples/problems/lensgridmanager.hh +++ b/examples/problems/lensgridmanager.hh @@ -30,6 +30,13 @@ #include #include +#include + +#if HAVE_DUNE_ALUGRID +#include +#include +#endif + #include #include @@ -62,6 +69,8 @@ NEW_PROP_TAG(GridGlobalRefinements); // set the Grid and GridManager properties SET_TYPE_PROP(LensGridManager, Grid, Dune::YaspGrid<2>); +//SET_TYPE_PROP(LensGridManager, Grid, Dune::ALUGrid< 2, 2, Dune::cube, Dune::nonconforming > ); + SET_TYPE_PROP(LensGridManager, GridManager, Ewoms::LensGridManager); } // namespace Properties @@ -115,16 +124,11 @@ public: LensGridManager(Simulator &simulator) : ParentType(simulator) { -#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 3) - std::bitset isPeriodic(false); - std::array cellRes; -#else - Dune::FieldVector isPeriodic(false); Dune::FieldVector cellRes; -#endif typedef double GridScalar; Dune::FieldVector upperRight; + Dune::FieldVector lowerLeft( 0 ); upperRight[0] = EWOMS_GET_PARAM(TypeTag, Scalar, DomainSizeX); upperRight[1] = EWOMS_GET_PARAM(TypeTag, Scalar, DomainSizeY); @@ -136,18 +140,21 @@ public: cellRes[2] = EWOMS_GET_PARAM(TypeTag, int, CellsZ); } + std::stringstream dgffile; + dgffile << "DGF" << std::endl; + dgffile << "INTERVAL" << std::endl; + dgffile << lowerLeft << std::endl; + dgffile << upperRight << std::endl; + dgffile << cellRes << std::endl; + dgffile << "#" << std::endl; + dgffile << "GridParameter" << std::endl; + dgffile << "overlap 1" << std::endl; + dgffile << "#" << std::endl; + + // use DGF parser to create a grid from interval block + gridPtr_.reset( Dune::GridPtr< Grid >( dgffile ).release() ); + unsigned numRefinements = EWOMS_GET_PARAM(TypeTag, unsigned, GridGlobalRefinements); -#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4) - gridPtr_.reset(new Dune::YaspGrid(upperRight, cellRes)); -#else - gridPtr_.reset(new Dune::YaspGrid( -#ifdef HAVE_MPI - /*mpiCommunicator=*/Dune::MPIHelper::getCommunicator(), -#endif - /*upperRightCorner=*/upperRight, - /*numCells=*/cellRes, isPeriodic, - /*overlap=*/1)); -#endif gridPtr_->globalRefine(numRefinements); this->finalizeInit_();