Add C-Lib and Matlab interface to getDataDirectories
This commit is contained in:
parent
d1c2ec48e7
commit
1cdc6b6d7e
5 changed files with 32 additions and 2 deletions
|
|
@ -212,7 +212,7 @@ 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',]
|
||||
'@Utilities': ['adddir.m', 'ck2cti.m', 'cleanup.m', 'geterr.m', 'getDataDirectories.m']
|
||||
}
|
||||
|
||||
# These files do not need to be documented in the MATLAB classes because they
|
||||
|
|
|
|||
|
|
@ -156,6 +156,7 @@ extern "C" {
|
|||
CANTERA_CAPI int showCanteraErrors();
|
||||
CANTERA_CAPI int setLogWriter(void* logger);
|
||||
CANTERA_CAPI int addCanteraDirectory(size_t buflen, const char* buf);
|
||||
CANTERA_CAPI int ct_getDataDirectories(int buflen, char* buf, const char* sep);
|
||||
CANTERA_CAPI int clearStorage();
|
||||
|
||||
CANTERA_CAPI int ck_to_cti(const char* in_file, const char* db_file,
|
||||
|
|
|
|||
10
interfaces/matlab/toolbox/getDataDirectories.m
Normal file
10
interfaces/matlab/toolbox/getDataDirectories.m
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
function d = getDataDirectories()
|
||||
% GETDATADIRECTORIES Get a cell array of the directories searched for data files.
|
||||
% getdatadirectories()
|
||||
% Get a cell array of the directories Cantera searches for data files
|
||||
%
|
||||
% :return:
|
||||
% Cell array with strings representing the data file search directories
|
||||
%
|
||||
|
||||
d = strsplit(ctmethods(0, 5, ';'), ';');
|
||||
|
|
@ -1420,6 +1420,15 @@ extern "C" {
|
|||
}
|
||||
}
|
||||
|
||||
int ct_getDataDirectories(int buflen, char* buf, const char* sep)
|
||||
{
|
||||
try {
|
||||
return copyString(getDataDirectories(sep), buf, buflen);
|
||||
} catch (...) {
|
||||
return handleAllExceptions(-1, ERR);
|
||||
}
|
||||
}
|
||||
|
||||
int setLogWriter(void* logger)
|
||||
{
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ void ctfunctions(int nlhs, mxArray* plhs[],
|
|||
{
|
||||
int job = getInt(prhs[1]);
|
||||
int iok = 0, dbg, validate;
|
||||
char* infile, *dbfile, *trfile, *idtag;
|
||||
char* infile, *dbfile, *trfile, *idtag, *sep;
|
||||
int buflen = 0;
|
||||
char* output_buf = 0;
|
||||
|
||||
|
|
@ -81,6 +81,16 @@ void ctfunctions(int nlhs, mxArray* plhs[],
|
|||
iok = clear_rxnpath();
|
||||
break;
|
||||
|
||||
// get string of data directories
|
||||
case 5:
|
||||
sep = getString(prhs[2]);
|
||||
buflen = ct_getDataDirectories(0, 0, sep);
|
||||
output_buf = (char*)mxCalloc(buflen, sizeof(char));
|
||||
iok = ct_getDataDirectories(buflen, output_buf, sep);
|
||||
plhs[0] = mxCreateString(output_buf);
|
||||
iok = 0;
|
||||
return;
|
||||
|
||||
default:
|
||||
mexErrMsgTxt("ctfunctions: unknown job");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue