[Dune] LeafGridViews and grid adaption

Matteo Semplice matteo.semplice at unito.it
Thu Aug 29 18:18:51 CEST 2013


Dear duners,
     I am wondering if a LeafGridView would be functional after grid 
adaption. Google found for me FlySpray FS#577, but that left me 
wondering what is the current status and my question is narrower than 
that raised in FS#577.

Currently I have a class which stores a reference to a Dune::Grid object 
and that has a method that creates a LeafGridView from the Grid object 
each time it is called.
If I could create a gridview in the main program and pass it around it 
would save me some headaches (and maybe some CPU time...).

I have in mind to change my code to something like this:

template<G>
class R{
     G::LeafGridView &leafgridview;
     public:
     R(G::LeafGridView &lgv) : leafgridview(lgv) {} //constructor
     void dostuff(){ //uses intersection iterator of leafgridview...}
}

main(){
     typedef SomeDuneGrid G;
     ... create a G& grid
     ... crate a G::LeafGridView lgv on grid
     R r(grid); //instance of R
     R.dostuff(); //first call to dostuff()
     ... adapt the grid
     R.dostuff(); // I need lgv to work properly during this call
}

Would it work? (at least for 2d AluGrid and OneDGrid?)

Thank you in advance!

Matteo




More information about the Dune mailing list