DUNE-FEM (unstable)

odesolverinterface.hh
1 #ifndef DUNE_FEM_SOLVER_ODESOLVERINTERFACE_HH
2 #define DUNE_FEM_SOLVER_ODESOLVERINTERFACE_HH
3 
4 #include <iostream>
5 
6 //- dune-common includes
8 
9 #include <dune/fem/io/parameter.hh>
10 #include <dune/fem/misc/mpimanager.hh>
11 #include <dune/fem/operator/common/spaceoperatorif.hh>
12 
13 namespace DuneODE
14 {
15  using namespace Dune;
16  using namespace Fem;
17 
19  template <class DestinationImp>
21  {
22  protected:
25 
26  struct Monitor
27  {
28  double odeSolveTime_;
29  double operatorTime_;
30  double error_;
31 
32  std::size_t numberOfElements_;
33 
34  int newtonIterations_;
35  int linearSolverIterations_;
36  int maxNewtonIterations_;
37  int maxLinearSolverIterations_;
38  int spaceOperatorCalls_;
39 
40  Monitor() { reset(); }
41 
42  // reset all counters
43  void reset()
44  {
45  odeSolveTime_ = 0;
46  operatorTime_ = 0;
47  error_ = 0;
48  numberOfElements_ = 0;
49  newtonIterations_ = 0;
50  linearSolverIterations_ = 0;
51  maxNewtonIterations_ = 0;
52  maxLinearSolverIterations_ = 0;
53  spaceOperatorCalls_ = 0;
54  }
55  };
56 
57  public:
59  typedef Monitor MonitorType;
60 
62  typedef DestinationImp DestinationType;
63 
65  virtual ~OdeSolverInterface () {}
66 
70  virtual void initialize(const DestinationType& arg) = 0;
71 
75  virtual void solve(DestinationType& u)
76  {
77  MonitorType monitor;
78  solve( u, monitor );
79  }
80 
85  virtual void solve ( DestinationType &u, MonitorType &monitor ) = 0;
86 
88  virtual void description(std::ostream&) const = 0;
89  };
90 
91 
92 } // namespace DuneODE
93 
94 #endif // #ifndef DUNE_FEM_SOLVER_ODESOLVERINTERFACE_HH
Interface class for ODE Solver.
Definition: odesolverinterface.hh:21
virtual ~OdeSolverInterface()
destructor
Definition: odesolverinterface.hh:65
Monitor MonitorType
monitor type
Definition: odesolverinterface.hh:59
OdeSolverInterface()
constructor
Definition: odesolverinterface.hh:24
virtual void description(std::ostream &) const =0
print description of ODE solver to out stream
virtual void solve(DestinationType &u, MonitorType &monitor)=0
solve where is the internal operator.
virtual void solve(DestinationType &u)
solve where is the internal operator.
Definition: odesolverinterface.hh:75
DestinationImp DestinationType
type of destination
Definition: odesolverinterface.hh:62
virtual void initialize(const DestinationType &arg)=0
initialize solver
A few common exception classes.
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (May 16, 22:29, 2024)