[Kinetics] Simplify logic in C_AnyN::multiply
This commit is contained in:
parent
6ca9dc2cc3
commit
e6bf450620
1 changed files with 7 additions and 19 deletions
|
|
@ -120,15 +120,6 @@ namespace Cantera
|
|||
* identical species are treated as involving separate species.
|
||||
*/
|
||||
|
||||
static doublereal ppow(doublereal x, doublereal order)
|
||||
{
|
||||
if (x > 0.0) {
|
||||
return std::pow(x, order);
|
||||
} else {
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles one species in a reaction.
|
||||
* See @ref Stoichiometry
|
||||
|
|
@ -360,20 +351,17 @@ public:
|
|||
}
|
||||
|
||||
void multiply(const doublereal* input, doublereal* output) const {
|
||||
doublereal oo;
|
||||
int neg_count = 0;
|
||||
for (size_t n = 0; n < m_n; n++) {
|
||||
oo = m_order[n];
|
||||
if (oo != 0.0) {
|
||||
if (input[m_ic[n]] < 0) {
|
||||
neg_count++;
|
||||
double order = m_order[n];
|
||||
if (order != 0.0) {
|
||||
double c = input[m_ic[n]];
|
||||
if (c > 0.0) {
|
||||
output[m_rxn] *= std::pow(c, order);
|
||||
} else {
|
||||
output[m_rxn] = 0.0;
|
||||
}
|
||||
output[m_rxn] *= ppow(input[m_ic[n]], oo);
|
||||
}
|
||||
}
|
||||
if (neg_count > 1) {
|
||||
output[m_rxn] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void incrementSpecies(const doublereal* input,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue