COPASI API  4.16.103
dewset.cpp
Go to the documentation of this file.
1 /* Begin CVS Header
2  $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/odepack++/dewset.cpp,v $
3  $Revision: 1.4 $
4  $Name: $
5  $Author: ssahle $
6  $Date: 2012/04/22 14:54:53 $
7  End CVS Header */
8 
9 // Copyright (C) 2012 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) 2001 - 2007 by Pedro Mendes, Virginia Tech Intellectual
15 // Properties, Inc. and EML Research, gGmbH.
16 // All rights reserved.
17 
18 //
19 // This C++ code is based on an f2c conversion of the Fortran
20 // library ODEPACK available at: http://www.netlib.org/odepack/
21 
22 #include <cmath>
23 
24 #include "copasi.h"
25 
26 #include "dewset.h"
27 
28 /* DECK DEWSET */
29 /* Subroutine */
30 C_INT dewset_(C_INT *n, C_INT *itol, double *rtol,
31  double *atol, double *ycur, double *ewt)
32 {
33  /* System generated locals */
34  C_INT i__1;
35  double d__1;
36 
37  /* Local variables */
38  C_INT i__;
39 
40  /* ***BEGIN PROLOGUE DEWSET */
41  /* ***SUBSIDIARY */
42  /* ***PURPOSE Set error weight vector. */
43  /* ***TYPE DOUBLE PRECISION (SEWSET-S, DEWSET-D) */
44  /* ***AUTHOR Hindmarsh, Alan C., (LLNL) */
45  /* ***DESCRIPTION */
46 
47  /* This subroutine sets the error weight vector EWT according to */
48  /* EWT(i) = RTOL(i)*ABS(YCUR(i)) + ATOL(i), i = 1,...,N, */
49  /* with the subscript on RTOL and/or ATOL possibly replaced by 1 above, */
50  /* depending on the value of ITOL. */
51 
52  /* ***SEE ALSO DLSODE */
53  /* ***ROUTINES CALLED (NONE) */
54  /* ***REVISION HISTORY (YYMMDD) */
55  /* 791129 DATE WRITTEN */
56  /* 890501 Modified prologue to SLATEC/LDOC format. (FNF) */
57  /* 890503 Minor cosmetic changes. (FNF) */
58  /* 930809 Renamed to allow single/double precision versions. (ACH) */
59  /* ***END PROLOGUE DEWSET */
60  /* **End */
61 
62  /* ***FIRST EXECUTABLE STATEMENT DEWSET */
63  /* Parameter adjustments */
64  --ewt;
65  --ycur;
66  --rtol;
67  --atol;
68 
69  /* Function Body */
70  switch (*itol)
71  {
72  case 1: goto L10;
73  case 2: goto L20;
74  case 3: goto L30;
75  case 4: goto L40;
76  }
77 
78 L10:
79  i__1 = *n;
80 
81  for (i__ = 1; i__ <= i__1; ++i__)
82  {
83  /* L15: */
84  ewt[i__] = rtol[1] * (d__1 = ycur[i__], fabs(d__1)) + atol[1];
85  }
86 
87  return 0;
88 L20:
89  i__1 = *n;
90 
91  for (i__ = 1; i__ <= i__1; ++i__)
92  {
93  /* L25: */
94  ewt[i__] = rtol[1] * (d__1 = ycur[i__], fabs(d__1)) + atol[i__];
95  }
96 
97  return 0;
98 L30:
99  i__1 = *n;
100 
101  for (i__ = 1; i__ <= i__1; ++i__)
102  {
103  /* L35: */
104  ewt[i__] = rtol[i__] * (d__1 = ycur[i__], fabs(d__1)) + atol[1];
105  }
106 
107  return 0;
108 L40:
109  i__1 = *n;
110 
111  for (i__ = 1; i__ <= i__1; ++i__)
112  {
113  /* L45: */
114  ewt[i__] = rtol[i__] * (d__1 = ycur[i__], fabs(d__1)) + atol[i__];
115  }
116 
117  return 0;
118  /* ----------------------- END OF SUBROUTINE DEWSET ---------------------- */
119 } /* dewset_ */
#define C_INT
Definition: copasi.h:115
C_INT dewset_(C_INT *n, C_INT *itol, double *rtol, double *atol, double *ycur, double *ewt)
Definition: dewset.cpp:30