[dune-pdelab] [dune-pdelab-commit] dune-pdelab r1695 - trunk/dune/pdelab/common/typetree

Steffen Müthing steffen.muething at ipvs.uni-stuttgart.de
Mon Jan 9 14:01:20 CET 2012


Hi Christian,

Am 09.01.2012 um 12:16 schrieb Christian Engwer:

> Hi Steffen,
> 
>> Log:
>> [TypeTree] Fix ambiguous access to base member in FixedCapacityStack
>> 
>> Apparently, base member lookup does not take visibility
>> into account, causing an ambiguity in the lookup of
>> the back() method (and several others), even though
>> there is only a single accessible implementation.
>> 
>> Fixed by explicitly importing the correct implementations
>> into FixedCapacityStack.
>> 
>> Thanks to Christoph Grueninger for reporting this!
> 
> can you give me a quick heads up, what are the features of this
> fixedcapacitystack? As we just had the discussion on the dune
> list... what is the difference to
> std::stack<somesuitablecontainerclass>

I've seen the discussion. The FixedCapacityStack in the TypeTree implementation
is a rather specialized contraption and should not be seen as a general purpose
stack with prereserved storage. I wrote it for passing around the TreePath during
dynamic TypeTree traversal, and it contains optimizations to improve both compilation 
and runtime performance in this special case:

1) In order to help the compiler in the already rather complicated tree traversal instantiation,
   there is a class FixedCapacityStackView, which is a base class of FixedCapacityStack and
   eliminates the stack capacity template argument using type erasure. Only those views appear
   during tree traversal.

2) These stack views form the basis of the DynamicTreePath class. TreePath implementations
   need to have a cheap copy constructor due to the way the traversal algorithms work. The stack views
   are optimized for that by keeping all information in a reference to a PIMPL object, of which there is always
   only a single instance per underlying stack that is allocated by that stack using inheritance. That way, a view
   only contains a single pointer, and the DynamicTreePath does not incur any dynamic memory operations.

Finally, the stack itself can only be copy-constructed, not assigned. From the top of my head I'm not entirely
sure about the reasoning behind that, but I think it was necessary to avoid some nasty bugs related to the
views.

In summary: The FixedCapacityStack is some highly specialized component that exists mainly to improve
tree iteration performance.

Steffen
    
> 
> Ciao
> Christian
> 
> _______________________________________________
> dune-pdelab mailing list
> dune-pdelab at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune-pdelab

Steffen Müthing
Universität Stuttgart
Institut für Parallele und Verteilte Systeme
Universitätsstr. 38
70569 Stuttgart
Tel: +49 711 685 88429
Fax: +49 711 685 88340
Email: steffen.muething at ipvs.uni-stuttgart.de









More information about the dune-pdelab mailing list