Reference documentation for deal.II version Git 7026f387cc 2019-10-15 14:19:01 -0400
\(\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}\)
timestep_control.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2010 - 2018 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/smartpointer.h>
21 #include <deal.II/base/subscriptor.h>
22 
23 #include <deal.II/lac/vector_memory.h>
24 
25 #include <cstdio>
26 
27 DEAL_II_NAMESPACE_OPEN
28 
29 // Forward declaration
30 #ifndef DOXYGEN
31 class ParameterHandler;
32 #endif
33 
34 namespace Algorithms
35 {
56  {
57  public:
61  TimestepControl(double start = 0.,
62  double final = 1.,
63  double tolerance = 1.e-2,
64  double start_step = 1.e-2,
65  double print_step = -1.,
66  double max_step = 1.);
67 
71  static void
73 
81  void
83 
87  double
88  start() const;
93  double
94  final() const;
98  double
99  tolerance() const;
103  double
104  step() const;
105 
109  double
110  now() const;
111 
116  bool
117  advance();
118 
122  void
123  start(double);
127  void
128  final(double);
132  void
133  tolerance(double);
134 
142  void
143  start_step(const double step);
144 
148  void
149  max_step(double);
150 
155  void
156  restart();
157 
161  bool
162  print();
163 
164  private:
168  double start_val;
169 
173  double final_val;
174 
179 
184 
188  double max_step_val;
189 
193  double min_step_val;
194 
200 
205  double step_val;
206 
210  double now_val;
211 
216  double print_step;
217 
222  };
223 
224 
225  inline double
227  {
228  return start_val;
229  }
230 
231 
232  inline double
234  {
235  return final_val;
236  }
237 
238 
239  inline double
241  {
242  return current_step_val;
243  }
244 
245 
246  inline double
248  {
249  return tolerance_val;
250  }
251 
252 
253  inline double
255  {
256  return now_val;
257  }
258 
259 
260  inline void
262  {
263  start_val = t;
264  }
265 
266 
267  inline void
269  {
270  final_val = t;
271  }
272 
273 
274  inline void
276  {
277  tolerance_val = t;
278  }
279 
280 
281  inline void
283  {
284  start_step_val = t;
285  }
286 
287 
288  inline void
290  {
291  max_step_val = t;
292  }
293 
294 
295  inline void
297  {
298  now_val = start_val;
301  if (print_step > 0.)
303  else
304  next_print_val = now_val - 1.;
305  }
306 
307 } // namespace Algorithms
308 
309 DEAL_II_NAMESPACE_CLOSE
310 
311 #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 start_step(const double step)
static void declare_parameters(ParameterHandler &param)
void parse_parameters(ParameterHandler &param)