DUNE PDELab (git)

hierarchicallagrangebasis.hh
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3#ifndef DUNE_FUNCTIONS_FUNCTIONSPACEBASES_HIERARCHICALLAGRANGEBASIS_HH
4#define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_HIERARCHICALLAGRANGEBASIS_HH
5
6#include <type_traits>
7
9
10#include <dune/localfunctions/hierarchical/hierarchicalp2.hh>
11
12#include <dune/functions/functionspacebases/nodes.hh>
13#include <dune/functions/functionspacebases/defaultglobalbasis.hh>
14#include <dune/functions/functionspacebases/lfeprebasismixin.hh>
15
16#include <dune/geometry/type.hh>
17
18namespace Dune {
19 namespace Functions {
20
21 // *****************************************************************************
22 // Implementation for Hierarchical Lagrange Basis
23 //
24 // - only orders k=1,2 are implemented up to now
25 // - order k=1 is identical to the standard Lagrange basis
26 // - implementation is restricted to simplex grids
27 //
28 // *****************************************************************************
29
39 template<typename GV, int k, typename R = double>
41
42 template<typename GV, typename R>
44 : public LFEPreBasisMixin<GV, LagrangeSimplexLocalFiniteElement<typename GV::ctype,R,GV::dimension,1>>
45 {
47 public:
48 HierarchicalLagrangePreBasis (const GV& gridView) :
49 Base(gridView, [](GeometryType gt, int) -> std::size_t { return gt.isVertex() ? 1 : 0; })
50 {
51 for (auto gt : gridView.indexSet().types(0)) {
52 if (!gt.isSimplex())
54 "Hierarchical Lagrange basis only implemented for simplex grids.");
55 }
56 }
57 };
58
59 template<typename GV, typename R>
60 class HierarchicalLagrangePreBasis<GV,2,R>
61 : public LFEPreBasisMixin<GV, HierarchicalP2LocalFiniteElement<typename GV::ctype,R,GV::dimension>>
62 {
63 using Base = LFEPreBasisMixin<GV, HierarchicalP2LocalFiniteElement<typename GV::ctype,R,GV::dimension>>;
64 public:
65 HierarchicalLagrangePreBasis (const GV& gridView) :
66 Base(gridView, [](GeometryType gt, int) -> std::size_t { return (gt.isVertex() || gt.isLine()) ? 1 : 0; })
67 {
68 for (auto gt : gridView.indexSet().types(0)) {
69 if (!gt.isSimplex())
71 "Hierarchical Lagrange basis only implemented for simplex grids.");
72 }
73 }
74 };
75
76
77 namespace BasisFactory {
78
87 template<int k, typename R=double>
89 {
90 static_assert(0 < k && k <= 2);
91 return [](const auto& gridView) {
92 return HierarchicalLagrangePreBasis<std::decay_t<decltype(gridView)>, k, R>(gridView);
93 };
94 }
95
96 } // end namespace BasisFactory
97
108 template<typename GV, int k, typename R=double>
110
111 } // end namespace Functions
112} // end namespace Dune
113
114#endif // DUNE_FUNCTIONS_FUNCTIONSPACEBASES_HIERARCHICALLAGRANGEBASIS_HH
Global basis for given pre-basis.
Definition: defaultglobalbasis.hh:46
A pre-basis for a hierarchical Lagrange basis.
Definition: hierarchicallagrangebasis.hh:40
A pre-basis mixin class parametrized with a local finite-element and a DOF layout.
Definition: lfeprebasismixin.hh:53
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:114
Default exception for dummy implementations.
Definition: exceptions.hh:263
A few common exception classes.
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
#define DUNE_THROW(E, m)
Definition: exceptions.hh:218
bool gt(const T &first, const T &second, typename EpsilonType< T >::Type epsilon)
test if first greater than second
Definition: float_cmp.cc:158
auto hierarchicalLagrange()
A factory that can create a HierarchicalLagrange pre-basis.
Definition: hierarchicallagrangebasis.hh:88
Dune namespace.
Definition: alignedallocator.hh:13
STL namespace.
A unique label for each type of element that can occur in a grid.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)