[dune-fem] Bug in jacobianAll

Martin Nolte nolte at mathematik.uni-freiburg.de
Wed Mar 4 22:38:48 CET 2015


Hi Marco,

Well, with the copyable entities, writing *entityIterator _and_ then storing a 
reference to its result is the only true source of segfaults I know of. In 
itself, both operations are ok, but they may not be combined.

So: Stick to the paradigm we successfully used over the last years: First 
defererence the entity iterator and store (a reference to) the entity. Then pass 
this entity around and you're basically safe. Just make sure the entity lives 
longer than any object (e.g., LocalFunction, LocalMatrix, etc.) associated to it.

A nice side effect of range-based for loops is that you are automatically safe 
as long as you don't propagate objects like LocalFunctions out of the loop 
(which I have never seen in dune-fem).

Should we put such information onto some FAQ list or into the release notes?

Best,

Martin

On 03/04/2015 07:25 PM, Agnese, Marco wrote:
> Ok I found the issue.
> In my code I was creating the local matrix calling
>
> op.localMatrix(*entityIterator,*entityIterator);
>
> With the copyable entities is not allowed any more. The solution is to do
>
> const Entity& entity(*entityIterator);
> op.localMatrix(entity,entity);
>
> 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