mirror of
https://github.com/Cantera/cantera.git
synced 2025-02-25 18:55:29 -06:00
[clib/Matlab] Add function for getting Cantera version
This commit is contained in:
@@ -212,7 +212,8 @@ if localenv['sphinx_docs']:
|
||||
'@Data': ['Air.m', 'constants.m', 'gasconstant.m', 'GRI30.m',
|
||||
'Hydrogen.m', 'Methane.m', 'Nitrogen.m', 'oneatm.m',
|
||||
'Oxygen.m', 'Water.m'],
|
||||
'@Utilities': ['adddir.m', 'ck2cti.m', 'cleanup.m', 'geterr.m', 'getDataDirectories.m']
|
||||
'@Utilities': ['adddir.m', 'ck2cti.m', 'cleanup.m', 'geterr.m',
|
||||
'getDataDirectories.m', 'canteraVersion.m']
|
||||
}
|
||||
|
||||
# These files do not need to be documented in the MATLAB classes because they
|
||||
|
||||
@@ -156,6 +156,7 @@ extern "C" {
|
||||
CANTERA_CAPI int ct_setLogWriter(void* logger);
|
||||
CANTERA_CAPI int ct_addCanteraDirectory(size_t buflen, const char* buf);
|
||||
CANTERA_CAPI int ct_getDataDirectories(int buflen, char* buf, const char* sep);
|
||||
CANTERA_CAPI int ct_getCanteraVersion(int buflen, char* buf);
|
||||
CANTERA_CAPI int ct_clearStorage();
|
||||
|
||||
CANTERA_CAPI int ct_ck2cti(const char* in_file, const char* db_file,
|
||||
|
||||
10
interfaces/matlab/toolbox/canteraVersion.m
Normal file
10
interfaces/matlab/toolbox/canteraVersion.m
Normal file
@@ -0,0 +1,10 @@
|
||||
function v = canteraVersion()
|
||||
% CANTERAVERSION Get Cantera version information
|
||||
% canteraVersion()
|
||||
%
|
||||
% :return:
|
||||
% A string containing the Cantera version
|
||||
%
|
||||
|
||||
v = ctmethods(0, 6);
|
||||
|
||||
@@ -1419,6 +1419,15 @@ extern "C" {
|
||||
}
|
||||
}
|
||||
|
||||
int ct_getCanteraVersion(int buflen, char* buf)
|
||||
{
|
||||
try {
|
||||
return copyString(CANTERA_VERSION, buf, buflen);
|
||||
} catch (...) {
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
}
|
||||
|
||||
int ct_setLogWriter(void* logger)
|
||||
{
|
||||
try {
|
||||
|
||||
@@ -90,6 +90,14 @@ void ctfunctions(int nlhs, mxArray* plhs[],
|
||||
iok = 0;
|
||||
return;
|
||||
|
||||
// get cantera version string
|
||||
case 6:
|
||||
buflen = ct_getCanteraVersion(0, 0);
|
||||
output_buf = (char*)mxCalloc(buflen, sizeof(char));
|
||||
iok = ct_getCanteraVersion(buflen, output_buf);
|
||||
plhs[0] = mxCreateString(output_buf);
|
||||
return;
|
||||
|
||||
default:
|
||||
mexErrMsgTxt("ctfunctions: unknown job");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user