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#if HAVE_DUNE_FEM
27#include <dune/fem/space/common/restrictprolonginterface.hh>
28#endif
29
30namespace Opm
31{
32 template < class Grid, class Container >
33 class CopyRestrictProlong;
34
35 template < class Grid, class Container >
37 {
38 using DomainFieldType = typename Grid::ctype;
40 };
41
42 template< class Grid, class Container >
44#if HAVE_DUNE_FEM
45 : public Dune::Fem::RestrictProlongInterfaceDefault< CopyRestrictProlongTraits< Grid, Container > >
46#endif
47 {
49
50 Container& container_;
51 public:
52 using DomainFieldType = typename Grid::ctype;
53
54 explicit CopyRestrictProlong( Container& container )
55 : container_( container )
56 {}
57
64 template <class Field>
65 void setFatherChildWeight(const Field&) const
66 {}
67
69 template< class Entity >
70 void restrictLocal ( const Entity& father, const Entity& son, bool initialize ) const
71 {
72 container_.resize();
73 assert( container_.codimension() == 0 );
74 if( initialize )
75 {
76 // copy values from son to father (only once)
77 container_[ father ] = container_[ son ];
78 }
79 }
80
82 template< class Entity, class LocalGeometry >
83 void restrictLocal(const Entity& father,
84 const Entity& son,
85 const LocalGeometry&,
86 bool initialize) const
87 { restrictLocal(father, son, initialize); }
88
90 template< class Entity >
91 void prolongLocal(const Entity& father,
92 const Entity& son,
93 bool) const
94 {
95 container_.resize();
96 assert( container_.codimension() == 0 );
97 // copy values from father to son all sons
98 container_[ son ] = container_[ father ];
99 }
100
102 template< class Entity, class LocalGeometry >
103 void prolongLocal(const Entity& father,
104 const Entity& son,
105 const LocalGeometry&,
106 bool initialize) const
107 { prolongLocal(father, son, initialize); }
108
112 template< class Communicator >
113 void addToList(Communicator&)
114 {
115 // TODO
116 }
117
121 template< class LoadBalancer >
122 void addToLoadBalancer(LoadBalancer&)
123 {
124 // TODO
125 }
126
127 };
128
129
130 class EmptyRestrictProlong;
131
133 {
134 using DomainFieldType = double ;
136 };
137
139#if HAVE_DUNE_FEM
140 : public Dune::Fem::RestrictProlongInterfaceDefault< EmptyRestrictProlongTraits >
141#endif
142 {
144
145 public:
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:47
void addToLoadBalancer(LoadBalancer &)
add discrete function to load balancer
Definition: restrictprolong.hh:122
typename Grid::ctype DomainFieldType
Definition: restrictprolong.hh:52
void restrictLocal(const Entity &father, const Entity &son, bool initialize) const
restrict data to father
Definition: restrictprolong.hh:70
void setFatherChildWeight(const Field &) const
explicit set volume ratio of son and father
Definition: restrictprolong.hh:65
void prolongLocal(const Entity &father, const Entity &son, const LocalGeometry &, bool initialize) const
prolong data to children
Definition: restrictprolong.hh:103
void prolongLocal(const Entity &father, const Entity &son, bool) const
prolong data to children
Definition: restrictprolong.hh:91
void restrictLocal(const Entity &father, const Entity &son, const LocalGeometry &, bool initialize) const
restrict data to father
Definition: restrictprolong.hh:83
void addToList(Communicator &)
add discrete function to communicator
Definition: restrictprolong.hh:113
CopyRestrictProlong(Container &container)
Definition: restrictprolong.hh:54
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:37
Definition: restrictprolong.hh:37
typename Grid::ctype DomainFieldType
Definition: restrictprolong.hh:38
Definition: restrictprolong.hh:133
double DomainFieldType
Definition: restrictprolong.hh:134