dune-vtk 2.12
Loading...
Searching...
No Matches
rangetype.hh
Go to the documentation of this file.
1#pragma once
2
3#include <type_traits>
4
5
6namespace Dune {
7
8// forward declarations
9template <class T, int N>
10class FieldVector;
11
12template <class T, int N, int M>
13class FieldMatrix;
14
15} // end namespace Dune
16
17namespace Dune::Vtk {
18
20template <class F, class D>
22
23namespace Impl {
24
25 template <class T, int N>
26 constexpr auto dimRangeImpl (Dune::FieldVector<T,N>)
27 -> std::integral_constant<int, N> { return {}; }
28
29 template <class T, int N, int M>
30 constexpr auto dimRangeImpl (Dune::FieldMatrix<T,N,M>)
31 -> std::integral_constant<int, N*M> { return {}; }
32
33 constexpr auto dimRangeImpl (...)
34 -> std::integral_constant<int, 1> { return {}; }
35
36} // end namespace Impl
37
39template <class T>
40static constexpr int dimRange ()
41{
42 return decltype(Impl::dimRangeImpl(std::declval<T>()))::value;
43}
44
45} // end namespace Dune::Vtk
Definition writer.hh:16
static constexpr int dimRange()
Number of components the range contains.
Definition rangetype.hh:40