mirror of
https://github.com/Cantera/cantera.git
synced 2025-02-25 18:55:29 -06:00
Mark Reactor/ReactorNet methods as const
This commit is contained in:
parent
e6c7030735
commit
222b0ebcf6
@ -150,7 +150,7 @@ public:
|
||||
// overloaded methods of class FuncEval
|
||||
|
||||
//! Return the number of equations
|
||||
virtual size_t neq() {
|
||||
virtual size_t neq() const {
|
||||
return m_nv;
|
||||
}
|
||||
|
||||
|
@ -150,10 +150,10 @@ public:
|
||||
}
|
||||
|
||||
//! Number of equations.
|
||||
virtual size_t neq()=0;
|
||||
virtual size_t neq() const = 0;
|
||||
|
||||
//! Number of sensitivity parameters.
|
||||
virtual size_t nparams() {
|
||||
virtual size_t nparams() const {
|
||||
return m_sens_params.size();
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,7 @@ public:
|
||||
|
||||
//! Number of sensitivity parameters associated with this reactor
|
||||
//! (including walls)
|
||||
virtual size_t nSensParams();
|
||||
virtual size_t nSensParams() const;
|
||||
|
||||
//! Add a sensitivity parameter associated with the reaction number *rxn*
|
||||
//! (in the homogeneous phase).
|
||||
@ -183,14 +183,14 @@ public:
|
||||
|
||||
//! Check whether Reactor object uses advance limits
|
||||
//! @returns True if at least one limit is set, False otherwise
|
||||
bool hasAdvanceLimits() {
|
||||
bool hasAdvanceLimits() const {
|
||||
return !m_advancelimits.empty();
|
||||
}
|
||||
|
||||
//! Retrieve absolute step size limits during advance
|
||||
//! @param[out] limits array of step size limits with length neq
|
||||
//! @returns True if at least one limit is set, False otherwise
|
||||
bool getAdvanceLimits(double* limits);
|
||||
bool getAdvanceLimits(double* limits) const;
|
||||
|
||||
//! Set individual step size limit for component name *nm*
|
||||
//! @param nm component name
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
}
|
||||
|
||||
//! Get the maximum integrator step.
|
||||
double maxTimeStep() {
|
||||
double maxTimeStep() const {
|
||||
return m_maxstep;
|
||||
}
|
||||
|
||||
@ -205,11 +205,11 @@ public:
|
||||
double* ydot, double* p, Array2D* j);
|
||||
|
||||
// overloaded methods of class FuncEval
|
||||
virtual size_t neq() {
|
||||
virtual size_t neq() const {
|
||||
return m_nv;
|
||||
}
|
||||
|
||||
size_t nReactors() {
|
||||
size_t nReactors() const {
|
||||
return m_reactors.size();
|
||||
}
|
||||
|
||||
@ -227,7 +227,7 @@ public:
|
||||
|
||||
virtual void getConstraints(double* constraints);
|
||||
|
||||
virtual size_t nparams() {
|
||||
virtual size_t nparams() const {
|
||||
return m_sens_params.size();
|
||||
}
|
||||
|
||||
@ -254,7 +254,7 @@ public:
|
||||
double scale);
|
||||
|
||||
//! The name of the p-th sensitivity parameter added to this ReactorNet.
|
||||
const std::string& sensitivityParameterName(size_t p) {
|
||||
const string& sensitivityParameterName(size_t p) const {
|
||||
return m_paramNames.at(p);
|
||||
}
|
||||
|
||||
@ -284,10 +284,10 @@ public:
|
||||
void setAdvanceLimits(const double* limits);
|
||||
|
||||
//! Check whether ReactorNet object uses advance limits
|
||||
bool hasAdvanceLimits();
|
||||
bool hasAdvanceLimits() const;
|
||||
|
||||
//! Retrieve absolute step size limits during advance
|
||||
bool getAdvanceLimits(double* limits);
|
||||
bool getAdvanceLimits(double* limits) const;
|
||||
|
||||
virtual void preconditionerSetup(double t, double* y, double gamma);
|
||||
|
||||
@ -302,7 +302,7 @@ public:
|
||||
|
||||
protected:
|
||||
//! Check that preconditioning is supported by all reactors in the network
|
||||
virtual void checkPreconditionerSupported();
|
||||
virtual void checkPreconditionerSupported() const;
|
||||
|
||||
//! Update the preconditioner based on the already computed jacobian values
|
||||
virtual void updatePreconditioner(double gamma);
|
||||
@ -315,7 +315,7 @@ protected:
|
||||
//! Returns the order used for last solution step of the ODE integrator
|
||||
//! The function is intended for internal use by ReactorNet::advance
|
||||
//! and deliberately not exposed in external interfaces.
|
||||
virtual int lastOrder();
|
||||
virtual int lastOrder() const;
|
||||
|
||||
std::vector<Reactor*> m_reactors;
|
||||
std::unique_ptr<Integrator> m_integ;
|
||||
|
@ -113,7 +113,7 @@ public:
|
||||
* Number of equations in the ODE system.
|
||||
* - overridden from FuncEval, called by the integrator during initialization.
|
||||
*/
|
||||
size_t neq() {
|
||||
size_t neq() const {
|
||||
return m_nEqs;
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ void Reactor::initialize(double t0)
|
||||
m_work.resize(maxnt);
|
||||
}
|
||||
|
||||
size_t Reactor::nSensParams()
|
||||
size_t Reactor::nSensParams() const
|
||||
{
|
||||
size_t ns = m_sensParams.size();
|
||||
for (auto& S : m_surfaces) {
|
||||
@ -549,7 +549,7 @@ void Reactor::setAdvanceLimits(const double *limits)
|
||||
}
|
||||
}
|
||||
|
||||
bool Reactor::getAdvanceLimits(double *limits)
|
||||
bool Reactor::getAdvanceLimits(double *limits) const
|
||||
{
|
||||
bool has_limit = hasAdvanceLimits();
|
||||
if (has_limit) {
|
||||
|
@ -272,7 +272,7 @@ void ReactorNet::getEstimate(double time, int k, double* yest)
|
||||
}
|
||||
}
|
||||
|
||||
int ReactorNet::lastOrder()
|
||||
int ReactorNet::lastOrder() const
|
||||
{
|
||||
if (m_integ) {
|
||||
return m_integ->lastOrder();
|
||||
@ -425,7 +425,7 @@ void ReactorNet::setAdvanceLimits(const double *limits)
|
||||
}
|
||||
}
|
||||
|
||||
bool ReactorNet::hasAdvanceLimits()
|
||||
bool ReactorNet::hasAdvanceLimits() const
|
||||
{
|
||||
bool has_limit = false;
|
||||
for (size_t n = 0; n < m_reactors.size(); n++) {
|
||||
@ -434,7 +434,7 @@ bool ReactorNet::hasAdvanceLimits()
|
||||
return has_limit;
|
||||
}
|
||||
|
||||
bool ReactorNet::getAdvanceLimits(double *limits)
|
||||
bool ReactorNet::getAdvanceLimits(double *limits) const
|
||||
{
|
||||
bool has_limit = false;
|
||||
for (size_t n = 0; n < m_reactors.size(); n++) {
|
||||
@ -569,7 +569,7 @@ void ReactorNet::updatePreconditioner(double gamma)
|
||||
precon->updatePreconditioner();
|
||||
}
|
||||
|
||||
void ReactorNet::checkPreconditionerSupported() {
|
||||
void ReactorNet::checkPreconditionerSupported() const {
|
||||
// check for non-mole-based reactors and throw an error otherwise
|
||||
for (auto reactor : m_reactors) {
|
||||
if (!reactor->preconditionerSupported()) {
|
||||
|
Loading…
Reference in New Issue
Block a user