dune-fem  2.4.1-rc
odesolverinterface.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_SOLVER_ODESOLVERINTERFACE_HH
2 #define DUNE_FEM_SOLVER_ODESOLVERINTERFACE_HH
3 
4 #include <iostream>
5 
6 namespace DuneODE
7 {
8 
10  template <class DestinationImp>
12  {
13  protected:
16 
17  struct Monitor
18  {
19  double odeSolveTime_;
20  double operatorTime_;
21  double error_;
22 
23  std::size_t numberOfElements_;
24 
30 
31  Monitor() { reset(); }
32 
33  // reset all counters
34  void reset()
35  {
36  odeSolveTime_ = 0;
37  operatorTime_ = 0;
38  error_ = 0;
39  numberOfElements_ = 0;
40  newtonIterations_ = 0;
41  linearSolverIterations_ = 0;
42  maxNewtonIterations_ = 0;
43  maxLinearSolverIterations_ = 0;
44  spaceOperatorCalls_ = 0;
45  }
46  };
47 
48  public:
51 
53  typedef DestinationImp DestinationType;
54 
56  virtual ~OdeSolverInterface () {}
57 
61  virtual void initialize(const DestinationType& arg) = 0;
62 
66  virtual void solve(DestinationType& u)
67  {
68  MonitorType monitor;
69  solve( u, monitor );
70  }
71 
76  virtual void solve ( DestinationType &u, MonitorType &monitor ) = 0;
77 
79  virtual void description(std::ostream&) const = 0;
80  };
81 
82 
83 } // namespace DuneODE
84 
85 #endif // #ifndef DUNE_FEM_SOLVER_ODESOLVERINTERFACE_HH
double operatorTime_
Definition: odesolverinterface.hh:20
Interface class for ODE Solver.
Definition: odesolverinterface.hh:11
double odeSolveTime_
Definition: odesolverinterface.hh:19
Monitor()
Definition: odesolverinterface.hh:31
int linearSolverIterations_
Definition: odesolverinterface.hh:26
Definition: multistep.hh:16
virtual ~OdeSolverInterface()
destructor
Definition: odesolverinterface.hh:56
void reset()
Definition: odesolverinterface.hh:34
int maxLinearSolverIterations_
Definition: odesolverinterface.hh:28
OdeSolverInterface()
constructor
Definition: odesolverinterface.hh:15
std::size_t numberOfElements_
Definition: odesolverinterface.hh:23
Monitor MonitorType
monitor type
Definition: odesolverinterface.hh:50
virtual void description(std::ostream &) const =0
print description of ODE solver to out stream
virtual void solve(DestinationType &u)
solve where is the internal operator.
Definition: odesolverinterface.hh:66
int newtonIterations_
Definition: odesolverinterface.hh:25
int maxNewtonIterations_
Definition: odesolverinterface.hh:27
Definition: odesolverinterface.hh:17
virtual void initialize(const DestinationType &arg)=0
initialize solver
double error_
Definition: odesolverinterface.hh:21
int spaceOperatorCalls_
Definition: odesolverinterface.hh:29
DestinationImp DestinationType
type of destination
Definition: odesolverinterface.hh:53