Changed some defines into const variables and put them

within the Cantera namespace. This is needed to 
avoid namespace issues. For example the define BAND interfered
with an mpi variable of the same name.
This commit is contained in:
Harry Moffat 2009-08-17 01:39:19 +00:00
parent d27a1bc9c5
commit 4340e7089e

View file

@ -27,164 +27,165 @@
#include "ct_defs.h"
#include "global.h"
#define DIAG 1
#define DENSE 2
#define NOJAC 4
#define JAC 8
#define GMRES 16
#define BAND 32
namespace Cantera {
/**
* Specifies the method used to integrate the system of equations.
* Not all methods are supported by all integrators.
*/
enum MethodType {
BDF_Method, /**< Backward Differentiation */
Adams_Method /**< Adams */
};
const int DIAG = 1;
const int DENSE = 2;
const int NOJAC = 4;
const int JAC = 8;
const int GMRES =16;
const int BAND =32;
/**
* Specifies the method used to integrate the system of equations.
* Not all methods are supported by all integrators.
*/
enum MethodType {
BDF_Method, /**< Backward Differentiation */
Adams_Method /**< Adams */
};
/**
* Specifies the method used for iteration.
* Not all methods are supported by all integrators.
*/
enum IterType {
Newton_Iter, /**< Newton iteration */
Functional_Iter /**< Functional iteration */
};
/**
* Abstract base class for ODE system integrators.
* @ingroup odeGroup
*/
class Integrator {
public:
virtual ~Integrator() {}
/** Set or reset the number of equations. */
//virtual void resize(int n)=0;
/**
* Specifies the method used for iteration.
* Not all methods are supported by all integrators.
*/
enum IterType {
Newton_Iter, /**< Newton iteration */
Functional_Iter /**< Functional iteration */
};
* Set error tolerances.
* @param reltol scalar relative tolerance
* @param number of equations
* @param abstol array of N absolute tolerance values
*/
virtual void setTolerances(doublereal reltol, int n,
doublereal* abstol) { warn("setTolerances"); }
/**
* Abstract base class for ODE system integrators.
* @ingroup odeGroup
* Set error tolerances.
* @param reltol scalar relative tolerance
* @param abstol scalar absolute tolerance
*/
virtual void setTolerances(doublereal reltol, doublereal abstol)
{ warn("setTolerances"); }
virtual void setSensitivityTolerances(doublereal reltol, doublereal abstol)
{}// { warn("setSensitivityTolerances"); }
/**
* Set problem type.
*/
class Integrator {
virtual void setProblemType(int probtype) { warn("setProblemType"); }
public:
/**
* Initialize the integrator for a new problem. Call after
* all options have been set.
* @param t0 initial time
* @param func RHS evaluator object for system of equations.
*/
virtual void initialize(doublereal t0, FuncEval& func)
{ warn("initialize"); }
virtual ~Integrator() {}
virtual void reinitialize(doublereal t0, FuncEval& func)
{ warn("reinitialize"); }
/** Set or reset the number of equations. */
//virtual void resize(int n)=0;
/**
* Integrate the system of equations.
* @param tout integrate to this time. Note that this is the
* absolute time value, not a time interval.
*/
virtual void integrate(doublereal tout)
{ warn("integrate"); }
/**
* Set error tolerances.
* @param reltol scalar relative tolerance
* @param number of equations
* @param abstol array of N absolute tolerance values
*/
virtual void setTolerances(doublereal reltol, int n,
doublereal* abstol) { warn("setTolerances"); }
/**
* Integrate the system of equations.
* @param tout integrate to this time. Note that this is the
* absolute time value, not a time interval.
*/
virtual doublereal step(doublereal tout)
{ warn("step"); return 0.0; }
/**
* Set error tolerances.
* @param reltol scalar relative tolerance
* @param abstol scalar absolute tolerance
*/
virtual void setTolerances(doublereal reltol, doublereal abstol)
{ warn("setTolerances"); }
/** The current value of the solution of equation k. */
virtual doublereal& solution(int k)
{ warn("solution"); return m_dummy; }
virtual void setSensitivityTolerances(doublereal reltol, doublereal abstol)
{}// { warn("setSensitivityTolerances"); }
/** The current value of the solution of the system of equations. */
virtual doublereal* solution()
{ warn("solution"); return 0; }
/**
* Set problem type.
*/
virtual void setProblemType(int probtype) { warn("setProblemType"); }
/** The number of equations. */
virtual int nEquations() const
{ warn("nEquations"); return 0; }
/**
* Initialize the integrator for a new problem. Call after
* all options have been set.
* @param t0 initial time
* @param func RHS evaluator object for system of equations.
*/
virtual void initialize(doublereal t0, FuncEval& func)
{ warn("initialize"); }
/** The number of function evaluations. */
virtual int nEvals() const
{ warn("nEvals"); return 0; }
virtual void reinitialize(doublereal t0, FuncEval& func)
{ warn("reinitialize"); }
/** Set the maximum integration order that will be used. **/
virtual void setMaxOrder(int n)
{ warn("setMaxorder"); }
/**
* Integrate the system of equations.
* @param tout integrate to this time. Note that this is the
* absolute time value, not a time interval.
*/
virtual void integrate(doublereal tout)
{ warn("integrate"); }
/** Set the solution method */
virtual void setMethod(MethodType t)
{ warn("setMethodType"); }
/**
* Integrate the system of equations.
* @param tout integrate to this time. Note that this is the
* absolute time value, not a time interval.
*/
virtual doublereal step(doublereal tout)
{ warn("step"); return 0.0; }
/** Set the linear iterator. */
virtual void setIterator(IterType t)
{ warn("setInterator"); }
/** The current value of the solution of equation k. */
virtual doublereal& solution(int k)
{ warn("solution"); return m_dummy; }
/** Set the maximum step size */
virtual void setMaxStepSize(double hmax)
{ warn("setMaxStepSize"); }
/** The current value of the solution of the system of equations. */
virtual doublereal* solution()
{ warn("solution"); return 0; }
/** Set the minimum step size */
virtual void setMinStepSize(double hmin)
{ warn("setMinStepSize"); }
/** The number of equations. */
virtual int nEquations() const
{ warn("nEquations"); return 0; }
virtual void setMaxSteps(int nmax)
{ warn("setMaxStep"); }
/** The number of function evaluations. */
virtual int nEvals() const
{ warn("nEvals"); return 0; }
virtual void setBandwidth(int N_Upper, int N_Lower)
{ warn("setBandwidth"); }
/** Set the maximum integration order that will be used. **/
virtual void setMaxOrder(int n)
{ warn("setMaxorder"); }
virtual int nSensParams()
{ warn("nSensParams()"); return 0; }
/** Set the solution method */
virtual void setMethod(MethodType t)
{ warn("setMethodType"); }
/** Set the linear iterator. */
virtual void setIterator(IterType t)
{ warn("setInterator"); }
/** Set the maximum step size */
virtual void setMaxStepSize(double hmax)
{ warn("setMaxStepSize"); }
/** Set the minimum step size */
virtual void setMinStepSize(double hmin)
{ warn("setMinStepSize"); }
virtual void setMaxSteps(int nmax)
{ warn("setMaxStep"); }
virtual void setBandwidth(int N_Upper, int N_Lower)
{ warn("setBandwidth"); }
virtual int nSensParams()
{ warn("nSensParams()"); return 0; }
virtual double sensitivity(int k, int p) {
warn("sensitivity"); return 0.0;
}
virtual double sensitivity(int k, int p) {
warn("sensitivity"); return 0.0;
}
private:
private:
doublereal m_dummy;
void warn(std::string msg) const {
writelog(">>>> Warning: method "+msg+" of base class "
+"Integrator called. Nothing done.\n");
}
doublereal m_dummy;
void warn(std::string msg) const {
writelog(">>>> Warning: method "+msg+" of base class "
+"Integrator called. Nothing done.\n");
}
};
};
// defined in ODE_integrators.cpp
Integrator* newIntegrator(std::string itype);
// defined in ODE_integrators.cpp
Integrator* newIntegrator(std::string itype);
// defined in ODE_integrators.cpp
void deleteIntegrator(Integrator *cv);
// defined in ODE_integrators.cpp
void deleteIntegrator(Integrator *cv);
} // namespace