-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfast_output.hxx
58 lines (47 loc) · 1.91 KB
/
fast_output.hxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
Copyright J. Omotani, UKAEA, 2018
email: [email protected]
FastOutput is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
FastOutput is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FastOutput. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef __FAST_OUTPUT_H__
#define __FAST_OUTPUT_H__
#include <bout/monitor.hxx>
#include <bout/physicsmodel.hxx>
#include <bout/region.hxx>
#include <datafile.hxx>
#include <globals.hxx>
#include <deque>
class Solver;
// Subclass of BOUT++ Monitor class so we can pass to Solver::
class FastOutput : public Monitor {
public:
FastOutput(Options* opt = nullptr);
FastOutput(FastOutput &f) = delete;
FastOutput &operator=(FastOutput &f) = delete;
/// Add a point to the output: the element of f with global indices
/// {ix,iy,iz} will be written when monitor_method() is called
void add(const std::string name, Field3D &f, const int ix, const int iy, const int iz);
/// Writes added points to output_file
int monitor_method(BoutReal simtime);
bool enabled=false, enable_monitor=false, enable_timestep=false;
/// provide Monitor::call method which is called by the Solver
int call(Solver* UNUSED(solver), BoutReal time, int UNUSED(iter), int UNUSED(nout)) {
return monitor_method(time);
}
private:
Datafile output_file;
std::deque<Field3D*> field3d_list;
std::deque<Ind3D> field3d_inds;
BoutReal current_time;
std::deque<BoutReal> output_vals;
};
#endif //__FAST_OUTPUT_H__