1#ifndef DUNE_FEM_LOCALRESTRICTPROLONG_HH
2#define DUNE_FEM_LOCALRESTRICTPROLONG_HH
4#include <dune/fem/function/localfunction/localfunction.hh>
15 template<
class DiscreteFunctionSpace >
16 class DefaultLocalRestrictProlong;
23 template<
class DiscreteFunctionSpace >
24 class ConstantLocalRestrictProlong
26 typedef ConstantLocalRestrictProlong< DiscreteFunctionSpace > ThisType;
31 typedef typename DiscreteFunctionSpaceType::DomainFieldType DomainFieldType;
33 ConstantLocalRestrictProlong ()
43 void setFatherChildWeight (
const DomainFieldType &weight )
49 template<
class LFFather,
class LFSon,
class LocalGeometry >
50 void restrictLocal ( LFFather &lfFather,
const LFSon &lfSon,
51 const LocalGeometry &geometryInFather,
bool initialize )
const
53 const DomainFieldType weight = (weight_ < DomainFieldType( 0 ) ? calcWeight( lfFather.entity(), lfSon.entity() ) : weight_);
55 assert( weight > 0.0 );
58 const int size = lfFather.size();
59 assert( lfFather.size() == lfSon.size() );
62 for(
int i = 0; i <
size; ++i )
63 lfFather[ i ] = weight * lfSon[ i ];
67 for(
int i = 0; i <
size; ++i )
68 lfFather[ i ] += weight * lfSon[ i ];
71 template<
class LFFather >
72 void restrictFinalize ( LFFather &lfFather )
const
76 template<
class LFFather,
class LFSon,
class LocalGeometry >
77 void prolongLocal (
const LFFather &lfFather, LFSon &lfSon,
78 const LocalGeometry &geometryInFather,
bool initialize )
const
80 const int size = lfFather.size();
81 assert( lfFather.size() == lfSon.size() );
82 for(
int i = 0; i <
size; ++i )
83 lfSon[ i ] = lfFather[ i ];
87 bool needCommunication ()
const {
return true; }
90 template<
class Entity >
91 static DomainFieldType calcWeight (
const Entity &father,
const Entity &son )
93 return son.geometry().volume() / father.geometry().volume();
97 DomainFieldType weight_;
105 template<
class DiscreteFunctionSpace >
106 class EmptyLocalRestrictProlong
108 typedef EmptyLocalRestrictProlong< DiscreteFunctionSpace > ThisType;
113 typedef typename DiscreteFunctionSpaceType::DomainFieldType DomainFieldType;
121 void setFatherChildWeight (
const DomainFieldType &weight ) {}
124 template<
class LFFather,
class LFSon,
class LocalGeometry >
125 void restrictLocal ( LFFather &lfFather,
const LFSon &lfSon,
126 const LocalGeometry &geometryInFather,
bool initialize )
const
128 template<
class LFFather >
129 void restrictFinalize ( LFFather &lfFather )
const
133 template<
class LFFather,
class LFSon,
class LocalGeometry >
134 void prolongLocal (
const LFFather &lfFather, LFSon &lfSon,
135 const LocalGeometry &geometryInFather,
bool initialize )
const
139 bool needCommunication ()
const {
return false; }
Dune namespace.
Definition: alignedallocator.hh:13
constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std::integer_sequence< T, II... >)
Return the size of the sequence.
Definition: integersequence.hh:75