restrictprolong.hh
1 // -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 // vi: set et ts=4 sw=4 sts=4:
3 /*
4  This file is part of the Open Porous Media project (OPM).
5 
6  OPM is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 2 of the License, or
9  (at your option) any later version.
10 
11  OPM is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with OPM. If not, see <http://www.gnu.org/licenses/>.
18 
19  Consult the COPYING file in the top-level source directory of this
20  module for the precise wording of the license and the list of
21  copyright holders.
22 */
23 #ifndef EWOMS_COPYRESTRICTPROLONG_HH
24 #define EWOMS_COPYRESTRICTPROLONG_HH
25 
26 #include <opm/common/Unused.hpp>
27 
28 #if HAVE_DUNE_FEM
29 #include <dune/fem/space/common/restrictprolonginterface.hh>
30 #endif
31 
32 namespace Ewoms
33 {
34  template < class Grid, class Container >
36 
37  template < class Grid, class Container >
39  {
40  typedef typename Grid::ctype DomainFieldType;
42  };
43 
44  template< class Grid, class Container >
46 #if HAVE_DUNE_FEM
47  : public Dune::Fem::RestrictProlongInterfaceDefault< CopyRestrictProlongTraits< Grid, Container > >
48 #endif
49  {
51 
52  Container& container_;
53  public:
54  typedef typename Grid::ctype DomainFieldType;
55 
56  explicit CopyRestrictProlong( Container& container )
57  : container_( container )
58  {}
59 
66  template <class Field>
67  void setFatherChildWeight(const Field& weight OPM_UNUSED) const
68  {}
69 
71  template< class Entity >
72  void restrictLocal ( const Entity& father, const Entity& son, bool initialize ) const
73  {
74  container_.resize();
75  assert( container_.codimension() == 0 );
76  if( initialize )
77  {
78  // copy values from son to father (only once)
79  container_[ father ] = container_[ son ];
80  }
81  }
82 
84  template< class Entity, class LocalGeometry >
85  void restrictLocal(const Entity& father,
86  const Entity& son,
87  const LocalGeometry& geometryInFather OPM_UNUSED,
88  bool initialize) const
89  { restrictLocal(father, son, initialize); }
90 
92  template< class Entity >
93  void prolongLocal(const Entity& father,
94  const Entity& son,
95  bool initialize OPM_UNUSED) const
96  {
97  container_.resize();
98  assert( container_.codimension() == 0 );
99  // copy values from father to son all sons
100  container_[ son ] = container_[ father ];
101  }
102 
104  template< class Entity, class LocalGeometry >
105  void prolongLocal(const Entity& father,
106  const Entity& son,
107  const LocalGeometry& geometryInFather OPM_UNUSED,
108  bool initialize) const
109  { prolongLocal(father, son, initialize); }
110 
114  template< class Communicator >
115  void addToList(Communicator& comm OPM_UNUSED)
116  {
117  // TODO
118  }
119 
123  template< class LoadBalancer >
124  void addToLoadBalancer(LoadBalancer& lb OPM_UNUSED)
125  {
126  // TODO
127  }
128 
129  };
130 
131 
132  class EmptyRestrictProlong;
133 
135  {
136  typedef double DomainFieldType;
138  };
139 
141 #if HAVE_DUNE_FEM
142  : public Dune::Fem::RestrictProlongInterfaceDefault< EmptyRestrictProlongTraits >
143 #endif
144  {
146 
147  public:
154  template <class Field>
155  void setFatherChildWeight(const Field& weight OPM_UNUSED) const
156  { }
157 
159  template< class Entity >
160  void restrictLocal(const Entity& father OPM_UNUSED,
161  const Entity& son OPM_UNUSED,
162  bool initialize OPM_UNUSED) const
163  { }
164 
166  template< class Entity, class LocalGeometry >
167  void restrictLocal(const Entity& father OPM_UNUSED,
168  const Entity& son OPM_UNUSED,
169  const LocalGeometry& geometryInFather OPM_UNUSED,
170  bool initialize OPM_UNUSED) const
171  { }
172 
174  template< class Entity >
175  void prolongLocal(const Entity& father OPM_UNUSED,
176  const Entity& son OPM_UNUSED,
177  bool initialize OPM_UNUSED) const
178  { }
179 
181  template< class Entity, class LocalGeometry >
182  void prolongLocal(const Entity& father OPM_UNUSED,
183  const Entity& son OPM_UNUSED,
184  const LocalGeometry& geometryInFather OPM_UNUSED,
185  bool initialize OPM_UNUSED) const
186  { }
187 
191  template< class Communicator >
192  void addToList(Communicator& comm OPM_UNUSED)
193  { }
194 
198  template< class LoadBalancer >
199  void addToLoadBalancer(LoadBalancer& lb OPM_UNUSED)
200  { }
201  };
202 
203 } // namespace Ewoms
204 
205 #endif
void setFatherChildWeight(const Field &weight OPM_UNUSED) const
explicit set volume ratio of son and father
Definition: restrictprolong.hh:155
void restrictLocal(const Entity &father OPM_UNUSED, const Entity &son OPM_UNUSED, const LocalGeometry &geometryInFather OPM_UNUSED, bool initialize OPM_UNUSED) const
restrict data to father
Definition: restrictprolong.hh:167
Definition: baseauxiliarymodule.hh:37
void addToList(Communicator &comm OPM_UNUSED)
add discrete function to communicator
Definition: restrictprolong.hh:192
Definition: restrictprolong.hh:134
void restrictLocal(const Entity &father, const Entity &son, const LocalGeometry &geometryInFather OPM_UNUSED, bool initialize) const
restrict data to father
Definition: restrictprolong.hh:85
void prolongLocal(const Entity &father, const Entity &son, const LocalGeometry &geometryInFather OPM_UNUSED, bool initialize) const
prolong data to children
Definition: restrictprolong.hh:105
void prolongLocal(const Entity &father, const Entity &son, bool initialize OPM_UNUSED) const
prolong data to children
Definition: restrictprolong.hh:93
void addToList(Communicator &comm OPM_UNUSED)
add discrete function to communicator
Definition: restrictprolong.hh:115
Definition: restrictprolong.hh:35
Definition: restrictprolong.hh:38
void addToLoadBalancer(LoadBalancer &lb OPM_UNUSED)
add discrete function to load balancer
Definition: restrictprolong.hh:199
Definition: restrictprolong.hh:140
void prolongLocal(const Entity &father OPM_UNUSED, const Entity &son OPM_UNUSED, bool initialize OPM_UNUSED) const
prolong data to children
Definition: restrictprolong.hh:175
void restrictLocal(const Entity &father, const Entity &son, bool initialize) const
restrict data to father
Definition: restrictprolong.hh:72
void prolongLocal(const Entity &father OPM_UNUSED, const Entity &son OPM_UNUSED, const LocalGeometry &geometryInFather OPM_UNUSED, bool initialize OPM_UNUSED) const
prolong data to children
Definition: restrictprolong.hh:182
void setFatherChildWeight(const Field &weight OPM_UNUSED) const
explicit set volume ratio of son and father
Definition: restrictprolong.hh:67
void restrictLocal(const Entity &father OPM_UNUSED, const Entity &son OPM_UNUSED, bool initialize OPM_UNUSED) const
restrict data to father
Definition: restrictprolong.hh:160
void addToLoadBalancer(LoadBalancer &lb OPM_UNUSED)
add discrete function to load balancer
Definition: restrictprolong.hh:124