Skip to content
Snippets Groups Projects
Commit af6aba82 authored by Elias Pipping's avatar Elias Pipping
Browse files

Revert "Cover dune-spgrid in unit tests, too"

This reverts commit 7712aa63.
parent 903d14da
Branches
Tags
No related merge requests found
...@@ -2,4 +2,4 @@ Module: dune-fufem ...@@ -2,4 +2,4 @@ Module: dune-fufem
Depends: dune-common (>= 2.4) dune-geometry (>= 2.4) dune-grid (>= 2.4) dune-istl (>= 2.4) dune-localfunctions (>= 2.4) dune-functions Depends: dune-common (>= 2.4) dune-geometry (>= 2.4) dune-grid (>= 2.4) dune-istl (>= 2.4) dune-localfunctions (>= 2.4) dune-functions
Version: 0.1 Version: 0.1
Maintainer: Carsten Gräser (graeser@math.fu-berlin.de) Maintainer: Carsten Gräser (graeser@math.fu-berlin.de)
Suggests: dune-alugrid dune-spgrid Suggests: dune-alugrid
...@@ -25,9 +25,6 @@ ...@@ -25,9 +25,6 @@
#include "dune/subgrid/subgrid.hh" #include "dune/subgrid/subgrid.hh"
#endif #endif
#if HAVE_DUNE_SPGRID
#include <dune/grid/spgrid.hh>
#endif
template <typename FT> template <typename FT>
struct ToleranceTraits { struct ToleranceTraits {
...@@ -269,46 +266,20 @@ GridType* constructCoarseGrid() ...@@ -269,46 +266,20 @@ GridType* constructCoarseGrid()
return gridFactory.createGrid(); return gridFactory.createGrid();
} }
template <int dim, class StructuredGrid>
struct StructuredGridConstructor
{
std::unique_ptr<StructuredGrid> construct() {
DUNE_THROW(Dune::NotImplemented, "Only able to construct YaspGrids and SPGrids");
}
};
template<int dim> template<int dim>
struct StructuredGridConstructor<dim, Dune::YaspGrid<dim>> Dune::YaspGrid<dim>* constructCoarseYaspGrid()
{ {
using StructuredGrid = Dune::YaspGrid<dim>; typedef Dune::YaspGrid<dim> GridType;
std::unique_ptr<StructuredGrid> construct() { Dune::FieldVector<typename GridType::ctype,dim> L(1.0);
Dune::FieldVector<typename StructuredGrid::ctype,dim> L(1.0);
typename Dune::array<int,dim> s; typename Dune::array<int,dim> s;
std::fill(s.begin(), s.end(), 1); std::fill(s.begin(), s.end(), 1);
return std::unique_ptr<StructuredGrid>(new StructuredGrid(L,s)); GridType* grid = new GridType(L,s);
}
};
#if HAVE_DUNE_SPGRID return grid;
template <int dim>
struct StructuredGridConstructor<dim, Dune::SPGrid<double,dim>>
{
using StructuredGrid = Dune::SPGrid<double,dim>;
std::unique_ptr<StructuredGrid> construct() {
Dune::FieldVector<double, dim> a(0);
Dune::FieldVector<double, dim> b(1);
Dune::SPDomain<double,dim> domain(a,b);
std::array<int,dim> precells;
std::fill(precells.begin(), precells.end(),1);
Dune::SPMultiIndex<dim> cells(precells);
return std::unique_ptr<StructuredGrid>(new StructuredGrid(domain,cells));
} }
};
#endif
template<class GridType> template<class GridType>
void refineLocally(GridType& grid, int refine=3) void refineLocally(GridType& grid, int refine=3)
...@@ -351,11 +322,11 @@ bool checkWithAdaptiveGrid(TestSuite& suite, int uniformRefinements, int localRe ...@@ -351,11 +322,11 @@ bool checkWithAdaptiveGrid(TestSuite& suite, int uniformRefinements, int localRe
return passed; return passed;
} }
template<int dim, class StructuredGrid, class TestSuite> template<int dim, class TestSuite>
bool checkWithStructuredGrid(TestSuite& suite, int uniformRefinements, std::string name) bool checkWithStructuredGrid(TestSuite& suite, int uniformRefinements, std::string name)
{ {
StructuredGridConstructor<dim, StructuredGrid> gridConstructor; typedef Dune::YaspGrid<dim> GridType;
auto grid = gridConstructor.construct(); GridType* grid(constructCoarseYaspGrid<dim>());
grid->globalRefine(uniformRefinements); grid->globalRefine(uniformRefinements);
...@@ -365,6 +336,7 @@ bool checkWithStructuredGrid(TestSuite& suite, int uniformRefinements, std::stri ...@@ -365,6 +336,7 @@ bool checkWithStructuredGrid(TestSuite& suite, int uniformRefinements, std::stri
if (passed) if (passed)
std::cout << "All tests passed with " << name << "." << std::endl; std::cout << "All tests passed with " << name << "." << std::endl;
delete grid;
return passed; return passed;
} }
...@@ -451,12 +423,8 @@ bool checkWithStandardStructuredGrids(TestSuite& suite) ...@@ -451,12 +423,8 @@ bool checkWithStandardStructuredGrids(TestSuite& suite)
{ {
bool passed = true; bool passed = true;
passed = passed and checkWithStructuredGrid<2, Dune::YaspGrid<2>>(suite, 4, "YaspGrid<2>"); passed = passed and checkWithStructuredGrid<2>(suite, 4, "YaspGrid<2>");
passed = passed and checkWithStructuredGrid<3, Dune::YaspGrid<3>>(suite, 2, "YaspGrid<3>"); passed = passed and checkWithStructuredGrid<3>(suite, 2, "YaspGrid<3>");
#if HAVE_DUNE_SPGRID
passed = passed and checkWithStructuredGrid<2, Dune::SPGrid<double, 2>>(suite, 4, "SPGridd<2>");
passed = passed and checkWithStructuredGrid<3, Dune::SPGrid<double, 3>>(suite, 2, "SPGridd<3>");
#endif
return passed; return passed;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment