DUNE-FEM (unstable)

combinedspace.hh
1#ifndef DUNE_FEM_SPACE_COMBINEDSPACE_COMBINEDSPACE_HH
2#define DUNE_FEM_SPACE_COMBINEDSPACE_COMBINEDSPACE_HH
3
4#include <map>
5#include <type_traits>
6#include <vector>
7
8#include <dune/fem/version.hh>
9
10#include <dune/fem/space/combinedspace/powerspace.hh>
11#include <dune/fem/space/common/discretefunctionspace.hh>
12#include <dune/fem/space/common/dofstorage.hh>
13#include <dune/fem/space/common/localrestrictprolong.hh>
14
15
16namespace Dune
17{
18
19 namespace Fem
20 {
21
31 template< class DiscreteFunctionSpace, int N, DofStoragePolicy policy >
32 class CombinedSpace;
33
38 template< class DiscreteFunctionSpace, int N >
39 class CombinedSpace< DiscreteFunctionSpace, N, PointBased >
40 : public DiscreteFunctionSpace::template ToNewDimRange< DiscreteFunctionSpace::dimRange *N >::Type
41 {
43 typedef typename DiscreteFunctionSpace::template ToNewDimRange< DiscreteFunctionSpace::dimRange *N >::Type BaseType;
44
45 static const DofStoragePolicy policy = PointBased;
46
47 public:
48 typedef typename BaseType::GridPartType GridPartType;
50
51 CombinedSpace ( GridPartType &gridPart,
52 const InterfaceType commInterface = InteriorBorder_All_Interface,
53 const CommunicationDirection commDirection = ForwardCommunication )
54 : BaseType( gridPart, commInterface, commDirection ),
55 containedSpace_( gridPart, commInterface, commDirection )
56 {}
57
58 CombinedSpace ( const ThisType& ) = delete;
59 ThisType& operator= ( const ThisType& ) = delete;
60
61 //- Additional methods
63 int numComponents () const
64 {
65 return N;
66 }
67
69 DofStoragePolicy myPolicy () const
70 {
71 return policy;
72 }
73
76 {
77 return containedSpace_;
78 }
79
80 private:
81 ContainedDiscreteFunctionSpaceType containedSpace_;
82 };
83
84
85 template< class DiscreteFunctionSpace, int N >
86 class CombinedSpace< DiscreteFunctionSpace, N, VariableBased >
87 : public PowerDiscreteFunctionSpace< DiscreteFunctionSpace, N >
88 {
89 typedef CombinedSpace< DiscreteFunctionSpace, N, VariableBased > ThisType;
90 typedef PowerDiscreteFunctionSpace< DiscreteFunctionSpace, N > BaseType;
91
92 static const DofStoragePolicy policy = VariableBased;
93
94 public:
95 typedef typename BaseType::GridPartType GridPartType;
96 typedef typename BaseType::ContainedDiscreteFunctionSpaceType ContainedDiscreteFunctionSpaceType;
97
98 CombinedSpace ( GridPartType &gridPart,
99 const InterfaceType commInterface = InteriorBorder_All_Interface,
100 const CommunicationDirection commDirection = ForwardCommunication )
101 : BaseType( gridPart, commInterface, commDirection )
102 {}
103
104 CombinedSpace ( const ThisType& ) = delete;
105 ThisType& operator= ( const ThisType& ) = delete;
106
107 //- Additional methods
109 int numComponents () const
110 {
111 return N;
112 }
113
115 DofStoragePolicy myPolicy () const
116 {
117 return policy;
118 }
119
121 const ContainedDiscreteFunctionSpaceType &containedSpace () const
122 {
123 return BaseType::containedSpace();
124 }
125 };
126
127
128
129 // specialization of DifferentDiscreteFunctionSpace for this CombinedSapce
130 template< class ContainedSpace, int N, DofStoragePolicy policy, class NewFunctionSpace >
131 struct DifferentDiscreteFunctionSpace< CombinedSpace< ContainedSpace, N, policy >, NewFunctionSpace >
132 {
133 typedef CombinedSpace< ContainedSpace, NewFunctionSpace::dimRange, policy > Type;
134 };
135
136
137 // DefaultLocalRestrictProlong ( specialization for CombinedSpace< DiscreteFunctionSpace, N, VariableBased > )
138 template< class DiscreteFunctionSpace, int N >
139 class DefaultLocalRestrictProlong< CombinedSpace< DiscreteFunctionSpace, N, PointBased > >
140 : public DefaultLocalRestrictProlong< typename DiscreteFunctionSpace::template ToNewDimRange< DiscreteFunctionSpace::dimRange *N >::Type >
141 {
142 typedef DefaultLocalRestrictProlong< CombinedSpace< DiscreteFunctionSpace, N, PointBased > > ThisType;
143 typedef DefaultLocalRestrictProlong< typename DiscreteFunctionSpace::template ToNewDimRange< DiscreteFunctionSpace::dimRange *N >::Type > BaseType;
144
145 public:
146 DefaultLocalRestrictProlong ( const CombinedSpace< DiscreteFunctionSpace, N, PointBased > &space )
147 : BaseType( space )
148 {}
149 };
150
151
152 // DefaultLocalRestrictProlong ( specialization for CombinedSpace< DiscreteFunctionSpace, N, VariableBased > )
153 template< class DiscreteFunctionSpace, int N >
154 class DefaultLocalRestrictProlong< CombinedSpace< DiscreteFunctionSpace, N, VariableBased > >
155 : public PowerLocalRestrictProlong< DiscreteFunctionSpace, N >
156 {
157 typedef DefaultLocalRestrictProlong< CombinedSpace< DiscreteFunctionSpace, N, VariableBased > > ThisType;
158 typedef PowerLocalRestrictProlong< DiscreteFunctionSpace, N > BaseType;
159
160 public:
161 DefaultLocalRestrictProlong ( const CombinedSpace< DiscreteFunctionSpace, N, VariableBased > &space )
162 : BaseType( space.containedSpace() )
163 {}
164 };
165
168 } // namespace Fem
169
170} // namespace Dune
171
172#endif // #ifndef DUNE_FEM_SPACE_COMBINEDSPACE_COMBINEDSPACE_HH
discrete function space
Combined Space Function Space.
Definition: combinedspace.hh:41
int numComponents() const
number of components
Definition: combinedspace.hh:63
DofStoragePolicy myPolicy() const
policy of this space
Definition: combinedspace.hh:69
const ContainedDiscreteFunctionSpaceType & containedSpace() const
contained space
Definition: combinedspace.hh:75
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 13, 23:29, 2024)