diff --git a/interfaces/matlab_experimental/1D/Domain1D.m b/interfaces/matlab_experimental/1D/Domain1D.m index 9ec5b8cb56..1a588f3f79 100644 --- a/interfaces/matlab_experimental/1D/Domain1D.m +++ b/interfaces/matlab_experimental/1D/Domain1D.m @@ -39,15 +39,15 @@ if nargin == 1 if strcmp(a, 'Inlet1D') - d.domainID = calllib(ct, 'inlet_new'); + d.domainID = callct('inlet_new'); elseif strcmp(a, 'Surf1D') - d.domainID = calllib(ct, 'surf_new'); + d.domainID = callct('surf_new'); elseif strcmp(a, 'Symm1D') - d.domainID = calllib(ct, 'symm_new'); + d.domainID = callct('symm_new'); elseif strcmp(a, 'Outlet1D') - d.domainID = calllib(ct, 'outlet_new'); + d.domainID = callct('outlet_new'); elseif strcmp(a, 'OutletRes') - d.domainID = calllib(ct, 'outletres_new'); + d.domainID = callct('outletres_new'); else error('Not enough arguments for that job number'); end @@ -55,15 +55,15 @@ % a stagnation flow if strcmp(a, 'StagnationFlow') if isa(b, 'Solution') - d.domainID = calllib(ct, 'stflow_new', ... + d.domainID = callct('stflow_new', ... b.tpID, b.kinID, b.trID, 1); else error('Wrong argument type. Expecting instance of class Solution.'); end elseif strcmp(a, 'ReactingSurface') if isa(b, 'Interface') - d.domainID = calllib(ct, 'reactingsurf_new'); - calllib(ct, 'reactingsurf_setkineticsmgr', ... + d.domainID = callct('reactingsurf_new'); + callct('reactingsurf_setkineticsmgr', ... d.domainID, b.kinID); else error('Wrong argument type. Expecting instance of class Interface.'); @@ -78,7 +78,7 @@ flowtype = 1; else flowtype = 2; end - d.domainID = calllib(ct, 'stflow_new', ... + d.domainID = callct('stflow_new', ... b.tpID, b.kinID, b.trID, flowtype); else error('Wrong argument type. Expecting instance of class Solution.'); @@ -104,7 +104,7 @@ function clear(d) % Instance of class :mat:func:`Domain1D` (or another % object that derives from Domain1D) % - calllib(ct, 'domain_del', d.domainID); + callct('domain_del', d.domainID); end function d = disableEnergy(d) @@ -117,7 +117,7 @@ function clear(d) % disp(' '); disp('Disabling the energy equation...'); - calllib(ct, 'stflow_solveEnergyEqn', d.domainID, 0); + callct('stflow_solveEnergyEqn', d.domainID, 0); end function d = enableEnergy(d) @@ -130,7 +130,7 @@ function clear(d) % disp(' '); disp('Enabling the energy equation...'); - calllib(ct, 'stflow_solveEnergyEqn', d.domainID, 1); + callct('stflow_solveEnergyEqn', d.domainID, 1); end function d = disableSoret(d) @@ -143,7 +143,7 @@ function clear(d) % disp(' '); disp('Disabling the Soret effect...'); - calllib(ct, 'stflow_enableSoret', d.domainID, 0); + callct('stflow_enableSoret', d.domainID, 0); end function d = enableSoret(d) @@ -156,7 +156,7 @@ function clear(d) % disp(' '); disp('Disabling the Soret effect...'); - calllib(ct, 'stflow_enableSoret', d.domainID, 1); + callct('stflow_enableSoret', d.domainID, 1); end %% Domain Get Methods @@ -173,8 +173,8 @@ function clear(d) % 1x2 Vector of the lower and upper bounds. % n = d.componentIndex(component); - lower = calllib(ct, 'domain_lowerBound', d.domainID, n); - upper = calllib(ct, 'domain_upperBound', d.domainID, n); + lower = callct('domain_lowerBound', d.domainID, n); + upper = callct('domain_upperBound', d.domainID, n); b = [lower, upper]; end @@ -194,7 +194,7 @@ function clear(d) if isa(name, 'double') n = name; else - n = calllib(ct, 'domain_componentIndex', ... + n = callct('domain_componentIndex', ... d.domainID, name); if n >= 0 n = n+1; @@ -222,11 +222,11 @@ function clear(d) s = cell(m); for i = 1:n id = index(i)-1; - buflen = calllib(ct, 'domain_componentName', ... + buflen = callct('domain_componentName', ... d.domainID, id, 0, 0); if buflen > 0 aa = char(zeros(1, buflen)); - [out_buf, aa] = calllib(ct, 'domain_componentName', ... + [out_buf, aa] = callct('domain_componentName', ... d.domainID, id, buflen, aa); s{i} = aa; end @@ -244,7 +244,7 @@ function clear(d) % This function returns an integer flag denoting the location % of the domain, beginning with 1 at the left. % - i = calllib(ct, 'domain_index', d.domainID); + i = callct('domain_index', d.domainID); if i >= 0 i = i + 1; end @@ -264,7 +264,7 @@ function clear(d) % This function returns an integer flag denoting the domain % type. % - i = calllib(ct, 'domain_type', d.domainID); + i = callct('domain_type', d.domainID); end function zz = gridPoints(d, n) @@ -283,13 +283,13 @@ function clear(d) np = d.nPoints; zz = zeros(1, np); for i = 1:np - zz(i) = calllib(ct, 'domain_grid', d.domainID, i-1); + zz(i) = callct('domain_grid', d.domainID, i-1); end else m = length(n); zz = zeros(1, m); for i = 1:m - zz(i) = calllib(ct, 'domain_grid', d.domainID, n(i)-1); + zz(i) = callct('domain_grid', d.domainID, n(i)-1); end end end @@ -358,7 +358,7 @@ function clear(d) % :return: % The mass flux in the domain. % - mdot = calllib(ct, 'bdry_mdot', d.domainID); + mdot = callct('bdry_mdot', d.domainID); end function y = massFraction(d, k) @@ -382,7 +382,7 @@ function clear(d) end if d.isInlet - y = calllib(ct, 'bdry_massFraction', d.domainID, k-1); + y = callct('bdry_massFraction', d.domainID, k-1); else error('Input domain must be an inlet'); end end @@ -397,7 +397,7 @@ function clear(d) % :return: % Number of variables at each grid point % - n = calllib(ct, 'domain_nComponents', d.domainID); + n = callct('domain_nComponents', d.domainID); end function n = nPoints(d) @@ -410,7 +410,7 @@ function clear(d) % :return: % Integer number of grid points. % - n = calllib(ct, 'domain_nPoints', d.domainID); + n = callct('domain_nPoints', d.domainID); end function tol = tolerances(d, component) @@ -426,8 +426,8 @@ function clear(d) % 1x2 Vector of the relative and absolute error tolerances. n = d.componentIndex(component); - rerr = calllib(ct, 'domain_rtol', d.domainID, n); - aerr = calllib(ct, 'domain_atol', d.domainID, n); + rerr = callct('domain_rtol', d.domainID, n); + aerr = callct('domain_atol', d.domainID, n); tol = [rerr, aerr]; end @@ -441,7 +441,7 @@ function clear(d) % :return: % Temperature. Units: K % - temperature = calllib(ct, 'bdry_temperature', d.domainID); + temperature = callct('bdry_temperature', d.domainID); end function pressure = get.P(d) @@ -472,7 +472,7 @@ function clear(d) if t <= 0 error('The temperature must be positive'); end - calllib(ct, 'bdry_setTemperature', d.domainID, t); + callct('bdry_setTemperature', d.domainID, t); end function set.P(d, p) @@ -488,7 +488,7 @@ function clear(d) if p <= 0 error('The pressure must be positive'); end - calllib(ct, 'stflow_setPressure', d.domainID, p); + callct('stflow_setPressure', d.domainID, p); end function setBounds(d, component, lower, upper) @@ -507,7 +507,7 @@ function setBounds(d, component, lower, upper) % n = d.componentIndex(component); - calllib(ct, 'domain_setBounds', d.domainID, n-1, lower, upper); + callct('domain_setBounds', d.domainID, n-1, lower, upper); end function setCoverageEqs(d, onoff) @@ -540,7 +540,7 @@ function setCoverageEqs(d, onoff) elseif isa(onoff, 'numeric') ion = onoff; end - calllib(ct, 'reactingsurf_enableCoverageEqs', d.domainID, ion); + callct('reactingsurf_enableCoverageEqs', d.domainID, ion); end function setFixedTempProfile(d, profile) @@ -562,11 +562,11 @@ function setFixedTempProfile(d, profile) sz = size(profile); if sz(1) == 2 l = length(profile(1, :)); - calllib(ct, 'stflow_setFixedTempProfile', d.domainID, ... + callct('stflow_setFixedTempProfile', d.domainID, ... l, profile(1, :), l, profile(2, :)); elseif sz(2) == 2 l = length(profile(:, 1)); - calllib(ct, 'stflow_setFixedTempProfile', d.domainID, ... + callct('stflow_setFixedTempProfile', d.domainID, ... l, profile(:, 1), l, profile(:, 2)); else error('Wrong temperature profile array shape.'); end @@ -582,7 +582,7 @@ function setID(d, id) % :param id: % String ID to assign % - calllib(ct, 'domain_setID', d.domainID, id); + callct('domain_setID', d.domainID, id); end function setMdot(d, mdot) @@ -595,7 +595,7 @@ function setMdot(d, mdot) % :param mdot: % Mass flow rate % - calllib(ct, 'bdry_setMdot', d.domainID, mdot); + callct('bdry_setMdot', d.domainID, mdot); end function setMoleFractions(d, x) @@ -609,7 +609,7 @@ function setMoleFractions(d, x) % String specifying the species and mole fractions in % the format ``'SPEC:X,SPEC2:X2'``. % - calllib(ct, 'bdry_setMoleFractions', d.domainID, x); + callct('bdry_setMoleFractions', d.domainID, x); end function setProfileD(d, n, p) @@ -655,19 +655,19 @@ function setSteadyTolerances(d, component, rtol, atol) if strcmp(component, 'default') nc = d.nComponents; for ii = 1:nc - calllib(ct, 'domain_setSteadyTolerances', ... + callct('domain_setSteadyTolerances', ... d.domainID, ii, rtol, atol); end elseif iscell(component) nc = length(component); for ii = 1:nc n = d.componentIndex(component{ii}); - calllib(ct, 'domain_setSteadyTolerances', ... + callct('domain_setSteadyTolerances', ... d.domainID, n, rtol, atol); end else n = d.componentIndex(component); - calllib(ct, 'domain_setSteadyTolerances', ... + callct('domain_setSteadyTolerances', ... d.domainID, ii, rtol, atol); end end @@ -691,19 +691,19 @@ function setTransientTolerances(d, component, rtol, atol) if strcmp(component, 'default') nc = d.nComponents; for ii = 1:nc - calllib(ct, 'domain_setTransientTolerances', ... + callct('domain_setTransientTolerances', ... d.domainID, ii, rtol, atol); end elseif iscell(component) nc = length(component); for ii = 1:nc n = d.componentIndex(component{ii}); - calllib(ct, 'domain_setTransientTolerances', ... + callct('domain_setTransientTolerances', ... d.domainID, n, rtol, atol); end else n = d.componentIndex(component); - calllib(ct, 'domain_setTransientTolerances', ... + callct('domain_setTransientTolerances', ... d.domainID, ii, rtol, atol); end end @@ -717,7 +717,7 @@ function setTransport(d, itr) % ID of the solution object for which transport properties % are calculated. % - calllib(ct, 'stflow_setTransport', d.domainID, itr); + callct('stflow_setTransport', d.domainID, itr); end function setupGrid(d, grid) @@ -729,7 +729,7 @@ function setupGrid(d, grid) % Instance of class :mat:func:`Domain1D` % :param grid: % - calllib(ct, 'domain_setupGrid', d.domainID, numel(grid), grid); + callct('domain_setupGrid', d.domainID, numel(grid), grid); end end diff --git a/interfaces/matlab_experimental/1D/Sim1D.m b/interfaces/matlab_experimental/1D/Sim1D.m index 840ec8045e..36c65e4dee 100644 --- a/interfaces/matlab_experimental/1D/Sim1D.m +++ b/interfaces/matlab_experimental/1D/Sim1D.m @@ -34,7 +34,7 @@ for n=1:nd ids(n) = domains(n).domainID; end - s.stID = calllib(ct, 'sim1D_new', nd, ids); + s.stID = callct('sim1D_new', nd, ids); else help(Stack); error('Wrong number of :parameters.'); @@ -54,7 +54,7 @@ function clear(s) % :param s: % Instance of class :mat:func:`Stack` % - calllib(ct, 'sim1D_del', s.stID); + callct('sim1D_del', s.stID); end function display(s, fname) @@ -70,7 +70,7 @@ function display(s, fname) if nargin == 1 fname = '-'; end - calllib(ct, 'sim1D_showSolution', s.stID, fname); + callct('sim1D_showSolution', s.stID, fname); end %% Stack Methods @@ -91,7 +91,7 @@ function display(s, fname) if isa(name, 'double') n = name; else - n = calllib(ct, 'sim1D_domainIndex', s.stID, name); + n = callct('sim1D_domainIndex', s.stID, name); if n >= 0 n = n+1; else @@ -103,7 +103,7 @@ function display(s, fname) function getInitialSoln(s) % Get the initial solution. - calllib(ct, 'sim1D_getInitialSoln', s.stID); + callct('sim1D_getInitialSoln', s.stID); end function z = grid(s, name) @@ -173,10 +173,10 @@ function plotSolution(s, domain, component) np = d.nPoints; r = zeros(nc, np); - calllib(ct, 'sim1D_eval', s.stID, rdt, count); + callct('sim1D_eval', s.stID, rdt, count); for m = 1:nc for n = 1:np - r(m, n) = calllib(ct, 'sim1D_workValue', ... + r(m, n) = callct('sim1D_workValue', ... s.stID, idom - 1, m - 1, n - 1); end end @@ -198,7 +198,7 @@ function restore(s, fname, id) % :param id: % ID of the element that should be restored % - calllib(ct, 'sim1D_restore', s.stID, fname, id) + callct('sim1D_restore', s.stID, fname, id) end function saveSoln(s, fname, id, desc) @@ -229,7 +229,7 @@ function saveSoln(s, fname, id, desc) elseif nargin == 3 desc = '--'; end - calllib(ct, 'sim1D_save', s.stID, fname, id, desc); + callct('sim1D_save', s.stID, fname, id, desc); end function setFixedTemperature(s, T) @@ -245,7 +245,7 @@ function setFixedTemperature(s, T) if T <= 0 error('temperature must be positive'); end - calllib(ct, 'sim1D_setFixedTemperature', s.stID, T); + callct('sim1D_setFixedTemperature', s.stID, T); end function setFlatProfile(s, domain, comp, v) @@ -263,7 +263,7 @@ function setFlatProfile(s, domain, comp, v) % Double value to be set. % - calllib(ct, 'sim1D_setFlatProfile', s.stID, ... + callct('sim1D_setFlatProfile', s.stID, ... domain - 1, comp - 1, v); end @@ -278,7 +278,7 @@ function setGridMin(s, domain, gridmin) % Double minimum grid spacing. % - calllib(ct, 'sim1D_setGridMin', s.stID, domain-1, gridmin); + callct('sim1D_setGridMin', s.stID, domain-1, gridmin); end function setMaxJacAge(s, ss_age, ts_age) @@ -299,7 +299,7 @@ function setMaxJacAge(s, ss_age, ts_age) if nargin == 2 ts_age = ss_age; end - calllib(ct, 'sim1D_setMaxJacAge', s.stID, ss_age, ts_age); + callct('sim1D_setMaxJacAge', s.stID, ss_age, ts_age); end function setProfile(s, name, comp, p) @@ -354,12 +354,12 @@ function setProfile(s, name, comp, p) if sz(1) == np + 1; for j = 1:np ic = d.componentIndex(c{j}); - calllib(ct, 'sim1D_setProfile', s.stID, ... + callct('sim1D_setProfile', s.stID, ... n - 1, ic - 1, sz(1), p(1, :), sz(1), p(j+1, :)); end elseif sz(2) == np + 1; ic = d.componentIndex(c{j}); - calllib(ct, 'sim1D_setProfile', s.stID, ... + callct('sim1D_setProfile', s.stID, ... n - 1, ic - 1, sz(2), p(:, 1), sz(2), p(:, j+1)); else error('Wrong profile shape.'); @@ -400,7 +400,7 @@ function setRefineCriteria(s, n, ratio, slope, curve, prune) if nargin < 6 prune = -0.1; end - calllib(ct, 'sim1D_setRefineCriteria', s.stID, ... + callct('sim1D_setRefineCriteria', s.stID, ... n - 1, ratio, slope, curve, prune); end @@ -419,7 +419,7 @@ function setTimeStep(s, stepsize, steps) % attempted. If this failed, two time steps would be taken. % - calllib(ct, 'sim1D_TimeStep', s.stID, ... + callct('sim1D_TimeStep', s.stID, ... stepsize, length(steps), steps); end @@ -450,7 +450,7 @@ function setValue(s, n, comp, localPoints, v) % Value to be set. % - calllib(ct, 'sim1D_setValue', s.stID, ... + callct('sim1D_setValue', s.stID, ... n - 1, comp - 1, localPoints - 1, v); end @@ -480,7 +480,7 @@ function setValue(s, n, comp, localPoints, v) icomp = d.componentIndex(component); x = zeros(1, np); for n = 1:np - x(n) = calllib(ct, 'sim1D_value', s.stID, ... + x(n) = callct('sim1D_value', s.stID, ... idom - 1, icomp - 1, n - 1); end else @@ -488,7 +488,7 @@ function setValue(s, n, comp, localPoints, v) x = zeros(nc, np); for m = 1:nc for n = 1:np - x(m, n) = calllib(ct, 'sim1D_value', s.stID, ... + x(m, n) = callct('sim1D_value', s.stID, ... idom - 1, m - 1, n - 1); end end @@ -510,7 +510,7 @@ function solve(s, loglevel, refineGrid) % Integer, 1 to allow grid refinement, 0 to disallow. % - calllib(ct, 'sim1D_solve', s.stID, loglevel, refineGrid); + callct('sim1D_solve', s.stID, loglevel, refineGrid); end function writeStats(s) @@ -526,7 +526,7 @@ function writeStats(s) % Instance of class :mat:func:`Stack` % - calllib(ct, 'sim1D_writeStats', s.stID, 1); + callct('sim1D_writeStats', s.stID, 1); end end diff --git a/interfaces/matlab_experimental/Base/Interface.m b/interfaces/matlab_experimental/Base/Interface.m index 9002d8486e..7279d45097 100644 --- a/interfaces/matlab_experimental/Base/Interface.m +++ b/interfaces/matlab_experimental/Base/Interface.m @@ -63,7 +63,7 @@ nsp = s.nSpecies; xx = zeros(1, nsp); pt = libpointer('doublePtr', xx); - calllib(ct, 'surf_getCoverages', surfID, xx); + callct('surf_getCoverages', surfID, xx); c = pt.Value; end @@ -90,7 +90,7 @@ nsp = s.nSpecies; xx = zeros(1, nsp); pt = libpointer('doublePtr', xx); - calllib(ct, 'surf_getConcentrations', surfID, xx); + callct('surf_getConcentrations', surfID, xx); c = pt.Value; end @@ -125,14 +125,14 @@ sz = length(cov); if sz == nsp if ((m == nsp && n == 1) || (m == 1 & n == nsp)) - calllib(ct, 'surf_setCoverages', surfID, cov, norm_flag); + callct('surf_setCoverages', surfID, cov, norm_flag); else error('wrong size for coverage array'); end else error('wrong size for coverage array'); end elseif isa(cov, 'char') - calllib(ct, 'surf_setCoveragesByName', surfID, cov); + callct('surf_setCoveragesByName', surfID, cov); end end @@ -146,7 +146,7 @@ % kmol/m for edge phases. surfID = s.tpID; - calllib(ct, 'surf_setSiteDensity', surfID, d); + callct('surf_setSiteDensity', surfID, d); end end diff --git a/interfaces/matlab_experimental/Base/Kinetics.m b/interfaces/matlab_experimental/Base/Kinetics.m index 275bcff3fe..b1a28c40cf 100644 --- a/interfaces/matlab_experimental/Base/Kinetics.m +++ b/interfaces/matlab_experimental/Base/Kinetics.m @@ -43,7 +43,7 @@ end end end - kin.kinID = calllib(ct, 'kin_newFromFile', src, id, ... + kin.kinID = callct('kin_newFromFile', src, id, ... iph, inb1, inb2, inb3, inb4); end @@ -52,7 +52,7 @@ function kinClear(kin) % Delete the kernel object - calllib(ct, 'kin_del', kin.kinID); + callct('kin_del', kin.kinID); end %% Get scalar attributes @@ -66,7 +66,7 @@ function kinClear(kin) % :return: % Multiplier of the rate of progress of reaction irxn. - n = calllib(ct, 'kin_multiplier', kin.kinID, irxn-1); + n = callct('kin_multiplier', kin.kinID, irxn-1); end function n = nReactions(kin) @@ -75,7 +75,7 @@ function kinClear(kin) % :return: % Integer number of reactions - n = calllib(ct, 'kin_nReactions', kin.kinID); + n = callct('kin_nReactions', kin.kinID); end function n = nTotalSpecies(kin) @@ -84,7 +84,7 @@ function kinClear(kin) % :return: % Integer total number of species. - n = calllib(ct, 'kin_nSpecies', kin.kinID); + n = callct('kin_nSpecies', kin.kinID); end function n = stoichReactant(kin, species, rxns) @@ -122,7 +122,7 @@ function kinClear(kin) for k = krange for i = irange - t = calllib(ct, 'kin_reactantStoichCoeff', ... + t = callct('kin_reactantStoichCoeff', ... kin.kinID, k-1, i-1); if t ~= 0.0 temp(k, i) = t; @@ -168,7 +168,7 @@ function kinClear(kin) for k = krange for i = irange - t = calllib(ct, 'kin_productStoichCoeff', ... + t = callct('kin_productStoichCoeff', ... kin.kinID, k-1, i-1); if t ~= 0.0 temp(k, i) = t; @@ -219,7 +219,7 @@ function kinClear(kin) nsp = kin.nTotalSpecies; xx = zeros(1, nsp); pt = libpointer('doublePtr', xx); - calllib(ct, 'kin_getCreationRates', kin.kinID, nsp, pt); + callct('kin_getCreationRates', kin.kinID, nsp, pt); cdot = pt.Value; end @@ -232,7 +232,7 @@ function kinClear(kin) nsp = kin.nTotalSpecies; xx = zeros(1, nsp); pt = libpointer('doublePtr', xx); - calllib(ct, 'kin_getDestructionRates', kin.kinID, nsp, pt); + callct('kin_getDestructionRates', kin.kinID, nsp, pt); ddot = pt.Value; end @@ -244,7 +244,7 @@ function kinClear(kin) % :return: % 1 if reaction number i is reversible. 0 if irreversible. - n = calllib(ct, 'kin_isReversible', kin.kinID, i); + n = callct('kin_isReversible', kin.kinID, i); end function wdot = netProdRates(kin) @@ -257,7 +257,7 @@ function kinClear(kin) nsp = kin.nTotalSpecies; xx = zeros(1, nsp); pt = libpointer('doublePtr', xx); - calllib(ct, 'kin_getNetProductionRates', kin.kinID, nsp, pt); + callct('kin_getNetProductionRates', kin.kinID, nsp, pt); wdot = pt.Value; end @@ -271,7 +271,7 @@ function kinClear(kin) nr = kin.nReactions; xx = zeros(1, nr); pt = libpointer('doublePtr', xx); - calllib(ct, 'kin_getFwdRateOfProgress', kin.kinID, nr, pt); + callct('kin_getFwdRateOfProgress', kin.kinID, nr, pt); q = pt.Value; end @@ -285,7 +285,7 @@ function kinClear(kin) nr = kin.nReactions; xx = zeros(1, nr); pt = libpointer('doublePtr', xx); - calllib(ct, 'kin_getRevRateOfProgress', kin.kinID, nr, pt); + callct('kin_getRevRateOfProgress', kin.kinID, nr, pt); q = pt.Value; end @@ -299,7 +299,7 @@ function kinClear(kin) nr = kin.nReactions; xx = zeros(1, nr); pt = libpointer('doublePtr', xx); - calllib(ct, 'kin_getNetRatesOfProgress', kin.kinID, nr, pt); + callct('kin_getNetRatesOfProgress', kin.kinID, nr, pt); q = pt.Value; end @@ -327,11 +327,11 @@ function kinClear(kin) rxn = cell(m, n); for i = 1:m for j = 1:n - buflen = calllib(ct, 'kin_getReactionString', kin.kinID, ... + buflen = callct('kin_getReactionString', kin.kinID, ... irxn - 1, 0, ''); if buflen > 0 aa = char(zeros(1, buflen)); - [~, aa] = calllib(ct, 'kin_getReactionString', ... + [~, aa] = callct('kin_getReactionString', ... kin.kinID, irxn - 1, buflen, aa); rxn{i, j} = aa; end @@ -349,7 +349,7 @@ function kinClear(kin) nr = kin.nReactions; xx = zeros(1, nr); pt = libpointer('doublePtr', xx); - calllib(ct, 'kin_getDelta', kin.kinID, 0, nr, pt); + callct('kin_getDelta', kin.kinID, 0, nr, pt); enthalpy = pt.Value; end @@ -363,7 +363,7 @@ function kinClear(kin) nr = kin.nReactions; xx = zeros(1, nr); pt = libpointer('doublePtr', xx); - calllib(ct, 'kin_getDelta', kin.kinID, 3, nr, pt); + callct('kin_getDelta', kin.kinID, 3, nr, pt); enthalpy = pt.Value; end @@ -377,7 +377,7 @@ function kinClear(kin) nr = kin.nReactions; xx = zeros(1, nr); pt = libpointer('doublePtr', xx); - calllib(ct, 'kin_getDelta', kin.kinID, 2, nr, pt); + callct('kin_getDelta', kin.kinID, 2, nr, pt); entropy = pt.Value; end @@ -391,7 +391,7 @@ function kinClear(kin) nr = kin.nReactions; xx = zeros(1, nr); pt = libpointer('doublePtr', xx); - calllib(ct, 'kin_getDelta', kin.kinID, 5, nr, pt); + callct('kin_getDelta', kin.kinID, 5, nr, pt); entropy = pt.Value; end @@ -405,7 +405,7 @@ function kinClear(kin) nr = kin.nReactions; xx = zeros(1, nr); pt = libpointer('doublePtr', xx); - calllib(ct, 'kin_getDelta', kin.kinID, 1, nr, pt); + callct('kin_getDelta', kin.kinID, 1, nr, pt); gibbs = pt.Value; end @@ -419,7 +419,7 @@ function kinClear(kin) nr = kin.nReactions; xx = zeros(1, nr); pt = libpointer('doublePtr', xx); - calllib(ct, 'kin_getDelta', kin.kinID, 4, nr, pt); + callct('kin_getDelta', kin.kinID, 4, nr, pt); gibbs = pt.Value; end @@ -435,7 +435,7 @@ function kinClear(kin) nr = kin.nReactions; xx = zeros(1, nr); pt = libpointer('doublePtr', xx); - calllib(ct, 'kin_getEquilibriumConstants', kin.kinID, nr, pt); + callct('kin_getEquilibriumConstants', kin.kinID, nr, pt); k = pt.Value; end @@ -449,7 +449,7 @@ function kinClear(kin) nr = kin.nReactions; xx = zeros(1, nr); pt = libpointer('doublePtr', xx); - calllib(ct, 'kin_getFwdRateConstants', kin.kinID, nr, pt); + callct('kin_getFwdRateConstants', kin.kinID, nr, pt); k = pt.Value; end @@ -463,7 +463,7 @@ function kinClear(kin) nr = kin.nReactions; xx = zeros(1, nr); pt = libpointer('doublePtr', xx); - calllib(ct, 'kin_getRevRateConstants', kin.kinID, 1, nr, pt); + callct('kin_getRevRateConstants', kin.kinID, 1, nr, pt); k = pt.Value; end @@ -476,7 +476,7 @@ function kinClear(kin) nsp = kin.nTotalSpecies; xx = zeros(1, nsp); pt = libpointer('doublePtr', xx); - calllib(ct, 'kin_getSourceTerms', kin.kinID, nsp, pt); + callct('kin_getSourceTerms', kin.kinID, nsp, pt); massProdRate = pt.Value; end @@ -505,7 +505,7 @@ function kinClear(kin) for i = 1:nr for j = 1:n - calllib(ct, 'kin_setMultiplier', kin.kinID, ... + callct('kin_setMultiplier', kin.kinID, ... irxn(i, j)-1, v); end end @@ -517,7 +517,7 @@ function advanceCoverages(kin, dt) % :parameter dt: % Time interval by which the coverages should be advanced. - calllib(ct, 'kin_advanceCoverages', kin.kinID, dt); + callct('kin_advanceCoverages', kin.kinID, dt); end end diff --git a/interfaces/matlab_experimental/Base/ThermoPhase.m b/interfaces/matlab_experimental/Base/ThermoPhase.m index 0ecea21aca..b442935389 100644 --- a/interfaces/matlab_experimental/Base/ThermoPhase.m +++ b/interfaces/matlab_experimental/Base/ThermoPhase.m @@ -81,7 +81,7 @@ if nargin == 1 id = '-'; end - tp.tpID = calllib(ct, 'thermo_newFromFile', src, id); + tp.tpID = callct('thermo_newFromFile', src, id); tp.basis = 'molar'; end @@ -93,10 +93,10 @@ function display(tp, threshold) if nargin < 2 || ~isnumeric(threshold) threshold = 1e-14; end - buflen = 0 - calllib(ct, 'thermo_report', tp.tpID, 0, '', 1); + buflen = 0 - callct('thermo_report', tp.tpID, 0, '', 1); aa = char([zeros(1, buflen, 'int8')]); ptr = libpointer('cstring', aa); - [iok, bb] = calllib(ct, 'thermo_report', tp.tpID, buflen, ptr, 1); + [iok, bb] = callct('thermo_report', tp.tpID, buflen, ptr, 1); disp(bb); end @@ -108,7 +108,7 @@ function tpClear(tp) % Instance of class :mat:func:`ThermoPhase` (or another % object that derives from ThermoPhase) % - calllib(ct, 'thermo_del', tp.tpID); + callct('thermo_del', tp.tpID); end function tp = set.basis(tp, b) @@ -180,7 +180,7 @@ function tpClear(tp) if nargin < 7 loglevel = 0; end - calllib(ct, 'thermo_equilibrate', tp.tpID, xy, solver, ... + callct('thermo_equilibrate', tp.tpID, xy, solver, ... rtol, maxsteps, maxiter, loglevel); end @@ -199,7 +199,7 @@ function tpClear(tp) nel = tp.nElements; aa = zeros(1, nel); pt = libpointer('doublePtr', aa); - calllib(ct, 'thermo_getAtomicWeights', ... + callct('thermo_getAtomicWeights', ... tp.tpID, nel, pt); amu = pt.Value; end @@ -217,7 +217,7 @@ function tpClear(tp) nsp = tp.nSpecies; yy = zeros(1, nsp); pt = libpointer('doublePtr', yy); - calllib(ct, 'thermo_getCharges', ... + callct('thermo_getCharges', ... tp.tpID, nsp, pt); e = pt.Value; end @@ -254,7 +254,7 @@ function tpClear(tp) k = zeros(m, n); for i = 1:m for j = 1:n - k(i, j) = calllib(ct, 'thermo_elementIndex', ... + k(i, j) = callct('thermo_elementIndex', ... tp.tpID, name{i, j}) + 1; if k(i, j) > 1e3 warning(['Element ', name{i, j}, ... @@ -264,7 +264,7 @@ function tpClear(tp) end end elseif ischar(name) - k = calllib(ct, 'thermo_elementIndex', ... + k = callct('thermo_elementIndex', ... tp.tpID, name) + 1; if k > 1e3 warning(['Element ', name, ... @@ -337,13 +337,13 @@ function tpClear(tp) % :return: % Scalar double mean molecular weight. Units: kg/kmol % - mmw = calllib(ct, 'thermo_meanMolecularWeight', tp.tpID); + mmw = callct('thermo_meanMolecularWeight', tp.tpID); end function density = molarDensity(tp) % Get the molar basis density in kmol/m^3. - density = calllib(ct, 'thermo_molarDensity', tp.tpID); + density = callct('thermo_molarDensity', tp.tpID); end function mw = MolecularWeights(tp) @@ -359,7 +359,7 @@ function tpClear(tp) nsp = tp.nSpecies; yy = zeros(1, nsp); pt = libpointer('doublePtr', yy); - calllib(ct, 'thermo_getMolecularWeights', ... + callct('thermo_getMolecularWeights', ... tp.tpID, nsp, pt); mw = pt.Value; end @@ -395,7 +395,7 @@ function tpClear(tp) n = -1; return end - n = calllib(ct, 'thermo_nAtoms', tp.tpID, k-1, m-1); + n = callct('thermo_nAtoms', tp.tpID, k-1, m-1); else error('Two input arguments required.') end @@ -411,7 +411,7 @@ function tpClear(tp) % :return: % Number of elements in the phase. % - nel = calllib(ct, 'thermo_nElements', tp.tpID); + nel = callct('thermo_nElements', tp.tpID); end function nsp = nSpecies(tp) @@ -424,7 +424,7 @@ function tpClear(tp) % :return: % Number of species in the phase. % - nsp = calllib(ct, 'thermo_nSpecies', tp.tpID); + nsp = callct('thermo_nSpecies', tp.tpID); end function k = speciesIndex(tp, name) @@ -458,7 +458,7 @@ function tpClear(tp) k = zeros(m, n); for i = 1:m for j = 1:n - k(i, j) = calllib(ct, 'thermo_speciesIndex', ... + k(i, j) = callct('thermo_speciesIndex', ... tp.tpID, name{i, j}) + 1; if k(i, j) > 1e6 warning(['Species ', name{i, j}, ... @@ -468,7 +468,7 @@ function tpClear(tp) end end elseif ischar(name) - k = calllib(ct, 'thermo_speciesIndex', ... + k = callct('thermo_speciesIndex', ... tp.tpID, name) + 1; if k > 1e6 warning(['Species ', name, ... @@ -497,11 +497,11 @@ function tpClear(tp) for i = 1:m for j = 1:n ksp = k(i, j) - 1; - buflen = calllib(ct, 'thermo_getSpeciesName', ... + buflen = callct('thermo_getSpeciesName', ... tp.tpID, ksp, 0, ''); if buflen > 0 aa = char(zeros(1, buflen)); - [~, aa] = calllib(ct, 'thermo_getSpeciesName', ... + [~, aa] = callct('thermo_getSpeciesName', ... tp.tpID, ksp, buflen, aa); nm{i, j} = aa; end @@ -532,7 +532,7 @@ function tpClear(tp) % :return: % Temperature. Units: K % - temperature = calllib(ct, 'thermo_temperature', tp.tpID); + temperature = callct('thermo_temperature', tp.tpID); end function pressure = get.P(tp) @@ -545,7 +545,7 @@ function tpClear(tp) % :return: % Pressure. Units: Pa % - pressure = calllib(ct, 'thermo_pressure', tp.tpID); + pressure = callct('thermo_pressure', tp.tpID); end function density = get.D(tp) @@ -558,7 +558,7 @@ function tpClear(tp) % :return: % Mass density. Units: kg/m**3 % - density = calllib(ct, 'thermo_density', tp.tpID); + density = callct('thermo_density', tp.tpID); end function volume = get.V(tp) @@ -588,7 +588,7 @@ function tpClear(tp) nsp = tp.nSpecies; xx = zeros(1, nsp); pt = libpointer('doublePtr', xx); - calllib(ct, 'thermo_getMoleFractions', ... + callct('thermo_getMoleFractions', ... tp.tpID, nsp, pt); moleFractions = pt.Value; @@ -650,7 +650,7 @@ function tpClear(tp) nsp = tp.nSpecies; yy = zeros(1, nsp); pt = libpointer('doublePtr', yy); - calllib(ct, 'thermo_getMassFractions', ... + callct('thermo_getMassFractions', ... tp.tpID, nsp, pt); massFractions = pt.Value; @@ -721,7 +721,7 @@ function tpClear(tp) nsp = tp.nSpecies; xx = zeros(1, nsp); pt = libpointer('doublePtr', xx); - calllib(ct, 'thermo_chemPotentials', ... + callct('thermo_chemPotentials', ... tp.tpID, nsp, pt); mu = pt.Value; end @@ -738,9 +738,9 @@ function tpClear(tp) % Units: J/kg-K (mass basis) or J/kmol-K (molar basis). % if strcmp(tp.basis, 'molar') - c = calllib(ct, 'thermo_cv_mole', tp.tpID); + c = callct('thermo_cv_mole', tp.tpID); elseif strcmp(tp.basis, 'mass') - c = calllib(ct, 'thermo_cv_mass', tp.tpID); + c = callct('thermo_cv_mass', tp.tpID); else error("basis not specified"); end end @@ -757,9 +757,9 @@ function tpClear(tp) % Units: J/kg-K (mass-basis) or J/mol-K (molar-basis). % if strcmp(tp.basis, 'molar') - c = calllib(ct, 'thermo_cp_mole', tp.tpID); + c = callct('thermo_cp_mole', tp.tpID); elseif strcmp(tp.basis, 'mass') - c = calllib(ct, 'thermo_cp_mass', tp.tpID); + c = callct('thermo_cp_mass', tp.tpID); else error("basis not specified"); end end @@ -774,7 +774,7 @@ function tpClear(tp) % :return: % Critical density. Units: kg/m**3 % - d = calllib(ct, 'thermo_critDensity', tp.tpID); + d = callct('thermo_critDensity', tp.tpID); end function p = critPressure(tp) @@ -787,7 +787,7 @@ function tpClear(tp) % :return: % Critical pressure. Units: Pa % - p = calllib(ct, 'thermo_critPressure', tp.tpID); + p = callct('thermo_critPressure', tp.tpID); end function t = critTemperature(tp) @@ -800,7 +800,7 @@ function tpClear(tp) % :return: % Critical temperature. Units: K % - t = calllib(ct, 'thermo_critTemperature', tp.tpID); + t = callct('thermo_critTemperature', tp.tpID); end function v = electricPotential(tp) @@ -813,7 +813,7 @@ function tpClear(tp) % :return: % The electric potential of the phase. Units: V % - v = calllib(ct, 'thermo_electricPotential', tp.tpID); + v = callct('thermo_electricPotential', tp.tpID); end function e = eosType(tp) @@ -826,11 +826,11 @@ function tpClear(tp) % :return: % An string identifying the equation of state. % - buflen = calllib(ct, 'thermo_getEosType', tp.tpID, 0, ''); + buflen = callct('thermo_getEosType', tp.tpID, 0, ''); if buflen > 0 aa = char([zeros(1, buflen, 'int8')]); ptr = libpointer('cstring', aa); - [~, bb] = calllib(ct, 'thermo_getEosType', ... + [~, bb] = callct('thermo_getEosType', ... tp.tpID, buflen, ptr); e = bb; clear aa bb ptr; @@ -866,7 +866,7 @@ function tpClear(tp) % :return: % Isothermal Compressibility. Units: 1/Pa % - b = calllib(ct, 'thermo_isothermalCompressibility', tp.tpID); + b = callct('thermo_isothermalCompressibility', tp.tpID); end function t = maxTemp(tp) @@ -885,7 +885,7 @@ function tpClear(tp) % :return: % Vector of maximum temperatures of all species % - t = calllib(ct, 'thermo_maxTemp', tp.tpID, -1); + t = callct('thermo_maxTemp', tp.tpID, -1); end function t = minTemp(tp) @@ -904,7 +904,7 @@ function tpClear(tp) % :return: % Vector of minimum temperatures of all species % - t = calllib(ct, 'thermo_minTemp', tp.tpID, -1); + t = callct('thermo_minTemp', tp.tpID, -1); end function p = refPressure(tp) @@ -918,7 +918,7 @@ function tpClear(tp) % Reference pressure in Pa. All standard-state % thermodynamic properties are for this pressure. % - p = calllib(ct, 'thermo_refPressure', tp.tpID, -1); + p = callct('thermo_refPressure', tp.tpID, -1); end function p = satPressure(tp, t) @@ -933,7 +933,7 @@ function tpClear(tp) % :return: % Saturation pressure for temperature T. Units: Pa % - p = calllib(ct, 'thermo_satPressure', tp.tpID, t); + p = callct('thermo_satPressure', tp.tpID, t); end function t = satTemperature(tp, p) @@ -948,7 +948,7 @@ function tpClear(tp) % :return: % Saturation temperature for pressure p. Units: K % - t = calllib(ct, 'thermo_satTemperature', tp.tpID, p); + t = callct('thermo_satTemperature', tp.tpID, p); end function c = soundspeed(tp) @@ -1006,7 +1006,7 @@ function tpClear(tp) % :return: % Thermal Expansion Coefficient. Units: 1/K % - a = calllib(ct, 'thermo_thermalExpansionCoeff', tp.tpID); + a = callct('thermo_thermalExpansionCoeff', tp.tpID); end function v = vaporFraction(tp) @@ -1019,7 +1019,7 @@ function tpClear(tp) % :return: % Vapor fraction. % - v = calllib(ct, 'thermo_vaporFraction', tp.tpID); + v = callct('thermo_vaporFraction', tp.tpID); end function enthalpy = get.H(tp) @@ -1034,9 +1034,9 @@ function tpClear(tp) % Units: J/kmol (molar) J/kg (mass). if strcmp(tp.basis, 'molar') - enthalpy = calllib(ct, 'thermo_enthalpy_mole', tp.tpID); + enthalpy = callct('thermo_enthalpy_mole', tp.tpID); elseif strcmp(tp.basis, 'mass') - enthalpy = calllib(ct, 'thermo_enthalpy_mass', tp.tpID); + enthalpy = callct('thermo_enthalpy_mass', tp.tpID); else error("basis not specified"); end end @@ -1057,7 +1057,7 @@ function tpClear(tp) nsp = tp.nSpecies; xx = zeros(1, nsp); pt = libpointer('doublePtr', xx); - calllib(ct, 'thermo_getEnthalpies_RT', tp.tpID, nsp, pt); + callct('thermo_getEnthalpies_RT', tp.tpID, nsp, pt); enthalpy = pt.Value; end @@ -1073,9 +1073,9 @@ function tpClear(tp) % Units: J/kmol-K (molar) J/kg-K (mass) % if strcmp(tp.basis, 'molar') - entropy = calllib(ct, 'thermo_entropy_mole', tp.tpID); + entropy = callct('thermo_entropy_mole', tp.tpID); elseif strcmp(tp.basis, 'mass') - entropy = calllib(ct, 'thermo_entropy_mass', tp.tpID); + entropy = callct('thermo_entropy_mass', tp.tpID); else error("basis not specified"); end end @@ -1092,9 +1092,9 @@ function tpClear(tp) % Units: J/kmol (molar) J/kg (mass). if strcmp(tp.basis, 'molar') - intEnergy = calllib(ct, 'thermo_intEnergy_mole', tp.tpID); + intEnergy = callct('thermo_intEnergy_mole', tp.tpID); elseif strcmp(tp.basis, 'mass') - intEnergy = calllib(ct, 'thermo_intEnergy_mass', tp.tpID); + intEnergy = callct('thermo_intEnergy_mass', tp.tpID); else error("basis not specified"); end end @@ -1111,9 +1111,9 @@ function tpClear(tp) % Units: J/kmol (molar) J/kg (mass). if strcmp(tp.basis, 'molar') - gibbs = calllib(ct, 'thermo_gibbs_mole', tp.tpID); + gibbs = callct('thermo_gibbs_mole', tp.tpID); elseif strcmp(tp.basis, 'mass') - gibbs = calllib(ct, 'thermo_gibbs_mass', tp.tpID); + gibbs = callct('thermo_gibbs_mass', tp.tpID); else error("basis not specified"); end end @@ -1300,7 +1300,7 @@ function tpClear(tp) % :param phi: % Electric potential. Units: V % - calllib(ct, 'thermo_setElectricPotential', tp.tpID, phi); + callct('thermo_setElectricPotential', tp.tpID, phi); end function tp = setState_Psat(tp, p, q) @@ -1318,7 +1318,7 @@ function tpClear(tp) % :param q: % Vapor fraction % - calllib(ct, 'thermo_setState_Psat', tp.tpID, p, q); + callct('thermo_setState_Psat', tp.tpID, p, q); end function tp = setState_Tsat(tp, t, q) @@ -1336,7 +1336,7 @@ function tpClear(tp) % :param q: % Vapor fraction % - calllib(ct, 'thermo_setState_Tsat', tp.tpID, t, 1 - q); + callct('thermo_setState_Tsat', tp.tpID, t, 1 - q); end function set.T(tp, temperature) @@ -1349,7 +1349,7 @@ function tpClear(tp) % :param temperature: % Temperature. Units: K % - calllib(ct, 'thermo_setTemperature', tp.tpID, temperature); + callct('thermo_setTemperature', tp.tpID, temperature); end function set.P(tp, pressure) @@ -1367,7 +1367,7 @@ function tpClear(tp) if pressure <= 0 error('The pressure must be positive'); end - calllib(ct, 'thermo_setPressure', tp.tpID, pressure); + callct('thermo_setPressure', tp.tpID, pressure); end function set.D(tp, density) @@ -1383,7 +1383,7 @@ function tpClear(tp) if density <= 0 error('The density must be positive'); end - calllib(ct, 'thermo_setDensity', tp.tpID, density); + callct('thermo_setDensity', tp.tpID, density); end function set.X(tp, xx) @@ -1413,10 +1413,10 @@ function tpClear(tp) norm = 0; else norm = 1; end - calllib(ct, 'thermo_setMoleFractions', tp.tpID, ... + callct('thermo_setMoleFractions', tp.tpID, ... nsp, xx, norm); elseif isa(xx, 'char') - calllib(ct, 'thermo_setMoleFractionsByName', tp.tpID, xx); + callct('thermo_setMoleFractionsByName', tp.tpID, xx); end end @@ -1446,10 +1446,10 @@ function tpClear(tp) norm = 0; else norm = 1; end - calllib(ct, 'thermo_setMassFractions', tp.tpID, ... + callct('thermo_setMassFractions', tp.tpID, ... nsp, yy, norm); elseif isa(yy, 'char') - calllib(ct, 'thermo_setMassFractionsByName', tp.tpID, yy); + callct('thermo_setMassFractionsByName', tp.tpID, yy); end end @@ -1464,7 +1464,7 @@ function tpClear(tp) if p <= 0 error('The pressure must be positive'); end - calllib(ct, 'thermo_set_RP', tp.tpID, [d, p]); + callct('thermo_set_RP', tp.tpID, [d, p]); end function set.DPX(tp, input) @@ -1483,7 +1483,7 @@ function tpClear(tp) if p <= 0 error('The pressure must be positive'); end - calllib(ct, 'thermo_set_HP', tp.tpID, [h, p]); + callct('thermo_set_HP', tp.tpID, [h, p]); end function set.HPX(tp, input) @@ -1505,7 +1505,7 @@ function tpClear(tp) if v <= 0 error('The specific volume must be positive'); end - calllib(ct, 'thermo_set_PV', tp.tpID, [p, v]); + callct('thermo_set_PV', tp.tpID, [p, v]); end function set.PVX(tp, input) @@ -1521,7 +1521,7 @@ function tpClear(tp) function set.SH(tp, input) s = input{1}; h = input{2}; - calllib(ct, 'thermo_set_SH', tp.tpID, [s, h]); + callct('thermo_set_SH', tp.tpID, [s, h]); end function set.SHX(tp, input) @@ -1540,7 +1540,7 @@ function tpClear(tp) if p <= 0 error('The pressure must be positive'); end - calllib(ct, 'thermo_set_SP', tp.tpID, [s, p]); + callct('thermo_set_SP', tp.tpID, [s, p]); end function set.SPX(tp, input) @@ -1559,7 +1559,7 @@ function tpClear(tp) if t <= 0 error('The temperature must be positive'); end - calllib(ct, 'thermo_set_ST', tp.tpID, [s, t]); + callct('thermo_set_ST', tp.tpID, [s, t]); end function set.STX(tp, input) @@ -1578,7 +1578,7 @@ function tpClear(tp) if v <= 0 error('The specific volume must be positive'); end - calllib(ct, 'thermo_set_SV', tp.tpID, [s, v]); + callct('thermo_set_SV', tp.tpID, [s, v]); end function set.SVX(tp, input) @@ -1620,7 +1620,7 @@ function tpClear(tp) error('The temperature must be positive'); end h = input{2}; - calllib(ct, 'thermo_set_TH', tp.tpID, [t, h]); + callct('thermo_set_TH', tp.tpID, [t, h]); end function set.THX(tp, input) @@ -1665,7 +1665,7 @@ function tpClear(tp) if v <= 0 error('The specific volume must be positive'); end - calllib(ct, 'thermo_set_TV', tp.tpID, [t, v]); + callct('thermo_set_TV', tp.tpID, [t, v]); end function set.TVX(tp, input) @@ -1684,7 +1684,7 @@ function tpClear(tp) if p <= 0 error('The pressure must be positive'); end - calllib(ct, 'thermo_set_UP', tp.tpID, [u, p]); + callct('thermo_set_UP', tp.tpID, [u, p]); end function set.UPX(tp, input) @@ -1703,7 +1703,7 @@ function tpClear(tp) if v <= 0 error('The specific volume must be positive'); end - calllib(ct, 'thermo_set_UV', tp.tpID, [u, v]); + callct('thermo_set_UV', tp.tpID, [u, v]); end function set.UVX(tp, input) @@ -1722,7 +1722,7 @@ function tpClear(tp) if v <= 0 error('The specific volume must be positive'); end - calllib(ct, 'thermo_set_VH', tp.tpID, [v, h]); + callct('thermo_set_VH', tp.tpID, [v, h]); end function set.VHX(tp, input) diff --git a/interfaces/matlab_experimental/Base/Transport.m b/interfaces/matlab_experimental/Base/Transport.m index 1c865b3ae6..d89c806d9f 100644 --- a/interfaces/matlab_experimental/Base/Transport.m +++ b/interfaces/matlab_experimental/Base/Transport.m @@ -25,10 +25,10 @@ else tr.th = tp; if strcmp(model, 'default') - tr.trID = calllib(ct, 'trans_newDefault', ... + tr.trID = callct('trans_newDefault', ... tp.tpID, loglevel); else - tr.trID = calllib(ct, 'trans_new', model, ... + tr.trID = callct('trans_new', model, ... tp.tpID, loglevel); end end @@ -40,7 +40,7 @@ function trClear(tr) % Delete the kernel object. - calllib(ct, 'trans_del', tr.trID); + callct('trans_del', tr.trID); end %% Transport Methods @@ -51,7 +51,7 @@ function trClear(tr) % :return: % Double dynamic viscosity. Unit: Pa*s. - v = calllib(ct, 'trans_viscosity', tr.trID); + v = callct('trans_viscosity', tr.trID); if v == -1.0 error(geterr); elseif v < 0.0 @@ -65,7 +65,7 @@ function trClear(tr) % :return: % Double thermal conductivity. Unit: W/m-K. - v = calllib(ct, 'trans_thermalConductivity', tr.trID); + v = callct('trans_thermalConductivity', tr.trID); if v == -1.0 error(geterr); elseif v < 0.0 @@ -79,7 +79,7 @@ function trClear(tr) % :return: % Double electrical conductivity. Unit: S/m. - v = calllib(ct, 'trans_electricalConductivity', tr.trID); + v = callct('trans_electricalConductivity', tr.trID); if v == -1.0 error(geterr); elseif v < 0.0 @@ -97,7 +97,7 @@ function trClear(tr) nsp = tr.th.nSpecies; xx = zeros(1, nsp); pt = libpointer('doublePtr', xx); - calllib(ct, 'trans_getMixDiffCoeffs', tr.trID, nsp, pt); + callct('trans_getMixDiffCoeffs', tr.trID, nsp, pt); v = pt.Value; end @@ -111,7 +111,7 @@ function trClear(tr) nsp = tr.th.nSpecies; xx = zeros(1, nsp); pt = libpointer('doublePtr', xx); - calllib(ct, 'trans_getThermalDiffCoeffs', tr.trID, nsp, pt); + callct('trans_getThermalDiffCoeffs', tr.trID, nsp, pt); v = pt.Value; end @@ -125,7 +125,7 @@ function trClear(tr) nsp = tr.th.nSpecies; xx = zeros(1, nsp); pt = libpointer('doublePtr', xx); - calllib(ct, 'trans_getBinDiffCoeffs', tr.trID, nsp, pt); + callct('trans_getBinDiffCoeffs', tr.trID, nsp, pt); v = pt.Value; end @@ -139,7 +139,7 @@ function trClear(tr) nsp = tr.th.nSpecies; xx = zeros(1, nsp); pt = libpointer('doublePtr', xx); - calllib(ct, 'trans_getMultiDiffCoeffs', tr.trID, nsp, pt); + callct('trans_getMultiDiffCoeffs', tr.trID, nsp, pt); v = pt.Value; end @@ -150,7 +150,7 @@ function setParameters(tr, type, k, p) % :parameter k: % :parameter p: - calllib(ct, 'trans_setParameters', tr.trID, type, k, p); + callct('trans_setParameters', tr.trID, type, k, p); end function setThermalConductivity(tr, lam) diff --git a/interfaces/matlab_experimental/Func/Func.m b/interfaces/matlab_experimental/Func/Func.m index 69e356dac1..311dc6032d 100644 --- a/interfaces/matlab_experimental/Func/Func.m +++ b/interfaces/matlab_experimental/Func/Func.m @@ -81,12 +81,12 @@ if itype < 20 [m, n] = size(p); lenp = m * n; - nn = calllib(ct, 'func_new', itype, n, lenp, p); + nn = callct('func_new', itype, n, lenp, p); elseif itype < 45 m = n; - nn = calllib(ct, 'func_new', itype, n, m, 0); + nn = callct('func_new', itype, n, m, 0); else - nn = calllib(ct, 'func_new', itype, n, 0, p); + nn = callct('func_new', itype, n, 0, p); end end @@ -138,7 +138,7 @@ function clear(f) % :param f: % Instance of class :mat:func:`Func` % - calllib(ct, 'func_del', f.id); + callct('func_del', f.id); end function display(f) @@ -172,7 +172,7 @@ function display(f) ind= s.subs{:}; b = zeros(1, length(ind)); for k = 1:length(ind) - b(k) = calllib(ct, 'func_value', a.id, ind(k)); + b(k) = callct('func_value', a.id, ind(k)); end else error('Specify value for x as p(x)'); end diff --git a/interfaces/matlab_experimental/Reactor/FlowDevice.m b/interfaces/matlab_experimental/Reactor/FlowDevice.m index adf306a7ee..07bcc2b6c4 100644 --- a/interfaces/matlab_experimental/Reactor/FlowDevice.m +++ b/interfaces/matlab_experimental/Reactor/FlowDevice.m @@ -39,7 +39,7 @@ end x.type = typ; - x.id = calllib(ct, 'flowdev_new', typ); + x.id = callct('flowdev_new', typ); x.upstream = -1; x.downstream = -1; end @@ -53,7 +53,7 @@ function clear(f) % :param f: % Instance of :mat:func:`FlowDevice` to be cleared. % - calllib(ct, 'flowdev_del', f.id); + callct('flowdev_del', f.id); end %% FlowDevice methods @@ -78,7 +78,7 @@ function install(f, upstream, downstream) end i = upstream.id; j = downstream.id; - calllib(ct, 'flowdev_install', f.id, i, j); + callct('flowdev_install', f.id, i, j); else error('install requires 3 arguments'); end end @@ -92,7 +92,7 @@ function install(f, upstream, downstream) % :return: % The mass flow rate through the :mat:func:`FlowDevice` at the current time % - mdot = calllib(ct, 'flowdev_massFlowRate2', f.id); + mdot = callct('flowdev_massFlowRate2', f.id); end function setFunction(f, mf) @@ -107,7 +107,7 @@ function setFunction(f, mf) % Instance of class :mat:func:`Func` % if strcmp(f.type, 'MassFlowController') - k = calllib(ct, 'flowdev_setTimeFunction', f.id, ... + k = callct('flowdev_setTimeFunction', f.id, ... mf.id); else error('Time function can only be set for mass flow controllers.'); @@ -126,7 +126,7 @@ function setMassFlowRate(f, mdot) % Mass flow rate % if strcmp(f.type, 'MassFlowController') - k = calllib(ct, 'flowdev_setMassFlowCoeff', f.id, mdot); + k = callct('flowdev_setMassFlowCoeff', f.id, mdot); else error('Mass flow rate can only be set for mass flow controllers.'); end @@ -143,7 +143,7 @@ function setMaster(f, d) % Instance of class :mat:func:`Func` % if strcmp(f.type, 'PressureController') - k = calllib(ct, 'flowdev_setMaster', f.id, d); + k = callct('flowdev_setMaster', f.id, d); else error('Master flow device can only be set for pressure controllers.'); end @@ -169,7 +169,7 @@ function setValveCoeff(f, k) if ~strcmp(f.type, 'Valve') error('Valve coefficient can only be set for valves.'); end - ok = calllib(ct, 'flowdev_setValveCoeff', f.id, k); + ok = callct('flowdev_setValveCoeff', f.id, k); end end diff --git a/interfaces/matlab_experimental/Reactor/Reactor.m b/interfaces/matlab_experimental/Reactor/Reactor.m index 97ddff0ca0..884381b1c7 100644 --- a/interfaces/matlab_experimental/Reactor/Reactor.m +++ b/interfaces/matlab_experimental/Reactor/Reactor.m @@ -52,7 +52,7 @@ end r.type = char(typ); - r.id = calllib(ct, 'reactor_new', typ); + r.id = callct('reactor_new', typ); % if r.id < 0 % error(geterr); @@ -71,7 +71,7 @@ function clear(r) % Clear the reactor from memory. - calllib(ct, 'reactor_del', r.id); + callct('reactor_del', r.id); end function addSensitivityReaction(r, m) @@ -82,7 +82,7 @@ function addSensitivityReaction(r, m) % :parameter m: % Index number of reaction. - calllib(ct, 'reactor_addSensitivityReaction', r.id, m); + callct('reactor_addSensitivityReaction', r.id, m); end function insert(r, gas) @@ -116,7 +116,7 @@ function setThermoMgr(r, t) error('Wrong object type'); end - calllib(ct, 'reactor_setThermoMgr', r.id, t.tpID); + callct('reactor_setThermoMgr', r.id, t.tpID); end function setKineticsMgr(r, k) @@ -135,7 +135,7 @@ function setKineticsMgr(r, k) error('Wrong object type'); end - calllib(ct, 'reactor_setKineticsMgr', r.id, k.kinID); + callct('reactor_setKineticsMgr', r.id, k.kinID); end %% Reactor get methods @@ -147,7 +147,7 @@ function setKineticsMgr(r, k) % The temperature of the reactor contents at the end of the % last call to 'advance' or 'step'. Unit: K. - temperature = calllib(ct, 'reactor_temperature', r.id); + temperature = callct('reactor_temperature', r.id); end function pressure = get.P(r) @@ -157,7 +157,7 @@ function setKineticsMgr(r, k) % The pressure of the reactor contents at the end of the % last call to 'advance' or 'step'. Unit: Pa. - pressure = calllib(ct, 'reactor_pressure', r.id); + pressure = callct('reactor_pressure', r.id); end function rho = get.D(r) @@ -166,7 +166,7 @@ function setKineticsMgr(r, k) % :return: % Density of the phase in the input. Unit: kg/m^3. - rho = calllib(ct, 'reactor_density', r.id); + rho = callct('reactor_density', r.id); end function mass = get.M(r) @@ -177,7 +177,7 @@ function setKineticsMgr(r, k) % last call to 'advance' or 'step'. The mass is retrieved % from the solution vector. Unit: kg. - mass = calllib(ct, 'reactor_mass', r.id); + mass = callct('reactor_mass', r.id); end function volume = get.V(r) @@ -187,7 +187,7 @@ function setKineticsMgr(r, k) % The volume of the reactor contents at the end of the % last call to 'advance' or 'step'. Unit: m^3. - volume = calllib(ct, 'reactor_volume', r.id); + volume = callct('reactor_volume', r.id); end function enthalpy_mass = get.H(r) @@ -198,7 +198,7 @@ function setKineticsMgr(r, k) % end of the last call to 'advance' or 'step'. The enthalpy % is retrieved from the solution vector. Unit: J/kg. - enthalpy_mass = calllib(ct, 'reactor_enthalpy_mass', r.id); + enthalpy_mass = callct('reactor_enthalpy_mass', r.id); end function intEnergy_mass = get.U(r) @@ -210,7 +210,7 @@ function setKineticsMgr(r, k) % internal energy is retrieved from the solution vector. % Unit: J/kg. - intEnergy_mass = calllib(ct, 'reactor_intEnergy_mass', r.id); + intEnergy_mass = callct('reactor_intEnergy_mass', r.id); end function yi = massFraction(r, species) @@ -224,7 +224,7 @@ function setKineticsMgr(r, k) else k = species - 1; end - yi = calllib(ct, 'reactor_massFraction', r.id, k); + yi = callct('reactor_massFraction', r.id, k); end function massFractions = get.Y(r) @@ -249,7 +249,7 @@ function setInitialVolume(r, v0) % :parameter v0: % Initial volume in m^3. - calllib(ct, 'reactor_setInitialVolume', r.id, v0); + callct('reactor_setInitialVolume', r.id, v0); end function r = set.Mdot(r, MFR) @@ -258,7 +258,7 @@ function setInitialVolume(r, v0) % :parameter MFR: % Mass flow rate in kg/s. - calllib(ct, 'reactor_setMassFlowRate', r.id, MFR); + callct('reactor_setMassFlowRate', r.id, MFR); r.Mdot = MFR; end @@ -286,7 +286,7 @@ function setInitialVolume(r, v0) else error('Input must be "on" or "off"'); end - calllib(ct, 'reactor_setChemistry', r.id, iflag); + callct('reactor_setChemistry', r.id, iflag); r.ChemistryFlag = flag; end @@ -314,7 +314,7 @@ function setInitialVolume(r, v0) end if iflag >= 0 - calllib(ct, 'reactor_setEnergy', r.id, iflag); + callct('reactor_setEnergy', r.id, iflag); else error('Input must be "on" or "off".'); end diff --git a/interfaces/matlab_experimental/Reactor/ReactorNet.m b/interfaces/matlab_experimental/Reactor/ReactorNet.m index 67c6185f53..99ce6995e7 100644 --- a/interfaces/matlab_experimental/Reactor/ReactorNet.m +++ b/interfaces/matlab_experimental/Reactor/ReactorNet.m @@ -33,7 +33,7 @@ reactors = {reactor}; end - r.id = calllib(ct, 'reactornet_new'); + r.id = callct('reactornet_new'); % add reactors nr = length(reactors); @@ -47,7 +47,7 @@ function clear(r) % Clear the ReactorNet object from the memory. - calllib(ct, 'reactornet_del', r.id); + callct('reactornet_del', r.id); end function addReactor(net, reactor) @@ -58,7 +58,7 @@ function addReactor(net, reactor) % :parameter reactor: % Instance of class 'Solution'. - calllib(ct, 'reactornet_addreactor', net.id, reactor.id); + callct('reactornet_addreactor', net.id, reactor.id); end function advance(r, tout) @@ -74,7 +74,7 @@ function advance(r, tout) % :parameter tout: % End time of the integration. Unit: s. - calllib(ct, 'reactornet_advance', r.id, tout); + callct('reactornet_advance', r.id, tout); end %% ReactorNet set methods @@ -86,7 +86,7 @@ function setInitialTime(r, t) % Time at which integration should be restarted, using the % current state as the initial condition. Unit: s. - calllib(ct, 'reactornet_setInitialTime', r.id, t); + callct('reactornet_setInitialTime', r.id, t); end function setMaxTimeStep(r, maxstep) @@ -100,7 +100,7 @@ function setMaxTimeStep(r, maxstep) % leads to numerical problems later. Use thismethod to set an % upper bound on the timestep. - calllib(ct, 'reactornet_setMaxTimeStep', r.id, maxstep); + callct('reactornet_setMaxTimeStep', r.id, maxstep); end function setSensitivityTolerances(r, rerr, aerr) @@ -111,7 +111,7 @@ function setSensitivityTolerances(r, rerr, aerr) % :parameter aerr: % Scalar absolute error tolerance. - calllib(ct, 'reactornet_setSensitivityTolerances', r.id, rerr, aerr); + callct('reactornet_setSensitivityTolerances', r.id, rerr, aerr); end function setTolerances(r, rerr, aerr) @@ -122,7 +122,7 @@ function setTolerances(r, rerr, aerr) % :parameter aerr: % Scalar absolute error tolerance. - calllib(ct, 'reactornet_setTolerances', r.id, rerr, aerr); + callct('reactornet_setTolerances', r.id, rerr, aerr); end %% ReactorNet get methods @@ -136,25 +136,25 @@ function setTolerances(r, rerr, aerr) % rapidly changing, the time step becomes smaller to resolve % the solution. - t = calllib(ct, 'reactor_step', r.id); + t = callct('reactor_step', r.id); end function t = get.time(r) % Get the current time in s. - t = calllib(ct, 'reactornet_time', r.id); + t = callct('reactornet_time', r.id); end function t = atol(r) % Get the absolute error tolerance. - t = calllib(ct, 'reactornet_atol', r.id); + t = callct('reactornet_atol', r.id); end function t = rtol(r) % Get the relative error tolerance. - t = calllib(ct, 'reactornet_rtol', r.id); + t = callct('reactornet_rtol', r.id); end function s = sensitivity(r, component, p, rxtr) @@ -169,7 +169,7 @@ function setTolerances(r, rerr, aerr) % Instance of class 'reactor'. if isa(component, 'string') - calllib(ct, 'reactornet_sensitivity', r.id, component, ... + callct('reactornet_sensitivity', r.id, component, ... p, rxtr.id); end % Check back on this one to add cases for component type integer. diff --git a/interfaces/matlab_experimental/Reactor/ReactorSurface.m b/interfaces/matlab_experimental/Reactor/ReactorSurface.m index d5c36b15d9..426d150ade 100644 --- a/interfaces/matlab_experimental/Reactor/ReactorSurface.m +++ b/interfaces/matlab_experimental/Reactor/ReactorSurface.m @@ -36,7 +36,7 @@ checklib; - s.surfID = calllib(ct, 'reactorsurface_new', 0); + s.surfID = callct('reactorsurface_new', 0); s.reactor = -1; % if r.id < 0 % error(geterr); @@ -69,14 +69,14 @@ function clear(s) % Clear the ReactorSurface object from the memory. - calllib(ct, 'reactorsurface_del', s.surfID); + callct('reactorsurface_del', s.surfID); end function install(s, r) % Install a ReactorSurface in a Reactor. s.reactor = r; - calllib(ct, 'reactorsurface_install', s.surfID, r.id); + callct('reactorsurface_install', s.surfID, r.id); end function addSensitivityReaction(s, r) @@ -87,7 +87,7 @@ function addSensitivityReaction(s, r) % :parameter m: % Index number of reaction. - calllib(ct, 'reactorsurface_addSensitivityReaction', s.surfID, r); + callct('reactorsurface_addSensitivityReaction', s.surfID, r); end %% ReactorSurface get methods @@ -95,7 +95,7 @@ function addSensitivityReaction(s, r) function a = get.area(s) % Get the areaof the reactor surface in m^2. - a = calllib(ct, 'reactorsurface_area', s.surfID); + a = callct('reactorsurface_area', s.surfID); end %% ReactorSurface set methods @@ -103,7 +103,7 @@ function addSensitivityReaction(s, r) function set.area(s, a) % Set the area of a reactor surface - calllib(ct, 'reactorsurface_setArea', s.surfID, a); + callct('reactorsurface_setArea', s.surfID, a); end function setKinetics(s, kin) @@ -119,7 +119,7 @@ function setKinetics(s, kin) ikin = kin.kinID; end - calllib(ct, 'reactorsurface_setkinetics', s.surfID, ikin); + callct('reactorsurface_setkinetics', s.surfID, ikin); end end end diff --git a/interfaces/matlab_experimental/Reactor/Wall.m b/interfaces/matlab_experimental/Reactor/Wall.m index f9fb269f6f..5c54dbb533 100644 --- a/interfaces/matlab_experimental/Reactor/Wall.m +++ b/interfaces/matlab_experimental/Reactor/Wall.m @@ -74,7 +74,7 @@ typ = 'Wall'; x.type = char(typ); - x.id = calllib(ct, 'wall_new', x.type); + x.id = callct('wall_new', x.type); % if x.index < 0 % error(geterr); % end @@ -138,7 +138,7 @@ function clear(w) % Clear the Wall object from the memory. - calllib(ct, 'wall_del', w.id); + callct('wall_del', w.id); end function install(w, l, r) @@ -146,13 +146,13 @@ function install(w, l, r) w.left = l; w.right = r; - calllib(ct, 'wall_install', w.id, l.id, r.id); + callct('wall_install', w.id, l.id, r.id); end function ok = ready(w) % Check whether a wall is ready. - ok = calllib(ct, 'wall_ready', w.id); + ok = callct('wall_ready', w.id); end %% ReactorNet set methods @@ -160,7 +160,7 @@ function install(w, l, r) function set.area(w, a) % Set the area of a wall. - calllib(ct, 'wall_setArea', w.id, a); + callct('wall_setArea', w.id, a); end function setThermalResistance(w, r) @@ -169,7 +169,7 @@ function setThermalResistance(w, r) % :parameter r: % Thermal resistance. Unit: K*m^2/W. - calllib(ct, 'wall_setThermalResistance', w.id, r); + callct('wall_setThermalResistance', w.id, r); end function setHeatTransferCoeff(w, u) @@ -178,7 +178,7 @@ function setHeatTransferCoeff(w, u) % :parameter u: % Heat transfer coefficient. Unit: W/(m^2-K). - calllib(ct, 'wall_setHeatTransferCoeff', w.id, u); + callct('wall_setHeatTransferCoeff', w.id, u); end function setEmissivity(w, epsilon) @@ -187,7 +187,7 @@ function setEmissivity(w, epsilon) % :param epsilon: % Nondimensional emissivity. - calllib(ct, 'wall_setEmissivity', w.id, epsilon); + callct('wall_setEmissivity', w.id, epsilon); end function setExpansionRateCoeff(w, k) @@ -196,7 +196,7 @@ function setExpansionRateCoeff(w, k) % :parameter k: % Expanstion rate coefficient. Unit: m/(s-Pa). - calllib(ct, 'wall_setExpansionRateCoeff', w.id, k); + callct('wall_setExpansionRateCoeff', w.id, k); end function setHeatFlux(w, f) @@ -210,7 +210,7 @@ function setHeatFlux(w, f) % :parameter f: % Instance of class 'Func'. Unit: W/m^2. - calllib(ct, 'wall_setHeatFlux', w.id, f.id); + callct('wall_setHeatFlux', w.id, f.id); end function setVelocity(w, f) @@ -224,7 +224,7 @@ function setVelocity(w, f) % :parameter f: % Instance of class 'Func'. Unit: m/s. - calllib(ct, 'wall_setVelocity', w.id, f.id); + callct('wall_setVelocity', w.id, f.id); end %% ReactorNet get methods @@ -232,19 +232,19 @@ function setVelocity(w, f) function a = get.area(w) % Get the area of the wall in m^2. - a = calllib(ct, 'wall_area', w.id); + a = callct('wall_area', w.id); end function q = qdot(w, t) % Get the total heat transfer through a wall at given time. - q = calllib(ct, 'wall_Q', w.id, t); + q = callct('wall_Q', w.id, t); end function v = vdot(w, t) % Get the rate of volumetric change at a given time. - v = calllib(ct, 'wall_vdot', w.id, t); + v = callct('wall_vdot', w.id, t); end end diff --git a/interfaces/matlab_experimental/Utility/callct.m b/interfaces/matlab_experimental/Utility/callct.m new file mode 100644 index 0000000000..36a6f7cbab --- /dev/null +++ b/interfaces/matlab_experimental/Utility/callct.m @@ -0,0 +1,16 @@ +function output = callct(varargin) + % CALLCT + % This is a simplified single output variant + err1 = -1; + err2 = -999.999; + err3 = double(intmax('uint64')); + + methodname = varargin{1}; + output = calllib(ct, methodname, varargin{2:end}); + if output == err2 || output == err3 + output = -1; + end + if output == -1 + geterr; + end +end diff --git a/interfaces/matlab_experimental/Utility/canteraGitCommit.m b/interfaces/matlab_experimental/Utility/canteraGitCommit.m index 917c83f69a..7674c0905e 100644 --- a/interfaces/matlab_experimental/Utility/canteraGitCommit.m +++ b/interfaces/matlab_experimental/Utility/canteraGitCommit.m @@ -6,8 +6,8 @@ % A string containing the Git commit hash for the current version of Cantera % checklib; - buflen = calllib(ct, 'ct_getGitCommit', 0, ''); + buflen = callct('ct_getGitCommit', 0, ''); aa = char(zeros(1, buflen)); - [~, aa] = calllib(ct, 'ct_getGitCommit', buflen, aa); + [~, aa] = callct('ct_getGitCommit', buflen, aa); v = aa; end diff --git a/interfaces/matlab_experimental/Utility/canteraVersion.m b/interfaces/matlab_experimental/Utility/canteraVersion.m index 8340b084a7..fe4e1ca311 100644 --- a/interfaces/matlab_experimental/Utility/canteraVersion.m +++ b/interfaces/matlab_experimental/Utility/canteraVersion.m @@ -6,8 +6,8 @@ % A string containing the Cantera version % checklib; - buflen = calllib(ct, 'ct_getCanteraVersion', 0, ''); + buflen = callct('ct_getCanteraVersion', 0, ''); aa = char(zeros(1, buflen)); - [~, aa] = calllib(ct, 'ct_getCanteraVersion', buflen, aa); + [~, aa] = callct('ct_getCanteraVersion', buflen, aa); v = aa; end diff --git a/interfaces/matlab_experimental/Utility/cleanup.m b/interfaces/matlab_experimental/Utility/cleanup.m index 32915f530e..86d3861b95 100644 --- a/interfaces/matlab_experimental/Utility/cleanup.m +++ b/interfaces/matlab_experimental/Utility/cleanup.m @@ -2,11 +2,11 @@ function cleanup() % Delete all stored Cantera objects and reclaim memory. % checklib; - calllib(ct, 'ct_clearOneDim'); - calllib(ct, 'ct_clearMix'); - calllib(ct, 'ct_clearFunc'); - calllib(ct, 'ct_clearStorage'); - calllib(ct, 'ct_clearReactors'); - calllib(ct, 'ct_clearReactionPath'); + callct('ct_clearOneDim'); + callct('ct_clearMix'); + callct('ct_clearFunc'); + callct('ct_clearStorage'); + callct('ct_clearReactors'); + callct('ct_clearReactionPath'); clear all end diff --git a/interfaces/matlab_experimental/Utility/getDataDirectories.m b/interfaces/matlab_experimental/Utility/getDataDirectories.m index 2943ee0273..2967f1d224 100644 --- a/interfaces/matlab_experimental/Utility/getDataDirectories.m +++ b/interfaces/matlab_experimental/Utility/getDataDirectories.m @@ -7,8 +7,8 @@ % Cell array with strings representing the data file search directories % checklib; - buflen = calllib(ct, 'ct_getDataDirectories', 0, '', ';'); + buflen = callct('ct_getDataDirectories', 0, '', ';'); aa = char(zeros(1, buflen)); - [~, aa, ~] = calllib(ct, 'ct_getDataDirectories', buflen, aa, ';'); + [~, aa, ~] = callct('ct_getDataDirectories', buflen, aa, ';'); d = aa; end diff --git a/interfaces/matlab_experimental/Utility/geterr.m b/interfaces/matlab_experimental/Utility/geterr.m index 0340ae6d16..432078d4d3 100644 --- a/interfaces/matlab_experimental/Utility/geterr.m +++ b/interfaces/matlab_experimental/Utility/geterr.m @@ -4,8 +4,8 @@ checklib; try buflen = calllib(ct, 'ct_getCanteraError', 0, ''); - aa = char([zeros(1, buflen, 'int8')]); - ptr = libpointer('cstring', aa); + aa = zeros(1, buflen+1, 'int8'); + ptr = libpointer('voidPtr', aa); [~, bb] = calllib(ct, 'ct_getCanteraError', buflen, ptr); e = bb; clear aa bb ptr