Cantera  2.0
CVodeInt.h
Go to the documentation of this file.
1 /**
2  * @file CVodeInt.h
3  */
4 // Copyright 2001 California Institute of Technology
5 
6 #ifndef CT_CVODEINT_H
7 #define CT_CVODEINT_H
8 
12 #include "cantera/base/ct_defs.h"
13 
14 namespace Cantera
15 {
16 
17 /**
18  * Exception thrown when a CVODE error is encountered.
19  */
20 class CVodeErr : public CanteraError
21 {
22 public:
23  CVodeErr(std::string msg) : CanteraError("CVodeInt", msg) {}
24 };
25 
26 
27 /**
28  * Wrapper class for 'cvode' integrator from LLNL.
29  * The unmodified cvode code is in directory ext/cvode.
30  *
31  * @see FuncEval.h. Classes that use CVodeInt:
32  * ImplicitChem, ImplicitSurfChem, Reactor
33  *
34  */
35 class CVodeInt : public Integrator
36 {
37 
38 public:
39 
40  CVodeInt();
41  virtual ~CVodeInt();
42  virtual void setTolerances(double reltol, size_t n, double* abstol);
43  virtual void setTolerances(double reltol, double abstol);
44  virtual void setProblemType(int probtype);
45  virtual void initialize(double t0, FuncEval& func);
46  virtual void reinitialize(double t0, FuncEval& func);
47  virtual void integrate(double tout);
48  virtual doublereal step(double tout);
49  virtual double& solution(size_t k);
50  virtual double* solution();
51  virtual int nEquations() const {
52  return m_neq;
53  }
54  virtual int nEvals() const;
55  virtual void setMaxOrder(int n) {
56  m_maxord = n;
57  }
58  virtual void setMethod(MethodType t);
59  virtual void setIterator(IterType t);
60  virtual void setMaxStepSize(double hmax);
61  virtual void setMinStepSize(double hmin);
62  virtual void setMaxSteps(int nmax);
63 
64 private:
65 
66  int m_neq;
67  void* m_cvode_mem;
68  double m_t0;
69  void* m_y, *m_abstol;
70  int m_type;
71  int m_itol;
72  int m_method;
73  int m_iter;
74  int m_maxord;
75  double m_reltol;
76  double m_abstols;
77  int m_nabs;
78  double m_hmax, m_hmin;
79  int m_maxsteps;
80 
81  vector_fp m_ropt;
82  long int* m_iopt;
83  void* m_data;
84 };
85 
86 } // namespace
87 
88 #endif // CT_CVODE