[Dune] Storing entity iterators

Steffen Müthing steffen.muething at iwr.uni-heidelberg.de
Thu Mar 12 09:46:55 CET 2015


> Am 12.03.2015 um 08:23 schrieb Andreas Dedner <a.s.dedner at warwick.ac.uk>:
> 
> Hi Marco.
> To answer that question please look into the implementation of GeometryGrid. Basically
> the question is whether the GeoGridEntity. But I think it more likely to be the new position and
> I would even say that if you get the old position then that is a bug since a change in the implementation
> could also easily change that behaviour (e.g. whether the geometry is build when geometry() is called
> or if it is build when the Entity is constructed....)
> Andreas

I recently had a look at that code while I was porting GeometryGrid to copyable entities. The way it works
is that the coordinates are evaluated and cached the first time you access the geometry of an entity object.
As a consequence, the entity will always give you the same geometry and not notice if you change the
coordinates after the first call to entity.geometry().

If your program needs to update the coordinate information, you’re probably better off storing EntitySeeds and
rebuilding the entities from that because that approach always gives you a fresh entity that will re-evaluate the
coordinate transformation of GeometryGrid. Of course, you DO re-evaluate the coordinate transformation, which
might be expensive, but that’s something to benchmark later on…

Steffen

> 
> 
> On 11/03/15 18:04, Agnese, Marco wrote: que
>> Hi Steffen, hi Christian Engwer and hi Oliver,
>> thank you for your answers. I wasn't aware that entity iterators were expensive.
>> Therefore storing a copy of the entities (or the entity seed) is the correct solution.
>> Good news since that was the solution I had implemented :)
>> 
>> Another very quick question.
>> 
>> Let's suppose that I have a GeometryGrid and I store a copy of an entity.
>> After that, I move the vertices of my grid (therefore I change the values of the discrete function defined on the host grid which defines my wrapped grid).
>> The entity copy extracted before is consistent with the updated GeometryGrid or is consistent with the old one?
>> More precisely, if I extract a vertex of the entity copy, the global coordinate will have the same value of the old grid or of the new grid?
>> Does it change the behaviour, if I store the entity seed instead of the entity copy?
>> 
>> Thank you very much,
>> cheers,
>> Marco.
>> 
>> _______________________________________________
>> 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20150312/938c41a0/attachment.sig>


More information about the Dune mailing list