Use override on various utility classes

This commit is contained in:
Ray Speth 2023-08-14 16:38:08 -04:00 committed by Ray Speth
parent cef19a9130
commit fc2185369d
28 changed files with 227 additions and 231 deletions

View File

@ -767,7 +767,7 @@ public:
{ {
} }
virtual string getClass() const { string getClass() const override {
return "InputFileError"; return "InputFileError";
} }
protected: protected:

View File

@ -86,7 +86,7 @@ public:
* @param m This is the number of columns in the new matrix * @param m This is the number of columns in the new matrix
* @param v Default fill value -> defaults to zero. * @param v Default fill value -> defaults to zero.
*/ */
void resize(size_t n, size_t m, double v=0.0); virtual void resize(size_t n, size_t m, double v=0.0);
//! Append a column to the existing matrix using a std vector //! Append a column to the existing matrix using a std vector
/*! /*!

View File

@ -24,7 +24,7 @@ public:
} }
//! Delete the static instance of this factory //! Delete the static instance of this factory
virtual void deleteFactory(); void deleteFactory() override;
//! Static function that returns the static instance of the factory, creating it //! Static function that returns the static instance of the factory, creating it
//! if necessary. //! if necessary.

View File

@ -14,10 +14,8 @@ namespace Cantera {
class NoExitLogger : public Logger { class NoExitLogger : public Logger {
public: public:
NoExitLogger() {} NoExitLogger() {}
virtual ~NoExitLogger() {}
virtual void error(const string& msg) void error(const string& msg) override {
{
std::cerr << msg << std::endl; std::cerr << msg << std::endl;
} }
}; };

View File

@ -94,7 +94,7 @@ public:
virtual ~CanteraError() throw() {}; virtual ~CanteraError() throw() {};
//! Get a description of the error //! Get a description of the error
const char* what() const throw(); const char* what() const throw() override;
//! Method overridden by derived classes to format the error message //! Method overridden by derived classes to format the error message
virtual string getMessage() const; virtual string getMessage() const;
@ -147,8 +147,8 @@ public:
ArraySizeError(const string& procedure, size_t sz, size_t reqd) : ArraySizeError(const string& procedure, size_t sz, size_t reqd) :
CanteraError(procedure), sz_(sz), reqd_(reqd) {} CanteraError(procedure), sz_(sz), reqd_(reqd) {}
virtual string getMessage() const; string getMessage() const override;
virtual string getClass() const { string getClass() const override {
return "ArraySizeError"; return "ArraySizeError";
} }
@ -178,9 +178,9 @@ public:
IndexError(const string& func, const string& arrayName, size_t m, size_t mmax) : IndexError(const string& func, const string& arrayName, size_t m, size_t mmax) :
CanteraError(func), arrayName_(arrayName), m_(m), mmax_(mmax) {} CanteraError(func), arrayName_(arrayName), m_(m), mmax_(mmax) {}
virtual ~IndexError() throw() {}; ~IndexError() throw() override {};
virtual string getMessage() const; string getMessage() const override;
virtual string getClass() const { string getClass() const override {
return "IndexError"; return "IndexError";
} }
@ -204,7 +204,7 @@ public:
NotImplementedError(const string& func, const string& msg, const Args&... args) : NotImplementedError(const string& func, const string& msg, const Args&... args) :
CanteraError(func, msg, args...) {} CanteraError(func, msg, args...) {}
virtual string getClass() const { string getClass() const override {
return "NotImplementedError"; return "NotImplementedError";
} }
}; };

View File

@ -100,7 +100,7 @@ public:
Py_XDECREF(m_value); Py_XDECREF(m_value);
} }
std::string getMessage() const { std::string getMessage() const override {
std::string msg; std::string msg;
PyObject* name = PyObject_GetAttrString(m_type, "__name__"); PyObject* name = PyObject_GetAttrString(m_type, "__name__");
@ -130,7 +130,7 @@ public:
return msg; return msg;
} }
virtual std::string getClass() const { std::string getClass() const override {
return "Exception"; return "Exception";
} }
@ -148,7 +148,7 @@ public:
m_pyobj(pyobj) { m_pyobj(pyobj) {
} }
double eval(double t) const { double eval(double t) const override {
void* err[2] = {0, 0}; void* err[2] = {0, 0};
double y = m_callback(t, m_pyobj, err); double y = m_callback(t, m_pyobj, err);
if (err[0]) { if (err[0]) {

View File

@ -50,7 +50,7 @@ inline int get_sundials_version()
class PythonLogger : public Cantera::Logger class PythonLogger : public Cantera::Logger
{ {
public: public:
virtual void write(const std::string& s) { void write(const std::string& s) override {
// 1000 bytes is the maximum size permitted by PySys_WriteStdout // 1000 bytes is the maximum size permitted by PySys_WriteStdout
static const size_t N = 999; static const size_t N = 999;
for (size_t i = 0; i < s.size(); i+=N) { for (size_t i = 0; i < s.size(); i+=N) {
@ -59,12 +59,12 @@ public:
std::cout.flush(); std::cout.flush();
} }
virtual void writeendl() { void writeendl() override {
PySys_WriteStdout("%s", "\n"); PySys_WriteStdout("%s", "\n");
std::cout.flush(); std::cout.flush();
} }
virtual void warn(const std::string& warning, const std::string& msg) { void warn(const std::string& warning, const std::string& msg) override {
if (mapped_PyWarnings.find(warning) != mapped_PyWarnings.end()) { if (mapped_PyWarnings.find(warning) != mapped_PyWarnings.end()) {
PyErr_WarnEx(mapped_PyWarnings[warning], msg.c_str(), 1); PyErr_WarnEx(mapped_PyWarnings[warning], msg.c_str(), 1);
} else { } else {
@ -73,7 +73,7 @@ public:
} }
} }
virtual void error(const std::string& msg) { void error(const std::string& msg) override {
PyErr_SetString(PyExc_RuntimeError, msg.c_str()); PyErr_SetString(PyExc_RuntimeError, msg.c_str());
} }
}; };

View File

@ -25,7 +25,7 @@ namespace Cantera
class PythonExtensionManager : public ExtensionManager class PythonExtensionManager : public ExtensionManager
{ {
public: public:
virtual void registerRateBuilders(const string& extensionName) override; void registerRateBuilders(const string& extensionName) override;
void registerRateBuilder(const string& moduleName, void registerRateBuilder(const string& moduleName,
const string& className, const string& rateName) override; const string& className, const string& rateName) override;

View File

@ -23,12 +23,12 @@ class KineticsFactory : public Factory<Kinetics>
public: public:
static KineticsFactory* factory(); static KineticsFactory* factory();
virtual void deleteFactory(); void deleteFactory() override;
/** /**
* Return a new, empty kinetics manager. * Return a new, empty kinetics manager.
*/ */
virtual Kinetics* newKinetics(const string& model); Kinetics* newKinetics(const string& model);
private: private:
static KineticsFactory* s_factory; static KineticsFactory* s_factory;

