[Dune] Example on IteratorRange

Aleksejs Fomins aleksejs.fomins at lspr.ch
Fri Jan 23 11:44:31 CET 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Steffen,

It seems to be much more straightforward than I imagined. Thank you

Aleksejs

On 23/01/15 10:58, Steffen Müthing wrote:
> Hi Aleksejs,
> 
> Am 23.01.2015 um 08:59 schrieb Aleksejs Fomins
> <aleksejs.fomins at lspr.ch>:
> 
>> Signierter PGP Teil Dear Christian,
>> 
>> Thank you for your reply.
>> 
>> I have a generic function which works the same way for all grid
>> views, with the exception that it iterates over the gridview in
>> some way.
> 
> That’s exactly what the DUNE-provided infrastructure is - a set of
> generic, freestanding functions that work with any GridView. For
> the details, take another look at the DUNE help page you mentioned 
> earlier.
> 
>> 
>> I thought it would make sense to implement this function as a 
>> protected member of the generic gridview class, and call it from
>> the derived leafgridview as
>> 
>> Base::f(LeafIteratorRange) Can I pass iterator ranges to
>> functions? What is their type then?
> 
> Yes, you can. Their type is unspecified on purpose, we just require
> them to work with a C++11 range-based for statement (for that the
> type needs to expose a begin() and an end() method, the return type
> can be deduced via auto / decltype). In practice, the default
> implementations of those functions all use the class
> Dune::IteratorRange for this purpose - take a look at it in
> Doxygen.
> 
> Steffen
> 
>> 
>> Cheers, Aleksejs
>> 
>> 
>> On 22/01/15 21:56, Christian Engwer wrote:
>>> Dear Aleksejs,
>>> 
>>> I'm sorry, but I don't uderstand your question. What exactly
>>> do you miss in the documentation?
>>> 
>>> There are examples for all functions like elements(gv), 
>>> intersection(e), entities(gv, dim/codim)...
>>> 
>>> On Thu, Jan 22, 2015 at 06:05:55PM +0100, Aleksejs Fomins
>>> wrote:
>>>> Dear Dune,
>>>> 
>>>> I remember we had a discussion before on using iterator
>>>> ranges for iterating over entities of gridview, as written in
>>>> here
>>>> 
>>>> http://www.dune-project.org/doc/doxygen/dune-grid-html/group___g_i_iteration.html#_details
>>>>
>>>>
>>>>
>>
>>>> 
Would somebody be so kind to show me to an example program doing this?
>>>> 
>>>> In particular, I do not seem to be able to derive from that 
>>>> documentation page on how one constructs such an iterator.
>>>> Or, at least, my Eclipse is not able to direct me to the
>>>> method like Dune::GridView::elements
>>> 
>>> as shown in the examples you are not calling methods on a
>>> class. These are free functions operating on a gridview, adding
>>> syntactic sugar ontop of the begin/end methods of the
>>> gridview.
>>> 
>>> Christian
>>> 
>>>> 
>>>> Thank you, Aleksejs
>>>> 
>>>> _______________________________________________ Dune mailing 
>>>> list Dune at dune-project.org 
>>>> http://lists.dune-project.org/mailman/listinfo/dune
>>>> 
>>> 
>> 
>> 
>> _______________________________________________ Dune mailing
>> list Dune at dune-project.org 
>> http://lists.dune-project.org/mailman/listinfo/dune
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQIcBAEBAgAGBQJUwiYPAAoJEDkNM7UOEwMZ3ocP/0FwR1JGfXnyjfq9XyKn7M00
gD8/X0FuktO3TfXjO0T+QAs25K75rvan2OOGKN4hQaQV97K0R4dUX8Y6Wx/PvZzo
f1rGM4AT03rbbQ6y2rNH/jMfHy3TZ4G7m+U8JJSSnrXMWt88exrVsT9OUKMC+Mww
pnkV6Cc0RN/uEgoM01AdEg3OIfcaOjzjgA3CBpBqwtvGatIyU+r43sx0vG0mTzeD
TCY6eAu6sTM+auQemQcw+vaz9p2GX15E1xbu4uCDEm9VII5xvzCGj6bN+IfP3UKl
VoVgsMoZ8D3FGdgXmTDjwAH/IgweLgdhDYCC8MadXaRkVDaDFv8/dIh4Wk9s3XEg
9EhMyRq8/JLuxmsaM7W6yw6RtAnq8iyBFUa/rJtDsMCpykgbzEgV/cwCjxrdNn9C
rTweTY3dR811+z5M3u2Hvhp416FO5+tzx9E2VHpPkWxajpzuKePwQCEvlwwUXHkl
6vJ8yAT/JFQU4Q4uvUAgG4qE/OIDZr41wm8CpG6bqq90mxEJldKyOhBYHCeSQlZ8
fs31j9+xJav4OZVyHTPuhDxCcjib20UG16UYm0yt7IU+bBM2ptpfiokElTyxBWuZ
RSYglC6m4ZDFbFyGsNgINWDu6MRtmJjpw9iWKt3VAcToEHXa6+lcolkd5R/mOdlF
q13YZhQGb2iCiSAOMTgC
=GKDD
-----END PGP SIGNATURE-----




More information about the Dune mailing list