Reference documentation for deal.II version 9.1.0-pre
theta_timestepping.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2010 - 2017 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_theta_timestepping_h
18 #define dealii_theta_timestepping_h
19 
20 #include <deal.II/algorithms/operator.h>
21 #include <deal.II/algorithms/timestep_control.h>
22 
23 #include <deal.II/base/smartpointer.h>
24 
25 DEAL_II_NAMESPACE_OPEN
26 
27 class ParameterHandler;
28 
29 namespace Algorithms
30 {
40  struct TimestepData
41  {
43  double time;
45  double step;
46  };
47 
190  template <typename VectorType>
192  {
193  public:
199  ThetaTimestepping(OperatorBase &op_explicit, OperatorBase &op_implicit);
200 
212  virtual void
213  operator()(AnyData &out, const AnyData &in) override;
214 
218  virtual void
219  notify(const Event &) override;
220 
225  void
226  set_output(OutputOperator<VectorType> &output);
227 
231  static void
232  declare_parameters(ParameterHandler &param);
233 
237  void
238  parse_parameters(ParameterHandler &param);
239 
243  double
244  current_time() const;
245 
249  double
250  theta() const;
251 
255  double
256  theta(double new_theta);
257 
264  const TimestepData &
265  explicit_data() const;
266 
273  const TimestepData &
274  implicit_data() const;
275 
280  timestep_control();
281 
282  private:
288 
293  double vtheta;
297  bool adaptive;
298 
303 
308 
309 
321 
333 
339  };
340 
341 
342  template <typename VectorType>
343  inline const TimestepData &
345  {
346  return d_explicit;
347  }
348 
349 
350  template <typename VectorType>
351  inline const TimestepData &
353  {
354  return d_implicit;
355  }
356 
357 
358  template <typename VectorType>
359  inline TimestepControl &
361  {
362  return control;
363  }
364 
365  template <typename VectorType>
366  inline void
368  {
369  output = &out;
370  }
371 
372 
373  template <typename VectorType>
374  inline double
376  {
377  return vtheta;
378  }
379 
380 
381  template <typename VectorType>
382  inline double
384  {
385  const double tmp = vtheta;
386  vtheta = new_theta;
387  return tmp;
388  }
389 
390 
391  template <typename VectorType>
392  inline double
394  {
395  return control.now();
396  }
397 } // namespace Algorithms
398 
399 DEAL_II_NAMESPACE_CLOSE
400 
401 #endif
const TimestepData & explicit_data() const
const TimestepData & implicit_data() const
TimestepControl & timestep_control()
double time
The current time.
SmartPointer< OperatorBase, ThetaTimestepping< VectorType > > op_implicit
SmartPointer< OutputOperator< VectorType >, ThetaTimestepping< VectorType > > output
void set_output(OutputOperator< VectorType > &output)
double step
The current step size times something.
SmartPointer< OperatorBase, ThetaTimestepping< VectorType > > op_explicit