files moved to Cantera/cxx/include
This commit is contained in:
parent
6af87772a1
commit
ce93fff649
15 changed files with 3 additions and 637 deletions
|
|
@ -1,25 +0,0 @@
|
|||
|
||||
#ifndef CANTERA_H_INCL
|
||||
#define CANTERA_H_INCL
|
||||
|
||||
namespace std{}
|
||||
using namespace std;
|
||||
|
||||
// definitions
|
||||
#include "kernel/ct_defs.h"
|
||||
|
||||
// some useful functions
|
||||
#include "kernel/global.h"
|
||||
|
||||
// the CanteraError exception class
|
||||
#include "kernel/ctexceptions.h"
|
||||
|
||||
using namespace Cantera;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
#ifndef CXX_IDEALGASMIX
|
||||
#define CXX_IDEALGASMIX
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "kernel/IdealGasPhase.h"
|
||||
#include "kernel/GRI_30_Kinetics.h"
|
||||
#include "kernel/importCTML.h"
|
||||
|
||||
namespace Cantera {
|
||||
|
||||
class GRI30 :
|
||||
public IdealGasPhase, public GRI_30_Kinetics
|
||||
{
|
||||
public:
|
||||
GRI30() : m_ok(false), m_r(0) {
|
||||
m_r = get_XML_File("gri30.xml");
|
||||
m_ok = buildSolutionFromXML(*m_r, "gri30", "phase", this, this);
|
||||
if (!m_ok) throw CanteraError("GRI30",
|
||||
"buildSolutionFromXML returned false");
|
||||
}
|
||||
|
||||
|
||||
virtual ~GRI30() {}
|
||||
|
||||
bool operator!() { return !m_ok;}
|
||||
bool ready() { return m_ok; }
|
||||
friend ostream& operator<<(ostream& s, GRI30& mix) {
|
||||
string r = report(mix, true);
|
||||
s << r;
|
||||
return s;
|
||||
}
|
||||
|
||||
protected:
|
||||
bool m_ok;
|
||||
XML_Node* m_r;
|
||||
|
||||
private:
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
#ifndef CXX_IDEALGASMIX
|
||||
#define CXX_IDEALGASMIX
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "kernel/IdealGasPhase.h"
|
||||
#include "kernel/GasKinetics.h"
|
||||
#include "kernel/importCTML.h"
|
||||
|
||||
namespace Cantera {
|
||||
|
||||
class IdealGasMix :
|
||||
public IdealGasPhase, public GasKinetics
|
||||
{
|
||||
public:
|
||||
IdealGasMix(string infile, string id="") : m_ok(false), m_r(0) {
|
||||
|
||||
m_r = get_XML_File(infile);
|
||||
if (id == "-") id = "";
|
||||
m_ok = buildSolutionFromXML(*m_r, id, "phase", this, this);
|
||||
if (!m_ok) throw CanteraError("IdealGasMix",
|
||||
"buildSolutionFromXML returned false");
|
||||
}
|
||||
|
||||
|
||||
IdealGasMix(XML_Node& root, string id) : m_ok(false), m_r(0) {
|
||||
m_ok = buildSolutionFromXML(root, id, "phase", this, this);
|
||||
}
|
||||
|
||||
virtual ~IdealGasMix() {}
|
||||
|
||||
bool operator!() { return !m_ok;}
|
||||
bool ready() { return m_ok; }
|
||||
friend ostream& operator<<(ostream& s, IdealGasMix& mix) {
|
||||
string r = report(mix, true);
|
||||
s << r;
|
||||
return s;
|
||||
}
|
||||
|
||||
protected:
|
||||
bool m_ok;
|
||||
XML_Node* m_r;
|
||||
|
||||
private:
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
#ifndef CXX_INTERFACE
|
||||
#define CXX_INTERFACE
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "kernel/SurfPhase.h"
|
||||
#include "kernel/InterfaceKinetics.h"
|
||||
#include "kernel/importCTML.h"
|
||||
|
||||
namespace Cantera {
|
||||
|
||||
class Interface :
|
||||
public SurfPhase, public InterfaceKinetics
|
||||
{
|
||||
public:
|
||||
Interface(string infile, string id, vector<ThermoPhase*> phases)
|
||||
: m_ok(false), m_r(0) {
|
||||
|
||||
m_r = get_XML_File(infile);
|
||||
if (id == "-") id = "";
|
||||
|
||||
XML_Node* x = get_XML_Node("#"+id, m_r);
|
||||
if (!x)
|
||||
throw CanteraError("Interface","error in get_XML_Node");
|
||||
|
||||
importPhase(*x, this);
|
||||
phases.push_back(this);
|
||||
importKinetics(*x, phases, this);
|
||||
m_ok = true;
|
||||
}
|
||||
|
||||
|
||||
virtual ~Interface() {}
|
||||
|
||||
bool operator!() { return !m_ok;}
|
||||
bool ready() { return m_ok; }
|
||||
|
||||
protected:
|
||||
bool m_ok;
|
||||
XML_Node* m_r;
|
||||
|
||||
private:
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,4 +1,7 @@
|
|||
|
||||
NOTE: The header files that used to be located here are now in
|
||||
Cantera/cxx/include.
|
||||
|
||||
The header files in this directory are for use in C++ application
|
||||
programs that use Cantera. The Cantera kernel itself does not use these
|
||||
header files. The kernel header files are kept in the same directory
|
||||
|
|
|
|||
|
|
@ -1,92 +0,0 @@
|
|||
/**
|
||||
* @file ctml.h
|
||||
*
|
||||
* CTML ("Cantera Markup Language") is the variant of XML that Cantera uses
|
||||
* to store data. These functions read and write it.
|
||||
*
|
||||
* see also: importCTML, ck2ctml.
|
||||
*/
|
||||
|
||||
|
||||
/* $Author$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
*/
|
||||
|
||||
// Copyright 2002 California Institute of Technology
|
||||
|
||||
|
||||
|
||||
#ifndef CT_CTML_H
|
||||
#define CT_CTML_H
|
||||
|
||||
#include "ct_defs.h"
|
||||
#include "xml.h"
|
||||
using namespace Cantera;
|
||||
|
||||
namespace ctml {
|
||||
|
||||
bool isBuiltin(string nm);
|
||||
|
||||
void addBool(XML_Node& node,
|
||||
string title,
|
||||
bool val);
|
||||
|
||||
void addInteger(XML_Node& node,
|
||||
string title,
|
||||
int val,
|
||||
string units="",
|
||||
string type="");
|
||||
|
||||
void addFloat(XML_Node& node,
|
||||
string title,
|
||||
doublereal val,
|
||||
string units="",
|
||||
string type="",
|
||||
doublereal minval = Undef,
|
||||
doublereal maxval = Undef);
|
||||
|
||||
void addIntegerArray(XML_Node& node,
|
||||
string title,
|
||||
int n,
|
||||
const int* vals,
|
||||
string units="",
|
||||
string type="",
|
||||
doublereal minval=Undef,
|
||||
doublereal maxval=Undef);
|
||||
|
||||
void addFloatArray(XML_Node& node,
|
||||
string title,
|
||||
int n,
|
||||
const double* vals,
|
||||
string units="",
|
||||
string type="",
|
||||
doublereal minval = Undef,
|
||||
doublereal maxval = Undef);
|
||||
|
||||
void addString(XML_Node& node,
|
||||
string title,
|
||||
string val,
|
||||
string type="");
|
||||
|
||||
void getFloatArray(XML_Node& node,
|
||||
vector_fp& v, bool convert=true);
|
||||
|
||||
void getStringArray(XML_Node& node, vector<string>& v);
|
||||
void getMap(XML_Node& node, map<string, string>& m);
|
||||
void getPairs(XML_Node& node, vector<string>& key, vector<string>& val);
|
||||
|
||||
void getIntegers(XML_Node& node, map<string,int>& v);
|
||||
void getFloats(XML_Node& node, map<string,double>& v, bool convert=true);
|
||||
doublereal getFloat(XML_Node& parent, string name, string type="");
|
||||
void getStrings(XML_Node& node, map<string,string>& v);
|
||||
void getFunction(XML_Node& node, string& type, doublereal& xmin,
|
||||
doublereal& xmax, vector_fp& coeffs);
|
||||
XML_Node* getByTitle(XML_Node& node, string title);
|
||||
void getString(XML_Node& node, string title, string& val,
|
||||
string& type);
|
||||
|
||||
string getString(XML_Node& parent, string name);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
/*
|
||||
* header file providing support for chemical equilibrium.
|
||||
*/
|
||||
#ifndef CT_EQUIL_INCL
|
||||
#define CT_EQUIL_INCL
|
||||
#include "kernel/ChemEquil.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
#ifndef CT_INTEG_H_INCL
|
||||
#define CT_INTEG_H_INCL
|
||||
|
||||
#include "kernel/CVode.h"
|
||||
|
||||
#endif
|
||||
|
|
@ -1,320 +0,0 @@
|
|||
/**
|
||||
* @file Kinetics.h
|
||||
*
|
||||
* $Author$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
*/
|
||||
|
||||
// Copyright 2001 California Institute of Technology
|
||||
|
||||
/**
|
||||
* @defgroup kineticsGroup Kinetics
|
||||
*/
|
||||
|
||||
#ifndef CT_KINETICS_H
|
||||
#define CT_KINETICS_H
|
||||
|
||||
#include "ctexceptions.h"
|
||||
//#include "Phase.h"
|
||||
#include "ThermoPhase.h"
|
||||
|
||||
namespace Cantera {
|
||||
|
||||
class ReactionData;
|
||||
|
||||
/**
|
||||
* Public interface for kinetics managers. This class serves as a
|
||||
* base class to derive 'kinetics managers', which are classes
|
||||
* that manage homogeneous chemistry within one phase.
|
||||
*/
|
||||
class Kinetics {
|
||||
|
||||
public:
|
||||
|
||||
// typedefs
|
||||
typedef ThermoPhase thermo_t;
|
||||
|
||||
/// Constructor.
|
||||
Kinetics() : m_ii(0), m_thermo(0), m_index(-1) {}
|
||||
Kinetics(thermo_t* thermo)
|
||||
: m_ii(0), m_index(-1) {
|
||||
if (thermo) {
|
||||
m_start.push_back(0);
|
||||
m_thermo.push_back(thermo);
|
||||
}
|
||||
}
|
||||
|
||||
/// Destructor. Does nothing.
|
||||
virtual ~Kinetics() {} // delete m_xml; }
|
||||
|
||||
int index(){ return m_index; }
|
||||
void setIndex(int index) { m_index = index; }
|
||||
|
||||
//XML_Node& xml() { return *m_xml; }
|
||||
|
||||
/// Identifies subclass.
|
||||
virtual int type() { return 0; }
|
||||
|
||||
int start(int n) { return m_start[n]; }
|
||||
|
||||
/// Number of reactions
|
||||
int nReactions() const {return m_ii;}
|
||||
|
||||
/// Number of species
|
||||
int nTotalSpecies() const {
|
||||
int n=0, np;
|
||||
np = nPhases();
|
||||
for (int p = 0; p < np; p++) n += thermo(p).nSpecies();
|
||||
return n;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stoichiometric coefficient of species k as a reactant in
|
||||
* reaction i.
|
||||
*/
|
||||
virtual doublereal reactantStoichCoeff(int k, int i) const {
|
||||
err("reactantStoichCoeff");
|
||||
return -1.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stoichiometric coefficient of species k as a product in
|
||||
* reaction i.
|
||||
*/
|
||||
virtual doublereal productStoichCoeff(int k, int i) const {
|
||||
err("productStoichCoeff");
|
||||
return -1.0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a read-only reference to the vector of reactant
|
||||
* index numbers for reaction i.
|
||||
*/
|
||||
virtual const vector_int& reactants(int i) const {
|
||||
return m_reactants[i];
|
||||
}
|
||||
virtual const vector_int& products(int i) const {
|
||||
return m_products[i];
|
||||
}
|
||||
|
||||
/**
|
||||
* Flag specifying the type of reaction. The legal values and
|
||||
* their meaning are specific to the particular kinetics
|
||||
* manager.
|
||||
*/
|
||||
virtual int reactionType(int i) const {
|
||||
err("reactionType");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Reaction Rates Of Progress
|
||||
*/
|
||||
//@{
|
||||
|
||||
/**
|
||||
* Forward rates of progress.
|
||||
* Return the forward rates of progress in array fwdROP, which
|
||||
* must be dimensioned at least as large as the total number
|
||||
* of reactions.
|
||||
*/
|
||||
virtual void getFwdRatesOfProgress(doublereal* fwdROP) {
|
||||
err("getFwdRatesOfProgress");
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse rates of progress.
|
||||
* Return the reverse rates of progress in array revROP, which
|
||||
* must be dimensioned at least as large as the total number
|
||||
* of reactions.
|
||||
*/
|
||||
virtual void getRevRatesOfProgress(doublereal* revROP) {
|
||||
err("getRevRatesOfProgress");
|
||||
}
|
||||
|
||||
/**
|
||||
* Net rates of progress. Return the net (forward - reverse)
|
||||
* rates of progress in array netROP, which must be
|
||||
* dimensioned at least as large as the total number of
|
||||
* reactions.
|
||||
*/
|
||||
virtual void getNetRatesOfProgress(doublereal* netROP) {
|
||||
err("getNetRatesOfProgress");
|
||||
}
|
||||
|
||||
/**
|
||||
* True if reaction i has been declared to be reversible. If
|
||||
* isReversible(i) is false, then the reverse rate of progress
|
||||
* for reaction i is always zero.
|
||||
*/
|
||||
virtual bool isReversible(int i){return false;}
|
||||
|
||||
/**
|
||||
* Species creation rates [kmol/m^3]. Return the species
|
||||
* creation rates in array cdot, which must be
|
||||
* dimensioned at least as large as the total number of
|
||||
* species.
|
||||
*
|
||||
*/
|
||||
virtual void getCreationRates(doublereal* cdot) {
|
||||
err("getCreationRates");
|
||||
}
|
||||
|
||||
/**
|
||||
* Species destruction rates [kmol/m^3]. Return the species
|
||||
* destruction rates in array ddot, which must be
|
||||
* dimensioned at least as large as the total number of
|
||||
* species.
|
||||
*
|
||||
*/
|
||||
virtual void getDestructionRates(doublereal* ddot) {
|
||||
err("getDestructionRates");
|
||||
}
|
||||
|
||||
/**
|
||||
* Species net production rates [kmol/m^3]. Return the species
|
||||
* net production rates (creation - destruction) in array
|
||||
* wdot, which must be dimensioned at least as large as the
|
||||
* total number of species.
|
||||
*/
|
||||
virtual void getNetProductionRates(doublereal* wdot) {
|
||||
err("getNetProductionRates");
|
||||
}
|
||||
|
||||
/**
|
||||
* Equilibrium constants. Return the equilibrium constants of
|
||||
* the reactions in concentration units in array kc, which
|
||||
* must be dimensioned at least as large as the total number
|
||||
* of reactions.
|
||||
*/
|
||||
virtual void getEquilibriumConstants(doublereal* kc) {
|
||||
err("getEquilibriumConstants");
|
||||
}
|
||||
//@}
|
||||
|
||||
|
||||
/**
|
||||
* @name Reaction Mechanism Construction
|
||||
*/
|
||||
//@{
|
||||
|
||||
|
||||
/**
|
||||
* Get the nth Phase object.
|
||||
*/
|
||||
//phase_t& phase(int n=0) { return *m_phase[n]; }
|
||||
//const phase_t& phase(int n=0) const { return *m_phase[n]; }
|
||||
int nPhases() const { return m_thermo.size(); }
|
||||
int phaseIndex(string ph) { return m_phaseindex[ph] - 1; }
|
||||
|
||||
/**
|
||||
* Add a phase.
|
||||
*/
|
||||
void addPhase(thermo_t& thermo) {
|
||||
if (m_thermo.size() > 0) {
|
||||
m_start.push_back(m_start.back()
|
||||
+ m_thermo.back()->nSpecies());
|
||||
}
|
||||
else {
|
||||
m_start.push_back(0);
|
||||
}
|
||||
m_thermo.push_back(&thermo);
|
||||
m_phaseindex[m_thermo.back()->id()] = nPhases();
|
||||
}
|
||||
thermo_t& thermo(int n=0) { return *m_thermo[n]; }
|
||||
const thermo_t& thermo(int n=0) const { return *m_thermo[n]; }
|
||||
thermo_t& phase(int n=0) { return *m_thermo[n]; }
|
||||
const thermo_t& phase(int n=0) const { return *m_thermo[n]; }
|
||||
|
||||
int speciesIndex(int k, int n) {
|
||||
return m_start[n] + k;
|
||||
}
|
||||
|
||||
int speciesIndex(string nm, string ph = "<any>") {
|
||||
int np = m_thermo.size();
|
||||
int k;
|
||||
string id;
|
||||
for (int n = 0; n < np; n++) {
|
||||
id = thermo(n).id();
|
||||
if (ph == id) {
|
||||
k = thermo(n).speciesIndex(nm);
|
||||
if (k < 0) return -1;
|
||||
return k + m_start[n];
|
||||
}
|
||||
else if (ph == "<any>") {
|
||||
k = thermo(n).speciesIndex(nm);
|
||||
if (k >= 0) return k + m_start[n];
|
||||
}
|
||||
}
|
||||
return -2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare to add reactions.
|
||||
*/
|
||||
virtual void init() {err("init");}
|
||||
|
||||
/// Finished adding reactions. Prepare for use.
|
||||
virtual void finalize() {err("finalize");}
|
||||
|
||||
virtual void addReaction(const ReactionData& r) {err("addReaction");}
|
||||
|
||||
virtual string reactionString(int i) const {
|
||||
err("reactionString"); return "<null>";
|
||||
}
|
||||
|
||||
|
||||
virtual const vector<grouplist_t>& reactantGroups(int i)
|
||||
{ err("reactantGroups"); return m_dummygroups; }
|
||||
|
||||
virtual const vector<grouplist_t>& productGroups(int i)
|
||||
{ err("productGroups"); return m_dummygroups; }
|
||||
|
||||
/**
|
||||
* @name Altering Reaction Rates
|
||||
*
|
||||
* These methods alter reaction rates. They are designed
|
||||
* primarily for carrying out sensitivity analysis.
|
||||
*/
|
||||
//@{
|
||||
|
||||
/// The current value of the multiplier for reaction i.
|
||||
doublereal multiplier(int i) const {return m_perturb[i];}
|
||||
|
||||
/// Set the multiplier for reaction i to f.
|
||||
void setMultiplier(int i, doublereal f) {m_perturb[i] = f;}
|
||||
|
||||
//@}
|
||||
|
||||
void incrementRxnCount() { m_ii++; m_perturb.push_back(1.0); }
|
||||
|
||||
virtual bool ready() const {return false;}
|
||||
|
||||
protected:
|
||||
|
||||
int m_ii;
|
||||
vector_fp m_perturb;
|
||||
vector<vector_int> m_reactants;
|
||||
vector<vector_int> m_products;
|
||||
vector<thermo_t*> m_thermo;
|
||||
vector_int m_start;
|
||||
// XML_Node* m_xml;
|
||||
map<string, int> m_phaseindex;
|
||||
int m_index;
|
||||
|
||||
private:
|
||||
|
||||
vector<grouplist_t> m_dummygroups;
|
||||
void err(string m) const {
|
||||
throw CanteraError("Kinetics::"+m,"Base class method called.");
|
||||
}
|
||||
};
|
||||
|
||||
typedef Kinetics kinetics_t;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
#ifndef CT_NUM_H_INCL
|
||||
#define CT_NUM_H_INCL
|
||||
|
||||
#include "kernel/DenseMatrix.h"
|
||||
#include "kernel/BandMatrix.h"
|
||||
|
||||
#endif
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
#ifndef CT_INCL_ONEDIM_H
|
||||
#define CT_INCL_ONEDIM_H
|
||||
|
||||
#include "kernel/oneD/Sim1D.h"
|
||||
#include "kernel/oneD/OneDim.h"
|
||||
#include "kernel/oneD/Domain1D.h"
|
||||
#include "kernel/oneD/Inlet1D.h"
|
||||
#include "kernel/oneD/MultiNewton.h"
|
||||
#include "kernel/oneD/MultiJac.h"
|
||||
#endif
|
||||
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
#ifndef CT_RXNPATHS_H
|
||||
#define CT_RXNPATHS_H
|
||||
|
||||
#include "kernel/ReactionPath.h"
|
||||
|
||||
#endif
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
#ifndef CT_SURFACE_INCL
|
||||
#define CT_SURFACE_INCL
|
||||
|
||||
#include "SurfPhase.h"
|
||||
#include "InterfaceKinetics.h"
|
||||
|
||||
#endif
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
#ifndef CT_TRANSPORT_INCL
|
||||
#define CT_TRANSPORT_INCL
|
||||
|
||||
#include "kernel/transport/TransportFactory.h"
|
||||
#include "kernel/transport/DustyGasTransport.h"
|
||||
#endif
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
#ifndef CT_INCL_ZERODIM_H
|
||||
#define CT_INCL_ZERODIM_H
|
||||
|
||||
#include "kernel/zeroD/Reactor.h"
|
||||
#include "kernel/zeroD/Reservoir.h"
|
||||
#include "kernel/zeroD/Wall.h"
|
||||
#include "kernel/zeroD/flowControllers.h"
|
||||
#endif
|
||||
|
||||
Loading…
Add table
Reference in a new issue