diff --git a/dune/solvers/test/common.hh b/dune/solvers/test/common.hh index d269aed844bbe73cc5f69244596323d5392440b0..fde2299d57f5973b9908febe56c70da811c4cecb 100644 --- a/dune/solvers/test/common.hh +++ b/dune/solvers/test/common.hh @@ -13,7 +13,7 @@ #include <dune/localfunctions/lagrange/pqkfactory.hh> -#include <dune/grid/common/gridfactory.hh> +#include <dune/grid/utility/structuredgridfactory.hh> #if HAVE_UG #include <dune/grid/uggrid.hh> @@ -361,40 +361,23 @@ void markBoundaryDOFs(const GridView& gridView, BitVector& isBoundary) } -template<class GridType> -GridType* constructCoarseGrid() +template<class GridType, class TestSuite> +bool checkWithGrid(TestSuite& suite, int uniformRefinements, std::string name) { const int dim=GridType::dimension; - typename Dune::GridFactory<GridType> gridFactory; - - typename Dune::FieldVector<double,dim> pos(0); - gridFactory.insertVertex(pos); - for (int i=0; i<dim; i++) { - pos = 0; pos[i] = 1; - gridFactory.insertVertex(pos); - } - - std::vector<unsigned int> element(dim+1); - for (int i=0; i<dim+1; i++) - element[i] = i; + Dune::FieldVector<double,dim> lower(0); + Dune::FieldVector<double,dim> upper(1); - gridFactory.insertElement( Dune::GeometryType(Dune::GeometryType::simplex,dim), element); + std::array<unsigned int,dim> elements; + std::fill(elements.begin(), elements.end(), 1); - return gridFactory.createGrid(); -} - - -template<class GridType, class TestSuite> -bool checkWithGrid(TestSuite& suite, int uniformRefinements, std::string name) -{ - typename std::template auto_ptr<GridType> gridPtr(constructCoarseGrid<GridType>()); - GridType& grid = *gridPtr; + std::shared_ptr<GridType> grid = Dune::StructuredGridFactory<GridType>::createSimplexGrid(lower,upper,elements); - grid.globalRefine(uniformRefinements); + grid->globalRefine(uniformRefinements); - std::cout << "Running test on " << name << " with " << grid.size(0) << " elements." << std::endl; + std::cout << "Running test on " << name << " with " << grid->size(0) << " elements." << std::endl; - bool passed = suite.check(grid); + bool passed = suite.check(*grid); if (passed) std::cout << "All tests passed with " << name << "." << std::endl; return passed;