View File

@ -64,7 +64,7 @@ public:
*/ */
static ReactionRateFactory* factory(); static ReactionRateFactory* factory();
virtual void deleteFactory(); void deleteFactory() override;
private: private:
//! Pointer to the single instance of the factory //! Pointer to the single instance of the factory

View File

@ -41,9 +41,9 @@ public:
void setValue(size_t row, size_t col, double value) override; void setValue(size_t row, size_t col, double value) override;
virtual void stateAdjustment(vector<double>& state) override; void stateAdjustment(vector<double>& state) override;
virtual void updatePreconditioner() override; void updatePreconditioner() override;
//! Prune preconditioner elements //! Prune preconditioner elements
void prunePreconditioner(); void prunePreconditioner();

View File

@ -74,8 +74,8 @@ public:
*/ */
void bfill(double v = 0.0); void bfill(double v = 0.0);
double& operator()(size_t i, size_t j); double& operator()(size_t i, size_t j) override;
double operator()(size_t i, size_t j) const; double operator()(size_t i, size_t j) const override;
//! Return a changeable reference to element (i,j). //! Return a changeable reference to element (i,j).
/*! /*!
@ -117,7 +117,7 @@ public:
*/ */
double _value(size_t i, size_t j) const; double _value(size_t i, size_t j) const;
virtual size_t nRows() const; size_t nRows() const override;
//! Number of columns //! Number of columns
size_t nColumns() const; size_t nColumns() const;
@ -132,8 +132,8 @@ public:
size_t ldim() const; size_t ldim() const;
//! Multiply A*b and write result to @c prod. //! Multiply A*b and write result to @c prod.
virtual void mult(const double* b, double* prod) const; void mult(const double* b, double* prod) const override;
virtual void leftMult(const double* const b, double* const prod) const; void leftMult(const double* const b, double* const prod) const override;
//! Perform an LU decomposition, the LAPACK routine DGBTRF is used. //! Perform an LU decomposition, the LAPACK routine DGBTRF is used.
/*! /*!
@ -142,7 +142,7 @@ public:
* @returns a success flag. 0 indicates a success; ~0 indicates some * @returns a success flag. 0 indicates a success; ~0 indicates some
* error occurred, see the LAPACK documentation * error occurred, see the LAPACK documentation
*/ */
int factor(); int factor() override;
//! Solve the matrix problem Ax = b //! Solve the matrix problem Ax = b
/*! /*!
@ -162,14 +162,14 @@ public:
* @returns a success flag. 0 indicates a success; ~0 indicates some error * @returns a success flag. 0 indicates a success; ~0 indicates some error
* occurred, see the LAPACK documentation * occurred, see the LAPACK documentation
*/ */
int solve(double* b, size_t nrhs=1, size_t ldb=0); int solve(double* b, size_t nrhs=1, size_t ldb=0) override;
//! Returns an iterator for the start of the band storage data //! Returns an iterator for the start of the band storage data
/*! /*!
* Iterator points to the beginning of the data, and it is changeable. * Iterator points to the beginning of the data, and it is changeable.
* @deprecated Unused. To be removed after %Cantera 3.0. * @deprecated Unused. To be removed after %Cantera 3.0.
*/ */
virtual vector<double>::iterator begin(); vector<double>::iterator begin() override;
//! Returns an iterator for the end of the band storage data //! Returns an iterator for the end of the band storage data
/*! /*!
@ -183,7 +183,7 @@ public:
* Iterator points to the beginning of the data, and it is not changeable. * Iterator points to the beginning of the data, and it is not changeable.
* @deprecated Unused. To be removed after %Cantera 3.0. * @deprecated Unused. To be removed after %Cantera 3.0.
*/ */
vector<double>::const_iterator begin() const; vector<double>::const_iterator begin() const override;
//! Returns a const iterator for the end of the band storage data //! Returns a const iterator for the end of the band storage data
/*! /*!
@ -192,7 +192,7 @@ public:
*/ */
vector<double>::const_iterator end() const; vector<double>::const_iterator end() const;
virtual void zero(); void zero() override;
//! Returns an estimate of the inverse of the condition number for the matrix //! Returns an estimate of the inverse of the condition number for the matrix
/*! /*!
@ -201,14 +201,14 @@ public:
* @param a1norm Norm of the matrix * @param a1norm Norm of the matrix
* @returns the inverse of the condition number * @returns the inverse of the condition number
*/ */
virtual double rcond(double a1norm); double rcond(double a1norm) override;
//! Returns the factor algorithm used. This method will always return 0 //! Returns the factor algorithm used. This method will always return 0
//! (LU) for band matrices. //! (LU) for band matrices.
virtual int factorAlgorithm() const; int factorAlgorithm() const override;
//! Returns the one norm of the matrix //! Returns the one norm of the matrix
virtual double oneNorm() const; double oneNorm() const override;
//! Return a pointer to the top of column j //! Return a pointer to the top of column j
/*! /*!
@ -232,7 +232,7 @@ public:
* @param j Value of the column * @param j Value of the column
* @returns a pointer to the top of the column * @returns a pointer to the top of the column
*/ */
virtual double* ptrColumn(size_t j); double* ptrColumn(size_t j) override;
//! Return a vector of const pointers to the columns //! Return a vector of const pointers to the columns
/*! /*!
@ -241,7 +241,7 @@ public:
* *
* @returns a vector of pointers to the top of the columns of the matrices. * @returns a vector of pointers to the top of the columns of the matrices.
*/ */
virtual double* const* colPts(); double* const* colPts() override;
//! Check to see if we have any zero rows in the Jacobian //! Check to see if we have any zero rows in the Jacobian
/*! /*!
@ -251,7 +251,7 @@ public:
* @param valueSmall OUTPUT value of the largest coefficient in the smallest row * @param valueSmall OUTPUT value of the largest coefficient in the smallest row
* @return index of the row that is most nearly zero * @return index of the row that is most nearly zero
*/ */
virtual size_t checkRows(double& valueSmall) const; size_t checkRows(double& valueSmall) const override;
//! Check to see if we have any zero columns in the Jacobian //! Check to see if we have any zero columns in the Jacobian
/*! /*!
@ -261,7 +261,7 @@ public:
* @param valueSmall OUTPUT value of the largest coefficient in the smallest column * @param valueSmall OUTPUT value of the largest coefficient in the smallest column
* @return index of the column that is most nearly zero * @return index of the column that is most nearly zero
*/ */
virtual size_t checkColumns(double& valueSmall) const; size_t checkColumns(double& valueSmall) const override;
//! LAPACK "info" flag after last factor/solve operation //! LAPACK "info" flag after last factor/solve operation
int info() const { return m_info; }; int info() const { return m_info; };

