6#ifndef DUNE_TYPETREE_TREEPATH_HH
7#define DUNE_TYPETREE_TREEPATH_HH
14#include <dune/common/documentation.hh>
15#include <dune/common/typetraits.hh>
16#include <dune/common/indices.hh>
18#include <dune/common/typetree/treepath.hh>
28 constexpr bool isHybridSizeT()
30 if constexpr (std::is_same_v<T, std::size_t>)
34 if constexpr (
requires { T::value; })
35 return std::is_same_v<T, std::integral_constant<std::size_t, T::value>>;
42 constexpr auto castToHybridSizeT(T t)
44 if constexpr (Dune::IsIntegralConstant<T>::value)
46 using VT =
typename T::value_type;
48 std::is_convertible_v<VT,std::size_t> &&
49 std::is_integral_v<VT> &&
51 "HybridTreePath indices must be convertible to std::size_t or std::integral_constant<std::size_t,v>");
52 return std::integral_constant<std::size_t, T::value>{};
55 std::is_convertible_v<T,std::size_t> &&
56 std::is_integral_v<T>,
57 "HybridTreePath indices must be convertible to std::size_t or std::integral_constant<std::size_t,v>");
59 "HybridTreePath indices must be convertible to std::size_t or std::integral_constant<std::size_t,v>");
60 return std::size_t(t);
84 template<
typename... T>
100 template<
typename... T>
101 requires (((std::is_integral_v<T> or Dune::IsIntegralConstant<T>::value) && ...))
104 return HybridMultiIndex(t...);
120 template<
typename,std::
size_t>
126 template<
typename,std::
size_t>
144 template<
typename, std::size_t...>
156 template<
typename,
typename>
159 template<std::size_t... i>
160 [[deprecated(
"This function will be removed after Dune 2.11.")]]
164 template<std::size_t k, std::size_t... i>
165 [[deprecated(
"This function will be removed after Dune 2.11.")]]
182 template<
typename... T>
183 requires (((std::is_integral_v<T> or Dune::IsIntegralConstant<T>::value) && ...))
186 return HybridMultiIndex(t...);
190 template<
typename... T>
213 template<std::size_t i,
typename... T>
216 return tp[index_constant<i>{}];
237 template<std::size_t i,
typename... T>
238 [[deprecated(
"This function will be removed after Dune 2.11. Use operator[] instead.")]]
241 return tp[index_constant<i>{}];
244 template<std::size_t... i>
246 [[deprecated(
"This class will be removed after Dune 2.11. Use the size() member function instead.")]]
248 :
public index_constant<
sizeof...(i)>
252 template<std::size_t k, std::size_t... i>
254 [[deprecated(
"This class will be removed after Dune 2.11. Use the free push_back() function instead.")]]
260 template<std::size_t k, std::size_t... i>
262 [[deprecated(
"This class will be removed after Dune 2.11. Use the free push_front() function instead.")]]
268 template<std::
size_t k>
270 [[deprecated(
"This class will be removed after Dune 2.11. Use the back() member function instead.")]]
272 :
public index_constant<k>
275 template<std::size_t j, std::size_t k, std::size_t... l>
277 [[deprecated(
"This class will be removed after Dune 2.11. Use the back() member function instead.")]]
282 template<std::size_t k, std::size_t... i>
284 [[deprecated(
"This class will be removed after Dune 2.11. Use the front() member function instead.")]]
286 :
public index_constant<k>
289 template<std::size_t k, std::size_t... i>
291 [[deprecated(
"This class will be removed after Dune 2.11. Use the free pop_back() function instead.")]]
297 template<std::size_t j,
302 [[deprecated(
"This class will be removed after Dune 2.11. Use the free pop_back() function instead.")]]
307 template<std::size_t k, std::size_t... i>
309 [[deprecated(
"This class will be removed after Dune 2.11. Use the free pop_front() function instead.")]]
315 template<std::size_t... i, std::size_t... k>
317 [[deprecated(
"This class will be removed after Dune 2.11. Use the free join() function instead.")]]
323 template<std::size_t... i>
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 std::size_t treePathSize(const HybridTreePath< T... > &)
Returns the size (number of components) of the given HybridTreePath.
Definition treepath.hh:191
constexpr auto makeTreePath(const T... t)
helper function to construct a new HybridTreePath from the given indices.
Definition treepath.hh:184
constexpr auto hybridTreePath(const T &... t)
Constructs a new HybridTreePath from the given indices.
Definition treepath.hh:102
Dune::HybridMultiIndex< T... > HybridTreePath
A type for representing tree paths that supports both compile time and run time indices.
Definition treepath.hh:85
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
HybridTreePath< Dune::index_constant< i >... > StaticTreePath
Definition treepath.hh:324
void print_tree_path(std::ostream &os)
Definition treepath.hh:161
Definition accumulate_static.hh:17
Definition accumulate_static.hh:18
Definition treepath.hh:107
Type
Definition treepath.hh:108
@ fullyStatic
Definition treepath.hh:108
@ dynamic
Definition treepath.hh:108
Definition treepath.hh:115
Definition treepath.hh:121
Definition treepath.hh:127
Definition treepath.hh:133
Definition treepath.hh:139
Definition treepath.hh:145
Definition treepath.hh:151
Definition treepath.hh:157
HybridTreePath< index_constant< i >..., index_constant< k > > type
Definition treepath.hh:257
HybridTreePath< index_constant< k >, index_constant< i >... > type
Definition treepath.hh:265
HybridTreePath< index_constant< i >... > type
Definition treepath.hh:294
HybridTreePath< index_constant< i >... > type
Definition treepath.hh:312
HybridTreePath< index_constant< i >..., index_constant< k >... > type
Definition treepath.hh:320