DUNE-FEM (unstable)

space.hh
1#ifndef DUNE_FEM_SPACE_FINITEVOLUME_SPACE_HH
2#define DUNE_FEM_SPACE_FINITEVOLUME_SPACE_HH
3
4#include <dune/grid/common/gridenums.hh>
5
6#include <dune/fem/common/hybrid.hh>
7#include <dune/fem/function/localfunction/average.hh>
8#include <dune/fem/gridpart/common/capabilities.hh>
9#include <dune/fem/space/common/capabilities.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/generic.hh>
14#include <dune/fem/space/mapper/codimensionmapper.hh>
15#include <dune/fem/space/shapefunctionset/selectcaching.hh>
16
17#include "basisfunctionsets.hh"
18#include "declaration.hh"
19#include "interpolation.hh"
20
21namespace Dune
22{
23
24 namespace Fem
25 {
26
27 // FiniteVolumeSpaceTraits
28 // -----------------------
29
30 template< class FunctionSpace, class GridPart, int codim, class Storage >
31 struct FiniteVolumeSpaceTraits
32 {
33 typedef FiniteVolumeSpace< FunctionSpace, GridPart, codim, Storage > DiscreteFunctionSpaceType;
34
35 typedef GridPart GridPartType;
36 typedef GridFunctionSpace< GridPartType, FunctionSpace > FunctionSpaceType;
37
38 static const int codimension = codim;
39
40 typedef typename GridPartType::template Codim< codimension >::EntityType EntityType;
41 typedef FiniteVolumeBasisFunctionSets< EntityType, typename FunctionSpaceType::RangeType > BasisFunctionSetsType;
42 typedef typename BasisFunctionSetsType::BasisFunctionSetType BasisFunctionSetType;
43
44 typedef CodimensionMapper< GridPartType, codimension > BlockMapperType;
45 typedef Hybrid::IndexRange< int, FunctionSpaceType::dimRange > LocalBlockIndices;
46
47 template <class DiscreteFunction, class Operation = DFCommunicationOperation::Copy >
48 struct CommDataHandle
49 {
50 typedef Operation OperationType;
51 typedef DefaultCommunicationHandler< DiscreteFunction, Operation > Type;
52 };
53 };
54
55
56
57 // FiniteVolumeSpace
58 // -----------------
59
60 template< class FunctionSpace, class GridPart, int codim = 0, class Storage = SimpleStorage >
61 class FiniteVolumeSpace
62 : public GenericDiscontinuousGalerkinSpace< FiniteVolumeSpaceTraits< FunctionSpace, GridPart, codim, Storage > >
63 {
64 typedef FiniteVolumeSpace< FunctionSpace, GridPart, codim, Storage > ThisType;
65 typedef GenericDiscontinuousGalerkinSpace< FiniteVolumeSpaceTraits< FunctionSpace, GridPart, codim, Storage > > BaseType;
66
67 public:
69 static const int polynomialOrder = 0;
70
72 typedef typename BaseType::GridPartType GridPartType;
74 typedef typename BaseType::EntityType EntityType;
75
77 typedef typename BaseType::BasisFunctionSetsType BasisFunctionSetsType;
79 typedef typename BaseType::BasisFunctionSetType BasisFunctionSetType;
80
82 typedef FiniteVolumeLocalInterpolation< GridPart, typename BasisFunctionSetType::RangeType > InterpolationType;
83 typedef InterpolationType LocalInterpolationType;
84 typedef LocalInterpolationType InterpolationImplType;
85
86 explicit FiniteVolumeSpace ( GridPartType &gridPart,
87 const InterfaceType commInterface = InteriorBorder_All_Interface,
88 const CommunicationDirection commDirection = ForwardCommunication )
89 : BaseType( gridPart, BasisFunctionSetsType(), commInterface, commDirection )
90 {}
91
93 static DFSpaceIdentifier type () { return FiniteVolumeSpace_id; }
94
96 InterpolationType interpolation () const
97 {
98 return InterpolationType();
99 }
100
102 static InterpolationType interpolation ( const EntityType &entity )
103 {
104 return InterpolationType();
105 }
106
107 LocalInterpolationType localInterpolation ( const EntityType &entity ) const
108 {
109 return LocalInterpolationType(entity);
110 }
111
113 void extendSize( const size_t extension ) { this->blockMapper().extendSize( extension ); }
114 };
115
116
118 template <class FunctionSpaceImp, class GridPartImp, int polOrd,
119 class BaseFunctionStorageImp,
120 class VolumeQuadratureImp>
122 FiniteVolumeSpace< FunctionSpaceImp, GridPartImp, polOrd, BaseFunctionStorageImp >,
123 VolumeQuadratureImp >
125 FiniteVolumeSpace< FunctionSpaceImp, GridPartImp, polOrd, BaseFunctionStorageImp >, VolumeQuadratureImp, false /* refElemScaling */>
126 {
127 typedef FiniteVolumeSpace< FunctionSpaceImp, GridPartImp, polOrd, BaseFunctionStorageImp > DiscreteFunctionSpaceImp;
128 typedef LocalMassMatrixImplementationDgOrthoNormal< DiscreteFunctionSpaceImp, VolumeQuadratureImp, false /* refElemScaling */ > BaseType;
129 public:
130 using BaseType :: BaseType;
131 };
132
133
134
135
136
137 // DefaultLocalRestrictProlong for FiniteVolumeSpace
138 // -------------------------------------------------
139
140 template< class FunctionSpace, class GridPart, int codim, class Storage >
141 class DefaultLocalRestrictProlong< FiniteVolumeSpace< FunctionSpace, GridPart, codim, Storage > >
142 : public ConstantLocalRestrictProlong< FiniteVolumeSpace< FunctionSpace, GridPart, codim, Storage > >
143 {
144 public:
145 DefaultLocalRestrictProlong ( const FiniteVolumeSpace< FunctionSpace, GridPart, codim, Storage > & )
146 {}
147 };
148
149
150
151 namespace Capabilities
152 {
153
154 template< class FunctionSpace, class GridPart, int codim, class Storage >
155 struct hasFixedPolynomialOrder< FiniteVolumeSpace< FunctionSpace, GridPart, codim, Storage > >
156 {
157 static const bool v = true;
158 };
159
160 template< class FunctionSpace, class GridPart, int codim, class Storage >
161 struct hasStaticPolynomialOrder< FiniteVolumeSpace< FunctionSpace, GridPart, codim, Storage > >
162 {
163 static const bool v = true;
164 static const int order = 0;
165 };
166
167 template< class FunctionSpace, class GridPart, int codim, class Storage >
168 struct isContinuous< FiniteVolumeSpace< FunctionSpace, GridPart, codim, Storage > >
169 {
170 static const bool v = false;
171 };
172
173 template< class FunctionSpace, class GridPart, int codim, class Storage >
174 struct isHierarchic< FiniteVolumeSpace< FunctionSpace, GridPart, codim, Storage > >
175 {
176 static const bool v = true;
177 };
178
179 template< class FunctionSpace, class GridPart, int codim, class Storage >
180 struct isLocalized< FiniteVolumeSpace< FunctionSpace, GridPart, codim, Storage > >
181 {
182 static const bool v = false; // there is no method 'shapeFunctionSet( const EntityType & )'
183 };
184
185 template< class FunctionSpace, class GridPart, int codim, class Storage >
186 struct isAdaptive< FiniteVolumeSpace< FunctionSpace, GridPart, codim, Storage > >
187 {
188 static const bool v = true;
189 };
190
191 template< class FunctionSpace, class GridPart, int codim, class Storage >
192 struct threadSafe< FiniteVolumeSpace< FunctionSpace, GridPart, codim, Storage > >
193 {
194 static const bool v = false;
195 };
196
197 template< class FunctionSpace, class GridPart, int codim, class Storage >
198 struct viewThreadSafe< FiniteVolumeSpace< FunctionSpace, GridPart, codim, Storage > >
199 {
200 static const bool v = true;
201 };
202
203 } // namespace Capabilities
204
205 } // namespace Fem
206
207} // namespace Dune
208
209#endif // #ifndef DUNE_FEM_SPACE_FINITEVOLUME_SPACE_HH
DFSpaceIdentifier type() const
return type identifier of discrete function space
Definition: discretefunctionspace.hh:294
A vector valued function space.
Definition: functionspace.hh:60
BaseType::GridPartType GridPartType
type of underlying grid part
Definition: generic.hh:40
BlockMapperType & blockMapper() const
get a reference to the block mapper
Definition: generic.hh:124
BaseType::EntityType EntityType
type of entity of codimension 0
Definition: generic.hh:42
BaseType::BasisFunctionSetType BasisFunctionSetType
type of basis function set of this space
Definition: generic.hh:49
Traits::BasisFunctionSetsType BasisFunctionSetsType
basis function sets
Definition: generic.hh:47
DG Local Mass Matrix for arbitrary spaces.
Definition: localmassmatrix.hh:987
Local Mass Matrix for arbitrary spaces.
Definition: localmassmatrix.hh:967
DFSpaceIdentifier
enumerator for identification of spaces
Definition: discretefunctionspace.hh:95
@ FiniteVolumeSpace_id
id for Finite Volume Space
Definition: discretefunctionspace.hh:99
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 (Nov 21, 23:30, 2024)