Added an option to remove all Cantera search paths from Matlab

This commit is contained in:
ssun30 2022-08-31 17:10:36 -04:00 committed by Ray Speth
parent 4e122e443d
commit 132dd6a81f
4 changed files with 27 additions and 21 deletions

View File

@ -1,22 +1,23 @@
function LoadCantera
if ispc
ctname = 'cantera_shared.dll';
elseif ismac
ctname = 'libcantera_shared.dylib';
elseif isunix
ctname = 'libcantera_shared.so';
else
error('Operating System Not Supported!');
return;
end
if ~libisloaded(ct)
[~,warnings] = loadlibrary([cantera_root '/Lib/' ctname], ...
[cantera_root '/include/cantera/clib/ctmatlab.h'], ...
'includepath', [cantera_root '/include'], ...
'addheader','ct','addheader','ctfunc', ...
'addheader','ctmultiphase','addheader', ...
'ctonedim','addheader','ctreactor', ...
'addheader','ctrpath','addheader','ctsurf');
end
disp('Cantera is ready for use');
% LoadCantera
% Load the Cantera C Library into the Memory
%
if ispc
ctname = 'cantera_shared.dll';
elseif ismac
ctname = 'libcantera_shared.dylib';
elseif isunix
ctname = 'libcantera_shared.so';
else
error('Operating System Not Supported!');
return;
end
if ~libisloaded(ct)
[~,warnings] = loadlibrary([cantera_root '/Lib/' ctname], ...
[cantera_root '/include/cantera/clib/ctmatlab.h'], ...
'includepath', [cantera_root '/include'], ...
'addheader','ct','addheader','ctfunc', ...
'addheader','ctmultiphase','addheader', ...
'ctonedim','addheader','ctreactor', ...
'addheader','ctrpath','addheader','ctsurf');
end
disp('Cantera is ready for use');

View File

@ -1,3 +1,6 @@
% UnloadCantera
% Unload the Cantear C Library from the Memory
%
if libisloaded(ct)
unloadlibrary(ct);
end

View File

@ -1,4 +1,5 @@
function cleanup()
% CLEANUP
% Delete all stored Cantera objects and reclaim memory.
%
checklib;

View File

@ -1,4 +1,5 @@
function e = geterr()
% GETERR
% Get the error message from a Cantera error.
%
checklib;