mirror of
https://github.com/Cantera/cantera.git
synced 2025-02-25 18:55:29 -06:00
*** empty log message ***
This commit is contained in:
parent
0d00c29e75
commit
ae09566d97
84
Cantera/src/ReactionStoichMgr.cpp
Normal file
84
Cantera/src/ReactionStoichMgr.cpp
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
|
||||||
|
#include "ReactionStoichMgr.h"
|
||||||
|
#include "StoichManager.h"
|
||||||
|
|
||||||
|
namespace Cantera {
|
||||||
|
|
||||||
|
ReactionStoichMgr::
|
||||||
|
ReactionStoichMgr() {
|
||||||
|
m_reactants = new StoichManagerN;
|
||||||
|
m_revproducts = new StoichManagerN;
|
||||||
|
m_irrevproducts = new StoichManagerN;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReactionStoichMgr::~ReactionStoichMgr() {
|
||||||
|
delete m_reactants;
|
||||||
|
delete m_revproducts;
|
||||||
|
delete m_irrevproducts;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ReactionStoichMgr::
|
||||||
|
add(int rxn, const vector_int& reactants, const vector_int& products,
|
||||||
|
bool reversible) {
|
||||||
|
vector_fp forder(reactants.size(), 1.0);
|
||||||
|
add(rxn, reactants, products, reversible, forder);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ReactionStoichMgr::
|
||||||
|
add(int rxn, const vector_int& reactants, const vector_int& products,
|
||||||
|
bool reversible, const vector_fp& fwdOrder) {
|
||||||
|
m_reactants->add(rxn, reactants, fwdOrder);
|
||||||
|
if (reversible)
|
||||||
|
m_revproducts->add(rxn, products);
|
||||||
|
else
|
||||||
|
m_irrevproducts->add(rxn, products);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ReactionStoichMgr::
|
||||||
|
getCreationRates(int nsp, const doublereal* ropf, const doublereal* ropr, doublereal* c) {
|
||||||
|
fill(c, c + nsp, 0.0);
|
||||||
|
m_revproducts->incrementSpecies(ropf, c);
|
||||||
|
m_irrevproducts->incrementSpecies(ropf, c);
|
||||||
|
m_reactants->incrementSpecies(ropr, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ReactionStoichMgr::
|
||||||
|
getDestructionRates(int nsp, const doublereal* ropf, const doublereal* ropr, doublereal* d) {
|
||||||
|
fill(d, d + nsp, 0.0);
|
||||||
|
m_revproducts->incrementSpecies(ropr, d);
|
||||||
|
m_reactants->incrementSpecies(ropf, d);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ReactionStoichMgr::
|
||||||
|
getNetProductionRates(int nsp, const doublereal* ropnet, doublereal* w) {
|
||||||
|
fill(w, w + nsp, 0.0);
|
||||||
|
m_revproducts->incrementSpecies(ropnet, w);
|
||||||
|
m_irrevproducts->incrementSpecies(ropnet, w);
|
||||||
|
m_reactants->decrementSpecies(ropnet, w);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ReactionStoichMgr::
|
||||||
|
getReactionDelta(int nr, const doublereal* g, doublereal* dg) {
|
||||||
|
fill(dg, dg + nr, 0.0);
|
||||||
|
m_revproducts->incrementReactions(g, dg);
|
||||||
|
m_irrevproducts->incrementReactions(g, dg);
|
||||||
|
m_reactants->decrementReactions(g, dg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ReactionStoichMgr::
|
||||||
|
getRevReactionDelta(int nr, const doublereal* g, doublereal* dg) {
|
||||||
|
fill(dg, dg + nr, 0.0);
|
||||||
|
m_revproducts->incrementReactions(g, dg);
|
||||||
|
m_reactants->decrementReactions(g, dg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ReactionStoichMgr::
|
||||||
|
multiplyReactants(const doublereal* c, doublereal* r) {
|
||||||
|
m_reactants->multiply(c, r);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ReactionStoichMgr::
|
||||||
|
multiplyRevProducts(const doublereal* c, doublereal* r) {
|
||||||
|
m_revproducts->multiply(c, r);
|
||||||
|
}
|
||||||
|
}
|
39
Cantera/src/ReactionStoichMgr.h
Normal file
39
Cantera/src/ReactionStoichMgr.h
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#ifndef CT_RXN_STOICH
|
||||||
|
#define CT_RXN_STOICH
|
||||||
|
|
||||||
|
#include "ct_defs.h"
|
||||||
|
|
||||||
|
namespace Cantera {
|
||||||
|
|
||||||
|
class StoichManagerN;
|
||||||
|
|
||||||
|
class ReactionStoichMgr {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
ReactionStoichMgr();
|
||||||
|
virtual ~ReactionStoichMgr();
|
||||||
|
|
||||||
|
void add(int rxn, const vector_int& reactants, const vector_int& products,
|
||||||
|
bool reversible, const vector_fp& fwdOrder);
|
||||||
|
void add(int rxn, const vector_int& reactants, const vector_int& products,
|
||||||
|
bool reversible);
|
||||||
|
|
||||||
|
void getCreationRates(int nsp, const doublereal* ropf, const doublereal* ropr, doublereal* c);
|
||||||
|
void getDestructionRates(int nsp, const doublereal* ropf, const doublereal* ropr, doublereal* d);
|
||||||
|
void getNetProductionRates(int nsp, const doublereal* ropnet, doublereal* w);
|
||||||
|
void getReactionDelta(int nr, const doublereal* g, doublereal* dg);
|
||||||
|
void getRevReactionDelta(int nr, const doublereal* g, doublereal* dg);
|
||||||
|
|
||||||
|
void multiplyReactants(const doublereal* c, doublereal* r);
|
||||||
|
void multiplyRevProducts(const doublereal* c, doublereal* r);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
StoichManagerN* m_reactants;
|
||||||
|
StoichManagerN* m_revproducts;
|
||||||
|
StoichManagerN* m_irrevproducts;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -150,7 +150,7 @@ namespace Cantera {
|
|||||||
const char q2 = '"';
|
const char q2 = '"';
|
||||||
rstring = "";
|
rstring = "";
|
||||||
char qtype = ' ';
|
char qtype = ' ';
|
||||||
string::size_type iloc1, iloc2, ilocStart;
|
string::size_type iloc1, iloc2, ilocStart = 0;
|
||||||
iloc1 = findUnbackslashed(s, q1);
|
iloc1 = findUnbackslashed(s, q1);
|
||||||
iloc2 = findUnbackslashed(s, q2);
|
iloc2 = findUnbackslashed(s, q2);
|
||||||
if (iloc2 != string::npos) {
|
if (iloc2 != string::npos) {
|
||||||
|
Loading…
Reference in New Issue
Block a user