AMDiS 2.10
The Adaptive Multi-Dimensional Simulation Toolbox
ProblemStatTraits.hpp
1#pragma once
2
3#include <dune/functions/functionspacebases/basistags.hh>
4#include <dune/functions/functionspacebases/compositebasis.hh>
5#include <dune/functions/functionspacebases/lagrangebasis.hh>
6#include <dune/functions/functionspacebases/powerbasis.hh>
7#include <dune/grid/yaspgrid.hh>
8
9#include <amdis/AdaptiveGrid.hpp>
10#include <amdis/common/Logical.hpp>
11#include <amdis/common/TypeTraits.hpp>
12#include <amdis/functions/GlobalBasis.hpp>
13
14namespace AMDiS
15{
16 namespace Impl
17 {
18 template <bool same, int... degs>
19 struct LagrangePreBasisCreatorImpl;
20
21 // specialization for single node basis
22 template <int deg>
23 struct LagrangePreBasisCreatorImpl<true, deg>
24 {
25 static auto create()
26 {
27 using namespace Dune::Functions::BasisFactory;
28 return lagrange<deg>();
29 }
30 };
31
32 // specialization for composite basis
33 template <int... degs>
34 struct LagrangePreBasisCreatorImpl<false, degs...>
35 {
36 static auto create()
37 {
38 using namespace Dune::Functions::BasisFactory;
39 return composite(lagrange<degs>()..., flatLexicographic());
40 }
41 };
42
43 // specialization for power basis
44 template <int deg, int... degs>
45 struct LagrangePreBasisCreatorImpl<true, deg, degs...>
46 {
47 static auto create()
48 {
49 using namespace Dune::Functions::BasisFactory;
50 return power<1+sizeof...(degs)>(lagrange<deg>(), flatLexicographic());
51 }
52 };
53
54 // factory to construct a global basis of several lagrange bases, with flat indexing.
55 template <int deg, int... degs>
56 struct LagrangePreBasisCreator
57 : public LagrangePreBasisCreatorImpl<((deg == degs) &&...), deg, degs...>
58 {};
59
60
61 template <int dow, int k = 1>
62 struct TaylorHoodPreBasisCreator
63 {
64 static auto create()
65 {
66 using namespace Dune::Functions::BasisFactory;
67 return composite(power<dow>(lagrange<k+1>(), flatInterleaved()), lagrange<k>(), flatLexicographic());
68 }
69 };
70
71 } // end namespace Impl
72
73
75 template <class GB, class T = double, class Traits = BackendTraits>
77 {
78 using GlobalBasis = GB;
79 using CoefficientType = T;
80 using Backend = Traits;
81 };
82
84 template <class HostGrid, class PreBasisCreator, class T = double, class Traits = BackendTraits>
86 {
87 using Grid = AdaptiveGrid_t<HostGrid>;
88 using GridView = typename Grid::LeafGridView;
89
90 static auto create(std::string const& name, GridView const& gridView)
91 {
92 return AMDiS::GlobalBasis{name, gridView, PreBasisCreator::create()};
93 }
94
95 static auto create(GridView const& gridView)
96 {
97 return AMDiS::GlobalBasis{gridView, PreBasisCreator::create()};
98 }
99
100 using GlobalBasis = decltype(create(std::declval<GridView>()));
101 using CoefficientType = T;
102 using Backend = Traits;
103 };
104
105
108 template <class Grid, int... degrees>
110 : public DefaultBasisCreator<Grid, Impl::LagrangePreBasisCreator<degrees...>>
111 {};
112
115 template <int dim, int... degrees>
117 : public LagrangeBasis<Dune::YaspGrid<dim>, degrees...>
118 {};
119
122 template <class Grid, int k = 1>
124 : public DefaultBasisCreator<Grid, Impl::TaylorHoodPreBasisCreator<Grid::dimensionworld,k>>
125 {};
126
127} // end namespace AMDiS
Global basis defined on a pre-basis.
Definition: GlobalBasis.hpp:48
Generator for a basis and default problem traits.
Definition: ProblemStatTraits.hpp:86
Wrapper around a global basis providing default traits.
Definition: ProblemStatTraits.hpp:77
ProblemStatTraits for a (composite) basis composed of lagrange bases of different degree.
Definition: ProblemStatTraits.hpp:111
ProblemStatTraits of Taylor-Hood basis of lagrange-type with pressure degree k.
Definition: ProblemStatTraits.hpp:125
Specialization of LagrangeBasis for Grid type Dune::YaspGrid for a given dimension.
Definition: ProblemStatTraits.hpp:118