Fix Matlab toolbox compilation

This code isn't part of namespace Cantera, so can't use the
typedefs that are specified in that namespace.
This commit is contained in:
Ray Speth 2023-08-04 17:21:47 -04:00 committed by Ray Speth
parent 25f6834da9
commit c50b8b4faf
7 changed files with 13 additions and 13 deletions

View File

@ -39,13 +39,13 @@ inline char* getString(const mxArray* p)
size_t m = mxGetM(p);
size_t n = mxGetN(p);
mwSize buflen = (mwSize)(m*n + 1);
string msg;
std::string msg;
if (m == 1) {
input_buf = (char*)mxCalloc(buflen, sizeof(char));
status = mxGetString(p, input_buf, buflen);
if (status != 0) {
msg = string(input_buf)
msg = std::string(input_buf)
+ "\nNot enough space. String is truncated.";
mexWarnMsgTxt(msg.c_str());
}

View File

@ -22,8 +22,8 @@ void kineticsmethods(int nlhs, mxArray* plhs[],
// construct a new instance
if (job == 0) {
checkNArgs(10, nrhs);
string fileName = getString(prhs[3]);
string phaseName = getString(prhs[4]);
std::string fileName = getString(prhs[3]);
std::string phaseName = getString(prhs[4]);
if (phaseName == "-") {
phaseName = "";
}

View File

@ -146,7 +146,7 @@ void mixturemethods(int nlhs, mxArray* plhs[],
// species properties
int iok = 0;
mwSize nsp = (mwSize) mix_nSpecies(i);
vector<double> x(nsp);
std::vector<double> x(nsp);
switch (job) {
case 41:
iok = mix_getChemPotentials(i,nsp, &x[0]);

View File

@ -72,7 +72,7 @@ void onedimmethods(int nlhs, mxArray* plhs[],
mexErrMsgTxt("wrong size for domain array");
}
vector<int> ptrs(sz);
std::vector<int> ptrs(sz);
for (size_t k = 0; k < sz; k++) {
ptrs[k] = int(dom_ids[k]);
}
@ -363,7 +363,7 @@ void onedimmethods(int nlhs, mxArray* plhs[],
tstep = getDouble(prhs[3]);
ns = getInt(prhs[4]);
dts = mxGetPr(prhs[5]);
vector<int> nsteps(ns);
std::vector<int> nsteps(ns);
for (n = 0; n < ns; n++) {
nsteps[n] = int(dts[n]);
}

View File

@ -182,7 +182,7 @@ void phasemethods(int nlhs, mxArray* plhs[],
} else if (job < 30) {
iok = 0;
size_t nsp = thermo_nSpecies(ph);
vector<double> x(nsp);
std::vector<double> x(nsp);
switch (job) {
case 20:
iok = thermo_getMoleFractions(ph,nsp, &x[0]);
@ -216,7 +216,7 @@ void phasemethods(int nlhs, mxArray* plhs[],
} else if (job < 40) {
iok = 0;
size_t nel = thermo_nElements(ph);
vector<double> x(nel);
std::vector<double> x(nel);
switch (job) {
case 30:
iok = thermo_getAtomicWeights(ph,nel, &x[0]);

View File

@ -60,7 +60,7 @@ void surfmethods(int nlhs, mxArray* plhs[],
} else if (job < 200) {
// return array parameters
nsp = thermo_nSpecies(surf);
vector<double> x(nsp);
std::vector<double> x(nsp);
iok = -1;
switch (job) {
case 101:

View File

@ -121,8 +121,8 @@ static void thermoget(int nlhs, mxArray* plhs[],
if (job == 0) {
checkNArgs(5, nrhs);
string fileName = getString(prhs[3]);
string phaseName = getString(prhs[4]);
std::string fileName = getString(prhs[3]);
std::string phaseName = getString(prhs[4]);
if (phaseName == "-") {
phaseName = "";
}
@ -229,7 +229,7 @@ static void thermoget(int nlhs, mxArray* plhs[],
} else if (job < 50) {
int iok = 0;
size_t nsp = thermo_nSpecies(n);
vector<double> x(nsp);
std::vector<double> x(nsp);
switch (job) {
case 32:
iok = thermo_getEnthalpies_RT(n, nsp, &x[0]);