[dune-functions] Calling tree() in unbound state?

Carsten Gräser graeser at mi.fu-berlin.de
Thu Sep 17 00:23:34 CEST 2015


Hi,
as we decided a local view is only usable if it's bound to an
entity. Especially accessing the tree will lead to undefined
behaviour since the size, local finite element, ... are not
initialized.

For the DiscreteGlobalBasisFunction I'd like to attach some data
to the tree nodes in the LocalFunction. This is possible by a map-like
container providing

   NodeData<Node>& operator[](const Node&)

Since the container data can only be interpreted if the node types
are known (we need to cast to NodeData<Node>, we need to traverse the
tree when copying or destroying the container.

As a consequence we must either require that the LocalFunction
containing the container is in bound state on copy or destruction,
or we must bind it internally to a dummy, e.g. gridView().begin<0>().
I really dislike both variants.

However, there's a possible solution. Since the tree structure
and node types are static, we could allow to access and traverse
the tree and its methods depending only on the structure, i.e.
treePath() and treeIndex(), even in unbound state. Only calling
element depended methods like localFiniteElement(), size(), offset(),
localIndex() would be undefined.

This would allow to explore the tree structure in unbound state
in order to, e.g., pre-allocate caches.

What's your opinion on this?

Best,
Carsten

BTW:
With the current implementation you can already do this.
The only exception is the treeIndex() method. But this
is a details that can easily be fixed.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <https://lists.dune-project.org/pipermail/dune-functions/attachments/20150917/978a5c87/attachment.sig>


More information about the dune-functions mailing list