6#ifndef __DUNE_ACFEM_RESTRICT_PROLONG_TUPLE_HH__
7#define __DUNE_ACFEM_RESTRICT_PROLONG_TUPLE_HH__
9#if HAVE_DUNE_FEM_SPACE_COMMON_RESTRICTPROLONGTUPLE_HH
11# include <dune/fem/space/common/restrictprolongtuple.hh>
18 using Fem::RestrictProlongDefaultTraits;
20#warning Using <dune/acfem/operators/restrictprolongtuple.hh> is deprecated, redirecting to <dune/fem/space/common/restrictprolongtuple.hh>
26#include <dune/fem/space/common/restrictprolonginterface.hh>
27#include <dune/fem/function/common/function.hh>
28#include <dune/common/tuples.hh>
51 template<
class RP1,
class RP2>
53 :
public Fem::RestrictProlongInterface<
54 Fem::RestrictProlongTraits<RestrictProlongPair<RP1, RP2>,
55 typename RP1::DomainFieldType> >,
56 public std::pair<RP1, RP2>
58 typedef std::pair<RP1, RP2> StorageType;
59 typedef Fem::RestrictProlongInterface<
60 Fem::RestrictProlongTraits<RestrictProlongPair<RP1, RP2>,
61 typename RP1::DomainFieldType> >
64 using StorageType::first;
65 using StorageType::second;
68 typedef typename RP1::DomainFieldType DomainFieldType;
71 : StorageType(rp1, rp2)
74 void setFatherChildWeight(
const DomainFieldType &weight)
const {
75 first.setFatherChildWeight(weight);
76 second.setFatherChildWeight(weight);
79 template<
class Entity>
80 void restrictLocal(
const Entity &father,
const Entity &son,
bool initialize)
const {
81 first.restrictLocal(father, son, initialize);
82 second.restrictLocal(father, son, initialize);
85 template<
class Entity,
class LocalGeometry>
86 void restrictLocal(
const Entity &father,
const Entity &son,
87 const LocalGeometry &geometryInFather,
88 bool initialize)
const {
89 first.restrictLocal(father, son, geometryInFather, initialize);
90 second.restrictLocal(father, son, geometryInFather, initialize);
93 template<
class Entity>
94 void prolongLocal(
const Entity &father,
const Entity &son,
bool initialize)
const {
95 first.prolongLocal(father, son, initialize);
96 second.prolongLocal(father, son, initialize);
99 template<
class Entity,
class LocalGeometry>
100 void prolongLocal(
const Entity &father,
const Entity &son,
101 const LocalGeometry &geometryInFather,
102 bool initialize)
const {
103 first.prolongLocal(father, son, geometryInFather, initialize);
104 second.prolongLocal(father, son, geometryInFather, initialize);
107 template<
class Communicator>
108 void addToList(Communicator &comm) {
109 first.addToList(comm);
110 second.addToList(comm);
113 template<
class LoadBalancer>
114 void addToLoadBalancer(LoadBalancer &lb) {
115 first.addToLoadBalancer(lb);
116 second.addToLoadBalancer(lb);
124 template<
class DiscreteFunction,
class... Rest>
127 typedef DiscreteFunction FirstDiscreteFunctionType;
128 typedef Fem::RestrictProlongDefault<FirstDiscreteFunctionType> FirstRestrictProlongType;
133 template<
class DiscreteFunction>
136 typedef DiscreteFunction FirstDiscreteFunctionType;
137 typedef Fem::RestrictProlongDefault<FirstDiscreteFunctionType> FirstRestrictProlongType;
138 typedef FirstRestrictProlongType Type;
146 Fem::RestrictProlongDefault<DF>
149 DF& df(
static_cast<DF&
>(df_));
151 return Fem::RestrictProlongDefault<DF>(df);
158 template<
class DF1,
class DF2,
class... Rest>
160 typename RestrictProlongDefaultTraits<DF1, DF2, Rest...>::Type
175 template<
class Tuple,
class Index = std::
integral_constant<
size_t, 0> >
178 enum { index = Index::value };
179 typedef std::integral_constant<size_t, index+1> NextIndexType;
180 typedef typename remove_reference<typename tuple_element<index, Tuple>::type>::type DiscreteFunctionType;
181 typedef Fem::RestrictProlongDefault<DiscreteFunctionType> RestrictProlongType;
185 static Type construct(
const Tuple& arg)
187 return Type(RestrictProlongType(get<index>(arg)), NextHelperType::construct(arg));
192 template<
class Tuple>
195 enum { index = tuple_size<Tuple>::value - 1 };
196 typedef typename remove_reference<typename tuple_element<index, Tuple>::type>::type DiscreteFunctionType;
197 typedef Fem::RestrictProlongDefault<DiscreteFunctionType> RestrictProlongType;
198 typedef RestrictProlongType Type;
200 static Type construct(
const Tuple& arg)
202 return Type(get<index>(arg));
206 template<
class... Args>
224 template<
class... Rest>
226 typename RestrictProlongDefaultTraits<Rest...>::Type
229 typedef tuple<Rest&...> TupleType;
Chain two RestrictProlong implementations together.
Definition: restrictprolongtuple.hh:57
static RestrictProlongDefaultTraits< Rest... >::Type makeRestrictProlongDefault(const tuple< Rest &... > &arg)
Conveniently form a compound RestrictProlong-implementation which conforms to RestrictProlongInterfac...
Definition: restrictprolongtuple.hh:227
static Fem::RestrictProlongDefault< DF > makeRestrictProlongDefault(Fem::Function< typename DF::FunctionSpaceType, DF > &df_)
Endpoint for the makeRestrictProlongDefault recursion.
Definition: restrictprolongtuple.hh:147
A helper class which defines the proper RestrictProlong compound data-type for tuples of Fem::Discret...
Definition: restrictprolongtuple.hh:126
AFAIK, C++11 is not capable of expanding tuples into parameter packs, so this recursive helper functi...
Definition: restrictprolongtuple.hh:177