1 #ifndef DUNE_FEM_SPACE_COMMON_RESTRICTPROLONGTUPLE_HH 2 #define DUNE_FEM_SPACE_COMMON_RESTRICTPROLONGTUPLE_HH 7 #include <dune/common/deprecated.hh> 8 #include <dune/common/forloop.hh> 9 #include <dune/common/tupleutility.hh> 22 template<
class... RestrictProlongInterfaces >
24 template<
class... DiscreteFunctions >
45 template<
class Head,
class... Tail >
51 template<
int i >
struct AddToList;
52 template<
int i >
struct AddToLoadBalancer;
53 template<
int i >
struct ProlongLocal;
54 template<
int i >
struct RestrictLocal;
55 template<
int i >
struct SetFatherChildWeight;
66 : tuple_(
std::forward< Head >( head ),
std::forward< Tail >( tail )... )
82 Dune::ForLoop< SetFatherChildWeight, 0,
sizeof...( Tail ) >::apply( weight, tuple_ );
86 template<
class Entity >
87 void restrictLocal (
const Entity &father,
const Entity &child,
bool initialize )
const 89 Dune::ForLoop< RestrictLocal, 0,
sizeof...( Tail ) >::apply( father, child, initialize, tuple_ );
93 template<
class Entity,
class LocalGeometry >
95 const LocalGeometry &geometryInFather,
bool initialize )
const 97 Dune::ForLoop< RestrictLocal, 0,
sizeof...( Tail ) >::apply( father, child, geometryInFather, initialize, tuple_ );
101 template<
class Entity >
102 void prolongLocal (
const Entity &father,
const Entity &child,
bool initialize )
const 104 Dune::ForLoop< ProlongLocal, 0,
sizeof...( Tail ) >::apply( father, child, initialize, tuple_ );
108 template<
class Entity,
class LocalGeometry >
110 const LocalGeometry &geometryInFather,
bool initialize )
const 112 Dune::ForLoop< ProlongLocal, 0,
sizeof...( Tail ) >::apply( father, child, geometryInFather, initialize, tuple_ );
116 template<
class Communicator >
119 Dune::ForLoop< AddToList, 0,
sizeof...( Tail ) >::apply( comm, tuple_ );
123 template<
class LoadBalancer >
126 Dune::ForLoop< AddToLoadBalancer, 0,
sizeof...( Tail ) >::apply( loadBalancer, tuple_ );
132 std::tuple< Head, Tail... > tuple_;
140 template<
class Head,
class... Tail >
144 template<
class Communicator >
145 static void apply ( Communicator &comm, std::tuple< Head, Tail... > &tuple )
147 std::get< i >( tuple ).addToList( comm );
156 template<
class Head,
class... Tail >
160 template<
class LoadBalancer >
161 static void apply (
LoadBalancer &loadBalancer, std::tuple< Head, Tail... > &tuple )
163 std::get< i >( tuple ).addToLoadBalancer( loadBalancer );
172 template<
class Head,
class... Tail >
176 template<
class Entity >
177 static void apply (
const Entity &father,
const Entity &child,
bool initialize,
178 const std::tuple< Head, Tail... > &tuple )
180 std::get< i >( tuple ).prolongLocal( father, child, initialize );
183 template<
class Entity,
class LocalGeometry >
184 static void apply (
const Entity &father,
const Entity &child,
const LocalGeometry &geometryInFather,
bool initialize,
185 const std::tuple< Head, Tail... > &tuple )
187 std::get< i >( tuple ).prolongLocal( father, child, geometryInFather, initialize );
196 template<
class Head,
class... Tail >
200 template<
class Entity >
201 static void apply (
const Entity &father,
const Entity &child,
bool initialize,
202 const std::tuple< Head, Tail... > &tuple )
204 std::get< i >( tuple ).restrictLocal( father, child, initialize );
207 template<
class Entity,
class LocalGeometry >
208 static void apply (
const Entity &father,
const Entity &child,
const LocalGeometry &geometryInFather,
bool initialize,
209 const std::tuple< Head, Tail... > &tuple )
211 std::get< i >( tuple ).restrictLocal( father, child, geometryInFather, initialize );
220 template<
class Head,
class... Tail >
224 static void apply (
const DomainFieldType &weight,
const std::tuple< Head, Tail... > &tuple )
226 std::get< i >( tuple ).setFatherChildWeight( weight );
243 template<
class... DiscreteFunctions >
249 template<
class DiscreteFunction >
252 typedef typename std::decay< DiscreteFunction >::type DiscreteFunctionType;
255 static Type apply ( DiscreteFunctionType &discreteFunction )
257 return Type( discreteFunction );
267 :
BaseType(
Dune::transformTuple< Operation >( tuple ) )
272 template<
class... DiscreteFunctions>
278 template<
class... DiscreteFunctions>
295 template<
class... DiscreteFunctions >
302 template<
class... DiscreteFunctions >
315 #endif // #ifndef DUNE_FEM_SPACE_COMMON_RESTRICTPROLONGTUPLE_HH void addToList(Communicator &comm)
add discrete function to communicator
Definition: restrictprolongtuple.hh:117
This is a wrapper for the default implemented restriction/prolongation operator, which only takes a d...
Definition: restrictprolonginterface.hh:172
Traits::DomainFieldType DomainFieldType
field type of domain vector space
Definition: restrictprolonginterface.hh:47
void addToLoadBalancer(LoadBalancer &loadBalancer)
add discrete function to load balancer
Definition: restrictprolongtuple.hh:124
RestrictProlongTuple(std::tuple< Head, Tail... > &&tuple)
Definition: restrictprolongtuple.hh:69
void restrictLocal(const Entity &father, const Entity &child, const LocalGeometry &geometryInFather, bool initialize) const
restrict data to father
Definition: restrictprolongtuple.hh:94
RestrictProlongTuple(Head &&head, Tail &&...tail)
Definition: restrictprolongtuple.hh:65
Definition: restrictprolongtuple.hh:273
RestrictProlongDefaultTuple(DiscreteFunctions &...discreteFunctions)
Definition: restrictprolongtuple.hh:262
BaseType::DomainFieldType DomainFieldType
field type of domain vector space
Definition: restrictprolongtuple.hh:55
void setFatherChildWeight(const DomainFieldType &weight) const
explicit set volume ratio of son and father
Definition: restrictprolongtuple.hh:80
static RestrictProlongDefaultTuple< DiscreteFunctions... > makeRestrictProlongDefault(DiscreteFunctions &...discreteFunctions)
Definition: restrictprolongtuple.hh:297
Interface class defining the local behaviour of the restrict/prolong operation (using BN) ...
Definition: restrictprolonginterface.hh:38
Definition: coordinate.hh:4
combine a variadic number of Dune::Fem::RestrictProlongInterface instances into a single object again...
Definition: restrictprolongtuple.hh:23
void prolongLocal(const Entity &father, const Entity &child, const LocalGeometry &geometryInFather, bool initialize) const
prolong data to children
Definition: restrictprolongtuple.hh:109
RestrictProlongDefaultTuple(std::tuple< DiscreteFunctions &... > tuple)
Definition: restrictprolongtuple.hh:266
conveniently set up a tuple of Dune::Fem::RestrictProlongDefault restriction/prolongation objects cre...
Definition: restrictprolongtuple.hh:25
void restrictLocal(const Entity &father, const Entity &child, bool initialize) const
restrict data to father
Definition: restrictprolongtuple.hh:87
RestrictProlongDefaultTuple< DiscreteFunctions... > Type
Definition: restrictprolongtuple.hh:281
void prolongLocal(const Entity &father, const Entity &child, bool initialize) const
prolong data to children
Definition: restrictprolongtuple.hh:102
This class manages the adaptation process. If the method adapt is called, then the grid is adapted an...
Definition: loadbalancer.hh:69
RestrictProlongDefaultTuple< DiscreteFunctions... > Type
Definition: restrictprolongtuple.hh:275
Traits class for derivation from RestrictProlongInterface.
Definition: restrictprolonginterface.hh:132