1#ifndef DUNE_FEM_SPACE_COMMON_RESTRICTPROLONGTUPLE_HH
2#define DUNE_FEM_SPACE_COMMON_RESTRICTPROLONGTUPLE_HH
8#include <dune/common/tupleutility.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;
67 : tuple_(
std::forward< Head >( head ),
std::forward< Tail >( tail )... )
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 >
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 >
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 >
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 )
141 template<
class Communicator >
148 template<
class 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 >
311 typedef typename std::decay< DiscreteFunction >::type DiscreteFunctionType;
314 static Type apply ( DiscreteFunctionType &discreteFunction )
316 return Type( discreteFunction );
326 :
BaseType(
Dune::transformTuple< Operation >( tuple ) )
331 template<
class... DiscreteFunctions>
337 template<
class... DiscreteFunctions>
Definition: bindguard.hh:11
Definition: forloop.hh:17
This class manages the adaptation process. If the method adapt is called, then the grid is adapted an...
Definition: loadbalancer.hh:66
Interface class defining the local behaviour of the restrict/prolong operation (using BN)
Definition: restrictprolonginterface.hh:39
Traits::DomainFieldType DomainFieldType
field type of domain vector space
Definition: restrictprolonginterface.hh:47
Traits class for derivation from RestrictProlongInterface.
Definition: restrictprolonginterface.hh:154
This is a wrapper for the default implemented restriction/prolongation operator, which only takes a d...
Definition: restrictprolonginterface.hh:203
combine a variadic number of Dune::Fem::RestrictProlongInterface instances into a single object again...
Definition: restrictprolongtuple.hh:22
conveniently set up a tuple of Dune::Fem::RestrictProlongDefault restriction/prolongation objects cre...
Definition: restrictprolongtuple.hh:305
RestrictProlongDefaultTuple(std::tuple< DiscreteFunctions &... > tuple)
Definition: restrictprolongtuple.hh:325
RestrictProlongDefaultTuple(DiscreteFunctions &... discreteFunctions)
Definition: restrictprolongtuple.hh:321
void prolongLocal(const Entity &father, const Entity &child, bool initialize) const
prolong data to children
Definition: restrictprolongtuple.hh:120
void finalize()
explicit set volume ratio of son and father
Definition: restrictprolongtuple.hh:87
void restrictLocal(const Entity &father, const Entity &child, bool initialize) const
restrict data to father
Definition: restrictprolongtuple.hh:100
void prolongLocal(const Entity &father, const Entity &child, const LocalGeometry &geometryInFather, bool initialize) const
prolong data to children
Definition: restrictprolongtuple.hh:127
void initialize()
initialize restrict prolong object (if necessary) before adaptation takes place
Definition: restrictprolongtuple.hh:81
RestrictProlongTuple(Head &&head, Tail &&... tail)
Definition: restrictprolongtuple.hh:66
void addToList(Communicator &comm, const Operation &op)
add discrete function to communicator
Definition: restrictprolongtuple.hh:135
void addToList(Communicator &comm)
add discrete function to communicator
Definition: restrictprolongtuple.hh:142
void restrictLocal(const Entity &father, const Entity &child, const LocalGeometry &geometryInFather, bool initialize) const
restrict data to father
Definition: restrictprolongtuple.hh:107
void setFatherChildWeight(const DomainFieldType &weight) const
explicit set volume ratio of son and father
Definition: restrictprolongtuple.hh:93
BaseType::DomainFieldType DomainFieldType
field type of domain vector space
Definition: restrictprolongtuple.hh:60
void addToLoadBalancer(LoadBalancer &loadBalancer)
add discrete function to load balancer
Definition: restrictprolongtuple.hh:149
void restrictFinalize(const Entity &father) const
Definition: restrictprolongtuple.hh:114
RestrictProlongTuple(std::tuple< Head, Tail... > &&tuple)
Definition: restrictprolongtuple.hh:70
Definition: restrictprolongtuple.hh:333
RestrictProlongDefaultTuple< DiscreteFunctions... > Type
Definition: restrictprolongtuple.hh:334
RestrictProlongDefaultTuple< DiscreteFunctions... > Type
Definition: restrictprolongtuple.hh:340