[clib] Rename some functions to increase consistency

This commit is contained in:
Ray Speth 2016-10-15 20:10:24 -04:00
parent 100d6db87b
commit 5f0e20bf93
9 changed files with 54 additions and 56 deletions

View file

@ -15,6 +15,9 @@ extern "C" {
#endif
CANTERA_CAPI int ct_appdelete();
CANTERA_CAPI int thermo_newFromXML(int mxml);
CANTERA_CAPI int thermo_del(int n);
CANTERA_CAPI size_t thermo_nElements(int n);
CANTERA_CAPI size_t thermo_nSpecies(int n);
CANTERA_CAPI double thermo_temperature(int n);
@ -44,13 +47,9 @@ extern "C" {
CANTERA_CAPI size_t thermo_speciesIndex(int n, const char* nm);
CANTERA_CAPI int thermo_report(int nth,
int ibuf, char* buf, int show_thermo);
CANTERA_CAPI int write_phase(int nth, int show_thermo, double threshold);
CANTERA_CAPI int thermo_print(int nth, int show_thermo, double threshold);
CANTERA_CAPI double thermo_nAtoms(int n, size_t k, size_t m);
CANTERA_CAPI int thermo_addElement(int n, const char* name, double weight);
CANTERA_CAPI int newThermoFromXML(int mxml);
CANTERA_CAPI int thermo_eosType(int n);
CANTERA_CAPI double thermo_refPressure(int n);
CANTERA_CAPI double thermo_minTemp(int n, int k);
@ -90,8 +89,9 @@ extern "C" {
CANTERA_CAPI int thermo_set_VH(int n, double* vals);
CANTERA_CAPI int thermo_set_TH(int n, double* vals);
CANTERA_CAPI int thermo_set_SH(int n, double* vals);
CANTERA_CAPI int thermo_equil(int n, const char* XY, int solver,
double rtol, int maxsteps, int maxiter, int loglevel);
CANTERA_CAPI int thermo_equilibrate(int n, const char* XY, int solver,
double rtol, int maxsteps, int maxiter,
int loglevel);
CANTERA_CAPI double thermo_critTemperature(int n);
CANTERA_CAPI double thermo_critPressure(int n);
@ -102,9 +102,10 @@ extern "C" {
CANTERA_CAPI int thermo_setState_Psat(int n, double p, double x);
CANTERA_CAPI int thermo_setState_Tsat(int n, double t, double x);
CANTERA_CAPI size_t newKineticsFromXML(int mxml, int iphase,
int neighbor1, int neighbor2, int neighbor3,
int neighbor4);
CANTERA_CAPI size_t kin_newFromXML(int mxml, int iphase,
int neighbor1, int neighbor2, int neighbor3,
int neighbor4);
CANTERA_CAPI int kin_del(int n);
CANTERA_CAPI size_t kin_nSpecies(int n);
CANTERA_CAPI size_t kin_nReactions(int n);
CANTERA_CAPI size_t kin_nPhases(int n);
@ -136,8 +137,8 @@ extern "C" {
CANTERA_CAPI int kin_advanceCoverages(int n, double tstep);
CANTERA_CAPI size_t kin_phase(int n, size_t i);
CANTERA_CAPI size_t newTransport(const char* model,
int th, int loglevel);
CANTERA_CAPI size_t trans_new(const char* model, int th, int loglevel);
CANTERA_CAPI int trans_del(int n);
CANTERA_CAPI double trans_viscosity(int n);
CANTERA_CAPI double trans_electricalConductivity(int n);
CANTERA_CAPI double trans_thermalConductivity(int n);
@ -156,9 +157,6 @@ extern "C" {
CANTERA_CAPI int setLogWriter(void* logger);
CANTERA_CAPI int addCanteraDirectory(size_t buflen, const char* buf);
CANTERA_CAPI int clearStorage();
CANTERA_CAPI int delThermo(int n);
CANTERA_CAPI int delKinetics(int n);
CANTERA_CAPI int delTransport(int n);
CANTERA_CAPI int ck_to_cti(const char* in_file, const char* db_file,
const char* tr_file, const char* id_tag, int debug, int validate);

View file

@ -14,13 +14,13 @@
extern "C" {
#endif
CANTERA_CAPI int surf_setcoverages(int i, const double* c, int norm);
CANTERA_CAPI int surf_getcoverages(int i, double* c);
CANTERA_CAPI int surf_setconcentrations(int i, const double* c);
CANTERA_CAPI int surf_getconcentrations(int i, double* c);
CANTERA_CAPI int surf_setsitedensity(int i, double s0);
CANTERA_CAPI double surf_sitedensity(int i);
CANTERA_CAPI int surf_setcoveragesbyname(int i, const char* c);
CANTERA_CAPI int surf_setCoverages(int i, const double* c, int norm);
CANTERA_CAPI int surf_getCoverages(int i, double* c);
CANTERA_CAPI int surf_setConcentrations(int i, const double* c);
CANTERA_CAPI int surf_getConcentrations(int i, double* c);
CANTERA_CAPI int surf_setSiteDensity(int i, double s0);
CANTERA_CAPI double surf_siteDensity(int i);
CANTERA_CAPI int surf_setCoveragesByName(int i, const char* c);
#ifdef __cplusplus
}

View file

@ -346,7 +346,7 @@ extern "C" {
//-------------- Thermo --------------------//
int newThermoFromXML(int mxml)
int thermo_newFromXML(int mxml)
{
try {
XML_Node& x = XmlCabinet::item(mxml);
@ -665,8 +665,8 @@ extern "C" {
}
}
int thermo_equil(int n, const char* XY, int solver,
double rtol, int maxsteps, int maxiter, int loglevel)
int thermo_equilibrate(int n, const char* XY, int solver,
double rtol, int maxsteps, int maxiter, int loglevel)
{
try {
string ssolver;
@ -679,7 +679,7 @@ extern "C" {
} else if (solver == 2) {
ssolver = "vcs";
} else {
throw CanteraError("thermo_equil",
throw CanteraError("thermo_equilibrate",
"Invalid equilibrium solver specified.");
}
ThermoCabinet::item(n).equilibrate(XY, ssolver, rtol, maxsteps,
@ -872,9 +872,9 @@ extern "C" {
//-------------- Kinetics ------------------//
size_t newKineticsFromXML(int mxml, int iphase,
int neighbor1, int neighbor2, int neighbor3,
int neighbor4)
size_t kin_newFromXML(int mxml, int iphase,
int neighbor1, int neighbor2, int neighbor3,
int neighbor4)
{
try {
XML_Node& x = XmlCabinet::item(mxml);
@ -1245,7 +1245,7 @@ extern "C" {
//------------------- Transport ---------------------------
size_t newTransport(const char* model, int ith, int loglevel)
size_t trans_new(const char* model, int ith, int loglevel)
{
try {
Transport* tr = newTransportMgr(model, &ThermoCabinet::item(ith),
@ -1367,7 +1367,7 @@ extern "C" {
//-------------------- Functions ---------------------------
int phase_report(int nth, int ibuf, char* buf, int show_thermo)
int thermo_report(int nth, int ibuf, char* buf, int show_thermo)
{
try {
bool stherm = (show_thermo != 0);
@ -1382,7 +1382,7 @@ extern "C" {
}
}
int write_phase(int nth, int show_thermo, double threshold)
int thermo_print(int nth, int show_thermo, double threshold)
{
try {
bool stherm = (show_thermo != 0);
@ -1447,7 +1447,7 @@ extern "C" {
}
}
int delThermo(int n)
int thermo_del(int n)
{
try {
ThermoCabinet::del(n);
@ -1457,7 +1457,7 @@ extern "C" {
}
}
int delKinetics(int n)
int kin_del(int n)
{
try {
KineticsCabinet::del(n);
@ -1467,7 +1467,7 @@ extern "C" {
}
}
int delTransport(int n)
int trans_del(int n)
{
try {
TransportCabinet::del(n);

View file

@ -20,7 +20,7 @@ typedef Cabinet<ThermoPhase> ThermoCabinet;
extern "C" {
int surf_setsitedensity(int i, double s0)
int surf_setSiteDensity(int i, double s0)
{
try {
ThermoCabinet::get<SurfPhase>(i).setSiteDensity(s0);
@ -30,7 +30,7 @@ extern "C" {
}
}
double surf_sitedensity(int i)
double surf_siteDensity(int i)
{
try {
return ThermoCabinet::get<SurfPhase>(i).siteDensity();
@ -39,7 +39,7 @@ extern "C" {
}
}
int surf_setcoverages(int i, const double* c, int norm)
int surf_setCoverages(int i, const double* c, int norm)
{
try {
if(norm){
@ -53,7 +53,7 @@ extern "C" {
}
}
int surf_setcoveragesbyname(int i, const char* c)
int surf_setCoveragesByName(int i, const char* c)
{
try {
ThermoCabinet::get<SurfPhase>(i).setCoveragesByName(c);
@ -63,7 +63,7 @@ extern "C" {
}
}
int surf_getcoverages(int i, double* c)
int surf_getCoverages(int i, double* c)
{
try {
ThermoCabinet::get<SurfPhase>(i).getCoverages(c);
@ -73,7 +73,7 @@ extern "C" {
}
}
int surf_setconcentrations(int i, const double* c)
int surf_setConcentrations(int i, const double* c)
{
try {
ThermoCabinet::get<SurfPhase>(i).setConcentrations(c);
@ -83,7 +83,7 @@ extern "C" {
}
}
int surf_getconcentrations(int i, double* c)
int surf_getConcentrations(int i, double* c)
{
try {
ThermoCabinet::get<SurfPhase>(i).getConcentrations(c);

View file

@ -27,7 +27,7 @@ void kineticsmethods(int nlhs, mxArray* plhs[],
int in2 = getInt(prhs[5]);
int in3 = getInt(prhs[6]);
int in4 = getInt(prhs[7]);
vv = static_cast<int>(newKineticsFromXML(root, iph, in1, in2, in3, in4));
vv = static_cast<int>(kin_newFromXML(root, iph, in1, in2, in3, in4));
plhs[0] = mxCreateNumericMatrix(1,1,mxDOUBLE_CLASS,mxREAL);
double* h = mxGetPr(plhs[0]);
*h = vv;
@ -160,7 +160,7 @@ void kineticsmethods(int nlhs, mxArray* plhs[],
iok = kin_setMultiplier(kin,irxn-1,v);
break;
case 3:
iok = delKinetics(kin);
iok = kin_del(kin);
break;
case 5:
iok = kin_advanceCoverages(kin,v);

View file

@ -112,7 +112,7 @@ void phasemethods(int nlhs, mxArray* plhs[],
double threshold;
switch (job) {
case 0:
vv = (double) newThermoFromXML(ph);
vv = (double) thermo_newFromXML(ph);
break;
case 1:
// floating-point attributes
@ -170,7 +170,7 @@ void phasemethods(int nlhs, mxArray* plhs[],
case 15:
show_thermo = getInt(prhs[3]);
threshold = getDouble(prhs[4]);
vv = write_phase(ph,show_thermo,threshold);
vv = thermo_print(ph,show_thermo,threshold);
if (vv == -1 || vv == ERR) {
reportError();
}

View file

@ -29,7 +29,7 @@ void surfmethods(int nlhs, mxArray* plhs[],
case 1:
checkNArgs(4, nrhs);
vv = getDouble(prhs[3]);
iok = surf_setsitedensity(surf, vv);
iok = surf_setSiteDensity(surf, vv);
break;
case 3:
checkNArgs(5, nrhs);
@ -39,7 +39,7 @@ void surfmethods(int nlhs, mxArray* plhs[],
nsp = thermo_nSpecies(surf);
norm = getInt(prhs[4]);
if ((m == nsp && n == 1) || (m == 1 && n == nsp)) {
iok = surf_setcoverages(surf, ptr, norm);
iok = surf_setCoverages(surf, ptr, norm);
} else {
mexErrMsgTxt("wrong array size for coverages");
}
@ -47,7 +47,7 @@ void surfmethods(int nlhs, mxArray* plhs[],
case 5:
checkNArgs(4, nrhs);
str = getString(prhs[3]);
iok = surf_setcoveragesbyname(surf, str);
iok = surf_setCoveragesByName(surf, str);
break;
default:
mexErrMsgTxt("unknown job");
@ -67,10 +67,10 @@ void surfmethods(int nlhs, mxArray* plhs[],
switch (job) {
case 101:
checkNArgs(3,nrhs);
iok = surf_getcoverages(surf, &x[0]);
iok = surf_getCoverages(surf, &x[0]);
break;
case 103:
iok = surf_getconcentrations(surf, &x[0]);
iok = surf_getConcentrations(surf, &x[0]);
break;
default:
;

View file

@ -29,7 +29,7 @@ static void thermoset(int nlhs, mxArray* plhs[],
}
switch (job) {
case 10:
ierr = delThermo(th);
ierr = thermo_del(th);
break;
case 1:
ierr = thermo_setPressure(th,*ptr);
@ -100,7 +100,7 @@ static void thermoset(int nlhs, mxArray* plhs[],
int maxsteps = getInt(prhs[6]);
int maxiter = getInt(prhs[7]);
int loglevel = getInt(prhs[8]);
ierr = thermo_equil(th, xy, solver, rtol, maxsteps, maxiter, loglevel);
ierr = thermo_equilibrate(th, xy, solver, rtol, maxsteps, maxiter, loglevel);
}
if (ierr < 0) {
reportError();
@ -123,7 +123,7 @@ static void thermoget(int nlhs, mxArray* plhs[],
bool ok = true;
switch (job) {
case 0:
vv = (double) newThermoFromXML(n);
vv = (double) thermo_newFromXML(n);
break;
case 2:
vv = thermo_enthalpy_mole(n);

View file

@ -22,7 +22,7 @@ void transportmethods(int nlhs, mxArray* plhs[],
char* model = getString(prhs[3]);
int loglevel = getInt(prhs[4]);
int m = -2;
m = (int) newTransport(model, n, loglevel);
m = (int) trans_new(model, n, loglevel);
if (m < 0) {
reportError();
}
@ -37,7 +37,7 @@ void transportmethods(int nlhs, mxArray* plhs[],
if (job < 10) {
switch (job) {
case 0:
delTransport(n);
trans_del(n);
vv = 0.0;
break;
case 1: