dune-typetree issueshttps://gitlab.dune-project.org/staging/dune-typetree/-/issues2024-02-10T16:21:28Zhttps://gitlab.dune-project.org/staging/dune-typetree/-/issues/14Use C++17 fold expression in accumulate_static.hh2024-02-10T16:21:28ZChristoph GrüningerUse C++17 fold expression in accumulate_static.hhIn `accumulate_static.hh` is a comment
> (we do not use c++17 fold expressions because gcc-7 fails to
> deduce the lambdas types here).
GCC 9 is the oldest version of GCC we still support. We should be able to make this piece of code m...In `accumulate_static.hh` is a comment
> (we do not use c++17 fold expressions because gcc-7 fails to
> deduce the lambdas types here).
GCC 9 is the oldest version of GCC we still support. We should be able to make this piece of code more readable by using C++17 fold expressions.https://gitlab.dune-project.org/staging/dune-typetree/-/issues/10Get rid of TreePath2024-02-22T18:01:54ZCarsten Gräsergraeser@math.fau.deGet rid of TreePathThere still exists the `TreePath` template for encoding a fully static path. Conceptually this was superseded by `HybridTreePath` since `HybridTreePath<index_constant<i>...>` can serve the same purpose as `TreePath<i...>`. Hence I think ...There still exists the `TreePath` template for encoding a fully static path. Conceptually this was superseded by `HybridTreePath` since `HybridTreePath<index_constant<i>...>` can serve the same purpose as `TreePath<i...>`. Hence I think it's a good idea to get rid of `TreePath`. Also `TreePath` itself is no longer used in dune-typetree. But there's two main obstacles:
* You cannot use `HybridTreePath<index_constant<i>...>` because a lot of the utility functions for `TreePath` are not implemented for `HybridTreePath`. This is mostly because the intended use is different: `HybridTreePath` is intended to by used as value, while those utilities act on types only.
* Dune-pdelab still uses `TreePath` in many places.
In principle I solved both locally:
* Implement (in dune-typetree) the missing utilities to make `HybridTreePath<index_constant<i>...>` a drop in replacement for `TreePath<i...>`.
* Replace (in dune-pdelab) all uses of `TreePath` by the corresponding `HybridTreePath`
Is there interest (from pdelab) in this change? In the long run I think that many of the above mentioned utilities can/should be dropped if pdelab switches to a more value based handling of treepaths.https://gitlab.dune-project.org/staging/dune-typetree/-/issues/9Move dune-typetree to dune-common2021-01-12T08:51:16ZCarsten Gräsergraeser@math.fau.deMove dune-typetree to dune-commonThis was decided on the 2020 dev meeting:https://dune-project.org/community/meetings/2020-02-devmeeting/.
This issue if for managing the transition.This was decided on the 2020 dev meeting:https://dune-project.org/community/meetings/2020-02-devmeeting/.
This issue if for managing the transition.https://gitlab.dune-project.org/staging/dune-typetree/-/issues/4forEachNode interface for tree-traversal with flexibla treePathType2024-02-04T16:42:30ZSimon PraetoriusforEachNode interface for tree-traversal with flexibla treePathTypeIn Merge-Request !2 a nice interface for tree-traversal is proposed. This fixes the treepath and traversal type to `dynamic`.
Is it somehow possible to extend the interface, so that one can choose the traversal type, i.e. `DynamicTraver...In Merge-Request !2 a nice interface for tree-traversal is proposed. This fixes the treepath and traversal type to `dynamic`.
Is it somehow possible to extend the interface, so that one can choose the traversal type, i.e. `DynamicTraversal` or `StaticTraversal` (or maybe `HybridTraversal`, see #3). Maybe something like
```c++
template <class Tree, class PreFunc, class LeafFunc, class PostFunc,
class Traversal = DynamicTraversal, TreePathType::Type treePathType = Traversal::treePathType>
void forEachNode(Tree&& tree, PreFunc&& preFunc, LeafFunc&& leafFunc, PostFunc&& postFunc,
Traversal = {})
{
ApplyToTree(tree, Impl::callbackVisitor(preFunc, leafFunc, postFunc, treePathType{}));
}
```
This includes the check, that the last element provides a static `treePathType` member. The class CallbackVisitor may be parametrized with the `treePathType`, i.e.
```c++
template <class PreFunc, class LeafFunc, class PostFunc, TreePathType::Type tpt>
class CallbackVisitor
: public TreeVisitor
{
public:
TreePathType::Type treePathType = tpt;
/*...*/
};
```
What about the specialization for inner + leaf or only leaf? Either, the SFINAE check as above for the last argument works, or one could make the `treePathType` container argument more explicit, i.e.
```c++
namespace TreePathType {
enum Type { fullyStatic, mostlyStatic, dynamic };
}
template <TreePathType::Type tpt>
struct TreePathType_t { using treePathType = tpt; };
using StaticTraversal = TreePathType<TreePathType::fullyStatic>;
using DynamicTraversal = TreePathType<TreePathType::dynamic>;
using HybridTraversal = TreePathType<TreePathType::mostlyStatic>;
```
and then using a more concrete function parameter for `forEachNode` without SFINAE:
```c++
template <class Tree, class NodeFunc, TreePathType::Type tpt = TreePathType::dynamic>
void forEachNode(Tree&& tree, NodeFunc&& nodeFunc, TreePathType<tpt> = {})
{ ... }
```