COPASI API  4.16.103
common.h
Go to the documentation of this file.
1 /* Begin CVS Header
2  $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/odepack++/common.h,v $
3  $Revision: 1.7 $
4  $Name: $
5  $Author: shoops $
6  $Date: 2012/01/19 18:36:46 $
7  End CVS Header */
8 
9 // Copyright (C) 2011 by Pedro Mendes, Virginia Tech Intellectual
10 // Properties, Inc., University of Heidelberg, and The University
11 // of Manchester.
12 // All rights reserved.
13 
14 // Copyright (C) 2008 by Pedro Mendes, Virginia Tech Intellectual
15 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
16 // and The University of Manchester.
17 // All rights reserved.
18 
19 // Copyright (C) 2001 - 2007 by Pedro Mendes, Virginia Tech Intellectual
20 // Properties, Inc. and EML Research, gGmbH.
21 // All rights reserved.
22 //
23 // This C++ code is based on an f2c conversion of the Fortran
24 // library ODEPACK available at: http://www.netlib.org/odepack/
25 
26 #ifndef ODEPACK_common
27 #define ODEPACK_common
28 
29 typedef void (*evalF)(const C_INT*, const double*, const double*, double*);
30 typedef void (*evalJ)(const C_INT*, const double*, const double*, const C_INT*,
31  const C_INT*, double*, const C_INT*);
32 typedef void (*evalG)(const C_INT*, const double*, const double*,
33  const C_INT*, double*);
34 
35 union dls001
36 {
37  struct
38  {
39  double rowns[209], ccmax, el0, h__, hmin, hmxi, hu, rc, tn,
40  uround;
41  C_INT iownd[6], iowns[6], icf, ierpj, iersl, jcur, jstart, kflag, l,
43  maxcor, msbp, mxncf, n, nq, nst, nfe, nje, nqu;
44  }
45  _1;
46  struct
47  {
48  double rls[218];
49  C_INT ils[37];
50  }
51  _2;
52  struct
53  {
54  double conit, crate, el[13], elco[156] /* was [13][12] */,
55  hold, rmax, tesco[36] /* was [3][12] */, ccmax, el0, h__,
56  hmin, hmxi, hu, rc, tn, uround;
57  C_INT iownd[6], ialth, ipup, lmax, meo, nqnyh, nslp, icf, ierpj,
60  nfe, nje, nqu;
61  }
62  _3;
63  struct
64  {
65  double rowns[209], ccmax, el0, h__, hmin, hmxi, hu, rc, tn, uround;
69  nqu;
70  }
71  lsoda;
72 };
73 
74 union dlsa01
75 {
76  struct
77  {
78  double rownd2, cm1[12], cm2[5], pdest, pdlast, ratio, pdnorm;
80  }
81  _1;
82  struct
83  {
84  double rownd2, rowns2[20], pdnorm;
85  C_INT iownd2[3], iowns2[2], jtyp, mused, mxordn, mxords;
86  }
87  _2;
88  struct
89  {
90  double rlsa[22];
91  C_INT ilsa[9];
92  }
93  _3;
94  struct
95  {
96  double tsw, rowns2[20], pdnorm;
98  }
99  lsoda;
100 };
101 
102 union dlsr01
103 {
104  struct
105  {
106  double rownr3[2], t0, tlast, toutc;
107  C_INT iownd3[3], iownr3[2], irfnd, itaskc, ngc, nge;
108  }
109  _1;
110  struct
111  {
112  double alpha, x2, rdum3[3];
113  C_INT iownd3[3], imax, last, idum3[4];
114  }
115  _2;
116  struct
117  {
118  double rlsr[5];
119  C_INT ilsr[9];
120  }
121  _3;
122  struct
123  {
124  double rownr3[2], t0, tlast, toutc;
125  C_INT lg0, lg1, lgx, iownr3[2], irfnd, itaskc, ngc, nge;
126  }
127  lsodar;
128 };
129 
130 class PJAC
131 {
132 public:
133  PJAC(C_INT(*pMethod)(C_INT *neq, double *y, double *yh,
134  C_INT *nyh, double *ewt, double *ftem,
135  double *savf, double *wm, C_INT *iwm,
136  evalF f, evalJ jac));
137 
138  virtual ~PJAC();
139 
140  virtual C_INT operator()(C_INT *neq, double *y, double *yh,
141  C_INT *nyh, double *ewt, double *ftem,
142  double *savf, double *wm, C_INT *iwm,
143  evalF f, evalJ jac);
144 
145 protected:
146  PJAC();
147 
148 private:
149  C_INT(*mpMethod)(C_INT *neq, double *y, double *yh,
150  C_INT *nyh, double *ewt, double *ftem,
151  double *savf, double *wm, C_INT *iwm,
152  evalF f, evalJ jac);
153 };
154 
155 template <typename CType> class PJACFunctor : public PJAC
156 {
157 public:
158  PJACFunctor(CType * pType,
159  C_INT(CType::*pMethod)(C_INT *neq, double *y, double *yh,
160  C_INT *nyh, double *ewt, double *ftem,
161  double *savf, double *wm, C_INT *iwm,
162  evalF f, evalJ jac)):
163  PJAC(),
164  mpType(pType),
165  mpMethod(pMethod)
166  {}
167 
168  virtual ~PJACFunctor() {}
169 
170  virtual C_INT operator()(C_INT *neq, double *y, double *yh,
171  C_INT *nyh, double *ewt, double *ftem,
172  double *savf, double *wm, C_INT *iwm,
173  evalF f, evalJ jac)
174  {
175  return (*mpType.*mpMethod)(neq, y, yh, nyh, ewt, ftem, savf, wm,
176  iwm, f, jac);
177  }
178 
179 protected:
180  PJACFunctor() : PJAC(), mpType(NULL), mpMethod(NULL) {}
181 
182 private:
183  CType * mpType;
184  C_INT(CType::*mpMethod)(C_INT *neq, double *y, double *yh,
185  C_INT *nyh, double *ewt, double *ftem,
186  double *savf, double *wm, C_INT *iwm,
187  evalF f, evalJ jac);
188 };
189 
190 class SLVS
191 {
192 public:
193  SLVS(C_INT(*pMethod)(double *wm, C_INT *iwm, double *x, double *tem));
194 
195  virtual ~SLVS();
196 
197  virtual C_INT operator()(double *wm, C_INT *iwm, double *x, double *tem);
198 
199 protected:
200  SLVS();
201 
202 private:
203  C_INT(*mpMethod)(double *wm, C_INT *iwm, double *x, double *tem);
204 };
205 
206 template <typename CType> class SLVSFunctor : public SLVS
207 {
208 public:
209  SLVSFunctor(CType * pType,
210  C_INT(CType::*pMethod)(double *wm, C_INT *iwm, double *x,
211  double *tem)):
212  SLVS(),
213  mpType(pType),
214  mpMethod(pMethod)
215  {}
216 
217  virtual ~SLVSFunctor() {}
218 
219  virtual C_INT operator()(double *wm, C_INT *iwm, double *x,
220  double *tem)
221  {return (*mpType.*mpMethod)(wm, iwm, x, tem);}
222 
223 protected:
224  SLVSFunctor() : SLVS(), mpType(NULL), mpMethod(NULL) {}
225 
226 private:
227  CType * mpType;
228  C_INT(CType::*mpMethod)(double *wm, C_INT *iwm, double *x,
229  double *tem);
230 };
231 
232 #endif // ODEPACK_common
double hold
Definition: common.h:54
C_INT l
Definition: common.h:41
#define C_INT
Definition: copasi.h:115
C_INT nslp
Definition: common.h:57
C_INT last
Definition: common.h:113
C_INT nhnil
Definition: common.h:66
void(* evalG)(const C_INT *, const double *, const double *, const C_INT *, double *)
Definition: common.h:32
virtual C_INT operator()(C_INT *neq, double *y, double *yh, C_INT *nyh, double *ewt, double *ftem, double *savf, double *wm, C_INT *iwm, evalF f, evalJ jac)
Definition: common.cpp:29
C_INT lgx
Definition: common.h:125
Definition: common.h:190
double x2
Definition: common.h:112
C_INT meth
Definition: common.h:41
C_INT ngc
Definition: common.h:107
SLVS()
Definition: common.cpp:35
C_INT jstart
Definition: common.h:41
struct dlsa01::@5 _2
C_INT nslast
Definition: common.h:66
struct dls001::@2 _3
struct dls001::@1 _2
C_INT maxcor
Definition: common.h:41
double rlsa[22]
Definition: common.h:90
C_INT(CType::* mpMethod)(double *wm, C_INT *iwm, double *x, double *tem)
Definition: common.h:228
double rowns2[20]
Definition: common.h:84
C_INT iownr3[2]
Definition: common.h:107
PJAC()
Definition: common.cpp:20
struct dls001::@3 lsoda
C_INT ilsr[9]
Definition: common.h:119
C_INT insufr
Definition: common.h:97
double rls[218]
Definition: common.h:48
C_INT ilsa[9]
Definition: common.h:91
C_INT itaskc
Definition: common.h:107
void(* evalF)(const C_INT *, const double *, const double *, double *)
Definition: common.h:29
C_INT imax
Definition: common.h:113
C_INT lg1
Definition: common.h:125
C_INT kflag
Definition: common.h:41
C_INT miter
Definition: common.h:41
C_INT mxhnil
Definition: common.h:66
struct dlsr01::@11 lsodar
C_INT irfnd
Definition: common.h:107
virtual ~PJAC()
Definition: common.cpp:27
C_INT nfe
Definition: common.h:41
C_INT iowns2[2]
Definition: common.h:85
C_INT insufi
Definition: common.h:97
double h__
Definition: common.h:39
double tn
Definition: common.h:39
struct dlsa01::@6 _3
C_INT irflag
Definition: common.h:79
Definition: common.h:102
C_INT jtyp
Definition: common.h:79
C_INT iownd[6]
Definition: common.h:41
C_INT idum3[4]
Definition: common.h:113
C_INT liwm
Definition: common.h:41
C_INT maxord
Definition: common.h:41
C_INT nqu
Definition: common.h:41
Definition: common.h:74
C_INT lg0
Definition: common.h:125
C_INT icount
Definition: common.h:79
C_INT lmax
Definition: common.h:57
virtual ~SLVS()
Definition: common.cpp:41
PJACFunctor(CType *pType, C_INT(CType::*pMethod)(C_INT *neq, double *y, double *yh, C_INT *nyh, double *ewt, double *ftem, double *savf, double *wm, C_INT *iwm, evalF f, evalJ jac))
Definition: common.h:158
C_INT nst
Definition: common.h:41
double t0
Definition: common.h:106
double toutc
Definition: common.h:106
void(* evalJ)(const C_INT *, const double *, const double *, const C_INT *, const C_INT *, double *, const C_INT *)
Definition: common.h:30
struct dlsr01::@8 _1
double crate
Definition: common.h:54
C_INT(* mpMethod)(double *wm, C_INT *iwm, double *x, double *tem)
Definition: common.h:203
virtual C_INT operator()(double *wm, C_INT *iwm, double *x, double *tem)
Definition: common.h:219
Definition: common.h:35
C_INT ils[37]
Definition: common.h:49
double rownr3[2]
Definition: common.h:106
C_INT ixpr
Definition: common.h:97
C_INT lacor
Definition: common.h:41
C_INT iersl
Definition: common.h:41
double ccmax
Definition: common.h:39
C_INT ierpj
Definition: common.h:41
double tlast
Definition: common.h:106
double tsw
Definition: common.h:96
double el[13]
Definition: common.h:54
double el0
Definition: common.h:39
double ratio
Definition: common.h:78
struct dlsa01::@4 _1
C_INT mxords
Definition: common.h:79
C_INT ialth
Definition: common.h:57
double conit
Definition: common.h:54
C_INT(* mpMethod)(C_INT *neq, double *y, double *yh, C_INT *nyh, double *ewt, double *ftem, double *savf, double *wm, C_INT *iwm, evalF f, evalJ jac)
Definition: common.h:149
C_INT ipup
Definition: common.h:57
C_INT mxordn
Definition: common.h:79
C_INT jcur
Definition: common.h:41
struct dlsr01::@10 _3
double rlsr[5]
Definition: common.h:118
PJACFunctor()
Definition: common.h:180
SLVSFunctor(CType *pType, C_INT(CType::*pMethod)(double *wm, C_INT *iwm, double *x, double *tem))
Definition: common.h:209
C_INT meo
Definition: common.h:57
double rdum3[3]
Definition: common.h:112
C_INT(CType::* mpMethod)(C_INT *neq, double *y, double *yh, C_INT *nyh, double *ewt, double *ftem, double *savf, double *wm, C_INT *iwm, evalF f, evalJ jac)
Definition: common.h:184
C_INT lewt
Definition: common.h:41
C_INT nyh
Definition: common.h:66
virtual C_INT operator()(C_INT *neq, double *y, double *yh, C_INT *nyh, double *ewt, double *ftem, double *savf, double *wm, C_INT *iwm, evalF f, evalJ jac)
Definition: common.h:170
C_INT nje
Definition: common.h:41
C_INT iownd3[3]
Definition: common.h:107
C_INT lyh
Definition: common.h:41
double rownd2
Definition: common.h:78
C_INT lsavf
Definition: common.h:41
C_INT nq
Definition: common.h:41
double rmax
Definition: common.h:54
double rowns[209]
Definition: common.h:39
double cm1[12]
Definition: common.h:78
virtual C_INT operator()(double *wm, C_INT *iwm, double *x, double *tem)
Definition: common.cpp:43
SLVSFunctor()
Definition: common.h:224
CType * mpType
Definition: common.h:183
C_INT mxncf
Definition: common.h:41
C_INT iownd2[3]
Definition: common.h:79
() void(yyvaluep))
C_INT lwm
Definition: common.h:41
double elco[156]
Definition: common.h:54
C_INT mxstep
Definition: common.h:66
double pdnorm
Definition: common.h:78
double hmxi
Definition: common.h:39
double rc
Definition: common.h:39
double tesco[36]
Definition: common.h:54
C_INT nge
Definition: common.h:107
double alpha
Definition: common.h:112
double pdlast
Definition: common.h:78
double pdest
Definition: common.h:78
struct dlsr01::@9 _2
struct dlsa01::@7 lsoda
double hmin
Definition: common.h:39
C_INT init
Definition: common.h:66
virtual ~PJACFunctor()
Definition: common.h:168
C_INT n
Definition: common.h:41
C_INT iowns[6]
Definition: common.h:41
struct dls001::@0 _1
C_INT icf
Definition: common.h:41
virtual ~SLVSFunctor()
Definition: common.h:217
Definition: common.h:130
CType * mpType
Definition: common.h:227
double hu
Definition: common.h:39
C_INT nqnyh
Definition: common.h:57
double cm2[5]
Definition: common.h:78
C_INT msbp
Definition: common.h:41
C_INT mused
Definition: common.h:79
double uround
Definition: common.h:39