1#ifndef DUNE_FEM_SPACE_COMMON_RESTRICTPROLONGTUPLE_HH
2#define DUNE_FEM_SPACE_COMMON_RESTRICTPROLONGTUPLE_HH
7#include <dune/fem/common/forloop.hh>
10#include <dune/fem/space/common/restrictprolonginterface.hh>
21 template<
class... RestrictProlongInterfaces >
23 template<
class... DiscreteFunctions >
44 template<
class Head,
class... Tail >
50 template<
int i >
struct AddToList;
51 template<
int i >
struct AddToLoadBalancer;
52 template<
int i >
struct ProlongLocal;
53 template<
int i >
struct RestrictLocal;
54 template<
int i >
struct SetFatherChildWeight;
55 template<
int i >
struct Initialize;
56 template<
int i >
struct Finalize;
60 typedef typename BaseType::DomainFieldType DomainFieldType;
67 : tuple_(
std::forward< Head >(
head ),
std::forward< Tail >(
tail )... )
83 Dune::Fem::ForLoop< Initialize, 0,
sizeof...( Tail ) >::apply( tuple_ );
89 Dune::Fem::ForLoop< Finalize, 0,
sizeof...( Tail ) >::apply( tuple_ );
93 void setFatherChildWeight (
const DomainFieldType &weight )
const
95 Dune::Fem::ForLoop< SetFatherChildWeight, 0,
sizeof...( Tail ) >::apply( weight, tuple_ );
99 template<
class Entity >
100 void restrictLocal (
const Entity &father,
const Entity &child,
bool initialize )
const
102 Dune::Fem::ForLoop< RestrictLocal, 0,
sizeof...( Tail ) >::apply( father, child, initialize, tuple_ );
106 template<
class Entity,
class LocalGeometry >
107 void restrictLocal (
const Entity &father,
const Entity &child,
108 const LocalGeometry &geometryInFather,
bool initialize )
const
110 Dune::Fem::ForLoop< RestrictLocal, 0,
sizeof...( Tail ) >::apply( father, child, geometryInFather, initialize, tuple_ );
113 template<
class Entity >
114 void restrictFinalize (
const Entity &father )
const
119 template<
class Entity >
120 void prolongLocal (
const Entity &father,
const Entity &child,
bool initialize )
const
122 Dune::Fem::ForLoop< ProlongLocal, 0,
sizeof...( Tail ) >::apply( father, child, initialize, tuple_ );
126 template<
class Entity,
class LocalGeometry >
127 void prolongLocal (
const Entity &father,
const Entity &child,
128 const LocalGeometry &geometryInFather,
bool initialize )
const
130 Dune::Fem::ForLoop< ProlongLocal, 0,
sizeof...( Tail ) >::apply( father, child, geometryInFather, initialize, tuple_ );
134 template<
class Communicator,
class Operation >
135 void addToList ( Communicator &comm,
const Operation& op )
137 Dune::Fem::ForLoop< AddToList, 0,
sizeof...( Tail ) >::apply( comm, tuple_, op );
141 template<
class Communicator >
142 void addToList ( Communicator &comm )
144 Dune::Fem::ForLoop< AddToList, 0,
sizeof...( Tail ) >::apply( comm, tuple_ );
148 template<
class LoadBalancer >
149 void addToLoadBalancer ( LoadBalancer &loadBalancer )
151 Dune::Fem::ForLoop< AddToLoadBalancer, 0,
sizeof...( Tail ) >::apply( loadBalancer, tuple_ );
157 std::tuple< Head, Tail... > tuple_;
165 template<
class Head,
class... Tail >
167 struct RestrictProlongTuple< Head, Tail... >::AddToList
169 template<
class Communicator,
class Operation >
170 static void apply ( Communicator &comm, std::tuple< Head, Tail... > &tuple,
const Operation& op )
172 std::get< i >( tuple ).addToList( comm, op );
175 template<
class Communicator >
176 static void apply ( Communicator &comm, std::tuple< Head, Tail... > &tuple )
178 std::get< i >( tuple ).addToList( comm );
187 template<
class Head,
class... Tail >
189 struct RestrictProlongTuple< Head, Tail... >::AddToLoadBalancer
191 template<
class LoadBalancer >
192 static void apply ( LoadBalancer &loadBalancer, std::tuple< Head, Tail... > &tuple )
194 std::get< i >( tuple ).addToLoadBalancer( loadBalancer );
203 template<
class Head,
class... Tail >
205 struct RestrictProlongTuple< Head, Tail... >::ProlongLocal
207 template<
class Entity >
208 static void apply (
const Entity &father,
const Entity &child,
bool initialize,
209 const std::tuple< Head, Tail... > &tuple )
211 std::get< i >( tuple ).prolongLocal( father, child, initialize );
214 template<
class Entity,
class LocalGeometry >
215 static void apply (
const Entity &father,
const Entity &child,
const LocalGeometry &geometryInFather,
bool initialize,
216 const std::tuple< Head, Tail... > &tuple )
218 std::get< i >( tuple ).prolongLocal( father, child, geometryInFather, initialize );
227 template<
class Head,
class... Tail >
229 struct RestrictProlongTuple< Head, Tail... >::RestrictLocal
231 template<
class Entity >
232 static void apply (
const Entity &father,
const Entity &child,
bool initialize,
233 const std::tuple< Head, Tail... > &tuple )
235 std::get< i >( tuple ).restrictLocal( father, child, initialize );
238 template<
class Entity,
class LocalGeometry >
239 static void apply (
const Entity &father,
const Entity &child,
const LocalGeometry &geometryInFather,
bool initialize,
240 const std::tuple< Head, Tail... > &tuple )
242 std::get< i >( tuple ).restrictLocal( father, child, geometryInFather, initialize );
251 template<
class Head,
class... Tail >
253 struct RestrictProlongTuple< Head, Tail... >::SetFatherChildWeight
255 static void apply (
const DomainFieldType &weight,
const std::tuple< Head, Tail... > &tuple )
257 std::get< i >( tuple ).setFatherChildWeight( weight );
265 template<
class Head,
class... Tail >
267 struct RestrictProlongTuple< Head, Tail... >::Initialize
269 static void apply ( std::tuple< Head, Tail... > &tuple )
271 std::get< i >( tuple ).initialize();
279 template<
class Head,
class... Tail >
281 struct RestrictProlongTuple< Head, Tail... >::Finalize
283 static void apply ( std::tuple< Head, Tail... > &tuple )
285 std::get< i >( tuple ).finalize();
302 template<
class... DiscreteFunctions >
308 template<
class DiscreteFunction >
316 return Type( discreteFunction );
326 :
BaseType( Dune::transformTuple< Operation >( tuple ) )
331 template<
class... DiscreteFunctions>
332 struct RestrictProlongDefaultTraits
337 template<
class... DiscreteFunctions>
338 struct RestrictProlongDefaultTraits<
std::tuple<DiscreteFunctions&...> >
340 typedef RestrictProlongDefaultTuple<DiscreteFunctions...> Type;
conveniently set up a tuple of Dune::Fem::RestrictProlongDefault restriction/prolongation objects cre...
Definition: restrictprolongtuple.hh:305
This is a wrapper for the default implemented restriction/prolongation operator, which only takes a d...
Definition: restrictprolonginterface.hh:207
Interface class defining the local behaviour of the restrict/prolong operation (using BN)
Definition: restrictprolonginterface.hh:40
combine a variadic number of Dune::Fem::RestrictProlongInterface instances into a single object again...
Definition: restrictprolongtuple.hh:22
forward declaration
Definition: discretefunction.hh:51
Contains utility classes which can be used with std::tuple.
Dune namespace.
Definition: alignedallocator.hh:13
constexpr std::integer_sequence< T, II... > tail(std::integer_sequence< T, I0, II... >)
For a sequence [head,tail...) return the tail sequence.
Definition: integersequence.hh:58
constexpr std::integral_constant< T, I0 > head(std::integer_sequence< T, I0, II... >)
For a sequence [head,tail...) return the single head element.
Definition: integersequence.hh:53
Traits class for derivation from RestrictProlongInterface.
Definition: restrictprolonginterface.hh:155