[Dune] An issue with the new GridViews

Oliver Sander sander at mi.fu-berlin.de
Thu Jul 31 11:29:07 CEST 2008


Dear Dune!
I just replaced a few uses of indexsets with grid views.  This is necessary
to be able to eventually remove the deprecated begin() and end() methods
of the IndexSet class.  I ran into one problem which I would like to point
out to you.

The main change in P1Operator (in dune-disc) was to replace

const IndexSet& is;  // in P1OperatorBase

by

const GridView& gv;

However, while the methods leafIndexSet() and levelIndexSet() return
const references to the index sets, the corresponding methods leafView()
and levelView() return values.  If you store const references to them you
run into strange problems with dangling references (read: segfaults).
Therefore, the line in P1OperatorBase now reads

GridView gv;

I am not saying that handing over values instead of references is
necessarily worse than handing over references.  However, one should
be aware of the change, because the problems you get are hard to
track down.

greetings,
Oliver

-- 
************************************************************************
* Oliver Sander                ** email: sander at mi.fu-berlin.de        *
* Freie Universität Berlin     ** phone: + 49 (30) 838 75217           *
* Institut für Mathematik II   ** URL  : page.mi.fu-berlin.de/~sander  *
* Arnimallee 6                 ** -------------------------------------*
* 14195 Berlin, Germany        ** Member of MATHEON (www.matheon.de)   *
************************************************************************





More information about the Dune mailing list