AQUAgpusph 4.1.2
Loading...
Searching...
No Matches
TimeManager.h
Go to the documentation of this file.
1/*
2 * This file is part of AQUAgpusph, a free CFD program based on SPH.
3 * Copyright (C) 2012 Jose Luis Cercos Pita <jl.cercos@upm.es>
4 *
5 * AQUAgpusph is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * AQUAgpusph is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with AQUAgpusph. If not, see <http://www.gnu.org/licenses/>.
17 */
18
24#ifndef TIMEMANAGER_H_INCLUDED
25#define TIMEMANAGER_H_INCLUDED
26
27#include <sphPrerequisites.h>
28#include <ProblemSetup.h>
29
30namespace Aqua {
31namespace InputOutput {
32
43{
44 public:
49 TimeManager(ProblemSetup& sim_data);
50
53
57 void update(float dt);
58
62 bool mustStop();
63
69 bool mustPrintOutput();
70
74 void step(unsigned int s) { *_step = s; }
78 unsigned int step() { return *_step; }
82 void time(float t) { *_time = t; }
86 float time() { return *_time; }
93 void frame(unsigned int frame) { *_frame = frame; }
100 unsigned int frame() { return *_frame; }
104 void dt(float dt) { *_dt = dt; }
108 float dt() { return *_dt; }
109
113 void outputStep(int s) { _output_step = s; }
117 int outputStep() { return _output_step; }
121 int outputIPF() { return _output_ipf; }
125 void outputTime(float t) { _output_time = t; }
129 float outputTime() { return _output_time; }
133 float outputFPS() { return _output_fps; }
134
138 float maxTime() { return *_time_max; }
142 unsigned int maxStep() { return *_steps_max; }
146 unsigned int maxFrame() { return *_frames_max; }
147
148 private:
150 unsigned int* _step;
152 float* _time;
154 float* _dt;
156 unsigned int* _frame;
159 float* _time_max;
162 unsigned int* _steps_max;
165 unsigned int* _frames_max;
166
168 float _output_time;
170 float _output_fps;
172 int _output_step;
174 int _output_ipf;
175};
176
177}
178} // namespace
179
180#endif // TIMEMANAGER_H_INCLUDED
Simulation configuration data structures. (See Aqua::InputOutput::ProblemSetup for details)
Simulation configuration data.
Definition: ProblemSetup.h:91
Main AQUAgpusph namespace.
Definition: ArgumentsManager.cpp:45
Set of definitions and macros related with the implementation.
Simulation time flow manager.
Definition: TimeManager.h:43
int outputStep()
Get the last output event time step index.
Definition: TimeManager.h:117
float time()
Get the simulation time instant.
Definition: TimeManager.h:86
void dt(float dt)
Set the simulation time step .
Definition: TimeManager.h:104
void outputTime(float t)
Set the last output event time instant.
Definition: TimeManager.h:125
void outputStep(int s)
Set the last output event time step index.
Definition: TimeManager.h:113
~TimeManager()
Destructor.
Definition: TimeManager.cpp:101
unsigned int maxFrame()
Get the number of frames to compute.
Definition: TimeManager.h:146
unsigned int step()
Get the simulation time step index.
Definition: TimeManager.h:78
float outputTime()
Get the last output event time instant.
Definition: TimeManager.h:129
bool mustPrintOutput()
Check if a general simulation output must be printed.
Definition: TimeManager.cpp:123
void update(float dt)
Pass to the next time step.
Definition: TimeManager.cpp:104
void frame(unsigned int frame)
Set the simulation frame.
Definition: TimeManager.h:93
float maxTime()
Get the total simulation time to compute.
Definition: TimeManager.h:138
float outputFPS()
Get the output frames per second.
Definition: TimeManager.h:133
bool mustStop()
Check if the simulation must be finished.
Definition: TimeManager.cpp:112
float dt()
Get the simulation time step .
Definition: TimeManager.h:108
void time(float t)
Set the simulation time instant.
Definition: TimeManager.h:82
unsigned int maxStep()
Get the number of frames to compute.
Definition: TimeManager.h:142
void step(unsigned int s)
Set the simulation time step index.
Definition: TimeManager.h:74
int outputIPF()
Get the iterations per output frame.
Definition: TimeManager.h:121
unsigned int frame()
Get the simulation frame.
Definition: TimeManager.h:100