[Dune] Example on IteratorRange

Aleksejs Fomins aleksejs.fomins at lspr.ch
Fri Jan 23 13:03:03 CET 2015


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

Dear Steffen,

I am sorry to bother you again, but I still do not understand it.
I HAVE read the doxygen about 3 times now.

Trivial question:

Dune::IteratorRange<GridViewType, ????> myHappyIteratorRange =
Dune::GridView::elements(gv,Dune::Partitions::interiorBorder)
some_function(myHappyIteratorRange);


What is the 2nd template parameter for the IteratorRange in this case?

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)

iQIcBAEBAgAGBQJUwjh3AAoJEDkNM7UOEwMZrH0P/1+ZhoV69L1OpS9fBSgZYs7M
y/cFq8/diVLehgqh0sXK7QKix3uQcleUqQ91GGMhEnOcLlFukBoQ6SCA0oTrxUhq
7oBHGK94YnEFzNvZRtJbSD0WrsOQxnZSHPCRMdtyUav2V3hEIqb1Y637rQfOMvQT
UigGMQRI134bqJ+QYSvLHmSa0W3ZC7QnREvF9HpADHb0mjMJc2UJaN2axRnwfZqo
9wiXIIyWJGWuwWxl89XXKGxHMEJGXhCXhqQ91S25sdbE/tWFGI6CCsSG1Ml2ta+d
YRylILvSskH1CUOO4iCxGEFCre5VoHhoe+jvvsZBpZYaW9OLUIC8Gb+GiD+JKuoS
aR3x9tPzZxEWQt7mR3OWh0RC6jjIg5W+We1j9VVGzt9GjDkfnl4RsjVOJFDYu9mW
U0eIB4EsisIF8DeP2XdQUxCqCiXi9e3nWoc11XcAKdXj2s0nz+xhO5ZzpSgKv3xj
aXVYbvfyHSrmFvbSFjrxY56kv69X8V8kTc5e05RSXP4/Zr0CB7aiIIeD3hmYHnFt
uAaS0DPfJpqrW0fC7bKe7l59icG2WTk7mZf1yn+Un+zkJ2wAiyx3YoK2EER2QaTm
183qhhmQ6wrI9b3dxOggoF+Y7STsOQKtnzpxbUdCUy6VaaIJNVtYl2Jsoz9hJgSS
1A/b9weHZUP7tBuBPWBa
=ir57
-----END PGP SIGNATURE-----




More information about the Dune mailing list