[Dune-devel] getting the first element
Aleksejs Fomins
aleksejs.fomins at lspr.ch
Tue Dec 1 18:21:33 CET 2015
Thanks Marco, I was not actually sure what the range-based for really was, but now I know :)
On 01.12.2015 18:13, Agnese, Marco wrote:
> The "range based for" are not new iterators but simply a feature of C++11 which allows you to loop over a container in the range begin() and end(). Therefore you need a begin() and end() iterator for ever container you want to loop over. The class elements wrap the iterators in such a way that can be used by the range based for.
>
> Obviously, if you want to loop over all the leaf grid view I would use the new syntax but if you need to extract a single elements or to loop over a subset I would explicitly extract the needed iterators.
> HIH
>
> Cheers,
> Marco
>
>
> ________________________________________
> From: Aleksejs Fomins <aleksejs.fomins at lspr.ch>
> Sent: 01 December 2015 17:06
> To: Agnese, Marco; dune-devel at dune-project.org
> Subject: Re: [Dune-devel] getting the first element
>
> Hey Marco,
>
> By new iterators I meant
>
> for (auto&& element : elements(gv)) {}
>
> I was not sure that the thing you just suggested was still allowed. I will try
>
> Thanks.
>
> Aleksejs
>
>
> On 01.12.2015 17:58, Agnese, Marco wrote:
>> Something like this
>>
>> const auto firstEntity(*(gv.template begin<0>()));
>>
>> ??
>>
>> I don't understand what you mean with new iterators...
>> ________________________________________
>> From: dune-devel-bounces+m.agnese13=imperial.ac.uk at dune-project.org <dune-devel-bounces+m.agnese13=imperial.ac.uk at dune-project.org> on behalf of Aleksejs Fomins <aleksejs.fomins at lspr.ch>
>> Sent: 01 December 2015 16:43
>> To: dune-devel at dune-project.org
>> Subject: [Dune-devel] getting the first element
>>
>> Dear Dune,
>>
>> Another small question.
>>
>> I want to extract 1 element from the leafGridView. I don't care which one it is.
>> How do I do this with the new fancy iterators?
>>
>> Best,
>> Aleksejs
>>
>> _______________________________________________
>> Dune-devel mailing list
>> Dune-devel at dune-project.org
>> http://lists.dune-project.org/mailman/listinfo/dune-devel
>>
More information about the Dune-devel
mailing list