Commit eb5be127 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

moved sizeImpl into local static member function

parent 80c0ff52
......@@ -16,24 +16,6 @@ namespace Dune
template <class T, int N, int M>
class FieldMatrix;
namespace Impl
{
template <class T, class = void>
struct SizeImpl
: std::integral_constant<int, 1> {};
template <class T, int N>
struct SizeImpl<FieldVector<T,N>>
: std::integral_constant<int, N> {};
template <class T, int N, int M>
struct SizeImpl<FieldMatrix<T,N,M>>
: std::integral_constant<int, N*M> {};
}
template <class T>
constexpr int sizeOf () { return Impl::SizeImpl<std::decay_t<T>>::value; }
/// Wrapper class for functions allowing local evaluations.
template <class GridView>
......@@ -47,6 +29,22 @@ namespace Dune
template <class F>
using Range = std::decay_t<decltype(std::declval<F>()(std::declval<Domain>()))>;
private:
template <class T, int N>
static auto sizeOfImpl (FieldVector<T,N> const&)
-> std::integral_constant<int, N> { return {}; }
template <class T, int N, int M>
static auto sizeOfImpl (FieldMatrix<T,N,M> const&)
-> std::integral_constant<int, N*M> { return {}; };
static auto sizeOfImpl (...)
-> std::integral_constant<int, 1> { return {}; }
template <class T>
static constexpr int sizeOf () { return decltype(sizeOfImpl(std::declval<T>()))::value; }
public:
/// Constructor VtkFunction from legacy VTKFunction
/**
......
......@@ -13,7 +13,10 @@
#include <dune/common/filledarray.hh>
#include <dune/common/test/testsuite.hh>
#if HAVE_UG
#include <dune/grid/uggrid.hh>
#endif
#include <dune/grid/yaspgrid.hh>
#include <dune/grid/utility/structuredgridfactory.hh>
......
......@@ -14,7 +14,10 @@
#include <dune/common/std/type_traits.hh>
#include <dune/common/test/testsuite.hh>
#if HAVE_UG
#include <dune/grid/uggrid.hh>
#endif
#include <dune/grid/yaspgrid.hh>
#include <dune/grid/utility/structuredgridfactory.hh>
......
......@@ -7,13 +7,17 @@
#include <cstring>
#include <iostream>
#include <set>
#include <vector>
#include <dune/common/parallel/mpihelper.hh> // An initializer of MPI
#include <dune/common/filledarray.hh>
#include <dune/common/test/testsuite.hh>
#if HAVE_UG
#include <dune/grid/uggrid.hh>
#endif
#include <dune/grid/yaspgrid.hh>
#include <dune/grid/utility/structuredgridfactory.hh>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment