[Dune] How to store entities?

Steffen Müthing steffen.muething at iwr.uni-heidelberg.de
Tue Dec 9 15:18:05 CET 2014


Hi Bernd,

Am 09.12.2014 um 15:07 schrieb Carsten Gräser <graeser at mi.fu-Berlin.de>:

> Since I already typed my (slightly longer) answer:
> 
> Am 09.12.2014 um 14:59 schrieb Robert Kloefkorn:
>> Hello Bernd,
>> 
>>> for some of our models, we store for each vertex all elements that
>>> share this vertex. We currently use a
>>> std::vector<EntityPointer> for this. I have a couple of questions
>>> concerning this:
>> 
>>> 1. Is this currently a good choice or are there better choices?
>> No (never has been) and Yes.
>> 
>>> 2. When would it be safe to store (smart) pointers to
>>> Entities/EntityPointers/EntitySeeds?
>> Just don't.
> With the new copyable entities the answer for all
> three is, that they are valid as long as the grid is
> not modified. Before, the Entity was only valid, as
> long as the EnitityPointer/Iterator containing it
> was not changed.
> 
>>> 3. What should I use in the future when EntityPointer is gone?
>> EntitySeed.
> Storing EntitySeed will always be the better choice, because
> this is the reason why it exists. If, for a certain grid
> manager, the EntityPointer would be the most efficient choice,
> then it would implement the EntitySeed using the EntityPointer.
> 
> The main point is that EntitySeed is exactly defined to be memory
> efficient and will often be just a pointer or index internally,
> where as EntityPointer may store a pointer to the grid, some
> cached data (geometry), ... in order to provide efficient access
> to Entity informaton.

Just to add my 2c: Back in October / November, I proposed a patch set that
changes all places in the grid interface which currently return an EntityPointer
to instead return an Entity, along with a bit of (directly deprecated) conversion
tricks that avoid breaking user code which still expects to be passed an EntityPointer.
With that patch, you can entirely get rid of EntityPointer.

As far as I understand, the general consensus among the developers was that this
change was a little to intrusive for 2.4 at this point. I don’t know what exactly is planned
for 2.4 right now, but I think that you’ll have to keep working with EntityPointers (created
from EntitySeeds of course) until 3.0. Then you’ll have to switch to Entities. Unfortunately,
there won’t be a deprecation period (but there is probably quite a lot of stuff that will break
in that release anyway).

Best,
Steffen

> 
> Best,
> Carsten
> 
> 
> _______________________________________________
> 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/20141209/f846fab4/attachment.sig>


More information about the Dune mailing list