dune-typetree 2.11
Loading...
Searching...
No Matches
TreePath
Collaboration diagram for TreePath:

Namespaces

namespace  Dune::TypeTree::TreePathType

Classes

class  Dune::TypeTree::FixedCapacityStackView< T >
class  Dune::TypeTree::FixedCapacityStack< T, capacity >
struct  Dune::TypeTree::TreePathSize< typename >
struct  Dune::TypeTree::TreePathPushBack< typename, size_t >
struct  Dune::TypeTree::TreePathPushFront< typename, size_t >
struct  Dune::TypeTree::TreePathBack< typename >
struct  Dune::TypeTree::TreePathFront< typename >
struct  Dune::TypeTree::TreePathPopBack< typename,... >
struct  Dune::TypeTree::TreePathPopFront< typename >
struct  Dune::TypeTree::TreePathConcat< typename, typename >
struct  Dune::TypeTree::TreePathSize< HybridTreePath< index_constant< i >... > >
struct  Dune::TypeTree::TreePathPushBack< HybridTreePath< index_constant< i >... >, k >
struct  Dune::TypeTree::TreePathPushFront< HybridTreePath< index_constant< i >... >, k >
struct  Dune::TypeTree::TreePathBack< HybridTreePath< index_constant< k > > >
struct  Dune::TypeTree::TreePathBack< HybridTreePath< index_constant< j >, index_constant< k >, index_constant< l >... > >
struct  Dune::TypeTree::TreePathFront< HybridTreePath< index_constant< k >, index_constant< i >... > >
struct  Dune::TypeTree::TreePathPopBack< HybridTreePath< index_constant< k > >, i... >
struct  Dune::TypeTree::TreePathPopBack< HybridTreePath< index_constant< j >, index_constant< k >, index_constant< l >... >, i... >
struct  Dune::TypeTree::TreePathPopFront< HybridTreePath< index_constant< k >, index_constant< i >... > >
struct  Dune::TypeTree::TreePathConcat< HybridTreePath< index_constant< i >... >, HybridTreePath< index_constant< k >... > >

Typedefs

template<typename... T>
using Dune::TypeTree::HybridTreePath = Dune::HybridMultiIndex<T...>
 A type for representing tree paths that supports both compile time and run time indices.
template<std::size_t... i>
using Dune::TypeTree::StaticTreePath = HybridTreePath<Dune::index_constant<i>...>

Functions

template<typename... T>
requires (((std::is_integral_v<T> or Dune::IsIntegralConstant<T>::value) && ...))
constexpr auto Dune::TypeTree::hybridTreePath (const T &... t)
 Constructs a new HybridTreePath from the given indices.
template<std::size_t... i>
void Dune::TypeTree::print_tree_path (std::ostream &os)
template<std::size_t k, std::size_t... i>
void Dune::TypeTree::print_tree_path (std::ostream &os)
template<typename... T>
requires (((std::is_integral_v<T> or Dune::IsIntegralConstant<T>::value) && ...))
constexpr auto Dune::TypeTree::makeTreePath (const T... t)
 helper function to construct a new HybridTreePath from the given indices.
template<typename... T>
constexpr std::size_t Dune::TypeTree::treePathSize (const HybridTreePath< T... > &)
 Returns the size (number of components) of the given HybridTreePath.
template<std::size_t i, typename... T>
constexpr auto Dune::TypeTree::treePathEntry (const HybridTreePath< T... > &tp, index_constant< i >={})
 Returns a copy of the i-th element of the HybridTreePath.
template<std::size_t i, typename... T>
constexpr std::size_t Dune::TypeTree::treePathIndex (const HybridTreePath< T... > &tp, index_constant< i >={})
 Returns the index value of the i-th element of the HybridTreePath.

Detailed Description

Typedef Documentation

◆ HybridTreePath

template<typename... T>
using Dune::TypeTree::HybridTreePath = Dune::HybridMultiIndex<T...>

A type for representing tree paths that supports both compile time and run time indices.

A HybridTreePath supports storing a combination of run time and compile time indices. This makes it possible to store the tree path to a tree node inside the tree node itself, even if the path contains one or more PowerNodes, where each child must have exactly the same type. At the same time, as much information as possible is kept accessible at compile time, allowing for more efficient algorithms.

