5
#include <dune/common/poolallocator.hh>
6
#include <dune/grid/geometrygrid.hh>
7
#include <dune/grid/geometrygrid/cachedcoordfunction.hh>
8
#include <dune/grid/io/file/dgfparser/dgfgeogrid.hh>
10
#include "functions.hh"
12
#include "gridcheck.cc"
13
#include "checkcommunicate.cc"
14
#include "checkgeometryinfather.cc"
15
#include "checkintersectionit.cc"
16
#include "checkiterators.cc"
17
#include "checkpartition.cc"
18
#include "checkgeometry.cc"
24
template< int dim, int dimworld >
30
template< int dim, int dimworld >
31
struct EnableLevelIntersectionIteratorCheck< Dune::AlbertaGrid< dim, dimworld > >
33
static const bool v = false;
36
template< class HostGrid, class CoordFunction >
37
struct EnableLevelIntersectionIteratorCheck< Dune::GeometryGrid< HostGrid, CoordFunction > >
39
static const bool v = EnableLevelIntersectionIteratorCheck< HostGrid >::v;
43
typedef Dune::COORDFUNCTION AnalyticalCoordFunction;
45
typedef Dune::GridSelector::GridType Grid;
47
#if CACHECOORDFUNCTION
48
typedef Dune::CachedCoordFunction< Grid, AnalyticalCoordFunction > CoordFunction;
50
typedef AnalyticalCoordFunction CoordFunction;
53
typedef Dune::GeometryGrid< Grid, CoordFunction > GeometryGrid;
54
typedef Dune::GeometryGrid< Grid, CoordFunction, Dune::PoolAllocator< char, 16384 > > GeometryGridWithPoolAllocator;
57
template <class GeometryGridType>
58
void test(const std::string& gridfile)
60
Dune::GridPtr< GeometryGridType > pgeogrid(gridfile);
61
GeometryGridType &geogrid = *pgeogrid;
63
geogrid.globalRefine( 1 );
64
geogrid.loadBalance();
66
std::cerr << "Checking grid..." << std::endl;
69
std::cerr << "Checking geometry... " << std::endl;
70
checkGeometry( geogrid.leafView() );
71
for( int i = 0; i <= geogrid.maxLevel(); ++i )
72
checkGeometry( geogrid.levelView( i ) );
74
std::cerr << "Checking geometry in father..." << std::endl;
75
checkGeometryInFather( geogrid );
76
std::cerr << "Checking intersections..." << std::endl;
77
checkIntersectionIterator( geogrid, !EnableLevelIntersectionIteratorCheck< Grid >::v );
79
checkIterators( geogrid.leafView() );
80
for( int i = 0; i <= geogrid.maxLevel(); ++i )
81
checkIterators( geogrid.levelView( i ) );
83
checkPartitionType( geogrid.leafView() );
84
for( int i = 0; i <= geogrid.maxLevel(); ++i )
85
checkPartitionType( geogrid.levelView( i ) );
87
std::cerr << "Checking geometry lifetime..." << std::endl;
88
checkGeometryLifetime( geogrid.leafView() );
90
std::cerr << "Checking communication..." << std::endl;
91
checkCommunication( geogrid, -1, std::cout );
92
if( EnableLevelIntersectionIteratorCheck< Grid >::v )
94
for( int i = 0; i <= geogrid.maxLevel(); ++i )
95
checkCommunication( geogrid, i, std::cout );
100
int main ( int argc, char **argv )
103
Dune::MPIHelper::instance( argc, argv );
105
std::string gridfile = DUNE_GRID_EXAMPLE_GRIDS_PATH "dgf/cube-2.dgf";
111
test<GeometryGrid>(gridfile);
112
// commented out, because it is not working
113
//test<GeometryGridWithPoolAllocator>(gridfile);
117
catch( const Dune::Exception &e )
119
std::cerr << e << std::endl;
124
std::cerr << "Unknown exception raised." << std::endl;
129
#error "COORDFUNCTION not defined (e.g., Helix, Circle; see functions.hh)"