[dune-fem] Bug in jacobianAll

Agnese, Marco m.agnese13 at imperial.ac.uk
Thu Mar 5 12:45:09 CET 2015


Hi Martin,

> 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.

I don't understand why. 
I mean dereferencing an iterator gives you an entity and simply you pass the reference to that entity to the method. 
Am I missing something? 

> 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.

Yes, I did 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).

I have to start to use the range-based loop!

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

I think that a note in the release notes would be useful and may save a lot of time since it is a tricky bug to spot.

Best,

Marco



More information about the dune-fem mailing list