Deprecate FuncEval::getInitialConditions and related functions

This commit is contained in:
Ray Speth 2015-11-03 17:45:04 -05:00
parent de133f1a3d
commit 70fe821c19
17 changed files with 39 additions and 6 deletions

View file

@ -141,6 +141,7 @@ public:
* @param y Value of the solution vector to be used. * @param y Value of the solution vector to be used.
* On output, this contains the initial value * On output, this contains the initial value
* of the solution. * of the solution.
* @deprecated Use getState() instead. To be removed after Cantera 2.3.
*/ */
virtual void getInitialConditions(doublereal t0, virtual void getInitialConditions(doublereal t0,
size_t leny, doublereal* y); size_t leny, doublereal* y);

View file

@ -8,6 +8,8 @@
#define CT_FUNCEVAL_H #define CT_FUNCEVAL_H
#include "cantera/base/ct_defs.h" #include "cantera/base/ct_defs.h"
#include "cantera/base/ctexceptions.h"
#include "cantera/base/global.h"
namespace Cantera namespace Cantera
{ {
@ -38,8 +40,18 @@ public:
/** /**
* Fill the solution vector with the initial conditions * Fill the solution vector with the initial conditions
* at initial time t0. * at initial time t0.
* @deprecated Use getState() instead. To be removed after Cantera 2.3.
*/ */
virtual void getInitialConditions(double t0, size_t leny, double* y)=0; virtual void getInitialConditions(double t0, size_t leny, double* y) {
warn_deprecated("FuncEval::getInitialConditions",
"Use getState instead. To be removed after Cantera 2.3.");
getState(y);
}
//! Fill in the vector *y* with the current state of the system
virtual void getState(double* y) {
throw NotImplementedError("FuncEval::getState");
}
//! Number of equations. //! Number of equations.
virtual size_t neq()=0; virtual size_t neq()=0;

View file

@ -29,6 +29,7 @@ public:
return ConstPressureReactorType; return ConstPressureReactorType;
} }
//! @deprecated Use getState instead. To be removed after Cantera 2.3.
virtual void getInitialConditions(doublereal t0, size_t leny, virtual void getInitialConditions(doublereal t0, size_t leny,
doublereal* y); doublereal* y);
virtual void getState(doublereal* y); virtual void getState(doublereal* y);

View file

@ -24,6 +24,7 @@ public:
return FlowReactorType; return FlowReactorType;
} }
//! @deprecated Use getState instead. To be removed after Cantera 2.3.
virtual void getInitialConditions(doublereal t0, size_t leny, virtual void getInitialConditions(doublereal t0, size_t leny,
doublereal* y); doublereal* y);
virtual void getState(doublereal* y); virtual void getState(doublereal* y);

View file

@ -31,6 +31,7 @@ public:
virtual void setThermoMgr(ThermoPhase& thermo); virtual void setThermoMgr(ThermoPhase& thermo);
//! @deprecated Use getState instead. To be removed after Cantera 2.3.
virtual void getInitialConditions(doublereal t0, size_t leny, virtual void getInitialConditions(doublereal t0, size_t leny,
doublereal* y); doublereal* y);
virtual void getState(doublereal* y); virtual void getState(doublereal* y);

View file

@ -28,6 +28,7 @@ public:
virtual void setThermoMgr(ThermoPhase& thermo); virtual void setThermoMgr(ThermoPhase& thermo);
//! @deprecated Use getState instead. To be removed after Cantera 2.3.
virtual void getInitialConditions(doublereal t0, size_t leny, virtual void getInitialConditions(doublereal t0, size_t leny,
doublereal* y); doublereal* y);
virtual void getState(doublereal* y); virtual void getState(doublereal* y);

View file

@ -100,6 +100,7 @@ public:
* @param[in] t0 Time at which initial conditions are determined * @param[in] t0 Time at which initial conditions are determined
* @param[in] leny Length of *y* (unused) * @param[in] leny Length of *y* (unused)
* @param[out] y state vector representing the initial state of the reactor * @param[out] y state vector representing the initial state of the reactor
* @deprecated Use getState instead. To be removed after Cantera 2.3.
*/ */
virtual void getInitialConditions(doublereal t0, size_t leny, virtual void getInitialConditions(doublereal t0, size_t leny,
doublereal* y); doublereal* y);

View file

@ -193,6 +193,8 @@ public:
} }
virtual void eval(doublereal t, doublereal* y, virtual void eval(doublereal t, doublereal* y,
doublereal* ydot, doublereal* p); doublereal* ydot, doublereal* p);
//! @deprecated Use getState instead. To be removed after Cantera 2.3.
virtual void getInitialConditions(doublereal t0, size_t leny, virtual void getInitialConditions(doublereal t0, size_t leny,
doublereal* y); doublereal* y);
virtual void getState(doublereal* y); virtual void getState(doublereal* y);

View file

