programmer's documentation
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cs_time_step.h
Go to the documentation of this file.
1 #ifndef __CS_TIME_STEP_H__
2 #define __CS_TIME_STEP_H__
3 
4 /*============================================================================
5  * Base time step data.
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2013 EDF S.A.
12 
13  This program is free software; you can redistribute it and/or modify it under
14  the terms of the GNU General Public License as published by the Free Software
15  Foundation; either version 2 of the License, or (at your option) any later
16  version.
17 
18  This program is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21  details.
22 
23  You should have received a copy of the GNU General Public License along with
24  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25  Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 */
27 
28 /*----------------------------------------------------------------------------*/
29 
30 /*----------------------------------------------------------------------------
31  * Local headers
32  *----------------------------------------------------------------------------*/
33 
34 #include "cs_defs.h"
35 
36 /*----------------------------------------------------------------------------*/
37 
39 
40 /*=============================================================================
41  * Macro definitions
42  *============================================================================*/
43 
44 /*============================================================================
45  * Type definitions
46  *============================================================================*/
47 
48 /* time step descriptor */
49 /*----------------------*/
50 
51 typedef struct {
52 
53  int nt_prev; /* absolute time step number reached by previous
54  computation */
55  int nt_cur; /* current absolute time step number */
56  int nt_max; /* maximum absolute time step number */
57 
58  double t_prev; /* physical time reached by previous
59  computation */
60  double t_cur; /* current absolute time */
61  double t_max; /* maximum absolute time */
62 
64 
65 /*============================================================================
66  * Static global variables
67  *============================================================================*/
68 
69 /* Pointer to main time step structure */
70 
71 extern const cs_time_step_t *cs_glob_time_step;
72 
73 /*=============================================================================
74  * Public function prototypes
75  *============================================================================*/
76 
77 /*----------------------------------------------------------------------------
78  * Define maximum time step number
79  *
80  * parameters:
81  * nt_max maximum time step number (unlimited if negative)
82  *----------------------------------------------------------------------------*/
83 
84 void
85 cs_time_step_define_nt_max(int nt_max);
86 
87 /*----------------------------------------------------------------------------
88  * Define maximum time value
89  *
90  * parameters:
91  * t_max <-- maximum time value (unlimited if negative)
92  *----------------------------------------------------------------------------*/
93 
94 void
95 cs_time_step_define_t_max(double t_max);
96 
97 /*----------------------------------------------------------------------------
98  * Set time values from previous (usually restarted) calculations
99  *
100  * parameters:
101  * nt_prev <-- previous time step number
102  * t_prev <-- previous physical time
103  *----------------------------------------------------------------------------*/
104 
105 void
106 cs_time_step_define_prev(int nt_prev,
107  double t_prev);
108 
109 /*----------------------------------------------------------------------------
110  * Increment the global time step.
111  *
112  * parameters:
113  * dt <-- time step value to increment
114  *----------------------------------------------------------------------------*/
115 
116 void
117 cs_time_step_increment(double dt);
118 
119 /*----------------------------------------------------------------------------
120  * Redefine the current time values.
121  *
122  * Remark: Using cs_time_step_increment() is preferred, but this function
123  * may be required for reverting to a previous time step.
124  *
125  * parameters:
126  * nt_cur <-- current time step number
127  * t_cur <-- current physical time
128  *----------------------------------------------------------------------------*/
129 
130 void
131 cs_time_step_redefine_cur(int nt_cur,
132  double t_cur);
133 
134 /*----------------------------------------------------------------------------*/
135 
137 
138 #endif /* __CS_TIME_STEP_H__ */