dune-fem  2.4.1-rc
powerlocalrestrictprolong.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_SPACE_COMBINEDSPACE_POWERLOCALRESTRICPROLONG_HH
2 #define DUNE_FEM_SPACE_COMBINEDSPACE_POWERLOCALRESTRICPROLONG_HH
3 
4 #include <algorithm>
5 
6 #include <dune/common/exceptions.hh>
7 
11 
13 
14 
15 namespace Dune
16 {
17 
18  namespace Fem
19  {
20 
21  // PowerLocalRestricProlong
22  // ------------------------
23 
24  template< class DiscreteFunctionSpace, int N >
26  {
28 
29  // type of contained DefaultLocalRestrictProlong
31 
32  public:
33  // type of DomainField
34  typedef typename LocalRestrictProlongType::DomainFieldType DomainFieldType;
35 
37  : localRestrictProlong_( space )
38  {}
39 
40  void setFatherChildWeight ( const DomainFieldType &weight )
41  {
42  localRestrictProlong_.setFatherChildWeight( weight );
43  }
44 
46  template< class LFFather, class LFSon, class LocalGeometry >
47  void restrictLocal ( LFFather &lfFather, const LFSon &lfSon,
48  const LocalGeometry &geometryInFather, bool initialize ) const
49  {
51  typedef DenseSubVector< typename LFFather::LocalDofVectorType > SubDofVectorTypeFather;
52 
53  typedef typename LFSon::BasisFunctionSetType::ScalarBasisFunctionSetType SubSonBasisFunctionSetType;
54  typedef typename LFFather::BasisFunctionSetType::ScalarBasisFunctionSetType SubFatherBasisFunctionSetType;
55 
56  SubFatherBasisFunctionSetType subFatherBasisFunctionSet = lfFather.basisFunctionSet().scalarBasisFunctionSet();
57  SubSonBasisFunctionSetType subSonBasisFunctionSet = lfSon.basisFunctionSet().scalarBasisFunctionSet();
58 
59  for( std::size_t i = 0; i < N; ++i )
60  {
61  std::size_t sonBasisSetSize = subSonBasisFunctionSet.size();
62  std::size_t fatherBasisSetsize = subFatherBasisFunctionSet.size();
63 
64  SubDofVectorTypeSon sonSubDofVector( lfSon.localDofVector(), sonBasisSetSize, sonBasisSetSize * i );
65  SubDofVectorTypeFather fatherSubDofVector( lfFather.localDofVector(), fatherBasisSetsize, fatherBasisSetsize * i );
66 
68  subLFSon( subSonBasisFunctionSet, sonSubDofVector );
70  subLFFather( subFatherBasisFunctionSet, fatherSubDofVector );
71 
72  localRestrictProlong_.restrictLocal( subLFFather, subLFSon, geometryInFather, initialize );
73  }
74  }
75 
76 
77  template< class LFFather, class LFSon, class LocalGeometry >
78  void prolongLocal ( const LFFather &lfFather, LFSon &lfSon,
79  const LocalGeometry &geometryInFather, bool initialize ) const
80  {
81  typedef DenseSubVector< typename LFSon::LocalDofVectorType > SubDofVectorTypeSon;
83 
84  typedef typename LFSon::BasisFunctionSetType::ScalarBasisFunctionSetType SubSonBasisFunctionSetType;
85  typedef typename LFFather::BasisFunctionSetType::ScalarBasisFunctionSetType SubFatherBasisFunctionSetType;
86 
87  SubSonBasisFunctionSetType subSonBasisFunctionSet = lfSon.basisFunctionSet().scalarBasisFunctionSet();
88  SubFatherBasisFunctionSetType subFatherBasisFunctionSet = lfFather.basisFunctionSet().scalarBasisFunctionSet();
89 
90  for( std::size_t i = 0; i < N; ++i )
91  {
92  std::size_t sonBasisSetSize = subSonBasisFunctionSet.size();
93  std::size_t fatherBasisSetsize = subFatherBasisFunctionSet.size();
94 
95  SubDofVectorTypeSon sonSubDofVector( lfSon.localDofVector(), sonBasisSetSize, sonBasisSetSize * i );
96  SubDofVectorTypeFather fatherSubDofVector( lfFather.localDofVector(), fatherBasisSetsize, fatherBasisSetsize * i );
97 
99  subLFSon( subSonBasisFunctionSet, sonSubDofVector );
101  subLFFather( subFatherBasisFunctionSet, fatherSubDofVector );
102 
103  localRestrictProlong_.prolongLocal( subLFFather, subLFSon, geometryInFather, initialize );
104  }
105  }
106 
107  bool needCommunication () const
108  {
109  return localRestrictProlong_.needCommunication();
110  }
111 
112  private:
113  LocalRestrictProlongType localRestrictProlong_;
114  };
115 
116  } // namespace Fem
117 
118 } // namespace Dune
119 
120 #endif // #ifndef DUNE_FEM_SPACE_COMBINEDSPACE_POWERLOCALRESTRICPROLONG_HH
Definition: powerlocalrestrictprolong.hh:25
void prolongLocal(const LFFather &lfFather, LFSon &lfSon, const LocalGeometry &geometryInFather, bool initialize) const
Definition: powerlocalrestrictprolong.hh:78
PowerLocalRestrictProlong(const DiscreteFunctionSpace &space)
Definition: powerlocalrestrictprolong.hh:36
void setFatherChildWeight(const DomainFieldType &weight)
Definition: powerlocalrestrictprolong.hh:40
interface for local functions
Definition: localfunction.hh:41
Definition: coordinate.hh:4
Definition: subvector.hh:22
void restrictLocal(LFFather &lfFather, const LFSon &lfSon, const LocalGeometry &geometryInFather, bool initialize) const
restrict data to father
Definition: powerlocalrestrictprolong.hh:47
Definition: const.hh:35
LocalRestrictProlongType::DomainFieldType DomainFieldType
Definition: powerlocalrestrictprolong.hh:34
discrete function space
bool needCommunication() const
Definition: powerlocalrestrictprolong.hh:107
Definition: common/localrestrictprolong.hh:16