[Dune] persistent containers

Matteo Semplice matteo.semplice at unito.it
Wed Mar 6 13:56:06 CET 2013


Hi dune,
I wanted to use a PersistentContainer for codim=1 entities, but ran into 
the following compilation error (with a freshly updated 2.2 svn version).

matteo at cassin:~/src/dune/dune-fv/src$ make dune_fv
g++ -std=c++0x -DHAVE_CONFIG_H -I. -I.. 
-I/home/matteo/src/dune/dune-common 
-I/home/matteo/src/dune/dune-geometry -I/home/matteo/src/dune/dune-grid 
-I/usr/lib/openmpi/include -I/usr/lib/openmpi/include/openmpi -pthread 
-DMPIPP_H -DENABLE_MPI=1 -I/home/matteo/include 
-I/home/matteo/include/alberta -DALBERTA_DIM=1 -DENABLE_ALBERTA 
-I/usr/lib/openmpi/include -I/usr/lib/openmpi/include/openmpi -pthread 
-DMPIPP_H -DENABLE_MPI=1 -I/home/matteo/include 
-I/home/matteo/include/serial -I/home/matteo/include/duneinterface 
-DENABLE_ALUGRID -I/home/matteo/include/parallel -DGRIDDIM=1 
-DWORLDDIM=1 -DONEDGRID -g -O3 -march=native -MT dune_fv-dune_fv.o -MD 
-MP -MF .deps/dune_fv-dune_fv.Tpo -c -o dune_fv-dune_fv.o `test -f 
'dune_fv.cc' || echo './'`dune_fv.cc
In file included from 
/home/matteo/src/dune/dune-grid/dune/grid/common/grid.hh:1327,
from /home/matteo/src/dune/dune-grid/dune/grid/onedgrid.hh:12,
from ../config.h:561,
from dune_fv.cc:30:
/home/matteo/src/dune/dune-grid/dune/grid/common/indexidset.hh: In 
member function ‘IdTypeImp Dune::IdSet<GridImp, IdSetImp, 
IdTypeImp>::id(const EntityType&) const [with EntityType = 
Dune::Intersection<const Dune::OneDGrid, 
Dune::OneDGridLeafIntersection>, GridImp = const Dune::OneDGrid, 
IdSetImp = Dune::OneDGridIdSet<const Dune::OneDGrid>, IdTypeImp = 
unsigned int]’:
/home/matteo/src/dune/dune-grid/dune/grid/utility/persistentcontainer.hh:321: 
instantiated from ‘typename Map::mapped_type& 
Dune::PersistentContainerMap<Grid, Id, Map>::operator[](const Entity&) 
[with Entity = Dune::Intersection<const Dune::OneDGrid, 
Dune::OneDGridLeafIntersection>, Grid = Dune::OneDGrid, Id = 
Dune::IdSet<const Dune::OneDGrid, Dune::OneDGridIdSet<const 
Dune::OneDGrid>, unsigned int>, Map = std::map<const unsigned int, 
double, std::less<const unsigned int>, std::allocator<unsigned int> >]’
dune_fv.cc:297: instantiated from here
/home/matteo/src/dune/dune-grid/dune/grid/common/indexidset.hh:411: 
error: no matching function for call to ‘Dune::OneDGridIdSet<const 
Dune::OneDGrid>::id(const Dune::Intersection<const Dune::OneDGrid, 
Dune::OneDGridLeafIntersection>&) const’
make: *** [dune_fv-dune_fv.o] Error 1

The relevant portion of the code is:

typedef Dune::PersistentContainer<G,double> PC;
PC ElemData(grid,0);
PC Fluxes(grid,1);
typedef G::LeafGridView GridView;
typedef GridView::Codim<0>::Iterator LeafIterator;
typedef GridView::IntersectionIterator IntersectionIterator;
typedef G::Codim<0>::EntityPointer EntityPointer;
typedef G::Codim<0>::Entity Entity;
GridView gridView = grid.leafView();
LeafIterator endit = gridView.end<0>();
for (LeafIterator it = gridView.begin<0>(); it!=endit; ++it)
{
const Entity& inside = *it;
double &u=ElemData[inside];
IntersectionIterator isend = gridView.iend(inside);
for (IntersectionIterator is = gridView.ibegin(inside); is!=isend; ++is){
typedef IntersectionIterator::Intersection t_intersection;
const t_intersection &face = is.operator* ();
double& p = Fluxes[face]; //<==== this is line 297
}}

and the error is triggered by the line with Fluxes[face]. Note that the 
line with ElemData[inside] compiles and the created reference u can be 
used correctly. This seems to happen with OneDGrid, Alberta and ALU, so 
I guess it's me doing something wrong here...

Any hints?

Best regards,
Matteo










More information about the Dune mailing list