AMDiS 2.10
The Adaptive Multi-Dimensional Simulation Toolbox
MultiIndex.hpp
1#pragma once
2
3#include <dune/common/reservedvector.hh>
4#include <dune/common/version.hh>
5#include <dune/functions/common/multiindex.hh>
6
7namespace AMDiS
8{
9 namespace Traits
10 {
11 template <class T>
13 : std::is_integral<T> {};
14
15 template <class I>
16 struct IsFlatIndex<Dune::Functions::StaticMultiIndex<I,1> >
17 : std::true_type {};
18
19 template <class I>
20 struct IsFlatIndex<std::array<I,1> >
21 : std::true_type {};
22
23 template <class I>
24 struct IsFlatIndex<Dune::ReservedVector<I,1> >
25 : std::true_type {};
26 }
27
28 inline std::size_t flatMultiIndex(std::size_t idx)
29 {
30 return idx;
31 }
32
33 inline std::size_t flatMultiIndex(Dune::Functions::StaticMultiIndex<std::size_t,1> const& idx)
34 {
35 return idx[0];
36 }
37
38 inline std::size_t flatMultiIndex(Dune::ReservedVector<std::size_t,1> const& idx)
39 {
40 return idx[0];
41 }
42
43 inline std::size_t flatMultiIndex(std::array<std::size_t,1> const& idx)
44 {
45 return idx[0];
46 }
47
48} // end namespace AMDiS
Definition: MultiIndex.hpp:13