ProblemStatTraits.hpp 1.79 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#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
    {
      using type = Dune::Functions::PQkNodalBasis<typename Mesh::LeafGridView, deg>;
    };
    
    template <class Mesh>
    struct DefaultFeSpaceFactory<Mesh, 1>
    {
      using type = Dune::Functions::PQ1NodalBasis<typename Mesh::LeafGridView>;
    };
    
    template <class Mesh, int deg>
    using DefaultFeSpaceFactory_t = typename DefaultFeSpaceFactory<Mesh, deg>::type;
  }
  
  /// The default traits, that can be used with variable mesh-type.
  /** The traits class specifies dim, dow and the polynomial degrees of 
    * Lagrange basis functions. Together with a Grid type the necessary parameters
    * for the \ref ProblemStat class are set.
    **/
  template <class MeshType, int _dim, int _dow = _dim, int... _degrees>
  struct DefaultTraitsMesh
  {
    static constexpr int dim = _dim;
    static constexpr int dimworld = _dow;
    static constexpr int nComponents = sizeof...(_degrees);
    
    static_assert( nComponents > 0, "Number of components > 0 required!" );
    
    using Mesh = MeshType;
    using FeSpaces = std::tuple<Impl::DefaultFeSpaceFactory_t<Mesh, _degrees>...>;
  };
  
  
  /// Specialization of \ref DefaultTraitsMesh for Grid type \ref Dune::YaspGrid.
  template <int _dim, int _dow = _dim, int... _degrees>
  using DefaultTraits = 
    DefaultTraitsMesh< Dune::YaspGrid<_dim>, _dim, _dow, _degrees...>;
  
    
  // DEPRECATED!
  template <int _dim, int _dimworld = _dim, int _degree0 = 1, int... _degrees>
  using ProblemStatTraits =
    DefaultTraits< _dim, _dimworld, _degree0, _degrees...>;
  
} // end namespace AMDiS