Changed names of functions handling loading and unloading Cantera.

This commit is contained in:
ssun30 2023-01-31 18:27:52 -05:00 committed by Ray Speth
parent 7573742c8f
commit 6279debf1e
9 changed files with 62 additions and 48 deletions

View File

@ -10,6 +10,7 @@ classdef fplus < Func
% :return:
% Instance of class :mat:class:`fplus`
%
methods
function f = fplus(a, b)

View File

@ -1,26 +0,0 @@
% Load the Cantera C Library into the Memory
%
if ispc
ctname = '/Lib/cantera_shared.dll';
elseif ismac
ctname = '/Lib/libcantera_shared.dylib';
elseif isunix
ctname = '/lib/libcantera_shared.so';
else
error('Operating System Not Supported!');
return;
end
if ~libisloaded(ct)
[~, warnings] = loadlibrary([cantera_root, 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
ct_ver = canteraVersion;
sprintf('%s is ready for use.', ct_ver);
clear all

View File

@ -1,7 +0,0 @@
% Unload the Cantear C Library from the Memory
%
if libisloaded(ct)
unloadlibrary(ct);
end
disp('Cantera has been unloaded');

View File

@ -1,3 +0,0 @@
function output = cantera_root()
output = '';
end

View File

@ -1,12 +0,0 @@
function cleanup()
% Delete all stored Cantera objects and reclaim memory.
%
checklib;
callct('ct_clearOneDim');
callct('ct_clearMix');
callct('ct_clearFunc');
callct('ct_clearStorage');
callct('ct_clearReactors');
callct('ct_clearReactionPath');
clear all
end

View File

@ -0,0 +1,21 @@
function ctCleanUp()
% Delete all stored Cantera objects and reclaim memory.
%
ctIsLoaded;
classList = {'Domain1D', 'Sim1D', 'Func', 'Kinetics', ...
'Interface', 'Mixture', 'Solution', 'FlowDevice', 'Reactor', ...
'Wall', 'ReactorNet', 'ReactorSurface', 'ThermoPhase', 'Transport'};
varList = evalin('base', 'whos');
for i = 1:length(varList)
for j = 1:length(classList)
if isa(evalin('base', ['eval("', varList(i).name, '")']), ...
classList{j});
evalin('base', ['clear ', varList(i).name]);
break
end
end
end
end

View File

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

View File

@ -0,0 +1,3 @@
function output = ctRoot()
output = '/home/ssun30/anaconda3/envs/ct-matlab';
end

View File

@ -0,0 +1,10 @@
function ctUnload()
% Unload the Cantear C Library from the Memory
%
if libisloaded(ctSharedLibrary)
ctCleanUp;
unloadlibrary(ctSharedLibrary);
end
disp('Cantera has been unloaded');
end