1 #ifndef DUNE_FEM_SPACE_COMBINEDSPACE_TUPLELOCALRESTIRCTPROLONG_HH 2 #define DUNE_FEM_SPACE_COMBINEDSPACE_TUPLELOCALRESTIRCTPROLONG_HH 9 #include <dune/common/exceptions.hh> 10 #include <dune/common/forloop.hh> 11 #include <dune/common/std/utility.hh> 12 #include <dune/common/tuples.hh> 31 template<
class ... DiscreteFunctionSpaces >
36 typedef std::tuple< DefaultLocalRestrictProlong< DiscreteFunctionSpaces > ... > LocalRestrictProlongTupleType;
38 static const int setSize =
sizeof...( DiscreteFunctionSpaces )-1;
41 template<
int >
struct SetFatherChildWeight;
42 template<
int >
struct RestrictLocal;
43 template<
int >
struct ProlongLocal;
47 "TupleLocalRestrictProlong needs common DomainFieldType in the Spaces!" );
49 typedef typename std::tuple_element< 0, LocalRestrictProlongTupleType >::type::DomainFieldType
DomainFieldType;
52 : localRestrictProlongTuple_( spaces ... )
57 ForLoop< SetFatherChildWeight, 0, setSize >::apply( weight, localRestrictProlongTuple_ );
61 template<
class LFFather,
class LFSon,
class LocalGeometry >
63 const LocalGeometry &geometryInFather,
bool initialize )
const 65 ForLoop< RestrictLocal, 0, setSize >::apply( lfFather, lfSon, geometryInFather, initialize, localRestrictProlongTuple_ );
69 template<
class LFFather,
class LFSon,
class LocalGeometry >
71 const LocalGeometry &geometryInFather,
bool initialize )
const 73 ForLoop< ProlongLocal, 0, setSize >::apply( lfFather, lfSon, geometryInFather, initialize, localRestrictProlongTuple_ );
78 return needCommunication( Std::index_sequence_for< DiscreteFunctionSpaces ... >() );
82 template< std::size_t ... i >
89 LocalRestrictProlongTupleType localRestrictProlongTuple_;
96 template<
class ... DiscreteFunctionSpaces >
101 template<
class Tuple >
112 template<
class ... DiscreteFunctionSpaces >
117 template<
class LFFather,
class LFSon,
class LocalGeometry,
class Tuple >
118 static void apply (
const LFFather &lfFather, LFSon &lfSon,
const LocalGeometry &geometryInFather,
bool initialize,
124 typedef typename LFFather::BasisFunctionSetType::template SubBasisFunctionSet< i >::type SubFatherBasisFunctionSetType;
125 typedef typename LFSon::BasisFunctionSetType::template SubBasisFunctionSet< i >::type SubSonBasisFunctionSetType;
127 SubFatherBasisFunctionSetType subFatherBasisFunctionSet = lfFather.basisFunctionSet().template subBasisFunctionSet< i >();
128 SubSonBasisFunctionSetType subSonBasisFunctionSet = lfSon.basisFunctionSet().template subBasisFunctionSet< i >();
130 std::size_t fatherBasisSetOffset = lfFather.basisFunctionSet().offset( i );
131 std::size_t sonBasisSetOffset = lfSon.basisFunctionSet().offset(i);
133 SubDofVectorTypeFather fatherSubDofVector( lfFather.localDofVector(), subFatherBasisFunctionSet.size(), fatherBasisSetOffset );
134 SubDofVectorTypeSon sonSubDofVector( lfSon.localDofVector(), subSonBasisFunctionSet.size(), sonBasisSetOffset );
137 subLFFather( subFatherBasisFunctionSet, fatherSubDofVector );
139 subLFSon( subSonBasisFunctionSet, sonSubDofVector );
141 std::get< i >( tuple ).
prolongLocal( subLFFather, subLFSon, geometryInFather, initialize );
149 template<
class ... DiscreteFunctionSpaces >
154 template<
class LFFather,
class LFSon,
class LocalGeometry,
class Tuple >
155 static void apply ( LFFather &lfFather,
const LFSon &lfSon,
const LocalGeometry &geometryInFather,
bool initialize,
161 typedef typename LFFather::BasisFunctionSetType::template SubBasisFunctionSet< i >::type SubFatherBasisFunctionSetType;
162 typedef typename LFSon::BasisFunctionSetType::template SubBasisFunctionSet< i >::type SubSonBasisFunctionSetType;
164 SubFatherBasisFunctionSetType subFatherBasisFunctionSet = lfFather.basisFunctionSet().template subBasisFunctionSet< i >();
165 SubSonBasisFunctionSetType subSonBasisFunctionSet = lfSon.basisFunctionSet().template subBasisFunctionSet< i >();
167 std::size_t fatherBasisSetOffset = lfFather.basisFunctionSet().offset(i);
168 std::size_t sonBasisSetOffset = lfSon.basisFunctionSet().offset(i);
170 SubDofVectorTypeFather fatherSubDofVector( lfFather.localDofVector(), subFatherBasisFunctionSet.size(), fatherBasisSetOffset );
171 SubDofVectorTypeSon sonSubDofVector( lfSon.localDofVector(), subSonBasisFunctionSet.size(), sonBasisSetOffset );
176 std::get< i >( tuple ).
restrictLocal( subLFFather, subLFSon, geometryInFather, initialize );
185 #endif // #ifndef DUNE_FEM_SPACE_COMBINEDSPACE_TUPLELOCALRESTIRCTPROLONG_HH
Definition: utility.hh:135
void prolongLocal(const LFFather &lfFather, LFSon &lfSon, const LocalGeometry &geometryInFather, bool initialize) const
Definition: tuplelocalrestrictprolong.hh:70
std::tuple_element< 0, LocalRestrictProlongTupleType >::type::DomainFieldType DomainFieldType
Definition: tuplelocalrestrictprolong.hh:43
interface for local functions
Definition: localfunction.hh:41
void restrictLocal(LFFather &lfFather, const LFSon &lfSon, const LocalGeometry &geometryInFather, bool initialize) const
restrict data to father
Definition: tuplelocalrestrictprolong.hh:62
Definition: tuplelocalrestrictprolong.hh:32
Definition: coordinate.hh:4
void setFatherChildWeight(const DomainFieldType &weight)
Definition: tuplelocalrestrictprolong.hh:55
Definition: subvector.hh:22
static constexpr bool Or(bool a)
Definition: utility.hh:98
TupleLocalRestrictProlong(const DiscreteFunctionSpaces &...spaces)
Definition: tuplelocalrestrictprolong.hh:51
bool needCommunication() const
Definition: tuplelocalrestrictprolong.hh:76
bool needCommunication(Std::index_sequence< i... >) const
Definition: tuplelocalrestrictprolong.hh:83