Note
Internally all indices are stored as std::size_t or std::integral_constant<std::size_t,v>. The latter is the same as Dune::index_constant<v>. If indices of other integral or std::integral_constant types are passed as arguments, they are converted.

◆ StaticTreePath

template<std::size_t... i>
using Dune::TypeTree::StaticTreePath = HybridTreePath<Dune::index_constant<i>...>

Function Documentation

◆ hybridTreePath()

template<typename... T>
requires (((std::is_integral_v<T> or Dune::IsIntegralConstant<T>::value) && ...))
auto Dune::TypeTree::hybridTreePath ( const T &... t)
nodiscardconstexpr

Constructs a new HybridTreePath from the given indices.

This function returns a new HybridTreePath with the given index values. It exists mainly to avoid having to manually specify the exact type of the new object.

Note
Internally all indices are stored as std::size_t or std::integral_constant<std::size_t,v>. The latter is the same as Dune::index_constant<v>. If indices of other integral or std::integral_constant types are passed as arguments, they are converted.
This is an alias for TreePath and HybridMultiIndex

◆ makeTreePath()

template<typename... T>
requires (((std::is_integral_v<T> or Dune::IsIntegralConstant<T>::value) && ...))
auto Dune::TypeTree::makeTreePath ( const T... t)
nodiscardconstexpr

helper function to construct a new HybridTreePath from the given indices.

This function returns a new HybridTreePath with the given index values.

Note
Internally all indices are stored as std::size_t or std::integral_constant<std::size_t,v>. The latter is the same as Dune::index_constant<v>. If indices of other integral or std::integral_constant types are passed as arguments, they are converted.

◆ print_tree_path() [1/2]

template<std::size_t k, std::size_t... i>
void Dune::TypeTree::print_tree_path ( std::ostream & os)

◆ print_tree_path() [2/2]

template<std::size_t... i>
void Dune::TypeTree::print_tree_path ( std::ostream & os)

◆ treePathEntry()

template<std::size_t i, typename... T>
auto Dune::TypeTree::treePathEntry ( const HybridTreePath< T... > & tp,
index_constant< i > = {} )
nodiscardconstexpr

Returns a copy of the i-th element of the HybridTreePath.

As HybridTreePath instances should not be mutated after their creation, this function returns a copy of the value. As values are either std::integral_constant or std::size_t, that's just as cheap as returning a reference.

The index for the entry can be passed either as a template parameter or as an index_constant:

auto tp = hybridTreePath(1,2,3,4);
using namespace Dune::Indices;
// the following two lines are equivalent
std::cout << treePathEntry<2>(tp) << std::endl;
std::cout << treePathEntry(tp,_2) << std::endl;
constexpr auto treePathEntry(const HybridTreePath< T... > &tp, index_constant< i >={})
Returns a copy of the i-th element of the HybridTreePath.
Definition treepath.hh:214
constexpr auto hybridTreePath(const T &... t)
Constructs a new HybridTreePath from the given indices.
Definition treepath.hh:102

◆ treePathIndex()

template<std::size_t i, typename... T>
std::size_t Dune::TypeTree::treePathIndex ( const HybridTreePath< T... > & tp,
index_constant< i > = {} )
nodiscardconstexpr

Returns the index value of the i-th element of the HybridTreePath.

This function always returns the actual index value, irrespective of whether the entry is a compile time index or a run time index.

Deprecated
The functions is deprecated. Use operator[] instead.

The index for the entry can be passed either as a template parameter or as an index_constant:

auto tp = hybridTreePath(1,2,3,4);
using namespace Dune::Indices;
// the following two lines are equivalent
std::cout << treePathIndex<2>(tp) << std::endl;
std::cout << treePathIndex(tp,_2) << std::endl;
constexpr std::size_t treePathIndex(const HybridTreePath< T... > &tp, index_constant< i >={})
Returns the index value of the i-th element of the HybridTreePath.
Definition treepath.hh:239

◆ treePathSize()

template<typename... T>
std::size_t Dune::TypeTree::treePathSize ( const HybridTreePath< T... > & )
nodiscardconstexpr

Returns the size (number of components) of the given HybridTreePath.