[Dune] getting entityPointer from array index

Carsten Gräser graeser at math.fu-berlin.de
Thu Jan 20 21:48:01 CET 2011


Hi,

Am 20.01.2011 18:40, schrieb arya fallahi:
> 
> Dear Dune developer team,
> 
> Is it possible to get the Entity Pointer of an element from its array index? Is there any special function implemented in dune to do that?
> 
> Best regards,
> Arya

no, this is not directly possible using the grid interface. In most cases
you can restructure your code to use iterators and access your data using
indices instead.

If you absolutly need random access you can store EntitySeeds
(development branch and future dune versions ≥ 2.1) in a
container and use them to create EntityPointers if you need access to the
corresponding Entity. EntitySeeds are intended to use as less memory as
possible while allowing quick access to Entities. Notice, that some grids
use the default implementations of EntitySeed which internally is an
EntityPointer (see below).

In dune versions before 2.1 you can store EntityPointers instead and
compactify them to reduce their memory usage. However they might still need
a lot of memory.

Best,
Carsten

PS:
Since this was already asked several times I added it to the faq.





More information about the Dune mailing list