View File

@ -31,53 +31,53 @@ public:
* Jacobian function, Newton iteration. * Jacobian function, Newton iteration.
*/ */
CVodesIntegrator(); CVodesIntegrator();
virtual ~CVodesIntegrator(); ~CVodesIntegrator() override;
virtual void setTolerances(double reltol, size_t n, double* abstol); void setTolerances(double reltol, size_t n, double* abstol) override;
virtual void setTolerances(double reltol, double abstol); void setTolerances(double reltol, double abstol) override;
virtual void setSensitivityTolerances(double reltol, double abstol); void setSensitivityTolerances(double reltol, double abstol) override;
virtual void initialize(double t0, FuncEval& func); void initialize(double t0, FuncEval& func) override;
virtual void reinitialize(double t0, FuncEval& func); void reinitialize(double t0, FuncEval& func) override;
virtual void integrate(double tout); void integrate(double tout) override;
virtual double step(double tout); double step(double tout) override;
virtual double& solution(size_t k); double& solution(size_t k) override;
virtual double* solution(); double* solution() override;
virtual double* derivative(double tout, int n); double* derivative(double tout, int n) override;
virtual int lastOrder() const; int lastOrder() const override;
virtual int nEquations() const { int nEquations() const override{
return static_cast<int>(m_neq); return static_cast<int>(m_neq);
} }
virtual int nEvals() const; int nEvals() const override;
virtual void setMaxOrder(int n) { void setMaxOrder(int n) override {
m_maxord = n; m_maxord = n;
} }
virtual void setMethod(MethodType t); void setMethod(MethodType t) override;
virtual void setMaxStepSize(double hmax); void setMaxStepSize(double hmax) override;
virtual void setMinStepSize(double hmin); void setMinStepSize(double hmin) override;
virtual void setMaxSteps(int nmax); void setMaxSteps(int nmax) override;
virtual int maxSteps(); int maxSteps() override;
virtual void setMaxErrTestFails(int n); void setMaxErrTestFails(int n) override;
virtual AnyMap solverStats() const; AnyMap solverStats() const override;
void setLinearSolverType(const string& linSolverType) { void setLinearSolverType(const string& linSolverType) override {
m_type = linSolverType; m_type = linSolverType;
} }
virtual string linearSolverType() const { string linearSolverType() const override {
return m_type; return m_type;
} }
virtual void setBandwidth(int N_Upper, int N_Lower) { void setBandwidth(int N_Upper, int N_Lower) override {
m_mupper = N_Upper; m_mupper = N_Upper;
m_mlower = N_Lower; m_mlower = N_Lower;
} }
virtual int nSensParams() { int nSensParams() override {
return static_cast<int>(m_np); return static_cast<int>(m_np);
} }
virtual double sensitivity(size_t k, size_t p); double sensitivity(size_t k, size_t p) override;
virtual void setProblemType(int probtype); void setProblemType(int probtype) override;
//! Returns a string listing the weighted error estimates associated //! Returns a string listing the weighted error estimates associated
//! with each solution component. //! with each solution component.
//! This information can be used to identify which variables are //! This information can be used to identify which variables are
//! responsible for integrator failures or unexpected small timesteps. //! responsible for integrator failures or unexpected small timesteps.
virtual string getErrorInfo(int N); string getErrorInfo(int N);
//! Error message information provide by CVodes //! Error message information provide by CVodes
string m_error_message; string m_error_message;

