DUNE-FEM (unstable)

anisotropic.hh
1#ifndef DUNE_FEM_HPDG_SPACE_DISCONTINUOUSGALERKIN_ANISOTROPIC_HH
2#define DUNE_FEM_HPDG_SPACE_DISCONTINUOUSGALERKIN_ANISOTROPIC_HH
3
4#include <algorithm>
5#include <utility>
6
7#include <dune/grid/common/gridenums.hh>
8
9#include <dune/fem/operator/matrix/istlmatrixadapter.hh>
10#include <dune/fem/space/common/commoperations.hh>
11#include <dune/fem/space/common/defaultcommhandler.hh>
12#include <dune/fem/space/common/localrestrictprolong.hh>
13#include <dune/fem/space/discontinuousgalerkin/localrestrictprolong.hh>
14
15#include <dune/fem/space/shapefunctionset/selectcaching.hh>
16#include <dune/fem/space/basisfunctionset/hpdg/anisotropic.hh>
17
18#include "blockmapper.hh"
19#include "space.hh"
20
21namespace Dune
22{
23
24 namespace Fem
25 {
26
27 namespace hpDG
28 {
29
30 // Internal forward declaration
31 // ----------------------------
32
33 template< class FunctionSpace, class GridPart, int order, class Storage = Fem::CachingStorage >
34 class AnisotropicDiscontinuousGalerkinSpace;
35
36
37
38#ifndef DOXYGEN
39
40 // AnisotropicDiscontinuousGalerkinSpaceTraits
41 // -------------------------------------------
42
43 template< class FunctionSpace, class GridPart, int order, class Storage >
44 struct AnisotropicDiscontinuousGalerkinSpaceTraits
45 {
46 using DiscreteFunctionSpaceType = hpDG::AnisotropicDiscontinuousGalerkinSpace< FunctionSpace, GridPart, order, Storage >;
47
48 using FunctionSpaceType = FunctionSpace;
49
50 using GridPartType = GridPart;
51
52 using BasisFunctionSetsType = hpDG::AnisotropicBasisFunctionSets< FunctionSpaceType, GridPartType, order, Storage >;
53 using BasisFunctionSetType = typename BasisFunctionSetsType::BasisFunctionSetType;
54
55 static const int codimension = BasisFunctionSetType::EntityType::codimension;
56
57 using BlockMapperType = hpDG::DiscontinuousGalerkinBlockMapper< GridPartType, BasisFunctionSetsType >;
58 static const int localBlockSize = BasisFunctionSetsType::localBlockSize;
59
60 typedef Hybrid::IndexRange< int, localBlockSize > LocalBlockIndices;
61
62 template< class DiscreteFunction, class Operation = Dune::Fem::DFCommunicationOperation::Copy >
63 struct CommDataHandle
64 {
65 using OperationType = Operation;
67 };
68 };
69
70#endif // #ifndef DOXYGEN
71
72
73
74 // AnisotropicDiscontinuousGalerkinSpace
75 // --------------------------------
76
86 template< class FunctionSpace, class GridPart, int order, class Storage >
88 : public hpDG::DiscontinuousGalerkinSpace< AnisotropicDiscontinuousGalerkinSpaceTraits< FunctionSpace, GridPart, order, Storage > >
89 {
91
92 public:
93 static const int polynomialOrder = order;
94
95 using GridPartType = typename BaseType::GridPartType;
96 using EntityType = typename BaseType::EntityType;
97 using BasisFunctionSetsType = typename BaseType::BasisFunctionSetsType;
98 typedef typename BaseType::KeyType KeyType;
99
100 explicit AnisotropicDiscontinuousGalerkinSpace ( GridPartType &gridPart,
103 : BaseType( gridPart, BasisFunctionSetsType(), defaultKey(), interface, direction )
104 {}
105
106 explicit AnisotropicDiscontinuousGalerkinSpace ( GridPartType &gridPart,
107 const typename BaseType::KeyType key,
110 : BaseType( gridPart, BasisFunctionSetsType(), key, interface, direction )
111 {}
112
113 explicit AnisotropicDiscontinuousGalerkinSpace ( GridPartType &gridPart,
114 const std::vector<int>& key,
117 : BaseType( gridPart, BasisFunctionSetsType(), convert(key), interface, direction )
118 {}
119
120 template <class Function,
121 std::enable_if_t<
122 std::is_arithmetic<
123 decltype(Function(std::declval<const EntityType>()))>::value,int> i=0>
127 : BaseType( gridPart, BasisFunctionSetsType(), defaultKey(), function, interface, direction )
128 {}
129
130 private:
131 KeyType convert( const std::vector<int>& v ) const
132 {
133 KeyType key;
134 assert( key.size() == v.size() );
135 for( unsigned int i=0; i<key.size(); ++i )
136 key[ i ] = v[ i ];
137 return key;
138 }
139
140 static KeyType defaultKey ()
141 {
142 KeyType key;
143 std::fill( key.begin(), key.end(), order );
144 return key;
145 }
146 };
147
148 } // namespace hpDG
149
150
151
152#ifndef DOXYGEN
153
154 // DefaultLocalRestrictProlong
155 // ---------------------------
156
157 template< class FunctionSpace, class GridPart, int order, class Storage >
158 class DefaultLocalRestrictProlong< hpDG::AnisotropicDiscontinuousGalerkinSpace< FunctionSpace, GridPart, order, Storage > >
159 : public DiscontinuousGalerkinLocalRestrictProlong< hpDG::AnisotropicDiscontinuousGalerkinSpace< FunctionSpace, GridPart, order, Storage >, false >
160 {
161 using BaseType = DiscontinuousGalerkinLocalRestrictProlong< hpDG::AnisotropicDiscontinuousGalerkinSpace< FunctionSpace, GridPart, order, Storage >, false >;
162
163 public:
164 explicit DefaultLocalRestrictProlong ( const typename BaseType::DiscreteFunctionSpaceType &space )
165 : BaseType( space )
166 {}
167 };
168
169
170#endif //#ifndef DOXYGEN
171
172 } // namespace Fem
173
174} // namespace Dune
175
176#endif // #ifndef DUNE_FEM_HPDG_SPACE_DISCONTINUOUSGALERKIN_ANISOTROPIC_HH
Default communication handler for discrete functions.
Definition: defaultcommhandler.hh:38
A vector valued function space.
Definition: functionspace.hh:60
Abstract class representing a function.
Definition: function.hh:50
Implementation of an -adaptive discrete function space using anisotropic product Legendre polynomials...
Definition: anisotropic.hh:89
Generic implementation of a -adaptive discontinuous finite element space.
Definition: space.hh:46
const KeyType & key(const EntityType &entity) const
get identifiying basis function set key assigned to given entity
Definition: space.hh:231
typename Traits::BasisFunctionSetsType BasisFunctionSetsType
basis function sets type
Definition: space.hh:56
typename BasisFunctionSetsType::KeyType KeyType
key type identifying a basis function set
Definition: space.hh:58
CommunicationDirection
Define a type for communication direction parameter.
Definition: gridenums.hh:170
InterfaceType
Parameter to be used for the communication functions.
Definition: gridenums.hh:86
@ ForwardCommunication
communicate as given in InterfaceType
Definition: gridenums.hh:171
@ InteriorBorder_All_Interface
send interior and border, receive all entities
Definition: gridenums.hh:88
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 27, 22:29, 2024)