[dune-fem] Bug in jacobianAll
Martin Nolte
nolte at mathematik.uni-freiburg.de
Mon Mar 9 13:44:12 CET 2015
Hi Marco,
until all grids are converted, the second variant should actually be the faster
one. The first one is, of course, more beautiful.
Grid implementations not adapted to the recent changes will return a "const
Entity &" on dereferencing an iterator. So, if you catch the reference, no extra
copy needs to be made.
If the grid implementation is already adapted to the interface change, it will
return an "Entity" on dereferencing an iterator and it has to be copied anyway.
In this case, there is no difference between the two versions, because "const
auto &" will also bind to the copy.
Best,
Martin
On 03/09/2015 12:09 PM, Agnese, Marco wrote:
> Hi Martin,
> thank you very much for the detailed explanation.
> I was aware of the copyable entities/intersections change but I hadn't thought about the implications.
>
> Now I am using in my code the range based for which seems a more concise and elegant way to solve this issue.
>
> One final question, performance wise, is better to use
>
> for(const auto entity: space)
>
> or
>
> for(const auto& entity:space) ?
>
> You said that might be some difference for some grid overloading the copy constructor, therefore I assume that the first should be preferred.Am I right?
>
> Thank you very much,
> cheers,
> Marco.
>
> _______________________________________________
> dune-fem mailing list
> dune-fem at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune-fem
>
--
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-fem
mailing list