[Dune] The new method getMark()

Oliver Sander sander at mi.fu-berlin.de
Mon Nov 13 10:28:48 CET 2006


Dear Dune!
Several questions occurred to me while trying to implement the getMark()
method for UGGrid.  Here they are:

- Why is getMark a method of the grid?  I would have expected it to be
   a method of the Entity, as are all other const methods that give
   information about entities.

- Suppose it is a method of the grid.  Why is it called with an Entity
   as the argument?  The corresponding mark()-method takes an
   Entity_Pointer_.  I think we should be consistent here.

- What is the precise semantics of the return value of mark()? The
   documentation says 'true if Entity was marked, false otherwise'.
   But what happens if the element has been marked before and I call
   mark() with refcount==0 (i.e. I deliberately unmark the element).
   Does the method return false (because the element is not marked
   anymore) or true (because I changed the element's state)?

I am tempted to suggest we turn mark() into a void method, because

- I expect the return value to be rarely used
- its semantics are not intuitively clear
- the implementation can be costly (e.g. UGGrid), because mark() may
   have to call getMark() internally to see whether it is changing
   the element's state.  And getMark can be surprisingly costly
   (UGGrid, again).
- if you do need the information of the return value you can also
   get it using getMark().

Let the discussion begin!

:-)
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