Reference documentation for deal.II version 9.1.1
\(\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}\)
deal.II
algorithms
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
class
ParameterHandler
;
30
31
namespace
Algorithms
32
{
52
class
TimestepControl
:
public
Subscriptor
53
{
54
public
:
59
enum
Strategy
60
{
65
uniform
,
73
doubling
74
};
75
79
TimestepControl
(
double
start
= 0.,
80
double
final
= 1.,
81
double
tolerance
= 1.e-2,
82
double
start_step
= 1.e-2,
83
double
print_step = -1.,
84
double
max_step
= 1.);
85
89
static
void
90
declare_parameters
(
ParameterHandler
¶m);
94
void
95
parse_parameters
(
ParameterHandler
¶m);
96
100
double
101
start
()
const
;
106
double
107
final
()
const
;
111
double
112
tolerance
()
const
;
116
double
117
step
()
const
;
118
122
double
123
now
()
const
;
124
129
bool
130
advance
();
131
135
void
136
start
(
double
);
140
void
141
final
(double);
145
void
146
tolerance
(
double
);
150
void
strategy
(
Strategy
);
151
159
void
160
start_step
(
const
double
step
);
161
165
void
166
max_step
(
double
);
167
172
void
173
restart
();
177
bool
178
print
();
182
void
183
file_name_format(
const
char
*);
184
const
char
*
185
file_name_format();
186
187
private
:
188
double
start_val;
189
double
final_val;
190
double
tolerance_val;
191
Strategy
strategy_val;
192
double
start_step_val;
193
double
max_step_val;
194
double
min_step_val;
199
double
current_step_val
;
200
double
step_val;
201
202
double
now_val;
203
double
print_step;
204
double
next_print_val;
205
206
char
format[30];
207
};
208
209
210
inline
double
211
TimestepControl::start
()
const
212
{
213
return
start_val;
214
}
215
216
217
inline
double
218
TimestepControl::final
()
const
219
{
220
return
final_val;
221
}
222
223
224
inline
double
225
TimestepControl::step
()
const
226
{
227
return
current_step_val
;
228
}
229
230
231
inline
double
232
TimestepControl::tolerance
()
const
233
{
234
return
tolerance_val;
235
}
236
237
238
inline
double
239
TimestepControl::now
()
const
240
{
241
return
now_val;
242
}
243
244
245
inline
void
246
TimestepControl::start
(
double
t)
247
{
248
start_val = t;
249
}
250
251
252
inline
void
253
TimestepControl::final
(
double
t)
254
{
255
final_val = t;
256
}
257
258
259
inline
void
260
TimestepControl::tolerance
(
double
t)
261
{
262
tolerance_val = t;
263
}
264
265
266
inline
void
267
TimestepControl::strategy
(
Strategy
t)
268
{
269
strategy_val = t;
270
}
271
272
273
inline
void
274
TimestepControl::start_step
(
const
double
t)
275
{
276
start_step_val = t;
277
}
278
279
280
inline
void
281
TimestepControl::max_step
(
double
t)
282
{
283
max_step_val = t;
284
}
285
286
287
inline
void
288
TimestepControl::restart
()
289
{
290
now_val = start_val;
291
step_val = start_step_val;
292
current_step_val
= step_val;
293
if
(print_step > 0.)
294
next_print_val = now_val + print_step;
295
else
296
next_print_val = now_val - 1.;
297
}
298
299
300
inline
void
301
TimestepControl::file_name_format(
const
char
*fmt)
302
{
303
strcpy(format, fmt);
304
}
305
306
307
inline
const
char
*
308
TimestepControl::file_name_format()
309
{
310
return
format;
311
}
312
}
// namespace Algorithms
313
314
DEAL_II_NAMESPACE_CLOSE
315
316
#endif
Algorithms::TimestepControl::advance
bool advance()
Definition:
timestep_control.cc:87
Algorithms::TimestepControl::tolerance
double tolerance() const
Definition:
timestep_control.h:232
Algorithms::TimestepControl::restart
void restart()
Definition:
timestep_control.h:288
Algorithms::TimestepControl::TimestepControl
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.)
Definition:
timestep_control.cc:25
Algorithms::TimestepControl::Strategy
Strategy
Definition:
timestep_control.h:59
Algorithms::TimestepControl::declare_parameters
static void declare_parameters(ParameterHandler ¶m)
Definition:
timestep_control.cc:53
Algorithms::TimestepControl::print
bool print()
Definition:
timestep_control.cc:129
Algorithms::TimestepControl::uniform
Definition:
timestep_control.h:65
Algorithms::TimestepControl::start
double start() const
Definition:
timestep_control.h:211
Subscriptor
Definition:
subscriptor.h:62
Algorithms::TimestepControl::now
double now() const
Definition:
timestep_control.h:239
Algorithms::TimestepControl::current_step_val
double current_step_val
Definition:
timestep_control.h:199
Algorithms::TimestepControl::start_step
void start_step(const double step)
Definition:
timestep_control.h:274
Algorithms::TimestepControl::max_step
void max_step(double)
Definition:
timestep_control.h:281
Algorithms::TimestepControl::strategy
void strategy(Strategy)
Definition:
timestep_control.h:267
Algorithms::TimestepControl::final
double final() const
Definition:
timestep_control.h:218
Algorithms
Definition:
newton.h:31
Algorithms::TimestepControl
Definition:
timestep_control.h:52
Algorithms::TimestepControl::parse_parameters
void parse_parameters(ParameterHandler ¶m)
Definition:
timestep_control.cc:69
ParameterHandler
Definition:
parameter_handler.h:844
Algorithms::TimestepControl::doubling
Definition:
timestep_control.h:73
Algorithms::TimestepControl::step
double step() const
Definition:
timestep_control.h:225
Generated by
1.8.16