ProblemStatTraits.hpp 1.89 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#pragma once

#include <tuple>

#include <dune/amdis/Mesh.hpp>
#include <dune/amdis/utility/GetDegree.hpp>

namespace AMDiS
{
  namespace Impl
  {
    // by default use Lagrange basis
    template <class Mesh, int deg>
    struct DefaultFeSpaceFactory
    {
16
      using GV = typename Mesh::LeafGridView;
17
18
      using ST = typename GV::IndexSet::IndexType;

19
      using type = Dune::Functions::PQkNodalBasis<GV, deg>;
20
    };
21

22
23
24
    template <class Mesh>
    struct DefaultFeSpaceFactory<Mesh, 1>
    {
25
      using GV = typename Mesh::LeafGridView;
26
      using ST = typename GV::IndexSet::IndexType;
27
      using type = Dune::Functions::PQ1NodalBasis<GV>;
28
    };
29

30
31
32
    template <class Mesh, int deg>
    using DefaultFeSpaceFactory_t = typename DefaultFeSpaceFactory<Mesh, deg>::type;
  }
33

34
  /// The default traits, that can be used with variable mesh-type.
35
  /** The traits class specifies dim, dow and the polynomial degrees of
36
37
38
    * Lagrange basis functions. Together with a Grid type the necessary parameters
    * for the \ref ProblemStat class are set.
    **/
39
  template <class MeshType, int... _degrees>
40
41
  struct DefaultTraitsMesh
  {
42
43
    static constexpr int dim = MeshType::dimension;
    static constexpr int dimworld = MeshType::dimensionworld;
44
    static constexpr int nComponents = sizeof...(_degrees);
45

46
    static_assert( nComponents > 0, "Number of components > 0 required!" );
47

48
49
50
    using Mesh = MeshType;
    using FeSpaces = std::tuple<Impl::DefaultFeSpaceFactory_t<Mesh, _degrees>...>;
  };
51
52


53
54
  /// Specialization of \ref DefaultTraitsMesh for Grid type \ref Dune::YaspGrid.
  template <int _dim, int _dow = _dim, int... _degrees>
55
56
57
58
  using DefaultTraits =
    DefaultTraitsMesh< Dune::YaspGrid<_dim>, _degrees...>;


59
60
61
62
  // DEPRECATED!
  template <int _dim, int _dimworld = _dim, int _degree0 = 1, int... _degrees>
  using ProblemStatTraits =
    DefaultTraits< _dim, _dimworld, _degree0, _degrees...>;
63

64
} // end namespace AMDiS