COPASI API  4.16.103
Cxerrwd.cpp
Go to the documentation of this file.
1 /* Begin CVS Header
2  $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/odepack++/Cxerrwd.cpp,v $
3  $Revision: 1.6 $
4  $Name: $
5  $Author: shoops $
6  $Date: 2009/01/07 19:01:06 $
7  End CVS Header */
8 
9 // Copyright (C) 2008 by Pedro Mendes, Virginia Tech Intellectual
10 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
11 // and The University 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 // This C++ code is based on an f2c conversion of the Fortran
19 // library ODEPACK available at: http://www.netlib.org/odepack/
20 
21 #include "copasi.h"
22 
23 #include "Cxerrwd.h"
24 
25 Cxerrwd::Cxerrwd(const bool & print):
26  mPrint(print),
27  mpOstream(NULL)
28 {}
29 
31 
32 void Cxerrwd::setOstream(std::ostream & os)
33 {mpOstream = &os;}
34 
35 void Cxerrwd::enablePrint(const bool & print)
36 {mPrint = print;}
37 
38 void Cxerrwd::operator() (const std::string & msg, const C_INT *, const C_INT *, const C_INT
39  *level, const C_INT *ni, const C_INT *i1, const C_INT *i2, const C_INT *nr,
40  const double *r1, const double *r2, C_INT)
41 {
42  /* ***BEGIN PROLOGUE XERRWD */
43  /* ***SUBSIDIARY */
44  /* ***PURPOSE Write error message with values. */
45  /* ***CATEGORY R3C */
46  /* ***TYPE DOUBLE PRECISION (XERRWV-S, XERRWD-D) */
47  /* ***AUTHOR Hindmarsh, Alan C., (LLNL) */
48  /* ***DESCRIPTION */
49 
50  /* Subroutines XERRWD, XSETF, XSETUN, and the function routine IXSAV, */
51  /* as given here, constitute a simplified version of the SLATEC error */
52  /* handling package. */
53 
54  /* All arguments are input arguments. */
55 
56  /* MSG = The message (character array). */
57  /* NMES = The length of MSG (number of characters). */
58  /* NERR = The error number (not used). */
59  /* LEVEL = The error level.. */
60  /* 0 or 1 means recoverable (control returns to caller). */
61  /* 2 means fatal (run is aborted--see note below). */
62  /* NI = Number of integers (0, 1, or 2) to be printed with message. */
63  /* I1,I2 = Integers to be printed, depending on NI. */
64  /* NR = Number of reals (0, 1, or 2) to be printed with message. */
65  /* R1,R2 = Reals to be printed, depending on NR. */
66 
67  /* Note.. this routine is machine-dependent and specialized for use */
68  /* in limited context, in the following ways.. */
69  /* 1. The argument MSG is assumed to be of type CHARACTER, and */
70  /* the message is printed with a format of (1X,A). */
71  /* 2. The message is assumed to take only one line. */
72  /* Multi-line messages are generated by repeated calls. */
73  /* 3. If LEVEL = 2, control passes to the statement STOP */
74  /* to abort the run. This statement may be machine-dependent. */
75  /* 4. R1 and R2 are assumed to be in double precision and are printed */
76  /* in D21.13 format. */
77 
78  /* ***ROUTINES CALLED IXSAV */
79  /* ***REVISION HISTORY (YYMMDD) */
80  /* 920831 DATE WRITTEN */
81  /* 921118 Replaced MFLGSV/LUNSAV by IXSAV. (ACH) */
82  /* 930329 Modified prologue to SLATEC format. (FNF) */
83  /* 930407 Changed MSG from CHARACTER*1 array to variable. (FNF) */
84  /* 930922 Minor cosmetic change. (FNF) */
85  /* ***END PROLOGUE XERRWD */
86 
87  /* *Internal Notes: */
88 
89  /* For a different default logical unit number, IXSAV (or a subsidiary */
90  /* routine that it calls) will need to be modified. */
91  /* For a different run-abort command, change the statement following */
92  /* statement 100 at the end. */
93  /* ----------------------------------------------------------------------- */
94  /* Subroutines called by XERRWD.. None */
95  /* Function routine called by XERRWD.. IXSAV */
96  /* ----------------------------------------------------------------------- */
97  /* **End */
98 
99  /* Declare arguments. */
100 
101  /* Declare local variables. */
102 
103  /* Get logical unit number and message print flag. */
104 
105  /* ***FIRST EXECUTABLE STATEMENT XERRWD */
106  if (!mPrint && !mpOstream)
107  {
108  goto L100;
109  }
110 
111  /* Write the message. */
112 
113  *mpOstream << msg << std::endl;
114 
115  if (*ni == 1)
116  {
117  *mpOstream << "\tIn above message, I1 = '" << *i1 << "'\n";
118  }
119  if (*ni == 2)
120  {
121  *mpOstream << "\tIn above message, I1 = '" << *i1
122  << "', I2 = '" << *i2 << "'\n";
123  }
124  if (*nr == 1)
125  {
126  *mpOstream << "\tIn above message, R1 = '" << *r1 << "'\n";
127  }
128  if (*nr == 2)
129  {
130  *mpOstream << "\tIn above message, R1 = '" << *r1
131  << "', R2 = '" << *r2 << "'\n";
132  }
133 
134  /* Abort the run if LEVEL = 2. */
135  if (*level == 2)
136  {
137  // :TODO: We need to abort here
138  }
139 
140 L100:
141 
142  /* ----------------------- End of Subroutine XERRWD ---------------------- */
143  return;
144 } /* xerrwd_ */
#define C_INT
Definition: copasi.h:115
void setOstream(std::ostream &os)
Definition: Cxerrwd.cpp:32
std::ostream * mpOstream
Definition: Cxerrwd.h:43
~Cxerrwd()
Definition: Cxerrwd.cpp:30
void enablePrint(const bool &print=true)
Definition: Cxerrwd.cpp:35
void operator()(const std::string &msg, const C_INT *nmes, const C_INT *nerr, const C_INT *level, const C_INT *ni, const C_INT *i1, const C_INT *i2, const C_INT *nr, const double *r1, const double *r2, C_INT msg_len)
Definition: Cxerrwd.cpp:38
Cxerrwd(const bool &print)
Definition: Cxerrwd.cpp:25
bool mPrint
Definition: Cxerrwd.h:42