@ -102,6 +102,8 @@ int ImplicitSurfChem::checkMatch(std::vector<ThermoPhase*> m_vec, ThermoPhase* t
void ImplicitSurfChem::getInitialConditions(doublereal t0, size_t lenc, void ImplicitSurfChem::getInitialConditions(doublereal t0, size_t lenc,
doublereal* c) doublereal* c)
{ {
warn_deprecated("ImplicitSurfChem::getInitialConditions",
"Use getState instead. To be removed after Cantera 2.3.");
getState(c); getState(c);
} }

View file

@ -200,7 +200,7 @@ void CVodeInt::initialize(double t0, FuncEval& func)
if (m_itol == 1 && m_nabs < m_neq) { if (m_itol == 1 && m_nabs < m_neq) {
throw CVodeErr("not enough absolute tolerance values specified."); throw CVodeErr("not enough absolute tolerance values specified.");
} }
func.getInitialConditions(m_t0, m_neq, N_VDATA(m_y)); func.getState(N_VDATA(m_y));
// set options // set options
m_iopt[MXSTEP] = m_maxsteps; m_iopt[MXSTEP] = m_maxsteps;
@ -247,7 +247,7 @@ void CVodeInt::initialize(double t0, FuncEval& func)
void CVodeInt::reinitialize(double t0, FuncEval& func) void CVodeInt::reinitialize(double t0, FuncEval& func)
{ {
m_t0 = t0; m_t0 = t0;
func.getInitialConditions(m_t0, m_neq, N_VDATA(m_y)); func.getState(N_VDATA(m_y));
// set options // set options
m_iopt[MXSTEP] = m_maxsteps; m_iopt[MXSTEP] = m_maxsteps;

View file

@ -281,7 +281,7 @@ void CVodesIntegrator::initialize(double t0, FuncEval& func)
throw CVodesErr("not enough absolute tolerance values specified."); throw CVodesErr("not enough absolute tolerance values specified.");
} }
func.getInitialConditions(m_t0, m_neq, NV_DATA_S(m_y)); func.getState(NV_DATA_S(m_y));
if (m_cvode_mem) { if (m_cvode_mem) {
CVodeFree(&m_cvode_mem); CVodeFree(&m_cvode_mem);
@ -344,8 +344,7 @@ void CVodesIntegrator::reinitialize(double t0, FuncEval& func)
{ {
m_t0 = t0; m_t0 = t0;
m_time = t0; m_time = t0;
func.getInitialConditions(m_t0, static_cast<sd_size_t>(m_neq), func.getState(NV_DATA_S(m_y));
NV_DATA_S(m_y));
int result; int result;
result = CVodeReInit(m_cvode_mem, m_t0, m_y); result = CVodeReInit(m_cvode_mem, m_t0, m_y);

View file

@ -16,6 +16,8 @@ namespace Cantera
void ConstPressureReactor::getInitialConditions(double t0, size_t leny, void ConstPressureReactor::getInitialConditions(double t0, size_t leny,
double* y) double* y)
{ {
warn_deprecated("ConstPressureReactor::getInitialConditions",
"Use getState instead. To be removed after Cantera 2.3.");
getState(y); getState(y);
} }

View file

@ -26,6 +26,8 @@ FlowReactor::FlowReactor() :
void FlowReactor::getInitialConditions(double t0, size_t leny, double* y) void FlowReactor::getInitialConditions(double t0, size_t leny, double* y)
{ {
warn_deprecated("FlowReactor::getInitialConditions",
"Use getState instead. To be removed after Cantera 2.3.");
getState(y); getState(y);
} }

View file

@ -28,6 +28,8 @@ void IdealGasConstPressureReactor::setThermoMgr(ThermoPhase& thermo)
void IdealGasConstPressureReactor::getInitialConditions(double t0, size_t leny, void IdealGasConstPressureReactor::getInitialConditions(double t0, size_t leny,
double* y) double* y)
{ {
warn_deprecated("IdealGasConstPressureReactor::getInitialConditions",
"Use getState instead. To be removed after Cantera 2.3.");
getState(y); getState(y);
} }

View file

@ -24,6 +24,8 @@ void IdealGasReactor::setThermoMgr(ThermoPhase& thermo)
void IdealGasReactor::getInitialConditions(double t0, size_t leny, double* y) void IdealGasReactor::getInitialConditions(double t0, size_t leny, double* y)
{ {
warn_deprecated("IdealGasReactor::getInitialConditions",
"Use getState instead. To be removed after Cantera 2.3.");
getState(y); getState(y);
} }

View file

@ -29,6 +29,8 @@ Reactor::Reactor() :
void Reactor::getInitialConditions(double t0, size_t leny, double* y) void Reactor::getInitialConditions(double t0, size_t leny, double* y)
{ {
warn_deprecated("Reactor::getInitialConditions",
"Use getState instead. To be removed after Cantera 2.3.");
getState(y); getState(y);
} }

View file

@ -177,6 +177,8 @@ void ReactorNet::updateState(doublereal* y)
void ReactorNet::getInitialConditions(double t0, size_t leny, double* y) void ReactorNet::getInitialConditions(double t0, size_t leny, double* y)
{ {
warn_deprecated("ReactorNet::getInitialConditions",
"Use getState instead. To be removed after Cantera 2.3.");
getState(y); getState(y);
} }