changed setMaxStep to setMaxStepSize, setMinStep to setMinStepSize, and added setMaxSteps to set the maximum number of steps that will be taken.

This commit is contained in:
Dave Goodwin 2004-05-16 13:54:11 +00:00
parent 6d5a3c7f0b
commit 305bdd09a2
3 changed files with 25 additions and 13 deletions

View file

@ -100,7 +100,8 @@ namespace Cantera {
m_reltol(1.e-9),
m_abstols(1.e-15),
m_nabs(0),
m_hmax(0.0)
m_hmax(0.0),
m_maxsteps(20000)
{
m_ropt.resize(OPT_SIZE,0.0);
m_iopt = new long[OPT_SIZE];
@ -152,16 +153,21 @@ namespace Cantera {
throw CVodeErr("unknown method");
}
void CVodeInt::setMaxStep(doublereal hmax) {
void CVodeInt::setMaxStepSize(doublereal hmax) {
m_hmax = hmax;
m_ropt[HMAX] = hmax;
}
void CVodeInt::setMinStep(doublereal hmin) {
void CVodeInt::setMinStepSize(doublereal hmin) {
m_hmin = hmin;
m_ropt[HMIN] = hmin;
}
void CVodeInt::setMaxSteps(int nmax) {
m_maxsteps = nmax;
m_iopt[MXSTEP] = m_maxsteps;
}
void CVodeInt::setIterator(IterType t) {
if (t == Newton_Iter)
m_iter = NEWTON;
@ -186,7 +192,7 @@ namespace Cantera {
func.getInitialConditions(m_t0, m_neq, N_VDATA(nv(m_y)));
// set options
m_iopt[MXSTEP] = 20000;
m_iopt[MXSTEP] = m_maxsteps;
m_iopt[MAXORD] = m_maxord;
m_ropt[HMAX] = m_hmax;
@ -235,7 +241,7 @@ namespace Cantera {
func.getInitialConditions(m_t0, m_neq, N_VDATA(nv(m_y)));
// set options
m_iopt[MXSTEP] = 20000;
m_iopt[MXSTEP] = m_maxsteps;
m_iopt[MAXORD] = m_maxord;
m_ropt[HMAX] = m_hmax;

View file

@ -62,8 +62,9 @@ namespace Cantera {
virtual void setMaxOrder(int n) { m_maxord = n; }
virtual void setMethod(MethodType t);
virtual void setIterator(IterType t);
virtual void setMaxStep(double hmax);
virtual void setMinStep(double hmin);
virtual void setMaxStepSize(double hmax);
virtual void setMinStepSize(double hmin);
virtual void setMaxSteps(int nmax);
private:
@ -80,6 +81,7 @@ namespace Cantera {
double m_abstols;
int m_nabs;
double m_hmax, m_hmin;
int m_maxsteps;
vector_fp m_ropt;
long int* m_iopt;

View file

@ -25,6 +25,7 @@
#include "FuncEval.h"
#include "ct_defs.h"
#include "global.h"
#define DIAG 1
#define DENSE 2
@ -146,19 +147,22 @@ namespace Cantera {
{ warn("setInterator"); }
/** Set the maximum step size */
virtual void setMaxStep(double hmax)
{ warn("setMaxStep"); }
virtual void setMaxStepSize(double hmax)
{ warn("setMaxStepSize"); }
/** Set the minimum step size */
virtual void setMinStep(double hmin)
{ warn("setMinStep"); }
virtual void setMinStepSize(double hmin)
{ warn("setMinStepSize"); }
virtual void setMaxSteps(int nmax)
{ warn("setMaxStep"); }
private:
doublereal m_dummy;
void warn(string msg) const {
cerr << ">>>> Warning: method " << msg << " of base class "
<< "Integrator called. Nothing done." << endl;
writelog(">>>> Warning: method "+msg+" of base class "
+"Integrator called. Nothing done.\n");
}
};