View File

@ -78,7 +78,7 @@ public:
* @param m New number of columns * @param m New number of columns
* @param v Default fill value. defaults to zero. * @param v Default fill value. defaults to zero.
*/ */
void resize(size_t n, size_t m, double v = 0.0); void resize(size_t n, size_t m, double v=0.0) override;
virtual double* const* colPts(); virtual double* const* colPts();

View File

@ -293,23 +293,23 @@ public:
return *this; return *this;
} }
virtual string write(const string& arg) const; string write(const string& arg) const override;
virtual int ID() const { int ID() const override {
return SinFuncType; return SinFuncType;
} }
virtual string type() const { string type() const override {
return "sin"; return "sin";
} }
virtual double eval(double t) const { double eval(double t) const override{
return sin(m_c*t); return sin(m_c*t);
} }
virtual Func1& duplicate() const; Func1& duplicate() const override;
virtual Func1& derivative() const; Func1& derivative() const override;
virtual shared_ptr<Func1> derivative3() const; shared_ptr<Func1> derivative3() const override;
}; };
@ -342,20 +342,20 @@ public:
return *this; return *this;
} }
virtual Func1& duplicate() const; Func1& duplicate() const override;
virtual string write(const string& arg) const; string write(const string& arg) const override;
virtual int ID() const { int ID() const override {
return CosFuncType; return CosFuncType;
} }
virtual string type() const { string type() const override {
return "cos"; return "cos";
} }
virtual double eval(double t) const { double eval(double t) const override {
return cos(m_c * t); return cos(m_c * t);
} }
virtual Func1& derivative() const; Func1& derivative() const override;
virtual shared_ptr<Func1> derivative3() const; shared_ptr<Func1> derivative3() const override;
}; };
@ -385,21 +385,21 @@ public:
Func1::operator=(right); Func1::operator=(right);
return *this; return *this;
} }
virtual string write(const string& arg) const; string write(const string& arg) const override;
virtual int ID() const { int ID() const override {
return ExpFuncType; return ExpFuncType;
} }
virtual string type() const { string type() const override {
return "exp"; return "exp";
} }
virtual double eval(double t) const { double eval(double t) const override {
return exp(m_c*t); return exp(m_c*t);
} }
virtual Func1& duplicate() const; Func1& duplicate() const override;
virtual Func1& derivative() const; Func1& derivative() const override;
virtual shared_ptr<Func1> derivative3() const; shared_ptr<Func1> derivative3() const override;
}; };
@ -420,17 +420,17 @@ public:
//! Constructor uses single parameter (factor) //! Constructor uses single parameter (factor)
Log1(const vector<double>& params); Log1(const vector<double>& params);
virtual string type() const { string type() const override {
return "log"; return "log";
} }
virtual double eval(double t) const { double eval(double t) const override {
return log(m_c * t); return log(m_c * t);
} }
virtual shared_ptr<Func1> derivative3() const; shared_ptr<Func1> derivative3() const override;
virtual string write(const string& arg) const; string write(const string& arg) const override;
}; };
//! Implements the @c pow() (power) function. //! Implements the @c pow() (power) function.
@ -459,20 +459,20 @@ public:
Func1::operator=(right); Func1::operator=(right);
return *this; return *this;
} }
virtual string write(const string& arg) const; string write(const string& arg) const override;
virtual int ID() const { int ID() const override {
return PowFuncType; return PowFuncType;
} }
virtual string type() const { string type() const override {
return "pow"; return "pow";
} }
virtual double eval(double t) const { double eval(double t) const override {
return pow(t, m_c); return pow(t, m_c);
} }
virtual Func1& duplicate() const; Func1& duplicate() const override;
virtual Func1& derivative() const; Func1& derivative() const override;
virtual shared_ptr<Func1> derivative3() const; shared_ptr<Func1> derivative3() const override;
}; };
//! Implements a tabulated function. //! Implements a tabulated function.
@ -509,21 +509,21 @@ public:
//! @since New in %Cantera 3.0 //! @since New in %Cantera 3.0
void setMethod(const string& method); void setMethod(const string& method);
virtual string write(const string& arg) const; string write(const string& arg) const override;
virtual int ID() const { int ID() const override {
return TabulatedFuncType; return TabulatedFuncType;
} }
virtual string type() const { string type() const override {
if (m_isLinear) { if (m_isLinear) {
return "tabulated-linear"; return "tabulated-linear";
} }
return "tabulated-previous"; return "tabulated-previous";
} }
virtual double eval(double t) const; double eval(double t) const override;
virtual Func1& duplicate() const; Func1& duplicate() const override;
virtual Func1& derivative() const; Func1& derivative() const override;
virtual shared_ptr<Func1> derivative3() const; shared_ptr<Func1> derivative3() const override;
private: private:
vector<double> m_tvec; //!< Vector of time values vector<double> m_tvec; //!< Vector of time values
vector<double> m_fvec; //!< Vector of function values vector<double> m_fvec; //!< Vector of function values
@ -559,20 +559,20 @@ public:
return *this; return *this;
} }
virtual string write(const string& arg) const; string write(const string& arg) const override;
virtual int ID() const { int ID() const override {
return ConstFuncType; return ConstFuncType;
} }
virtual string type() const { string type() const override {
return "constant"; return "constant";
} }
virtual double eval(double t) const { double eval(double t) const override {
return m_c; return m_c;
} }
virtual Func1& duplicate() const; Func1& duplicate() const override;
virtual Func1& derivative() const; Func1& derivative() const override;
virtual shared_ptr<Func1> derivative3() const { shared_ptr<Func1> derivative3() const override {
return make_shared<Const1>(0.0); return make_shared<Const1>(0.0);
} }
}; };
@ -597,7 +597,7 @@ public:
Sum1(shared_ptr<Func1> f1, shared_ptr<Func1> f2) : Func1(f1, f2) {} Sum1(shared_ptr<Func1> f1, shared_ptr<Func1> f2) : Func1(f1, f2) {}
virtual ~Sum1() { ~Sum1() override {
if (!m_f1_shared) { if (!m_f1_shared) {
delete m_f1; delete m_f1;
} }
@ -624,29 +624,29 @@ public:
return *this; return *this;
} }
virtual int ID() const { int ID() const override {
return SumFuncType; return SumFuncType;
} }
virtual string type() const { string type() const override {
return "sum"; return "sum";
} }
virtual double eval(double t) const { double eval(double t) const override {
return m_f1->eval(t) + m_f2->eval(t); return m_f1->eval(t) + m_f2->eval(t);
} }
virtual Func1& duplicate() const; Func1& duplicate() const override;
virtual Func1& derivative() const; Func1& derivative() const override;
virtual shared_ptr<Func1> derivative3() const { shared_ptr<Func1> derivative3() const override {
return newSumFunction(m_f1_shared->derivative3(), m_f2_shared->derivative3()); return newSumFunction(m_f1_shared->derivative3(), m_f2_shared->derivative3());
} }
virtual int order() const { int order() const override {
return 0; return 0;
} }
virtual string write(const string& arg) const; string write(const string& arg) const override;
}; };
/** /**
@ -668,7 +668,7 @@ public:
Diff1(shared_ptr<Func1> f1, shared_ptr<Func1> f2) : Func1(f1, f2) {} Diff1(shared_ptr<Func1> f1, shared_ptr<Func1> f2) : Func1(f1, f2) {}
virtual ~Diff1() { ~Diff1() override {
if (!m_f1_shared) { if (!m_f1_shared) {
delete m_f1; delete m_f1;
} }
@ -695,30 +695,30 @@ public:
return *this; return *this;
} }
virtual int ID() const { int ID() const override {
return DiffFuncType; return DiffFuncType;
} }
virtual string type() const { string type() const override {
return "diff"; return "diff";
} }
virtual double eval(double t) const { double eval(double t) const override {
return m_f1->eval(t) - m_f2->eval(t); return m_f1->eval(t) - m_f2->eval(t);
} }
virtual Func1& duplicate() const; Func1& duplicate() const override;
virtual Func1& derivative() const; Func1& derivative() const override;
virtual shared_ptr<Func1> derivative3() const { shared_ptr<Func1> derivative3() const override {
return newDiffFunction(m_f1_shared->derivative3(), m_f2_shared->derivative3()); return newDiffFunction(m_f1_shared->derivative3(), m_f2_shared->derivative3());
} }
virtual int order() const { int order() const override {
return 0; return 0;
} }
virtual string write(const string& arg) const; string write(const string& arg) const override;
}; };
@ -741,7 +741,7 @@ public:
Product1(shared_ptr<Func1> f1, shared_ptr<Func1> f2) : Func1(f1, f2) {} Product1(shared_ptr<Func1> f1, shared_ptr<Func1> f2) : Func1(f1, f2) {}
virtual ~Product1() { ~Product1() override {
if (!m_f1_shared) { if (!m_f1_shared) {
delete m_f1; delete m_f1;
} }
@ -768,26 +768,26 @@ public:
return *this; return *this;
} }
virtual int ID() const { int ID() const override {
return ProdFuncType; return ProdFuncType;
} }
virtual string type() const { string type() const override {
return "product"; return "product";
} }
virtual string write(const string& arg) const; string write(const string& arg) const override;
virtual double eval(double t) const { double eval(double t) const override {
return m_f1->eval(t) * m_f2->eval(t); return m_f1->eval(t) * m_f2->eval(t);
} }
virtual Func1& duplicate() const; Func1& duplicate() const override;
virtual Func1& derivative() const; Func1& derivative() const override;
virtual shared_ptr<Func1> derivative3() const; shared_ptr<Func1> derivative3() const override;
virtual int order() const { int order() const override {
return 1; return 1;
} }
}; };
@ -810,7 +810,7 @@ public:
TimesConstant1(shared_ptr<Func1> f1, double a) : Func1(f1, a) {} TimesConstant1(shared_ptr<Func1> f1, double a) : Func1(f1, a) {}
virtual ~TimesConstant1() { ~TimesConstant1() override {
if (!m_f1_shared) { if (!m_f1_shared) {
delete m_f1; delete m_f1;
} }
@ -831,14 +831,14 @@ public:
m_parent = 0; m_parent = 0;
return *this; return *this;
} }
virtual int ID() const { int ID() const override {
return TimesConstantFuncType; return TimesConstantFuncType;
} }
virtual string type() const { string type() const override {
return "times-constant"; return "times-constant";
} }
virtual double isProportional(TimesConstant1& other) { double isProportional(TimesConstant1& other) override {
if (func1().isIdentical(other.func1())) { if (func1().isIdentical(other.func1())) {
return (other.c()/c()); return (other.c()/c());
} else { } else {
@ -846,7 +846,7 @@ public:
} }
} }
virtual double isProportional(Func1& other) { double isProportional(Func1& other) override {
if (func1().isIdentical(other)) { if (func1().isIdentical(other)) {
return 1.0/c(); return 1.0/c();
} else { } else {
@ -854,20 +854,20 @@ public:
} }
} }
virtual double eval(double t) const { double eval(double t) const override {
return m_f1->eval(t) * m_c; return m_f1->eval(t) * m_c;
} }
virtual Func1& duplicate() const; Func1& duplicate() const override;
virtual Func1& derivative() const; Func1& derivative() const override;
virtual shared_ptr<Func1> derivative3() const { shared_ptr<Func1> derivative3() const override {
return newTimesConstFunction(m_f1_shared->derivative3(), m_c); return newTimesConstFunction(m_f1_shared->derivative3(), m_c);
} }
virtual string write(const string& arg) const; string write(const string& arg) const override;
virtual int order() const { int order() const override {
return 0; return 0;
} }
}; };
@ -890,7 +890,7 @@ public:
PlusConstant1(shared_ptr<Func1> f1, double a) : Func1(f1, a) {} PlusConstant1(shared_ptr<Func1> f1, double a) : Func1(f1, a) {}
virtual ~PlusConstant1() { ~PlusConstant1() override {
if (!m_f1_shared) { if (!m_f1_shared) {
delete m_f1; delete m_f1;
} }
@ -912,27 +912,27 @@ public:
return *this; return *this;
} }
virtual int ID() const { int ID() const override {
return PlusConstantFuncType; return PlusConstantFuncType;
} }
virtual string type() const { string type() const override {
return "plus-constant"; return "plus-constant";
} }
virtual double eval(double t) const { double eval(double t) const override {
return m_f1->eval(t) + m_c; return m_f1->eval(t) + m_c;
} }
virtual Func1& duplicate() const; Func1& duplicate() const override;
virtual Func1& derivative() const; Func1& derivative() const override;
virtual shared_ptr<Func1> derivative3() const { shared_ptr<Func1> derivative3() const override {
return m_f1_shared->derivative3(); return m_f1_shared->derivative3();
} }
virtual string write(const string& arg) const; string write(const string& arg) const override;
virtual int order() const { int order() const override {
return 0; return 0;
} }
}; };
@ -957,7 +957,7 @@ public:
Ratio1(shared_ptr<Func1> f1, shared_ptr<Func1> f2) : Func1(f1, f2) {} Ratio1(shared_ptr<Func1> f1, shared_ptr<Func1> f2) : Func1(f1, f2) {}
virtual ~Ratio1() { ~Ratio1() override {
if (!m_f1_shared) { if (!m_f1_shared) {
delete m_f1; delete m_f1;
} }
@ -984,25 +984,25 @@ public:
return *this; return *this;
} }
virtual int ID() const { int ID() const override {
return RatioFuncType; return RatioFuncType;
} }
virtual string type() const { string type() const override {
return "ratio"; return "ratio";
} }
virtual double eval(double t) const { double eval(double t) const override {
return m_f1->eval(t) / m_f2->eval(t); return m_f1->eval(t) / m_f2->eval(t);
} }
virtual Func1& duplicate() const; Func1& duplicate() const override;
virtual Func1& derivative() const; Func1& derivative() const override;
virtual shared_ptr<Func1> derivative3() const; shared_ptr<Func1> derivative3() const override;
virtual string write(const string& arg) const; string write(const string& arg) const override;
virtual int order() const { int order() const override {
return 1; return 1;
} }
}; };
@ -1026,7 +1026,7 @@ public:
Composite1(shared_ptr<Func1> f1, shared_ptr<Func1> f2) : Func1(f1, f2) {} Composite1(shared_ptr<Func1> f1, shared_ptr<Func1> f2) : Func1(f1, f2) {}
virtual ~Composite1() { ~Composite1() override {
if (!m_f1_shared) { if (!m_f1_shared) {
delete m_f1; delete m_f1;
} }
@ -1053,25 +1053,25 @@ public:
return *this; return *this;
} }
virtual int ID() const { int ID() const override {
return CompositeFuncType; return CompositeFuncType;
} }
virtual string type() const { string type() const override {
return "composite"; return "composite";
} }
virtual double eval(double t) const { double eval(double t) const override {
return m_f1->eval(m_f2->eval(t)); return m_f1->eval(m_f2->eval(t));
} }
virtual Func1& duplicate() const; Func1& duplicate() const override;
virtual Func1& derivative() const; Func1& derivative() const override;
virtual shared_ptr<Func1> derivative3() const; shared_ptr<Func1> derivative3() const override;
virtual string write(const string& arg) const; string write(const string& arg) const override;
virtual int order() const { int order() const override {
return 2; return 2;
} }
}; };
@ -1122,11 +1122,11 @@ public:
return *this; return *this;
} }
virtual string type() const { string type() const override {
return "Gaussian"; return "Gaussian";
} }
virtual double eval(double t) const { double eval(double t) const override {
double x = (t - m_t0)/m_tau; double x = (t - m_t0)/m_tau;
return m_A * std::exp(-x*x); return m_A * std::exp(-x*x);
} }
@ -1154,7 +1154,7 @@ class Gaussian : public Gaussian1
Gaussian(const Gaussian& b); Gaussian(const Gaussian& b);
virtual Func1& duplicate() const; Func1& duplicate() const override;
}; };
@ -1193,13 +1193,13 @@ public:
return *this; return *this;
} }
virtual string type() const { string type() const override {
return "polynomial"; return "polynomial";
} }
virtual Func1& duplicate() const; Func1& duplicate() const override;
virtual double eval(double t) const { double eval(double t) const override {
double r = m_cpoly[m_cpoly.size()-1]; double r = m_cpoly[m_cpoly.size()-1];
for (size_t n = 1; n < m_cpoly.size(); n++) { for (size_t n = 1; n < m_cpoly.size(); n++) {
r *= t; r *= t;
@ -1256,13 +1256,13 @@ public:
return *this; return *this;
} }
virtual string type() const { string type() const override {
return "Fourier"; return "Fourier";
} }
virtual Func1& duplicate() const; Func1& duplicate() const override;
virtual double eval(double t) const { double eval(double t) const override {
size_t n, nn; size_t n, nn;
double sum = m_a0_2; double sum = m_a0_2;
for (n = 0; n < m_ccos.size(); n++) { for (n = 0; n < m_ccos.size(); n++) {
@ -1323,13 +1323,13 @@ public:
return *this; return *this;
} }
virtual string type() const { string type() const override {
return "Arrhenius"; return "Arrhenius";
} }
virtual Func1& duplicate() const; Func1& duplicate() const override;
virtual double eval(double t) const { double eval(double t) const override {
double sum = 0.0; double sum = 0.0;
for (size_t n = 0; n < m_A.size(); n++) { for (size_t n = 0; n < m_A.size(); n++) {
sum += m_A[n]*std::pow(t,m_b[n])*std::exp(-m_E[n]/t); sum += m_A[n]*std::pow(t,m_b[n])*std::exp(-m_E[n]/t);
@ -1371,19 +1371,19 @@ public:
return *this; return *this;
} }
virtual string type() const { string type() const override {
return "periodic"; return "periodic";
} }
virtual Func1& duplicate() const; Func1& duplicate() const override;
virtual ~Periodic1() { ~Periodic1() override {
if (!m_f1_shared) { if (!m_f1_shared) {
delete m_f1; delete m_f1;
} }
} }
virtual double eval(double t) const { double eval(double t) const override {
int np = int(t/m_c); int np = int(t/m_c);
double time = t - np*m_c; double time = t - np*m_c;
return m_f1->eval(time); return m_f1->eval(time);

View File

@ -30,7 +30,7 @@ public:
*/ */
static Func1Factory* factory(); static Func1Factory* factory();
virtual void deleteFactory(); void deleteFactory() override;
private: private:
//! Pointer to the single instance of the factory //! Pointer to the single instance of the factory
@ -64,7 +64,7 @@ public:
*/ */
static Math1FactoryA* factory(); static Math1FactoryA* factory();
virtual void deleteFactory(); void deleteFactory() override;
private: private:
//! Pointer to the single instance of the factory //! Pointer to the single instance of the factory
@ -97,7 +97,7 @@ public:
*/ */
static Math1FactoryB* factory(); static Math1FactoryB* factory();
virtual void deleteFactory(); void deleteFactory() override;
private: private:
//! Pointer to the single instance of the factory //! Pointer to the single instance of the factory

