From f1a15f0e696561dcb67991d10d0881ee2852acf9 Mon Sep 17 00:00:00 2001 From: Dave Goodwin Date: Thu, 13 May 2004 16:58:29 +0000 Subject: [PATCH] *** empty log message *** --- Cantera/clib/src/Makefile.in | 1 - Cantera/clib/src/ctonedim.cpp | 20 +++++++------- Cantera/cxx/src/writelog.cpp | 8 ++++++ Cantera/fortran/src/Makefile.in | 1 - Cantera/matlab/cantera/private/write.cpp | 5 ++++ Cantera/matlab/setup_winmatlab.py | 26 ++++++------------ Cantera/python/Cantera/OneD/onedim.py | 11 ++++++-- Cantera/python/Cantera/Reactor.py | 15 +++++----- Cantera/python/src/ctonedim_methods.cpp | 25 +++++++++-------- Cantera/python/src/ctphase_methods.cpp | 2 +- Cantera/python/src/ctxml_methods.cpp | 2 +- Cantera/python/src/writelog.cpp | 4 +++ Cantera/src/Makefile.in | 2 +- Cantera/src/converters/CKParser.cpp | 35 ++++++------------------ Cantera/src/global.h | 14 +++++++--- Cantera/src/misc.cpp | 19 +++++++++++++ Cantera/src/oneD/MultiNewton.cpp | 4 +-- Cantera/src/zeroD/ReactorNet.cpp | 19 +++++++++---- Cantera/src/zeroD/ReactorNet.h | 21 +++++++++++++- Makefile.in | 9 ++++-- config/configure | 18 +++++++++--- config/configure.in | 8 ++++++ configure | 4 +++ ext/cvode/Makefile.in | 5 +--- 24 files changed, 174 insertions(+), 104 deletions(-) diff --git a/Cantera/clib/src/Makefile.in b/Cantera/clib/src/Makefile.in index e445e92b3..3842a73cb 100755 --- a/Cantera/clib/src/Makefile.in +++ b/Cantera/clib/src/Makefile.in @@ -68,7 +68,6 @@ ifeq ($(shared_ctlib),1) $(EXT_LIBS) @LIBS@ $(FORT_LIBS) else @ARCHIVE@ $(CTLIB) $(OBJS) - ranlib $(CTLIB) endif clean: diff --git a/Cantera/clib/src/ctonedim.cpp b/Cantera/clib/src/ctonedim.cpp index 550983be2..c07575331 100644 --- a/Cantera/clib/src/ctonedim.cpp +++ b/Cantera/clib/src/ctonedim.cpp @@ -126,7 +126,7 @@ extern "C" { try { return _domain(i)->grid(n); } - catch (CanteraError) { return -1; } + catch (CanteraError) { return DERR; } } int DLL_EXPORT domain_setBounds(int i, int n, double lower, double upper) { @@ -141,14 +141,14 @@ extern "C" { try { return _domain(i)->upperBound(n); } - catch (CanteraError) { return -1.0; } + catch (CanteraError) { return DERR; } } double DLL_EXPORT domain_lowerBound(int i, int n) { try { return _domain(i)->lowerBound(n); } - catch (CanteraError) { return -1.0; } + catch (CanteraError) { return DERR; } } int DLL_EXPORT domain_setTolerances(int i, int n, double rtol, @@ -164,14 +164,14 @@ extern "C" { try { return _domain(i)->rtol(n); } - catch (CanteraError) { return -1.0; } + catch (CanteraError) { return DERR; } } double DLL_EXPORT domain_atol(int i, int n) { try { return _domain(i)->atol(n); } - catch (CanteraError) { return -1.0; } + catch (CanteraError) { return DERR; } } int DLL_EXPORT domain_setupGrid(int i, int npts, double* grid) { @@ -271,21 +271,21 @@ extern "C" { try { return _bdry(i)->temperature(); } - catch (CanteraError) { return -1; } + catch (CanteraError) { return DERR; } } double DLL_EXPORT bdry_massFraction(int i, int k) { try { return _bdry(i)->massFraction(k); } - catch (CanteraError) { return -1; } + catch (CanteraError) { return DERR; } } double DLL_EXPORT bdry_mdot(int i) { try { return _bdry(i)->mdot(); } - catch (CanteraError) { return -1; } + catch (CanteraError) { return DERR; } } int DLL_EXPORT reactingsurf_setkineticsmgr(int i, int j) { @@ -547,14 +547,14 @@ extern "C" { try { return _sim1D(i)->value(idom, icomp, localPoint); } - catch (CanteraError) { return -1.0; } + catch (CanteraError) { return DERR; } } double DLL_EXPORT sim1D_workValue(int i, int idom, int icomp, int localPoint) { try { return _sim1D(i)->workValue(idom, icomp, localPoint); } - catch (CanteraError) { return -1.0; } + catch (CanteraError) { return DERR; } } int DLL_EXPORT sim1D_eval(int i, double rdt, int count) { diff --git a/Cantera/cxx/src/writelog.cpp b/Cantera/cxx/src/writelog.cpp index 1321b7635..5484bd5bf 100644 --- a/Cantera/cxx/src/writelog.cpp +++ b/Cantera/cxx/src/writelog.cpp @@ -40,4 +40,12 @@ namespace Cantera { void writelog(const string& s) { cout << s; } + + /** + * Write an error message and quit. + */ + void error(const string& msg) { + cerr << msg << endl; + exit(-1); + } } diff --git a/Cantera/fortran/src/Makefile.in b/Cantera/fortran/src/Makefile.in index de7a394f5..057f9cd05 100644 --- a/Cantera/fortran/src/Makefile.in +++ b/Cantera/fortran/src/Makefile.in @@ -53,7 +53,6 @@ FTLIB = @buildlib@/$(LIB_NAME) lib: $(OBJS) $(LIB_DEPS) $(RM) $(FTLIB) @ARCHIVE@ $(FTLIB) $(OBJS) - ranlib $(FTLIB) clean: $(RM) $(OBJS) $(FTLIB) diff --git a/Cantera/matlab/cantera/private/write.cpp b/Cantera/matlab/cantera/private/write.cpp index bf3534793..c61513f29 100644 --- a/Cantera/matlab/cantera/private/write.cpp +++ b/Cantera/matlab/cantera/private/write.cpp @@ -22,5 +22,10 @@ namespace Cantera { ch = s[n]; } } + + void error(const std::string& msg) { + string err = "error("+msg+");"; + mexEvalString(err.c_str()); + } } diff --git a/Cantera/matlab/setup_winmatlab.py b/Cantera/matlab/setup_winmatlab.py index 47cb4f659..7f6c14517 100644 --- a/Cantera/matlab/setup_winmatlab.py +++ b/Cantera/matlab/setup_winmatlab.py @@ -1,35 +1,27 @@ import sys -bindir = '/home/goodwin/ct154/bin' -libdir = '/home/goodwin/dv/sf/cantera/build/lib/i686-pc-linux-gnu' -incdir = '/home/goodwin/dv/sf/cantera/build/include' -dflibdir = '' - -libs = ['clib', 'oneD', 'zeroD', 'transport', 'cantera', 'recipes', - 'cvode', 'ctlapack', 'ctmath', 'ctblas', 'tpx'] +bindir = '/usr/local/bin' +libdir = '/Users/dgg/dv/sf/cantera/build/lib/powerpc-apple-darwin7.3.0' +incdir = '/Users/dgg/dv/sf/cantera/build/include' +libs = '-lclib -loneD -lzeroD -ltransport -lcantera -lrecipes -lcvode -lctlapack -lctmath -lctblas -ltpx -lg2c -lgcc' f = open('setup.m','w') -f.write('cd cantera\nbuild_cantera\nexit\n') +f.write('cd cantera\nbuildux\nexit\n') f.close() -fb = open('cantera/build_cantera.m','w') +fb = open('cantera/buildux.m','w') fb.write(""" disp('building Cantera..'); -mex -I"""+incdir+""" private/ctmethods.cpp private/ctfunctions.cpp ... +mex private/ctmethods.cpp private/ctfunctions.cpp ... private/xmlmethods.cpp private/phasemethods.cpp ... private/thermomethods.cpp private/kineticsmethods.cpp ... private/transportmethods.cpp private/reactormethods.cpp ... private/wallmethods.cpp private/flowdevicemethods.cpp ... + private/funcmethods.cpp ... private/onedimmethods.cpp private/surfmethods.cpp private/write.cpp ... +"""+'-I'+incdir+' -L'+libdir+' '+libs+'\n'+"""disp('done.'); """) -s = '' -for lib in libs: - s += ' '+libdir+'/'+lib+'.lib ...\n' -fb.write(s) -fb.write(' "'+dflibdir+'/dformd.lib" ...\n') -fb.write(' "'+dflibdir+'/dfconsol.lib" ...\n') -fb.write(' "'+dflibdir+'/dfport.lib" \n') fb.close() fp = open('cantera/ctbin.m','w') diff --git a/Cantera/python/Cantera/OneD/onedim.py b/Cantera/python/Cantera/OneD/onedim.py index 567e64189..20f76dcd9 100644 --- a/Cantera/python/Cantera/OneD/onedim.py +++ b/Cantera/python/Cantera/OneD/onedim.py @@ -323,10 +323,15 @@ class AxisymmetricFlow(Domain1D): def pressure(self): return self._p - def setFixedTempProfile(self, temp): + def setFixedTempProfile(self, pos, temp): """Set the fixed temperature profile. This profile is used - whenever the energy equation is disabled. """ - return _cantera.stflow_setFixedTempProfile(self._hndl, temp) + whenever the energy equation is disabled. + + pos - arrray of relative positions from 0 to 1 + temp - array of temperature values + + """ + return _cantera.stflow_setFixedTempProfile(self._hndl, pos, temp) def solveSpeciesEqs(self, flag = 1): """Enable or disable solving the species equations. If invoked diff --git a/Cantera/python/Cantera/Reactor.py b/Cantera/python/Cantera/Reactor.py index 61def5b3b..5bdae4d48 100644 --- a/Cantera/python/Cantera/Reactor.py +++ b/Cantera/python/Cantera/Reactor.py @@ -577,7 +577,7 @@ class Valve(FlowDevice): self.setValveCoeff(Kv, mdot0) - def setValveCoeff(self, Kv, mdot0 = 0.0): + def setValveCoeff(self, Kv = -1.0, mdot0 = 0.0): """Set or reset the valve coefficient \f$ K_v \f$.""" vv = zeros(2,'d') vv[0] = Kv @@ -808,12 +808,12 @@ class ReactorNet: Example: - r1 = Reactor(gas1) - r2 = Reactor(gas2) - <... install walls, inlets, outlets, etc...> + >>> r1 = Reactor(gas1) + >>> r2 = Reactor(gas2) + >>> <... install walls, inlets, outlets, etc...> - reactor_network = ReactorNet([r1, r2]) - reactor_network.advance(time) + >>> reactor_network = ReactorNet([r1, r2]) + >>> reactor_network.advance(time) """ @@ -847,7 +847,8 @@ class ReactorNet: Add a reactor to the network. """ self._reactors.append(reactor) - _cantera.reactornet_addreactor(self.__reactornet_id, reactor.reactor_id()) + _cantera.reactornet_addreactor(self.__reactornet_id, + reactor.reactor_id()) def setInitialTime(self, t0): diff --git a/Cantera/python/src/ctonedim_methods.cpp b/Cantera/python/src/ctonedim_methods.cpp index 2ada490ef..e32e83ec8 100644 --- a/Cantera/python/src/ctonedim_methods.cpp +++ b/Cantera/python/src/ctonedim_methods.cpp @@ -93,7 +93,7 @@ py_domain_componentName(PyObject *self, PyObject *args) _val = domain_componentName(i,n,nameout_sz,nameout); PyObject* _ret = Py_BuildValue("s",nameout); - delete nameout; + delete[] nameout; if (int(_val) == -1) return reportCanteraError(); return _ret; @@ -142,7 +142,7 @@ py_domain_lowerBound(PyObject *self, PyObject *args) return NULL; _val = domain_lowerBound(i,n); - if (int(_val) == -1) return reportCanteraError(); + if (_val == DERR) return reportCanteraError(); return Py_BuildValue("d",_val); } @@ -157,7 +157,7 @@ py_domain_upperBound(PyObject *self, PyObject *args) return NULL; _val = domain_upperBound(i,n); - if (int(_val) == -1) return reportCanteraError(); + if (_val == DERR) return reportCanteraError(); return Py_BuildValue("d",_val); } @@ -189,7 +189,7 @@ py_domain_rtol(PyObject *self, PyObject *args) return NULL; _val = domain_rtol(i,n); - if (int(_val) == -1) return reportCanteraError(); + if (_val == DERR) return reportCanteraError(); return Py_BuildValue("d",_val); } @@ -204,7 +204,7 @@ py_domain_atol(PyObject *self, PyObject *args) return NULL; _val = domain_atol(i,n); - if (int(_val) == -1) return reportCanteraError(); + if (_val == DERR) return reportCanteraError(); return Py_BuildValue("d",_val); } @@ -286,7 +286,7 @@ py_domain_grid(PyObject *self, PyObject *args) return NULL; _val = domain_grid(i,n); - if (int(_val) == -1) return reportCanteraError(); + if (_val == DERR) return reportCanteraError(); return Py_BuildValue("d",_val); } @@ -345,7 +345,7 @@ py_bdry_temperature(PyObject *self, PyObject *args) return NULL; _val = bdry_temperature(i); - if (int(_val) == -1) return reportCanteraError(); + if (_val == DERR) return reportCanteraError(); return Py_BuildValue("d",_val); } @@ -360,7 +360,7 @@ py_bdry_massFraction(PyObject *self, PyObject *args) return NULL; _val = bdry_massFraction(i,k); - if (int(_val) == -1) return reportCanteraError(); + if (_val == DERR) return reportCanteraError(); return Py_BuildValue("d",_val); } @@ -374,7 +374,7 @@ py_bdry_mdot(PyObject *self, PyObject *args) return NULL; _val = bdry_mdot(i); - if (int(_val) == -1) return reportCanteraError(); + if (_val == DERR) return reportCanteraError(); return Py_BuildValue("d",_val); } @@ -845,11 +845,12 @@ py_sim1D_value(PyObject *self, PyObject *args) int idom; int icomp; int localPoint; - if (!PyArg_ParseTuple(args, "iiii:sim1D_value", &i, &idom, &icomp, &localPoint)) + if (!PyArg_ParseTuple(args, "iiii:sim1D_value", &i, &idom, &icomp, + &localPoint)) return NULL; _val = sim1D_value(i,idom,icomp,localPoint); - if (int(_val) == -1) return reportCanteraError(); + if (_val == DERR) return reportCanteraError(); return Py_BuildValue("d",_val); } @@ -866,7 +867,7 @@ py_sim1D_workValue(PyObject *self, PyObject *args) return NULL; _val = sim1D_workValue(i,idom,icomp,localPoint); - if (int(_val) == -1) return reportCanteraError(); + if (_val == DERR) return reportCanteraError(); return Py_BuildValue("d",_val); } diff --git a/Cantera/python/src/ctphase_methods.cpp b/Cantera/python/src/ctphase_methods.cpp index 9c9580d4d..543f7fa71 100644 --- a/Cantera/python/src/ctphase_methods.cpp +++ b/Cantera/python/src/ctphase_methods.cpp @@ -193,7 +193,7 @@ phase_getstring(PyObject *self, PyObject *args) } if (iok >= 0) { PyObject* str = Py_BuildValue("s",output_buf); - delete output_buf; + delete[] output_buf; return str; } delete output_buf; diff --git a/Cantera/python/src/ctxml_methods.cpp b/Cantera/python/src/ctxml_methods.cpp index 3c0f5233f..3c05306ec 100644 --- a/Cantera/python/src/ctxml_methods.cpp +++ b/Cantera/python/src/ctxml_methods.cpp @@ -53,7 +53,7 @@ py_xml_attrib(PyObject *self, PyObject *args) int iok = xml_attrib(n, key, val); if (iok < 0) return reportError(iok); PyObject* r = Py_BuildValue("s",val); - delete val; + delete[] val; return r; } diff --git a/Cantera/python/src/writelog.cpp b/Cantera/python/src/writelog.cpp index 415a90579..cda6194a7 100644 --- a/Cantera/python/src/writelog.cpp +++ b/Cantera/python/src/writelog.cpp @@ -22,4 +22,8 @@ namespace Cantera { } } + void error(const std::string& msg) { + string err = "raise \""+msg+"\""; + PyRun_SimpleString((char *)err.c_str()); + } } diff --git a/Cantera/src/Makefile.in b/Cantera/src/Makefile.in index 2223dad5a..a550d31f6 100755 --- a/Cantera/src/Makefile.in +++ b/Cantera/src/Makefile.in @@ -104,7 +104,7 @@ CXX_LIBS = @LIBS@ CXX_INCLUDES = -I. CANTERA_LIB = @buildlib@/libcantera.a -DEPENDS = $(EVERYTHING:.o=.d) +DEPENDS = $(EVERYTHING:.o=.d) $(PCH:.gch=.d) %.d: g++ -MM $*.cpp > $*.d diff --git a/Cantera/src/converters/CKParser.cpp b/Cantera/src/converters/CKParser.cpp index 99bf99334..2bd028a71 100755 --- a/Cantera/src/converters/CKParser.cpp +++ b/Cantera/src/converters/CKParser.cpp @@ -6,26 +6,9 @@ // Copyright 2001 California Institute of Technology // // $Log$ -// Revision 1.3 2003-08-26 03:25:41 dggoodwin +// Revision 1.4 2004-05-13 16:58:33 dggoodwin // *** empty log message *** // -// Revision 1.2 2003/07/30 20:56:57 dggoodwin -// *** empty log message *** -// -// Revision 1.1.1.1 2003/04/14 17:57:52 dggoodwin -// Initial import. -// -// Revision 1.1 2003/03/05 00:28:16 dgg -// *** empty log message *** -// -// Revision 1.21 2003/03/02 02:15:50 dgg -// *** empty log message *** -// -// Revision 1.20 2003/02/19 14:36:31 dgg -// *** empty log message *** -// -// Revision 1.19 2003/02/13 19:07:19 dgg -// *** empty log message *** // // turn off warnings about truncating long names under Windows @@ -44,8 +27,6 @@ #include "writelog.h" #include -//#include "../Cantera/src/ctmap.h" - using namespace std; @@ -99,8 +80,7 @@ namespace ckr { }; - extern void getDefaultAtomicWeights(map& weights); - //extern void getDefaultAtomicWeights(ct::ctmap_sd& weights); + extern void getDefaultAtomicWeights(map& weights); static double getNumberFromString(string s) { bool inexp = false; @@ -121,8 +101,6 @@ namespace ckr { else if (ch != '.' && (ch < '0' || ch > '9')) { return UNDEF; } - //else if (!inexp && isdigit(ch) && ch != '0') return UNDEF; - //else if (!inexp && ) return UNDEF; } return atof(s.c_str()); } @@ -289,9 +267,12 @@ namespace ckr { // Cantera anti-comment character const char undoCommentChar = '%'; - // unix end of line + // carriage return const char char13 = char(13); + // linefeed + const char char10 = char(10); + istream& f = *m_ckfile; // if putCKLine was called to 'put back' a line, then return this @@ -316,8 +297,8 @@ namespace ckr { while (1 > 0) { f.get(ch); if (!f || f.eof()) break; - if (ch == '\n' || ch == char13) break; - line += ch; + if (ch == '\n' || ch == char10) break; + if (isprint(ch)) line += ch; } int icom = line.find(commentChar); diff --git a/Cantera/src/global.h b/Cantera/src/global.h index fc2bd8b68..8ce76a82a 100755 --- a/Cantera/src/global.h +++ b/Cantera/src/global.h @@ -35,6 +35,8 @@ namespace Cantera { /// Print the error messages to stream f void showErrors(ostream& f); + void showErrors(); + /// Discard the last error message void popError(); @@ -87,12 +89,16 @@ namespace Cantera { void writelog(const string& msg); void writelog(const char* msg); - - //void getlog(string& s); - //void clearlog(); + /// write an error message and quit. Like writelog, this is + /// specific to each environment. The C++ version calls exit(), + /// the Python version throws a Python exception, and the Matlab + /// version calls Matlab function error(). + void error(const string& msg); + /** - * Return the conversion factor to convert unit string 'unit' to SI units. + * Return the conversion factor to convert unit string 'unit' to + * SI units. */ doublereal toSI(string unit); doublereal actEnergyToSI(string unit); diff --git a/Cantera/src/misc.cpp b/Cantera/src/misc.cpp index 9ac6cfe7c..ce650ecf4 100755 --- a/Cantera/src/misc.cpp +++ b/Cantera/src/misc.cpp @@ -229,6 +229,25 @@ namespace Cantera { __app->errorRoutine.clear(); } + void showErrors() { + appinit(); + int i = __app->errorMessage.size(); + if (i == 0) return; + writelog("\n\n"); + writelog("************************************************\n"); + writelog(" Cantera Error! \n"); + writelog("************************************************\n\n"); + int j; + for (j = 0; j < i; j++) { + writelog("\n"); + writelog(string("Procedure: ")+ __app->errorRoutine[j]+"\n"); + writelog(string("Error: ")+__app->errorMessage[j]+"\n"); + } + writelog("\n\n"); + __app->errorMessage.clear(); + __app->errorRoutine.clear(); + } + void setError(string r, string msg) { appinit(); __app->errorMessage.push_back(msg); diff --git a/Cantera/src/oneD/MultiNewton.cpp b/Cantera/src/oneD/MultiNewton.cpp index f57bdd061..f2948ac08 100644 --- a/Cantera/src/oneD/MultiNewton.cpp +++ b/Cantera/src/oneD/MultiNewton.cpp @@ -72,7 +72,7 @@ namespace Cantera { int n = m_workarrays.size(); int i; for (i = 0; i < n; i++) { - delete m_workarrays[i]; + delete[] m_workarrays[i]; } } @@ -84,7 +84,7 @@ namespace Cantera { int n = m_workarrays.size(); int i; for (i = 0; i < n; i++) { - delete m_workarrays[i]; + delete[] m_workarrays[i]; } m_workarrays.clear(); } diff --git a/Cantera/src/zeroD/ReactorNet.cpp b/Cantera/src/zeroD/ReactorNet.cpp index bc96aea55..6106623aa 100644 --- a/Cantera/src/zeroD/ReactorNet.cpp +++ b/Cantera/src/zeroD/ReactorNet.cpp @@ -4,8 +4,9 @@ namespace Cantera { ReactorNet::ReactorNet() : FuncEval(), m_nr(0), m_nreactors(0), - m_integ(0), m_init(false), - m_nv(0), m_rtol(1.0e-6), + m_integ(0), m_time(0.0), m_init(false), + m_nv(0), m_rtol(1.0e-6), m_atols(1.0e-15), + m_maxstep(-1.0), m_verbose(false) { m_integ = new CVodeInt; @@ -43,7 +44,7 @@ namespace Cantera { } } m_atol.resize(neq()); - fill(m_atol.begin(), m_atol.end(), 1.e-15); + fill(m_atol.begin(), m_atol.end(), m_atols); m_integ->setTolerances(m_rtol, neq(), m_atol.begin()); m_integ->setMaxStep(m_maxstep); if (m_verbose) { @@ -58,7 +59,8 @@ namespace Cantera { void ReactorNet::advance(doublereal time) { if (!m_init) { - m_maxstep = time - m_time; + if (m_maxstep < 0.0) + m_maxstep = time - m_time; initialize(); } m_integ->integrate(time); @@ -68,7 +70,8 @@ namespace Cantera { double ReactorNet::step(doublereal time) { if (!m_init) { - m_maxstep = time - m_time; + if (m_maxstep < 0.0) + m_maxstep = time - m_time; initialize(); } m_time = m_integ->step(time); @@ -79,6 +82,9 @@ namespace Cantera { void ReactorNet::eval(doublereal t, doublereal* y, doublereal* ydot) { int n; int start = 0; + + // use a try... catch block, since exceptions are not passed + // through CVODE, since it is C code try { updateState(y); for (n = 0; n < m_nreactors; n++) { @@ -87,7 +93,8 @@ namespace Cantera { } } catch (CanteraError) { - showErrors(cout); + showErrors(); + error("Terminating execution."); } } diff --git a/Cantera/src/zeroD/ReactorNet.h b/Cantera/src/zeroD/ReactorNet.h index 33d63e5b9..b8ef90346 100644 --- a/Cantera/src/zeroD/ReactorNet.h +++ b/Cantera/src/zeroD/ReactorNet.h @@ -37,7 +37,6 @@ namespace Cantera { /** @name Methods to set up a simulation. */ //@{ - /** * Set initial time. Default = 0.0 s. Restarts integration * from this time using the current mixture state as the @@ -48,6 +47,25 @@ namespace Cantera { m_init = false; } + /// Set the maximum time step. + void setMaxTimeStep(double maxstep) { + m_maxstep = maxstep; + m_init = false; + } + + void setTolerances(doublereal rtol, doublereal atol) { + m_rtol = rtol; + m_atols = atol; + m_init = false; + } + + /// Current value of the simulation time. + doublereal time() { return m_time; } + + /// Relative tolerance. + doublereal rtol() { return m_rtol; } + doublereal atol() { return m_atols; } + /** * Initialize the reactor network. */ @@ -102,6 +120,7 @@ namespace Cantera { vector_int m_size; vector_fp m_atol; doublereal m_rtol; + doublereal m_atols; doublereal m_maxstep; bool m_verbose; diff --git a/Makefile.in b/Makefile.in index ea64d749f..8dcc8bd52 100755 --- a/Makefile.in +++ b/Makefile.in @@ -16,6 +16,7 @@ build_matlab = @BUILD_MATLAB@ build_particles = @BUILD_PARTICLES@ os_is_win = @OS_IS_WIN@ incl_user_code = @INCL_USER_CODE@ +do_ranlib = @DO_RANLIB@ prefix=@prefix@ @@ -53,7 +54,9 @@ endif clib: cd Cantera/clib/src; @MAKE@ - ranlib @buildlib@/*.a +ifeq ($(do_ranlib),1) + @RANLIB@ @buildlib@/*.a +endif cxxlib: cd Cantera/cxx/src; @MAKE@ @@ -66,7 +69,9 @@ kernel-install: rm -f @ct_libdir@/* @INSTALL@ -m 644 @buildlib@/*.a @ct_libdir@ cd Cantera/clib/src; @MAKE@ install - ranlib @ct_libdir@/*.a +ifeq ($(do_ranlib),1) + @RANLIB@ @ct_libdir@/*.a +endif win-kernel-install: @INSTALL@ -d @ct_libdir@ diff --git a/config/configure b/config/configure index 88086268d..044881677 100755 --- a/config/configure +++ b/config/configure @@ -271,7 +271,7 @@ PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="Cantera.README" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CVF_LIBDIR local_inst local_python_inst python_prefix ctversion homedir ct_libdir ct_incdir ct_incroot ct_bindir ct_datadir ct_demodir ct_templdir ct_mandir ct_tutdir ct_docdir ct_dir CANTERA_LIBDIR CANTERA_INCDIR CT_TOOLS_BIN CANTERA_BINDIR CANTERA_EXAMPLES_DIR CANTERA_DATADIR build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os username ctroot buildinc buildlib buildbin MAKE ARCHIVE SOEXT SHARED PIC LCXX_FLAGS LCXX_END_LIBS USERDIR INCL_USER_CODE KERNEL BUILD_CK LIB_DIR LAPACK_LIBRARY build_lapack BLAS_LIBRARY build_blas LOCAL_LIBS CANTERA_PARTICLES_DIR BUILD_PARTICLES CT_SHARED_LIB BUILD_F90 PYTHON_CMD BUILD_PYTHON MATLAB_CMD BUILD_MATLAB BUILD_CLIB export_name INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT CC CFLAGS ac_ct_CC F77 FFLAGS ac_ct_F77 FLIBS precompile_headers CXX_DEPENDS OS_IS_DARWIN OS_IS_WIN OS_IS_CYGWIN SHARED_CTLIB mex_ext F77_EXT CXX_EXT OBJ_EXT EXE_EXT local_math_libs math_libs SO LDSHARED LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CVF_LIBDIR local_inst local_python_inst python_prefix ctversion homedir ct_libdir ct_incdir ct_incroot ct_bindir ct_datadir ct_demodir ct_templdir ct_mandir ct_tutdir ct_docdir ct_dir CANTERA_LIBDIR CANTERA_INCDIR CT_TOOLS_BIN CANTERA_BINDIR CANTERA_EXAMPLES_DIR CANTERA_DATADIR build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os username ctroot buildinc buildlib buildbin MAKE ARCHIVE DO_RANLIB RANLIB SOEXT SHARED PIC LCXX_FLAGS LCXX_END_LIBS USERDIR INCL_USER_CODE KERNEL BUILD_CK LIB_DIR LAPACK_LIBRARY build_lapack BLAS_LIBRARY build_blas LOCAL_LIBS CANTERA_PARTICLES_DIR BUILD_PARTICLES CT_SHARED_LIB BUILD_F90 PYTHON_CMD BUILD_PYTHON MATLAB_CMD BUILD_MATLAB BUILD_CLIB export_name INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT CC CFLAGS ac_ct_CC F77 FFLAGS ac_ct_F77 FLIBS precompile_headers CXX_DEPENDS OS_IS_DARWIN OS_IS_WIN OS_IS_CYGWIN SHARED_CTLIB mex_ext F77_EXT CXX_EXT OBJ_EXT EXE_EXT local_math_libs math_libs SO LDSHARED LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -1533,6 +1533,14 @@ fi +DO_RANLIB=1 +if test "x${RANLIB}" = "x"; then +DO_RANLIB=0 +fi + + + + #---------------------------------------- @@ -3256,7 +3264,7 @@ fi # Provide some information about the compiler. -echo "$as_me:3259:" \ +echo "$as_me:3267:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -3433,7 +3441,7 @@ _ACEOF # flags. ac_save_FFLAGS=$FFLAGS FFLAGS="$FFLAGS $ac_verb" -(eval echo $as_me:3436: \"$ac_link\") >&5 +(eval echo $as_me:3444: \"$ac_link\") >&5 ac_f77_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'` echo "$ac_f77_v_output" >&5 FFLAGS=$ac_save_FFLAGS @@ -3513,7 +3521,7 @@ _ACEOF # flags. ac_save_FFLAGS=$FFLAGS FFLAGS="$FFLAGS $ac_cv_prog_f77_v" -(eval echo $as_me:3516: \"$ac_link\") >&5 +(eval echo $as_me:3524: \"$ac_link\") >&5 ac_f77_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'` echo "$ac_f77_v_output" >&5 FFLAGS=$ac_save_FFLAGS @@ -4424,6 +4432,8 @@ s,@buildlib@,$buildlib,;t t s,@buildbin@,$buildbin,;t t s,@MAKE@,$MAKE,;t t s,@ARCHIVE@,$ARCHIVE,;t t +s,@DO_RANLIB@,$DO_RANLIB,;t t +s,@RANLIB@,$RANLIB,;t t s,@SOEXT@,$SOEXT,;t t s,@SHARED@,$SHARED,;t t s,@PIC@,$PIC,;t t diff --git a/config/configure.in b/config/configure.in index def5d5b73..3fcc200f3 100755 --- a/config/configure.in +++ b/config/configure.in @@ -199,6 +199,14 @@ fi AC_SUBST(ARCHIVE) +DO_RANLIB=1 +if test "x${RANLIB}" = "x"; then +DO_RANLIB=0 +fi + +AC_SUBST(DO_RANLIB) +AC_SUBST(RANLIB) + #---------------------------------------- diff --git a/configure b/configure index c7b0d02fa..f6b828826 100755 --- a/configure +++ b/configure @@ -243,6 +243,9 @@ FORT_MODULE_PATH_CMD=${FORT_MODULE_PATH_CMD:="-I$FORT_MODULE_DIRECTORY"} # the command to create a static library ARCHIVE=${ARCHIVE:="ar ruv"} +# the command to run 'ranlib' if it is needed. +RANLIB=${RANLIB:="ranlib"} + # the command to run the 'make' utility. The Cantera Makefiles are # compatible with the GNU make utility, so if your make utility # doesn't work, try GNU make. @@ -273,6 +276,7 @@ RPFONT=${RPFONT:="Helvetica"} export CANTERA_VERSION export USER_SRC_DIR export ARCHIVE +export RANLIB export BLAS_LIBRARY export BUILD_F90 export BUILD_FORTRAN_90_INTERFACE diff --git a/ext/cvode/Makefile.in b/ext/cvode/Makefile.in index c865f53ce..6b87bfb5d 100755 --- a/ext/cvode/Makefile.in +++ b/ext/cvode/Makefile.in @@ -19,9 +19,6 @@ # # Modify the COMPILER and OPTS variables as needed. # -# If the ranlib utility is not available on your system, then remove the call -# to ranlib from the commands to create libcvode.a. - all: @buildlib@/libcvode.a COMPILER = @CC@ @@ -35,7 +32,7 @@ OBJS = source/cvode.o source/cvdense.o source/dense.o source/cvband.o \ @buildlib@/libcvode.a: $(OBJS) $(RM) @buildlib@/libcvode.a - (ar rcv @buildlib@/libcvode.a $(OBJS); ranlib @buildlib@/libcvode.a) + (ar rcv @buildlib@/libcvode.a $(OBJS)) source/cvode.o: source/cvode.c include/cvode.h include/llnltyps.h \ include/nvector.h include/llnlmath.h