[Kinetics] Falloff initialization checks for correct number of parameters

This commit is contained in:
Ray Speth 2015-04-29 22:12:00 -04:00
parent 0a2b4816ef
commit 6648b9ec34
2 changed files with 21 additions and 1 deletions

View file

@ -32,7 +32,7 @@ public:
* @param c Vector of coefficients of the parameterization. The number and
* meaning of these coefficients is subclass-dependent.
*/
virtual void init(const vector_fp& c) {}
virtual void init(const vector_fp& c);
/**
* Update the temperature-dependent portions of the falloff function, if

View file

@ -10,8 +10,22 @@
namespace Cantera
{
void Falloff::init(const vector_fp& c)
{
if (c.size() != 0) {
throw CanteraError("Falloff::init",
"Incorrect number of parameters. 0 required. Received " +
int2str(c.size()) + ".");
}
}
void Troe::init(const vector_fp& c)
{
if (c.size() != 3 && c.size() != 4) {
throw CanteraError("Troe::init",
"Incorrect number of parameters. 3 or 4 required. Received " +
int2str(c.size()) + ".");
}
m_a = c[0];
if (c[1] == 0.0) {
m_rt3 = 1000.;
@ -57,6 +71,12 @@ void Troe::getParameters(double* params) const {
void SRI::init(const vector_fp& c)
{
if (c.size() != 3 && c.size() != 5) {
throw CanteraError("SRI::init",
"Incorrect number of parameters. 3 or 5 required. Received " +
int2str(c.size()) + ".");
}
if (c[2] < 0.0) {
throw CanteraError("SRI::init()",
"m_c parameter is less than zero: " + fp2str(c[2]));