View File

@ -20,7 +20,7 @@ public:
static PreconditionerFactory* factory(); static PreconditionerFactory* factory();
//! Delete preconditioner factory //! Delete preconditioner factory
virtual void deleteFactory(); void deleteFactory() override;
private: private:
static PreconditionerFactory* s_factory; static PreconditionerFactory* s_factory;

View File

@ -69,7 +69,7 @@ public:
ResidJacEval(double atol = 1.0e-13); ResidJacEval(double atol = 1.0e-13);
//! Return the number of equations in the equation system //! Return the number of equations in the equation system
virtual int nEquations() const; int nEquations() const override;
//! Evaluate the residual function //! Evaluate the residual function
/*! /*!
@ -96,11 +96,10 @@ public:
const int id_x = -1, const int id_x = -1,
const double delta_x = 0.0); const double delta_x = 0.0);
virtual int eval(const double t, const double* const y, int eval(const double t, const double* const y, const double* const ydot,
const double* const ydot, double* const r) override;
double* const r);
virtual int getInitialConditions(const double t0, double* const y, double* const ydot); int getInitialConditions(const double t0, double* const y, double* const ydot) override;
//! Filter the solution predictions //! Filter the solution predictions
/*! /*!

View File

@ -29,7 +29,7 @@ public:
*/ */
static DomainFactory* factory(); static DomainFactory* factory();
virtual void deleteFactory(); void deleteFactory() override;
private: private:
//! Pointer to the single instance of the factory //! Pointer to the single instance of the factory

