Skip to content

#1104 Remove EntityPointer in favour of improved Entity objects.

Metadata

Property Value
Reported by Robert K (robertk@posteo.org)
Reported at May 14, 2012 13:26
Type Feature Request
Version Git (pre2.4) [autotools]
Operating System Unspecified / All
Last edited by Christoph Grüninger (gruenich@iws.uni-stuttgart.de)
Last edited at Dec 9, 2013 13:40

Description

Problem description:

There are a number of problems with the EntityPointer class.

  • It does not behave like a pointer and in fact it can not do so, because Entities can be on-the-fly objects.

  • Dereferencing an EntityPointer returns a reference, therefore the EntityPointer basically has to contain the Entity so that two concepts are rolled into one.

  • Storing Entities through the EntityPointer is not really feasible because EntityPointers contain the Entity. To allow light weight storage the concept of an EntitySeed is available. For many grids this need not contain more than a pointer or a few indices. The grid then provides methods to convert an EntitySeed to an Entity.

  • Having fewer classes to code reduces the work for implementing a new grid.

  • Avoid problems with the following line of code (already happened many times):

    const Entity & outside = *(intersection.outside());
    // here the corresponding entity pointer already went out of scope
    outside.geometry()

    The compiler cannot warn about this, but this will fail or give wrong results, depending on the grid implementation.

  • There should be some performance gain for example with MetaGrids since they do not have to store their own EntityPointer the HostEntityPointer...

Proposal:

Removal of EntityPointer: The transition should be not to difficult since the typedef for EntityPointer will point to Entity and on the Entity class we introduce the method

const Entity* operator -> () const { return this; }

Iterators will return entity objects. A example implementation is attached.

After this the interface will be much better to understand and better to use. In fact, all methods returning a reference to an object should be revised.

Storage of entities: For "storage" of Entities in array-like structures we use the concept EntitySeed.

Attachments