Reference documentation for deal.II version GIT 368e8637aa 2023-09-27 11:20:02+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
timestep_control.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2010 - 2022 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 
17 #ifndef dealii_time_step_control_h
18 #define dealii_time_step_control_h
19 
20 #include <deal.II/base/config.h>
21 
24 
26 
27 #include <cstdio>
28 
30 
31 // Forward declaration
32 #ifndef DOXYGEN
33 class ParameterHandler;
34 #endif
35 
36 namespace Algorithms
37 {
62  {
63  public:
67  TimestepControl(double start = 0.,
68  double final = 1.,
69  double tolerance = 1.e-2,
70  double start_step = 1.e-2,
71  double print_step = -1.,
72  double max_step = 1.);
73 
77  static void
79 
87  void
89 
93  double
94  start() const;
99  double
100  final() const;
104  double
105  tolerance() const;
109  double
110  step() const;
111 
115  double
116  now() const;
117 
122  bool
123  advance();
124 
128  void
129  start(double);
133  void
134  final(double);
138  void
139  tolerance(double);
140 
148  void
149  start_step(const double step);
150 
154  void
155  max_step(double);
156 
161  void
162  restart();
163 
167  bool
168  print();
169 
170  private:
174  double start_val;
175 
179  double final_val;
180 
185 
190 
194  double max_step_val;
195 
199  double min_step_val;
200 
206 
211  double step_val;
212 
216  double now_val;
217 
222  double print_step;
223 
228  };
229 
230 
231  inline double
233  {
234  return start_val;
235  }
236 
237 
238  inline double
240  {
241  return final_val;
242  }
243 
244 
245  inline double
247  {
248  return current_step_val;
249  }
250 
251 
252  inline double
254  {
255  return tolerance_val;
256  }
257 
258 
259  inline double
261  {
262  return now_val;
263  }
264 
265 
266  inline void
268  {
269  start_val = t;
270  }
271 
272 
273  inline void
275  {
276  final_val = t;
277  }
278 
279 
280  inline void
282  {
283  tolerance_val = t;
284  }
285 
286 
287  inline void
289  {
290  start_step_val = t;
291  }
292 
293 
294  inline void
296  {
297  max_step_val = t;
298  }
299 
300 
301  inline void
303  {
304  now_val = start_val;
307  if (print_step > 0.)
309  else
310  next_print_val = now_val - 1.;
311  }
312 
313 } // namespace Algorithms
314 
316 
317 #endif
TimestepControl(double start=0., double final=1., double tolerance=1.e-2, double start_step=1.e-2, double print_step=-1., double max_step=1.)
void parse_parameters(ParameterHandler &param)
void start_step(const double step)
static void declare_parameters(ParameterHandler &param)
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:477
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:478