View File

@ -20,7 +20,7 @@ public:
static PDSSFactory* factory(); static PDSSFactory* factory();
//! delete the static instance of this factory //! delete the static instance of this factory
virtual void deleteFactory(); void deleteFactory() override;
//! Create a new thermodynamic property manager. //! Create a new thermodynamic property manager.
/*! /*!
@ -29,7 +29,7 @@ public:
* Returns NULL if something went wrong. Throws an exception if the string * Returns NULL if something went wrong. Throws an exception if the string
* wasn't matched. * wasn't matched.
*/ */
virtual PDSS* newPDSS(const string& model); PDSS* newPDSS(const string& model);
private: private:
//! static member of a single instance //! static member of a single instance

View File

@ -205,7 +205,7 @@ public:
bool addSpecies(shared_ptr<Species> spec) override; bool addSpecies(shared_ptr<Species> spec) override;
//! Since interface phases have no volume, this returns 0.0. //! Since interface phases have no volume, this returns 0.0.
virtual double molarVolume() const override { double molarVolume() const override {
return 0.0; return 0.0;
} }

View File

@ -34,7 +34,7 @@ public:
static ThermoFactory* factory(); static ThermoFactory* factory();
//! delete the static instance of this factory //! delete the static instance of this factory
virtual void deleteFactory(); void deleteFactory() override;
//! Create a new thermodynamic property manager. //! Create a new thermodynamic property manager.
/*! /*!
@ -43,7 +43,7 @@ public:
* CanteraError if the named model isn't registered with ThermoFactory. * CanteraError if the named model isn't registered with ThermoFactory.
* @deprecated To be removed after %Cantera 3.0; superseded by newThermo() * @deprecated To be removed after %Cantera 3.0; superseded by newThermo()
*/ */
virtual ThermoPhase* newThermoPhase(const string& model); ThermoPhase* newThermoPhase(const string& model);
private: private:
//! static member of a single instance //! static member of a single instance

