The GeometryGrid takes an stl-conforming allocator as its third template parameter. The PoolAllocator class from dune-common is (AFAIK) standard conforming. Hence I should be able to use the two together. However when I try I get loads of compiler errors. Just uncomment the line
//test(gridfile);
from test-geogrid.cc to see it for yourself. The complete error log is also attached for your convenience.
This is a known issue. I don't know where the trouble comes from. It worked fine with the (removed) SmallObjectAllocator, so I'm quite reluctant to waste time on this issue.
The important error message is as follows:
error: incomplete type ‘const Dune::GeometryGrid<Dune::YaspGrid<2>, Dune::IdenticalCoordFunction<double, 2u>, Dune::PoolAllocator<void, 10ul> >’ used in nested name specifier
This seems like the old chicken-egg problem in dune-grid. All interface facades require the type of the grid to be passed as a template argument. All they do is extracting the Traits class, ctype, dimension and dimensionworld from it. Moreover, it is the only way the implementation can access grid-specific information. Now, this class can only be complete, once all these facades have been successfully instantiated. When writing a grid you sometimes run into the trouble of using something from the grid class that is not yet allowed to be accessed. Finding this spot is a real piece of work, because the compiler output is not helpful at all.
I suggest to fix (i.e., remove) this chicken-egg problem before tackling this bug. This will, of course, mean changing the template argument list for all interface facades in dune-grid. The good news about this is that pure users are not affected by such a change.
Looking into poolallocator.hh, this seems to be the intended behavior when allocating a block with more than one object. As I already stated in the commit message, I'm misusing an allocator for characters to allocate memory blocks of arbitrary size (necessary for the dynamic polymorphism of the geometries).
Notice: GeometryGrid is very slow with the standard allocator. If you're out for performance, you need a very fast allocator, so a working PoolAllocator would be really welcome.