AQUAgpusph 5.0.4
Loading...
Searching...
No Matches
TimeManager.hpp
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
23
24#ifndef TIMEMANAGER_H_INCLUDED
25#define TIMEMANAGER_H_INCLUDED
26
27#include "sphPrerequisites.hpp"
28#include "ProblemSetup.hpp"
29
30namespace Aqua {
31namespace InputOutput {
32
43{
44 public:
49 TimeManager(const ProblemSetup& sim_data);
50
53
57 bool mustStop();
58
64 bool mustPrintOutput();
65
69 inline unsigned int step() const { return *_step; }
70
74 inline float time() const { return *_time; }
75
82 inline unsigned int frame() const { return *_frame; }
83
87 inline float dt() const { return *_dt; }
88
92 inline float maxTime() const { return *_time_max; }
93
97 inline unsigned int maxStep() const { return *_steps_max; }
98
102 inline unsigned int maxFrame() const { return *_frames_max; }
103
107 inline void outputStep(int s) { _output_step = s; }
108
112 inline int outputStep() const { return _output_step; }
113
117 inline int outputIPF() const { return _output_ipf; }
118
122 inline void outputTime(float t) { _output_time = t; }
123
127 inline float outputTime() const { return _output_time; }
128
132 inline float outputFPS() const { return _output_fps; }
133
134 private:
138 void sync();
139
141 unsigned int* _step;
143 float* _time;
145 float* _dt;
147 unsigned int* _frame;
150 float* _time_max;
153 unsigned int* _steps_max;
156 unsigned int* _frames_max;
157
159 float _output_time;
161 float _output_fps;
163 int _output_step;
165 int _output_ipf;
166};
167
168}
169} // namespace
170
171#endif // TIMEMANAGER_H_INCLUDED
Simulation configuration data structures. (See Aqua::InputOutput::ProblemSetup for details)
Simulation configuration data.
Definition ProblemSetup.hpp:91
unsigned int frame() const
Get the simulation frame.
Definition TimeManager.hpp:82
unsigned int maxStep() const
Get the number of frames to compute.
Definition TimeManager.hpp:97
void outputTime(float t)
Set the last output event time instant.
Definition TimeManager.hpp:122
void outputStep(int s)
Set the last output event time step index.
Definition TimeManager.hpp:107
int outputStep() const
Get the last output event time step index.
Definition TimeManager.hpp:112
float outputFPS() const
Get the output frames per second.
Definition TimeManager.hpp:132
unsigned int step() const
Get the simulation time step index.
Definition TimeManager.hpp:69
int outputIPF() const
Get the iterations per output frame.
Definition TimeManager.hpp:117
bool mustPrintOutput()
Check if a general simulation output must be printed.
Definition TimeManager.cpp:116
float maxTime() const
Get the total simulation time to compute.
Definition TimeManager.hpp:92
float outputTime() const
Get the last output event time instant.
Definition TimeManager.hpp:127
bool mustStop()
Check if the simulation must be finished.
Definition TimeManager.cpp:104
TimeManager(const ProblemSetup &sim_data)
Definition TimeManager.cpp:33
unsigned int maxFrame() const
Get the number of frames to compute.
Definition TimeManager.hpp:102
float dt() const
Get the simulation time step .
Definition TimeManager.hpp:87
float time() const
Get the simulation time instant.
Definition TimeManager.hpp:74
Input/Output data interfaces.
Definition ArgumentsManager.cpp:51
Main AQUAgpusph namespace.
Definition ArgumentsManager.cpp:50
Set of definitions and macros related with the implementation.
#define DECLDIR
Prefix to export C functions on the compiled library.
Definition sphPrerequisites.hpp:65