View File

@ -45,7 +45,7 @@ public:
static TransportFactory* factory(); static TransportFactory* factory();
//! Deletes the statically allocated factory instance. //! Deletes the statically allocated factory instance.
virtual void deleteFactory(); void deleteFactory() override;
//! Build a new transport manager using a transport manager //! Build a new transport manager using a transport manager
//! that may not be the same as in the phase description //! that may not be the same as in the phase description
@ -55,8 +55,7 @@ public:
* @param thermo ThermoPhase object * @param thermo ThermoPhase object
* @param log_level log level * @param log_level log level
*/ */
virtual Transport* newTransport(const string& model, ThermoPhase* thermo, Transport* newTransport(const string& model, ThermoPhase* thermo, int log_level=0);
int log_level=0);
//! Build a new transport manager using the default transport manager //! Build a new transport manager using the default transport manager
//! in the phase description and return a base class pointer to it //! in the phase description and return a base class pointer to it
@ -64,7 +63,7 @@ public:
* @param thermo ThermoPhase object * @param thermo ThermoPhase object
* @param log_level log level * @param log_level log level
*/ */
virtual Transport* newTransport(ThermoPhase* thermo, int log_level=0); Transport* newTransport(ThermoPhase* thermo, int log_level=0);
private: private:
//! Static instance of the factor -> This is the only instance of this //! Static instance of the factor -> This is the only instance of this

