restrictprolong.hh
Go to the documentation of this file.
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 <cassert>
27
28#if HAVE_DUNE_FEM
29#include <dune/fem/space/common/restrictprolonginterface.hh>
30#endif
31
32namespace Opm {
33
34template <class Grid, class Container>
35class CopyRestrictProlong;
36
37template <class Grid, class Container>
39{
40 using DomainFieldType = typename Grid::ctype;
42};
43
44template<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
54public:
55 using DomainFieldType = typename Grid::ctype;
56
57 explicit CopyRestrictProlong(Container& container)
58 : container_(container)
59 {}
60
67 template <class Field>
68 void setFatherChildWeight(const Field&) const
69 {}
70
72 template<class Entity>
73 void restrictLocal (const Entity& father, const Entity& son, bool initialize) const
74 {
75 container_.resize();
76 assert(container_.codimension() == 0);
77 if (initialize) {
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&,
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) 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&,
108 bool initialize) const
109 { prolongLocal(father, son, initialize); }
110
114 template<class Communicator>
115 void addToList(Communicator&)
116 {
117 // TODO
118 }
119
123 template<class LoadBalancer>
124 void addToLoadBalancer(LoadBalancer&)
125 {
126 // TODO
127 }
128};
129
130class EmptyRestrictProlong;
131
133{
134 using DomainFieldType = double;
136};
137
139#if HAVE_DUNE_FEM
140 : public Dune::Fem::RestrictProlongInterfaceDefault< EmptyRestrictProlongTraits >
141#endif
142{
144
145public:
152 template <class Field>
153 void setFatherChildWeight(const Field&) const
154 {}
155
157 template<class Entity>
158 void restrictLocal(const Entity&,
159 const Entity&,
160 bool) const
161 {}
162
164 template<class Entity, class LocalGeometry>
165 void restrictLocal(const Entity&,
166 const Entity&,
167 const LocalGeometry&,
168 bool) const
169 {}
170
172 template<class Entity>
173 void prolongLocal(const Entity&,
174 const Entity&,
175 bool) const
176 {}
177
179 template<class Entity, class LocalGeometry>
180 void prolongLocal(const Entity&,
181 const Entity&,
182 const LocalGeometry&,
183 bool) const
184 {}
185
189 template<class Communicator>
190 void addToList(Communicator&)
191 {}
192
196 template<class LoadBalancer>
197 void addToLoadBalancer(LoadBalancer&)
198 {}
199};
200
201} // namespace Opm
202
203#endif
Definition: restrictprolong.hh:49
void addToLoadBalancer(LoadBalancer &)
add discrete function to load balancer
Definition: restrictprolong.hh:124
typename Grid::ctype DomainFieldType
Definition: restrictprolong.hh:55
void restrictLocal(const Entity &father, const Entity &son, bool initialize) const
restrict data to father
Definition: restrictprolong.hh:73
void setFatherChildWeight(const Field &) const
explicit set volume ratio of son and father
Definition: restrictprolong.hh:68
void prolongLocal(const Entity &father, const Entity &son, const LocalGeometry &, bool initialize) const
prolong data to children
Definition: restrictprolong.hh:105
void prolongLocal(const Entity &father, const Entity &son, bool) const
prolong data to children
Definition: restrictprolong.hh:93
void restrictLocal(const Entity &father, const Entity &son, const LocalGeometry &, bool initialize) const
restrict data to father
Definition: restrictprolong.hh:85
void addToList(Communicator &)
add discrete function to communicator
Definition: restrictprolong.hh:115
CopyRestrictProlong(Container &container)
Definition: restrictprolong.hh:57
Definition: restrictprolong.hh:142
void addToList(Communicator &)
add discrete function to communicator
Definition: restrictprolong.hh:190
void restrictLocal(const Entity &, const Entity &, const LocalGeometry &, bool) const
restrict data to father
Definition: restrictprolong.hh:165
void prolongLocal(const Entity &, const Entity &, const LocalGeometry &, bool) const
prolong data to children
Definition: restrictprolong.hh:180
void addToLoadBalancer(LoadBalancer &)
add discrete function to load balancer
Definition: restrictprolong.hh:197
void setFatherChildWeight(const Field &) const
explicit set volume ratio of son and father
Definition: restrictprolong.hh:153
void prolongLocal(const Entity &, const Entity &, bool) const
prolong data to children
Definition: restrictprolong.hh:173
void restrictLocal(const Entity &, const Entity &, bool) const
restrict data to father
Definition: restrictprolong.hh:158
Definition: blackoilboundaryratevector.hh:39
Definition: restrictprolong.hh:39
typename Grid::ctype DomainFieldType
Definition: restrictprolong.hh:40
Definition: restrictprolong.hh:133
double DomainFieldType
Definition: restrictprolong.hh:134