[Dune] The new method getMark()

Olaf Ippisch olaf.ippisch at ipvs.uni-stuttgart.de
Mon Nov 13 10:53:56 CET 2006


Hi all,
On Monday, 13. November 2006 10:28, Oliver Sander wrote:
> - 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.
I think it makes sense, that getMark() is located at the same position as 
mark() which is a method of the grid as well. The mark state can be stored by 
the grid centrally and it is not necessary to couple it to an entity. For me 
its a question of efficiency.
> 
> - 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.
I agree with you. The call to mark() and getMark() should be consistent (which 
is why getMark() should also be a method of the grid).

> 
> - 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().
I support Oliver's proposition.

Regards,
Olaf

-- 
Dr. Olaf Ippisch               
Universität Stuttgart
Institut für Parallele und Verteilte Systeme
Simulation großer Systeme
Universitätsstraße 38, Raum 2.109
Tel: 0711/7816252     FAX: 0711/78161252
Mail: Universitätsstraße 38, 70569 Stuttgart
e-mail: <olaf.ippisch at ipvs.uni-stuttgart.de>

What is mind? No matter. And what is matter? Never mind.




More information about the Dune mailing list