[Dune] Comments on Dune Developer Meeting 2014.

Martin Nolte nolte at mathematik.uni-freiburg.de
Thu Sep 25 14:45:34 CEST 2014


Hi Robert,

thanks for adding yourself to the list. You were always intended to be there - 
we simply had no chance of asking.

As for the iterators: We felt that, while the protect-the-user argument was 
good and valid a few years ago, that is no longer true in the C++11 era. Once 
you can use range-based for-loops, novice users will prefer these of 
hand-written iterator loops. Those people writing then (e.g., we or 
STL-algorithm developers) are aware of this copy and will not accidentally 
call the postfix increment.

And, as far as I am concerned: Don't protect me from myself - just tell me 
about the pitfalls. But we could make it an experimental grid extension ;-).

Best,

Martin

On 09/25/2014 02:25 PM, Robert Kloefkorn wrote:
> Hello Dune,
>
> I went through the protocol of the user meeting.
>
> I would like to comment on the STL forward_iterator interface change and
> here mainly on the postfix increment.
>
> The problem with that method is, besides being redundant to the prefix,
> that copying a grid iterator might not be a cheap thing, e.g. it is
> definitely not in unstructured grids like ALUGrid or AlbertaGrid where
> the whole iterator stack storing the tree information has to be copied.
> For that reason we disabled this postfix increment a couple of years
> ago, i.e. is was available in DUNE some time ago. Also, a dune grid is
> not a STL container, but let's not go there now.
>
> So I would suggest to implement an EntityIterator --> STL iterator
> wrapper class that adds the missing postfix iterator by implementing
>
> This operator++ (int) {
>    This copy( *this );
>    this->operator++ ();
>    return copy;
> }
>
> whenever a true STL iterator is needed (for whatever reason, that
> question was not answered so far).
>
> The benefit would be, that nobody could accidentally use the postfix
> increment and yielding huge performance decrease without noticing. He
> would have to use the STL wrapper first.
>
> Best,
>
> Robert
>
> PS: I took the liberty to adding myself to the list of participants of
> the "parallel features of the grid interface" meeting. I also suggest
> that the protocol should be read-only from now on ;-)
>
>
> _______________________________________________
> Dune mailing list
> Dune at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune
>

-- 
Dr. Martin Nolte <nolte at mathematik.uni-freiburg.de>

Universität Freiburg                                   phone: +49-761-203-5630
Abteilung für angewandte Mathematik                    fax:   +49-761-203-5632
Hermann-Herder-Straße 10
79104 Freiburg, Germany




More information about the Dune mailing list