View File

@ -24,14 +24,14 @@ class FlowDeviceFactory : public Factory<FlowDevice>
public: public:
static FlowDeviceFactory* factory(); static FlowDeviceFactory* factory();
virtual void deleteFactory(); void deleteFactory() override;
//! Create a new flow device by type name. //! Create a new flow device by type name.
/*! /*!
* @param flowDeviceType the type to be created. * @param flowDeviceType the type to be created.
* @deprecated To be removed after %Cantera 3.0; replaceable by newFlowDevice3. * @deprecated To be removed after %Cantera 3.0; replaceable by newFlowDevice3.
*/ */
virtual FlowDevice* newFlowDevice(const string& flowDeviceType); FlowDevice* newFlowDevice(const string& flowDeviceType);
private: private:
static FlowDeviceFactory* s_factory; static FlowDeviceFactory* s_factory;

View File

@ -24,14 +24,14 @@ class ReactorFactory : public Factory<ReactorBase>
public: public:
static ReactorFactory* factory(); static ReactorFactory* factory();
virtual void deleteFactory(); void deleteFactory() override;
//! Create a new reactor by type name. //! Create a new reactor by type name.
/*! /*!
* @param reactorType the type to be created. * @param reactorType the type to be created.
* @deprecated To be removed after %Cantera 3.0; replaceable by newReactor3. * @deprecated To be removed after %Cantera 3.0; replaceable by newReactor3.
*/ */
virtual ReactorBase* newReactor(const string& reactorType); ReactorBase* newReactor(const string& reactorType);
private: private:
static ReactorFactory* s_factory; static ReactorFactory* s_factory;

View File

@ -24,14 +24,14 @@ class WallFactory : public Factory<WallBase>
public: public:
static WallFactory* factory(); static WallFactory* factory();
virtual void deleteFactory(); void deleteFactory() override;
//! Create a new wall by type name. //! Create a new wall by type name.
/*! /*!
* @param wallType the type to be created. * @param wallType the type to be created.
* @deprecated To be removed after %Cantera 3.0; replaceable by newWall3. * @deprecated To be removed after %Cantera 3.0; replaceable by newWall3.
*/ */
virtual WallBase* newWall(const string& wallType); WallBase* newWall(const string& wallType);
private: private:
static WallFactory* s_factory; static WallFactory* s_factory;

View File

@ -18,17 +18,17 @@ class ML_Logger : public Logger
{ {
public: public:
ML_Logger() {} ML_Logger() {}
virtual ~ML_Logger() {} ~ML_Logger() override {}
virtual void write(const string& s) { void write(const string& s) override {
mexPrintf("%s", s.c_str()); mexPrintf("%s", s.c_str());
} }
virtual void writeendl() { void writeendl() override {
mexPrintf("\n"); mexPrintf("\n");
} }
virtual void error(const string& msg) { void error(const string& msg) override {
mexErrMsgTxt(msg.c_str()); mexErrMsgTxt(msg.c_str());
} }
}; };

View File

@ -10,11 +10,11 @@ public:
m_fs.open(fName, std::ios::out); m_fs.open(fName, std::ios::out);
} }
virtual void write(const std::string& msg) { void write(const std::string& msg) override {
m_fs << msg; m_fs << msg;
} }
virtual void writeendl() { void writeendl() override {
m_fs << std::endl; m_fs << std::endl;
} }