Reference documentation for deal.II version 9.0.0
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 at
12 // the top level of the deal.II distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 
17 #ifndef dealii_theta_timestepping_h
18 #define dealii_theta_timestepping_h
19 
20 #include <deal.II/base/smartpointer.h>
21 #include <deal.II/algorithms/operator.h>
22 #include <deal.II/algorithms/timestep_control.h>
23 
24 DEAL_II_NAMESPACE_OPEN
25 
26 class ParameterHandler;
27 
28 namespace Algorithms
29 {
39  struct TimestepData
40  {
42  double time;
44  double step;
45  };
46 
189  template <typename VectorType>
191  {
192  public:
200 
212  virtual void operator() (AnyData &out, const AnyData &in);
213 
217  virtual void notify(const Event &);
218 
224 
228  static void declare_parameters (ParameterHandler &param);
229 
233  void parse_parameters (ParameterHandler &param);
234 
238  double current_time() const;
239 
243  double theta() const;
244 
248  double theta(double new_theta);
249 
256  const TimestepData &explicit_data() const;
257 
264  const TimestepData &implicit_data() const;
265 
270 
271  private:
277 
282  double vtheta;
286  bool adaptive;
287 
292 
297 
298 
310 
322 
327  };
328 
329 
330  template <typename VectorType>
331  inline
332  const TimestepData &
334  {
335  return d_explicit;
336  }
337 
338 
339  template <typename VectorType>
340  inline
341  const TimestepData &
343  {
344  return d_implicit;
345  }
346 
347 
348  template <typename VectorType>
349  inline
352  {
353  return control;
354  }
355 
356  template <typename VectorType>
357  inline
359  {
360  output = &out;
361  }
362 
363 
364  template <typename VectorType>
365  inline
367  {
368  return vtheta;
369  }
370 
371 
372  template <typename VectorType>
373  inline
374  double ThetaTimestepping<VectorType>::theta (double new_theta)
375  {
376  const double tmp = vtheta;
377  vtheta = new_theta;
378  return tmp;
379  }
380 
381 
382  template <typename VectorType>
383  inline
385  {
386  return control.now();
387  }
388 }
389 
390 DEAL_II_NAMESPACE_CLOSE
391 
392 #endif
virtual void notify(const Event &)
ThetaTimestepping(OperatorBase &op_explicit, OperatorBase &op_implicit)
TimestepControl & timestep_control()
static void declare_parameters(ParameterHandler &param)
virtual void operator()(AnyData &out, const AnyData &in)
const TimestepData & explicit_data() const
void parse_parameters(ParameterHandler &param)
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
const TimestepData & implicit_data() const