FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
expression.hpp
1// FEAT3: Finite Element Analysis Toolbox, Version 3
2// Copyright (C) 2010 by Stefan Turek & the FEAT group
3// FEAT3 is released under the GNU General Public License version 3,
4// see the file 'copyright.txt' in the top level directory for details.
5
6#pragma once
7
8// includes, FEAT
11#include <kernel/util/string.hpp>
12
13namespace FEAT
14{
15 namespace Solver
16 {
17 // forward declaration
18 enum class Status;
19
21 enum class ExpressionType
22 {
24 start_solve = 0,
38 defect,
40 timings,
44 prol,
46 rest,
51 };
52
54 inline std::ostream& operator<<(std::ostream& os, ExpressionType type)
55 {
56 switch(type)
57 {
59 return os << "start";
61 return os << "end";
63 return os << "precond";
65 return os << "precond_l";
67 return os << "precond_r";
69 return os << "smoother";
71 return os << "coarse";
73 return os << "defect";
75 return os << "timings";
77 return os << "level_timings";
79 return os << "prol";
81 return os << "rest";
83 return os << "uzawa_s";
85 return os << "uzawa_a";
86 default:
87 return os << "unknown";
88 }
89 }
91
93 {
94 public:
95 String solver_name;
96
97 explicit ExpressionBase(String name) :
98 solver_name(name)
99 {
100 }
101
102 virtual ~ExpressionBase()
103 {
104 }
105
106 virtual ExpressionType get_type() = 0;
107 };
108
110 {
111 public:
112 explicit ExpressionStartSolve(String name) :
113 ExpressionBase(name)
114 {
115 }
116
117 virtual ~ExpressionStartSolve()
118 {
119 }
120
121 virtual ExpressionType get_type() override
122 {
124 }
125 };
126
128 {
129 public:
134
135 explicit ExpressionEndSolve(String name, Status end_status, Index iterations) :
136 ExpressionBase(name),
137 status(end_status),
138 iters(iterations)
139 {
140 }
141 virtual ~ExpressionEndSolve()
142 {
143 }
144
145 virtual ExpressionType get_type() override
146 {
148 }
149 };
150
152 {
153 public:
154 String precond_name;
155
156 explicit ExpressionCallPrecond(String name, String precond_name_in) :
157 ExpressionBase(name),
158 precond_name(precond_name_in)
159 {
160 }
161
162 virtual ~ExpressionCallPrecond()
163 {
164 }
165
166 virtual ExpressionType get_type() override
167 {
169 }
170 };
171
173 {
174 public:
175 String precond_name;
176
177 explicit ExpressionCallPrecondL(String name, String precond_name_in) :
178 ExpressionBase(name),
179 precond_name(precond_name_in)
180 {
181 }
182
184 {
185 }
186
187 virtual ExpressionType get_type() override
188 {
190 }
191 };
192
194 {
195 public:
196 String precond_name;
197
198 explicit ExpressionCallPrecondR(String name, String precond_name_in) :
199 ExpressionBase(name),
200 precond_name(precond_name_in)
201 {
202 }
203
205 {
206 }
207
208 virtual ExpressionType get_type() override
209 {
211 }
212 };
213
215 {
216 public:
217 String smoother_name;
218
219 explicit ExpressionCallSmoother(String name, String smoother_name_in) :
220 ExpressionBase(name),
221 smoother_name(smoother_name_in)
222 {
223 }
224
226 {
227 }
228
229 virtual ExpressionType get_type() override
230 {
232 }
233 };
234
236 {
237 public:
238 String coarse_solver_name;
239
240 explicit ExpressionCallCoarseSolver(String name, String coarse_solver_name_in) :
241 ExpressionBase(name),
242 coarse_solver_name(coarse_solver_name_in)
243 {
244 }
245
247 {
248 }
249
250 virtual ExpressionType get_type() override
251 {
253 }
254 };
255
257 {
258 public:
259 Index level;
260
261 explicit ExpressionProlongation(String name, Index level_in) :
262 ExpressionBase(name),
263 level(level_in)
264 {
265 }
266
268 {
269 }
270
271 virtual ExpressionType get_type() override
272 {
274 }
275 };
276
278 {
279 public:
280 Index level;
281
282 explicit ExpressionRestriction(String name, Index level_in) :
283 ExpressionBase(name),
284 level(level_in)
285 {
286 }
287
288 virtual ~ExpressionRestriction()
289 {
290 }
291
292 virtual ExpressionType get_type() override
293 {
295 }
296 };
297
299 {
300 public:
301 double def;
302 Index iter;
303
304 explicit ExpressionDefect(String name, double defect, Index iter_in) :
305 ExpressionBase(name),
306 def(defect),
307 iter(iter_in)
308 {
309 }
310
311 virtual ~ExpressionDefect()
312 {
313 }
314
315 virtual ExpressionType get_type() override
316 {
318 }
319 };
320
322 {
323 public:
324 double solver_toe, mpi_execute_reduction, mpi_execute_blas2, mpi_execute_blas3, mpi_execute_collective, mpi_wait_reduction, mpi_wait_blas2, mpi_wait_blas3, mpi_wait_collective;
325
326 explicit ExpressionTimings(String name, double solver_toe_in, double mpi_execute_reduction_in, double mpi_execute_blas2_in, double mpi_execute_blas3_in,
327 double mpi_execute_collective_in, double mpi_wait_reduction_in, double mpi_wait_blas2_in, double mpi_wait_blas3_in, double mpi_wait_collective_in) :
328 ExpressionBase(name),
329 solver_toe(solver_toe_in),
330 mpi_execute_reduction(mpi_execute_reduction_in),
331 mpi_execute_blas2(mpi_execute_blas2_in),
332 mpi_execute_blas3(mpi_execute_blas3_in),
333 mpi_execute_collective(mpi_execute_collective_in),
334 mpi_wait_reduction(mpi_wait_reduction_in),
335 mpi_wait_blas2(mpi_wait_blas2_in),
336 mpi_wait_blas3(mpi_wait_blas3_in),
337 mpi_wait_collective(mpi_wait_collective_in)
338 {
339 }
340
341 virtual ~ExpressionTimings()
342 {
343 }
344
345 virtual ExpressionType get_type() override
346 {
348 }
349 };
350
352 {
353 public:
354 Index level;
355 double level_toe, mpi_execute_reduction, mpi_execute_blas2, mpi_execute_blas3, mpi_execute_collective, mpi_wait_reduction, mpi_wait_blas2, mpi_wait_blas3, mpi_wait_collective;
356
357 explicit ExpressionLevelTimings(String name, Index level_in, double level_toe_in, double mpi_execute_reduction_in, double mpi_execute_blas2_in, double mpi_execute_blas3_in,
358 double mpi_execute_collective_in, double mpi_wait_reduction_in, double mpi_wait_blas2_in, double mpi_wait_blas3_in, double mpi_wait_collective_in) :
359 ExpressionBase(name),
360 level(level_in),
361 level_toe(level_toe_in),
362 mpi_execute_reduction(mpi_execute_reduction_in),
363 mpi_execute_blas2(mpi_execute_blas2_in),
364 mpi_execute_blas3(mpi_execute_blas3_in),
365 mpi_execute_collective(mpi_execute_collective_in),
366 mpi_wait_reduction(mpi_wait_reduction_in),
367 mpi_wait_blas2(mpi_wait_blas2_in),
368 mpi_wait_blas3(mpi_wait_blas3_in),
369 mpi_wait_collective(mpi_wait_collective_in)
370 {
371 }
372
374 {
375 }
376
377 virtual ExpressionType get_type() override
378 {
380 }
381 };
382
384 {
385 public:
386 String solver_s_name;
387
388 explicit ExpressionCallUzawaS(String name, String solver_s_name_in) :
389 ExpressionBase(name),
390 solver_s_name(solver_s_name_in)
391 {
392 }
393
394 virtual ~ExpressionCallUzawaS()
395 {
396 }
397
398 virtual ExpressionType get_type() override
399 {
401 }
402 };
403
405 {
406 public:
407 String solver_a_name;
408
409 explicit ExpressionCallUzawaA(String name, String solver_a_name_in) :
410 ExpressionBase(name),
411 solver_a_name(solver_a_name_in)
412 {
413 }
414
415 virtual ~ExpressionCallUzawaA()
416 {
417 }
418
419 virtual ExpressionType get_type() override
420 {
422 }
423 };
424 } // namespace Solver
425} // namespace FEAT
FEAT Kernel base header.
Index iters
the iteration count needed in this solve process
Definition: expression.hpp:133
Status status
the status result of the solver call
Definition: expression.hpp:131
String class implementation.
Definition: string.hpp:46
@ defect
left-preconditioned defect minimization
@ iter
Plot every iteration (if applicable)
ExpressionType
Expression Type enumeration.
Definition: expression.hpp:22
@ timings
annotate iterations timings
@ call_uzawa_a
call A matrix solver (uzawa complement)
@ prol
prolonation (multigrid)
@ end_solve
end last solve process
@ call_precond_l
call L preconditioner
@ defect
annotate iterations defect
@ rest
restriction (multigrid)
@ call_uzawa_s
call S matrix solver (uzawa complement)
@ call_coarse_solver
call coarse grid solver
@ call_precond_r
call R preconditioner
@ level_timings
annotate level timings
@ call_precond
call preconditioner
@ start_solve
start new solve process
Status
Solver status return codes enumeration.
Definition: base.hpp:47
FEAT namespace.
Definition: adjactor.hpp:12
std::uint64_t Index
Index data type.