diff --git a/src/clib/ctfunc.cpp b/src/clib/ctfunc.cpp index 55bc5c74a..1f538641d 100644 --- a/src/clib/ctfunc.cpp +++ b/src/clib/ctfunc.cpp @@ -103,6 +103,16 @@ extern "C" { } } + int func_clear() + { + try { + FuncCabinet::clear(); + return 0; + } catch (...) { + return handleAllExceptions(-1, ERR); + } + } + int func_copy(int i) { try { diff --git a/src/clib/ctfunc.h b/src/clib/ctfunc.h index 00b6bab40..a3311eab8 100644 --- a/src/clib/ctfunc.h +++ b/src/clib/ctfunc.h @@ -9,6 +9,7 @@ extern "C" { CANTERA_CAPI int func_new(int type, size_t n, size_t lenp, double* p); CANTERA_CAPI int func_del(int i); + CANTERA_CAPI int func_clear(); CANTERA_CAPI int func_copy(int i); CANTERA_CAPI int func_assign(int i, int j); CANTERA_CAPI double func_value(int i, double t); diff --git a/src/clib/ctmultiphase.cpp b/src/clib/ctmultiphase.cpp index 5a5f88689..27336200e 100644 --- a/src/clib/ctmultiphase.cpp +++ b/src/clib/ctmultiphase.cpp @@ -36,6 +36,16 @@ extern "C" { } } + int mix_clear() + { + try { + mixCabinet::clear(); + return 0; + } catch (...) { + return handleAllExceptions(-1, ERR); + } + } + int mix_copy(int i) { try { diff --git a/src/clib/ctmultiphase.h b/src/clib/ctmultiphase.h index 984787795..d20c20c74 100644 --- a/src/clib/ctmultiphase.h +++ b/src/clib/ctmultiphase.h @@ -9,6 +9,7 @@ extern "C" { CANTERA_CAPI int mix_new(); CANTERA_CAPI int mix_del(int i); + CANTERA_CAPI int mix_clear(); CANTERA_CAPI int mix_copy(int i); CANTERA_CAPI int mix_assign(int i, int j); CANTERA_CAPI int mix_addPhase(int i, int j, double moles); diff --git a/src/clib/ctreactor.cpp b/src/clib/ctreactor.cpp index 59ed14095..8e4664c94 100644 --- a/src/clib/ctreactor.cpp +++ b/src/clib/ctreactor.cpp @@ -656,4 +656,17 @@ extern "C" { return handleAllExceptions(-1, ERR); } } + + int clear_reactors() + { + try { + ReactorCabinet::clear(); + NetworkCabinet::clear(); + FlowDeviceCabinet::clear(); + WallCabinet::clear(); + return 0; + } catch (...) { + return handleAllExceptions(-1, ERR); + } + } } diff --git a/src/clib/ctreactor.h b/src/clib/ctreactor.h index 610bd04fa..8a3a2c4f8 100644 --- a/src/clib/ctreactor.h +++ b/src/clib/ctreactor.h @@ -71,6 +71,8 @@ extern "C" { CANTERA_CAPI int wall_setEmissivity(int i, double epsilon); CANTERA_CAPI int wall_ready(int i); CANTERA_CAPI int wall_addSensitivityReaction(int i, int lr, int rxn); + + CANTERA_CAPI int clear_reactors(); } #endif diff --git a/src/clib/ctrpath.cpp b/src/clib/ctrpath.cpp index 330973f1c..c20694224 100644 --- a/src/clib/ctrpath.cpp +++ b/src/clib/ctrpath.cpp @@ -308,4 +308,15 @@ extern "C" { return handleAllExceptions(-1, ERR); } } + + int clear_rxnpath() + { + try { + DiagramCabinet::clear(); + BuilderCabinet::clear(); + return 0; + } catch (...) { + return handleAllExceptions(-1, ERR); + } + } } diff --git a/src/clib/ctrpath.h b/src/clib/ctrpath.h index eca30db14..95be4bbba 100644 --- a/src/clib/ctrpath.h +++ b/src/clib/ctrpath.h @@ -34,6 +34,8 @@ extern "C" { CANTERA_CAPI int rbuild_init(int i, char* logfile, int k); CANTERA_CAPI int rbuild_build(int i, int k, char* el, char* dotfile, int idiag, int iquiet); + + CANTERA_CAPI int clear_rxnpath(); } #endif diff --git a/src/matlab/ctfunctions.cpp b/src/matlab/ctfunctions.cpp index f62ed0d9f..17fe73f71 100644 --- a/src/matlab/ctfunctions.cpp +++ b/src/matlab/ctfunctions.cpp @@ -5,8 +5,12 @@ #include #include "clib/ct.h" +#include "clib/ctreactor.h" #include "clib/ctonedim.h" +#include "clib/ctmultiphase.h" #include "clib/ctxml.h" +#include "clib/ctfunc.h" +#include "clib/ctrpath.h" #include "ctmatutils.h" using namespace std; @@ -66,8 +70,12 @@ void ctfunctions(int nlhs, mxArray* plhs[], case 4: iok = domain_clear(); iok = sim1D_clear(); + iok = mix_clear(); iok = xml_clear(); + iok = func_clear(); iok = clearStorage(); + iok = clear_reactors(); + iok = clear_rxnpath(); break; default: diff --git a/test/matlab/testImport.m b/test/matlab/testImport.m index d41bbc8a1..c5d395bcd 100644 --- a/test/matlab/testImport.m +++ b/test/matlab/testImport.m @@ -9,3 +9,5 @@ assertEqual(length(dkm), nSpecies(gas)) function testImportCTI gas = importPhase('h2o2.cti'); assertEqual(temperature(gas), 300) + +cleanup()