Debian Codegraph @

src/num/aslBasicBC.h

raw
1 /*
2 * Advanced Simulation Library <http://asl.org.il>
3 *
4 * Copyright 2015 Avtech Scientific <http://avtechscientific.com>
5 *
6 *
7 * This file is part of Advanced Simulation Library (ASL).
8 *
9 * ASL is free software: you can redistribute it and/or modify it
10 * under the terms of the GNU Affero General Public License as
11 * published by the Free Software Foundation, version 3 of the License.
12 *
13 * ASL is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Affero General Public License for more details.
17 *
18 * You should have received a copy of the GNU Affero General Public License
19 * along with ASL. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23
24 #ifndef ASLBASICBC_H
25 #define ASLBASICBC_H
26
27 #include "aslBCond.h"
28 #include <data/aslDataWithGhostNodes.h>
29 #include <acl/aclMath/aclVectorOfElementsDef.h>
30
31
32 namespace acl{
33 class Kernel;
34 typedef std::shared_ptr<Kernel> SPKernel;
35 }
36
37
38
39 namespace asl
40 {
41 template <typename T> class UValue;
42 class PositionFunction;
43 typedef std::shared_ptr<PositionFunction> SPPositionFunction;
44
45
46 /// Bondary condition that puts fixed value in each point
47 /**
48 \ingroup GenericBC
49 */
50 class BCConstantValue:public BCond
51 {
52 public:
53 typedef SPAbstractDataWithGhostNodes Data;
54 acl::SPKernel kernel;
55 protected:
56 Data data;
57 acl::VectorOfElements value;
58 public:
59 BCConstantValue(Data d, const acl::VectorOfElements & v);
60 virtual void execute();
61 virtual void init();
62 void setValue(const acl::VectorOfElements & v);
63 };
64
65 /// Bondary condition that puts fixed value in each point
66 /**
67 \ingroup GenericBC
68 */
69 class BCConstantValueMap:public BCondWithMap
70 {
71 public:
72 typedef SPAbstractDataWithGhostNodes Data;
73 acl::SPKernel kernel;
74 protected:
75 Data data;
76 acl::VectorOfElements value;
77 public:
78 BCConstantValueMap(Data d,
79 const acl::VectorOfElements & v,
80 Data map);
81 ~BCConstantValueMap();
82 virtual void execute();
83 virtual void init();
84 void setValue(const acl::VectorOfElements & v);
85 };
86
87 /// Bondary condition that puts fixed value in each boundary point
88 /**
89 \ingroup GenericBC
90 */
91 class BCConstantValueMiddlePointMap:public BCondWithMap
92 {
93 public:
94 typedef SPAbstractDataWithGhostNodes Data;
95 acl::SPKernel kernel;
96 protected:
97 Data data;
98 acl::VectorOfElements value;
99 public:
100 BCConstantValueMiddlePointMap(Data d,
101 const acl::VectorOfElements & v,
102 Data map,
103 const VectorTemplate *const t);
104 ~BCConstantValueMiddlePointMap();
105 virtual void execute();
106 virtual void init();
107 void setValue(const acl::VectorOfElements & v);
108 };
109
110 /// Bondary condition that puts fixed value in each point
111 /**
112 \ingroup GenericBC
113 */
114 class BCValuePFMap:public BCondWithMap
115 {
116 public:
117 typedef SPAbstractDataWithGhostNodes Data;
118 acl::SPKernel kernel;
119 protected:
120 Data data;
121 SPPositionFunction value;
122 public:
123 BCValuePFMap(Data d,
124 SPPositionFunction val,
125 Data map);
126 ~BCValuePFMap();
127 virtual void execute();
128 virtual void init();
129 void setValue(SPPositionFunction v);
130 };
131
132
133 /// Bondary condition that puts fixed value in each point
134 /**
135 \ingroup GenericBC
136 */
137 SPBCond generateBCConstantValue(SPAbstractDataWithGhostNodes d,
138 double v,
139 const std::vector<SlicesNames> & sl);
140 /// Bondary condition that puts fixed value in each point
141 /**
142 \ingroup GenericBC
143 */
144 SPBCond generateBCConstantValue(SPAbstractDataWithGhostNodes d,
145 UValue<double> & v,
146 const std::vector<SlicesNames> & sl);
147 /// Bondary condition that puts fixed value in each point
148 /**
149 \ingroup GenericBC
150 */
151 SPBCond generateBCConstantValue(SPAbstractDataWithGhostNodes d,
152 UValue<AVec<float>> & v,
153 const std::vector<SlicesNames> & sl);
154 /// Bondary condition that puts fixed value in each point
155 /**
156 \ingroup GenericBC
157 */
158 SPBCond generateBCConstantValue(SPAbstractDataWithGhostNodes d,
159 AVec<> v,
160 const std::vector<SlicesNames> & sl);
161
162 /// Bondary condition that puts fixed value in each point \ingroup GenericBC
163 SPNumMethod generateBCConstantValue(SPAbstractDataWithGhostNodes d,
164 double v,
165 SPAbstractDataWithGhostNodes map);
166
167 /// Bondary condition that puts fixed value in each point \ingroup GenericBC
168 SPNumMethod generateBCConstantValue(SPAbstractDataWithGhostNodes d,
169 AVec<> v,
170 SPAbstractDataWithGhostNodes map);
171
172 /// Bondary condition that puts fixed value in each point \ingroup GenericBC
173 SPNumMethod generateBCConstantValue(SPAbstractDataWithGhostNodes d,
174 SPPositionFunction v,
175 SPAbstractDataWithGhostNodes map);
176
177 /// Bondary condition that puts fixed value in each point \ingroup GenericBC
178 SPNumMethod generateBCConstantValueMiddlePoint(SPAbstractDataWithGhostNodes d,
179 double v,
180 SPAbstractDataWithGhostNodes map,
181 const VectorTemplate *const t);
182
183 /// Bondary condition that puts fixed value in each point \ingroup GenericBC
184 SPNumMethod generateBCConstantValueMiddlePoint(SPAbstractDataWithGhostNodes d,
185 AVec<> v,
186 SPAbstractDataWithGhostNodes map,
187 const VectorTemplate *const t);
188
189
190 /// Bondary condition that makes fixed gradient \ingroup GenericBC
191 class BCConstantGradient:public BCond
192 {
193 public:
194 typedef SPAbstractDataWithGhostNodes Data;
195 acl::SPKernel kernel;
196 protected:
197 Data data;
198 acl::VectorOfElements value;
199 public:
200 BCConstantGradient(Data d,
201 const acl::VectorOfElements & v,
202 const VectorTemplate *const t);
203 virtual void execute();
204 virtual void init();
205 void setValue(const acl::VectorOfElements & value);
206 };
207
208 /// Bondary condition that makes fixed gradient \ingroup GenericBC
209 class BCConstantGradientMap:public BCondWithMap
210 {
211 public:
212 typedef SPAbstractDataWithGhostNodes Data;
213 acl::SPKernel kernel;
214 protected:
215 Data data;
216 acl::VectorOfElements value;
217 public:
218 BCConstantGradientMap(Data d,
219 const acl::VectorOfElements & v,
220 Data map,
221 const VectorTemplate *const t);
222 BCConstantGradientMap(Data d,
223 const acl::VectorOfElements & v,
224 Data map,
225 Data computationalDomain,
226 const VectorTemplate *const t);
227 ~BCConstantGradientMap();
228 virtual void execute();
229 virtual void init();
230 void setValue(const acl::VectorOfElements & v);
231 };
232
233 /// Bondary condition that makes fixed gradient \ingroup GenericBC
234 SPBCond generateBCConstantGradient(SPAbstractDataWithGhostNodes d,
235 double v,
236 const VectorTemplate *const t,
237 const std::vector<SlicesNames> & sl);
238
239 /// Bondary condition that makes fixed gradient \ingroup GenericBC
240 SPNumMethod generateBCConstantGradient(SPAbstractDataWithGhostNodes d,
241 double v,
242 SPAbstractDataWithGhostNodes map,
243 const VectorTemplate *const t);
244 /// Bondary condition that makes fixed gradient \ingroup GenericBC
245 SPNumMethod generateBCConstantGradient(SPAbstractDataWithGhostNodes d,
246 double v,
247 SPAbstractDataWithGhostNodes map,
248 SPAbstractDataWithGhostNodes computatinalDomain,
249 const VectorTemplate *const t);
250
251 /// Bondary condition that makes fixed gradient \ingroup GenericBC
252 SPNumMethod generateBCConstantGradient(SPAbstractDataWithGhostNodes d,
253 AVec<> v,
254 SPAbstractDataWithGhostNodes map,
255 const VectorTemplate *const t);
256
257 /// Bondary condition that makes fixed gradient, second order accuracy \ingroup GenericBC
258 SPNumMethod generateBCConstantGradient2(SPAbstractDataWithGhostNodes d,
259 double v,
260 SPAbstractDataWithGhostNodes map,
261 const VectorTemplate *const t);
262 /// Bondary condition that makes fixed gradient, second order accuracy \ingroup GenericBC
263 SPNumMethod generateBCConstantGradient2(SPAbstractDataWithGhostNodes d,
264 double v,
265 SPAbstractDataWithGhostNodes map,
266 SPAbstractDataWithGhostNodes computatinalDomain,
267 const VectorTemplate *const t);
268
269 /// Bondary condition that makes fixed gradient, second order accuracy \ingroup GenericBC
270 SPNumMethod generateBCConstantGradient2(SPAbstractDataWithGhostNodes d,
271 AVec<> v,
272 SPAbstractDataWithGhostNodes map,
273 const VectorTemplate *const t);
274
275 /// Bondary condition that adds fixed value to one in each point
276 /**
277 \ingroup GenericBC
278 */
279 class BCConstantSource:public BCond
280 {
281 public:
282 typedef SPDataWithGhostNodesACLData Data;
283 acl::SPKernel kernel;
284 protected:
285 Data data;
286 cl_double value;
287 public:
288 BCConstantSource(Data d, cl_double v);
289 virtual void execute();
290 virtual void init();
291 void setValue(cl_double value);
292 };
293
294
295 /// Bondary condition that copies directly the values from one data to another
296 /**
297 \ingroup GenericBC
298 */
299 class BCDirectCopier:public BCondConnector
300 {
301 public:
302 typedef SPDataWithGhostNodesACLData Data;
303 acl::SPKernel kernel;
304 protected:
305 Data & source;
306 Data & destination;
307 public:
308 BCDirectCopier(Data dSource,Data dDestination);
309 virtual void execute();
310 virtual void init();
311 };
312
313 /// Bondary condition that puts fixed value in each point uses Slices
314 /**
315 \ingroup GenericBC
316 */
317 class BCSConstantValue:public BCondSlice
318 {
319 public:
320 typedef SPDataWithGhostNodesACLData Data;
321 protected:
322 acl::SPKernel kernel;
323 Data data;
324 cl_double value;
325 public:
326 BCSConstantValue(Data d, cl_double v);
327 virtual void execute();
328 virtual void init();
329 };
330
331
332
333 } //asl
334
335 #endif //ASLBASICBC_H