[clib] Remove some redundant/unusable/unnecessary functions

This commit is contained in:
Ray Speth 2016-10-15 19:30:43 -04:00
parent a8c6158543
commit bdda7b5eaf
14 changed files with 1 additions and 351 deletions

View file

@ -51,7 +51,6 @@ extern "C" {
CANTERA_CAPI int phase_addElement(int n, const char* name, double weight);
CANTERA_CAPI int newThermoFromXML(int mxml);
CANTERA_CAPI size_t th_nSpecies(size_t n);
CANTERA_CAPI int th_eosType(int n);
CANTERA_CAPI double th_refPressure(int n);
CANTERA_CAPI double th_minTemp(int n, int k);
@ -106,8 +105,6 @@ extern "C" {
CANTERA_CAPI size_t newKineticsFromXML(int mxml, int iphase,
int neighbor1, int neighbor2, int neighbor3,
int neighbor4);
CANTERA_CAPI int installRxnArrays(int pxml, int ikin,
const char* default_phase);
CANTERA_CAPI size_t kin_nSpecies(int n);
CANTERA_CAPI size_t kin_nReactions(int n);
CANTERA_CAPI size_t kin_nPhases(int n);
@ -154,9 +151,6 @@ extern "C" {
CANTERA_CAPI int trans_getMassFluxes(int n, const double* state1,
const double* state2, double delta, double* fluxes);
CANTERA_CAPI int import_phase(int nth, int nxml, const char* id);
CANTERA_CAPI int import_kinetics(int nxml, const char* id,
int nphases, const int* ith, int nkin);
CANTERA_CAPI int getCanteraError(int buflen, char* buf);
CANTERA_CAPI int showCanteraErrors();
CANTERA_CAPI int setLogWriter(void* logger);
@ -165,9 +159,6 @@ extern "C" {
CANTERA_CAPI int delThermo(int n);
CANTERA_CAPI int delKinetics(int n);
CANTERA_CAPI int delTransport(int n);
CANTERA_CAPI int readlog(int n, char* buf);
CANTERA_CAPI int buildSolutionFromXML(const char* src, int ixml, const char* id,
int ith, int ikin);
CANTERA_CAPI int ck_to_cti(const char* in_file, const char* db_file,
const char* tr_file, const char* id_tag, int debug, int validate);

View file

@ -17,7 +17,6 @@ extern "C" {
CANTERA_CAPI int func_new(int type, size_t n, size_t lenp, const double* p);
CANTERA_CAPI int func_del(int i);
CANTERA_CAPI int func_clear();
CANTERA_CAPI int func_copy(int i);
CANTERA_CAPI double func_value(int i, double t);
CANTERA_CAPI int func_derivative(int i);
CANTERA_CAPI int func_duplicate(int i);

View file

@ -17,7 +17,6 @@ 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_addPhase(int i, int j, double moles);
CANTERA_CAPI int mix_init(int i);
CANTERA_CAPI int mix_updatePhases(int i);
@ -43,14 +42,7 @@ extern "C" {
CANTERA_CAPI double mix_elementMoles(int i, int m);
CANTERA_CAPI double mix_equilibrate(int i, const char* XY, double err,
int maxsteps, int maxiter, int loglevel);
CANTERA_CAPI double mix_vcs_equilibrate(int i, const char* XY, int estimateEquil,
int printLvl, int solver,
double rtol, int maxsteps,
int maxiter, int loglevel);
CANTERA_CAPI int mix_getChemPotentials(int i, size_t lenmu, double* mu);
CANTERA_CAPI int mix_getValidChemPotentials(int i, double bad_mu,
int standard, size_t lenmu,
double* mu);
CANTERA_CAPI double mix_enthalpy(int i);
CANTERA_CAPI double mix_entropy(int i);
CANTERA_CAPI double mix_gibbs(int i);

View file

@ -34,7 +34,6 @@ extern "C" {
CANTERA_CAPI double domain_atol(int i, int n);
CANTERA_CAPI int domain_setupGrid(int i, size_t npts, const double* grid);
CANTERA_CAPI int domain_setID(int i, const char* id);
CANTERA_CAPI int domain_setDesc(int i, const char* desc);
CANTERA_CAPI double domain_grid(int i, int n);
CANTERA_CAPI int bdry_setMdot(int i, double mdot);
@ -90,12 +89,7 @@ extern "C" {
int icomp, int localPoint);
CANTERA_CAPI int sim1D_eval(int i, double rdt, int count);
CANTERA_CAPI int sim1D_setMaxJacAge(int i, int ss_age, int ts_age);
CANTERA_CAPI int sim1D_timeStepFactor(int i, double tfactor);
CANTERA_CAPI int sim1D_setTimeStepLimits(int i, double tsmin, double tsmax);
CANTERA_CAPI int sim1D_setFixedTemperature(int i, double temp);
CANTERA_CAPI int sim1D_evalSSJacobian(int i);
CANTERA_CAPI double sim1D_jacobian(int i, int m, int n);
CANTERA_CAPI size_t sim1D_size(int i);
#ifdef __cplusplus
}

View file

@ -16,7 +16,6 @@ extern "C" {
CANTERA_CAPI int reactor_new(int type);
CANTERA_CAPI int reactor_del(int i);
CANTERA_CAPI int reactor_copy(int i);
CANTERA_CAPI int reactor_setInitialVolume(int i, double v);
CANTERA_CAPI int reactor_setChemistry(int i, int cflag);
CANTERA_CAPI int reactor_setEnergy(int i, int eflag);
@ -36,7 +35,6 @@ extern "C" {
CANTERA_CAPI int reactornet_new();
CANTERA_CAPI int reactornet_del(int i);
CANTERA_CAPI int reactornet_copy(int i);
CANTERA_CAPI int reactornet_setInitialTime(int i, double t);
CANTERA_CAPI int reactornet_setMaxTimeStep(int i, double maxstep);
CANTERA_CAPI int reactornet_setTolerances(int i, double rtol, double atol);
@ -57,11 +55,9 @@ extern "C" {
CANTERA_CAPI int flowdev_setMassFlowRate(int i, double mdot);
CANTERA_CAPI int flowdev_setParameters(int i, int n, const double* v);
CANTERA_CAPI int flowdev_setFunction(int i, int n);
CANTERA_CAPI int flowdev_ready(int i);
CANTERA_CAPI int wall_new(int type);
CANTERA_CAPI int wall_del(int i);
CANTERA_CAPI int wall_copy(int i);
CANTERA_CAPI int wall_install(int i, int n, int m);
CANTERA_CAPI int wall_setkinetics(int i, int n, int m);
CANTERA_CAPI double wall_vdot(int i, double t);
@ -75,7 +71,6 @@ extern "C" {
CANTERA_CAPI int wall_setVelocity(int i, int n);
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 reactorsurface_new(int type);
CANTERA_CAPI int reactorsurface_del(int i);

View file

@ -20,7 +20,6 @@ extern "C" {
CANTERA_CAPI int xml_clear();
CANTERA_CAPI int xml_copy(int i);
CANTERA_CAPI int xml_build(int i, const char* file);
CANTERA_CAPI int xml_preprocess_and_build(int i, const char* file, int debug);
CANTERA_CAPI int xml_attrib(int i, const char* key, char* value);
CANTERA_CAPI int xml_addAttrib(int i, const char* key, const char* value);
CANTERA_CAPI int xml_addComment(int i, const char* comment);
@ -35,7 +34,6 @@ extern "C" {
CANTERA_CAPI int xml_addChildNode(int i, int j);
CANTERA_CAPI int xml_write(int i, const char* file);
CANTERA_CAPI int xml_removeChild(int i, int j);
CANTERA_CAPI int ctml_getFloatArray(int i, size_t n, double* data, int iconvert);
#ifdef __cplusplus
}

View file

@ -357,15 +357,6 @@ extern "C" {
}
}
size_t th_nSpecies(size_t n)
{
try {
return ThermoCabinet::item(n).nSpecies();
} catch (...) {
return handleAllExceptions(npos, npos);
}
}
int th_eosType(int n)
{
try {
@ -912,19 +903,6 @@ extern "C" {
}
}
int installRxnArrays(int pxml, int ikin,
const char* default_phase)
{
try {
XML_Node& p = XmlCabinet::item(pxml);
Kinetics& k = KineticsCabinet::item(ikin);
installReactionArrays(p, k, default_phase);
return 0;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
//-------------------------------------
int kin_type(int n)
{
@ -1389,35 +1367,6 @@ extern "C" {
//-------------------- Functions ---------------------------
int import_phase(int nth, int nxml, const char* id)
{
try {
ThermoPhase& thrm = ThermoCabinet::item(nth);
XML_Node& node = XmlCabinet::item(nxml);
importPhase(node, &thrm);
return 0;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
int import_kinetics(int nxml, const char* id, int nphases, const int* ith, int nkin)
{
try {
vector<thermo_t*> phases;
for (int i = 0; i < nphases; i++) {
phases.push_back(&ThermoCabinet::item(ith[i]));
}
XML_Node& node = XmlCabinet::item(nxml);
Kinetics& k = KineticsCabinet::item(nkin);
importKinetics(node, phases, &k);
return 0;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
int phase_report(int nth, int ibuf, char* buf, int show_thermo)
{
try {
@ -1486,25 +1435,6 @@ extern "C" {
}
}
int readlog(int n, char* buf)
{
try {
string s;
writelog("function readlog is deprecated!");
int nlog = static_cast<int>(s.size());
if (n < 0) {
return nlog;
}
int nn = min(n-1, nlog);
copy(s.begin(), s.begin() + nn,
buf);
buf[min(nlog, n-1)] = '\0';
return 0;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
int clearStorage()
{
try {
@ -1547,43 +1477,6 @@ extern "C" {
}
}
int buildSolutionFromXML(const char* src, int ixml, const char* id,
int ith, int ikin)
{
try {
XML_Node* root = 0;
if (ixml > 0) {
root = &XmlCabinet::item(ixml);
}
ThermoPhase& t = ThermoCabinet::item(ith);
Kinetics& kin = KineticsCabinet::item(ikin);
XML_Node* r = 0;
if (root) {
r = &root->root();
}
XML_Node* x = get_XML_Node(src, r);
if (!x) {
return false;
}
importPhase(*x, &t);
kin.addPhase(t);
kin.init();
installReactionArrays(*x, kin, x->id());
t.setState_TP(300.0, OneAtm);
if (r) {
if (&x->root() != &r->root()) {
delete &x->root();
}
} else {
delete &x->root();
}
return 0;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
int ck_to_cti(const char* in_file, const char* db_file, const char* tr_file,
const char* id_tag, int debug, int validate)
{

View file

@ -121,15 +121,6 @@ extern "C" {
}
}
int func_copy(int i)
{
try {
return FuncCabinet::newCopy(i);
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
double func_value(int i, double t)
{
try {

View file

@ -50,15 +50,6 @@ extern "C" {
}
}
int mix_copy(int i)
{
try {
return mixCabinet::newCopy(i);
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
int mix_addPhase(int i, int j, double moles)
{
try {
@ -317,30 +308,6 @@ extern "C" {
}
}
doublereal mix_vcs_equilibrate(int i, const char* XY, int estimateEquil,
int printLvl, int solver, doublereal rtol,
int maxsteps, int maxiter, int loglevel)
{
try {
string ssolver;
if (solver < 0) {
ssolver = "auto";
} else if (solver == 1) {
ssolver = "gibbs";
} else if (solver == 2) {
ssolver = "vcs";
} else {
throw CanteraError("mix_vcs_equilibrate",
"Invalid equilibrium solver specified.");
}
mixCabinet::item(i).equilibrate(XY, ssolver, rtol, maxsteps,
maxiter, estimateEquil, loglevel);
return 0;
} catch (...) {
return handleAllExceptions(ERR, ERR);
}
}
int mix_getChemPotentials(int i, size_t lenmu, double* mu)
{
try {
@ -353,20 +320,6 @@ extern "C" {
}
}
int mix_getValidChemPotentials(int i, double bad_mu,
int standard, size_t lenmu, double* mu)
{
try {
bool st = (standard == 1);
MultiPhase& mix = mixCabinet::item(i);
mix.checkSpeciesArraySize(lenmu);
mixCabinet::item(i).getValidChemPotentials(bad_mu, mu, st);
return 0;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
double mix_enthalpy(int i)
{
try {

View file

@ -222,18 +222,6 @@ extern "C" {
}
}
int domain_setDesc(int i, const char* desc)
{
try {
DomainCabinet::item(i).setDesc(desc);
return 0;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
int inlet_new()
{
try {
@ -710,31 +698,6 @@ extern "C" {
}
}
int sim1D_timeStepFactor(int i, double tfactor)
{
try {
SimCabinet::item(i).setTimeStepFactor(tfactor);
return 0;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
int sim1D_setTimeStepLimits(int i, double tsmin, double tsmax)
{
try {
if (tsmin > 0.0) {
SimCabinet::item(i).setMinTimeStep(tsmin);
}
if (tsmax > 0.0) {
SimCabinet::item(i).setMaxTimeStep(tsmax);
}
return 0;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
int sim1D_setFixedTemperature(int i, double temp)
{
try {
@ -744,32 +707,4 @@ extern "C" {
return handleAllExceptions(-1, ERR);
}
}
int sim1D_evalSSJacobian(int i)
{
try {
SimCabinet::item(i).evalSSJacobian();
return 0;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
double sim1D_jacobian(int i, int m, int n)
{
try {
return SimCabinet::item(i).jacobian(m,n);
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
size_t sim1D_size(int i)
{
try {
return SimCabinet::item(i).size();
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
}

View file

@ -59,15 +59,6 @@ extern "C" {
}
}
int reactor_copy(int i)
{
try {
return ReactorCabinet::newCopy(i);
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
int reactor_setInitialVolume(int i, double v)
{
try {
@ -249,15 +240,6 @@ extern "C" {
}
}
int reactornet_copy(int i)
{
try {
return NetworkCabinet::newCopy(i);
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
int reactornet_setInitialTime(int i, double t)
{
try {
@ -463,15 +445,6 @@ extern "C" {
}
}
int flowdev_ready(int i)
{
try {
return int(FlowDeviceCabinet::item(i).ready());
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
///////////// Walls ///////////////////////
int wall_new(int type)
@ -493,15 +466,6 @@ extern "C" {
}
}
int wall_copy(int i)
{
try {
return WallCabinet::newCopy(i);
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
int wall_install(int i, int n, int m)
{
try {
@ -636,16 +600,6 @@ extern "C" {
}
}
int wall_addSensitivityReaction(int i, int lr, int rxn)
{
try {
WallCabinet::item(i).addSensitivityReaction(lr, rxn);
return 0;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
// ReactorSurface
int reactorsurface_new(int type)

View file

@ -100,16 +100,6 @@ extern "C" {
}
}
int xml_preprocess_and_build(int i, const char* file, int debug)
{
try {
XmlCabinet::item(i) = *get_XML_File(file);
return 0;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
int xml_attrib(int i, const char* key, char* value)
{
try {
@ -270,30 +260,4 @@ extern "C" {
return 0;
}
int ctml_getFloatArray(int i, size_t n, doublereal* data, int iconvert)
{
try {
XML_Node& node = XmlCabinet::item(i);
vector_fp v;
bool conv = false;
if (iconvert > 0) {
conv = true;
}
getFloatArray(node, v, conv);
size_t nv = v.size();
// array not big enough
if (n < nv) {
throw CanteraError("ctml_getFloatArray",
"array must be dimensioned at least {}", nv);
}
for (size_t i = 0; i < nv; i++) {
data[i] = v[i];
}
} catch (...) {
return handleAllExceptions(-1, ERR);
}
return 0;
}
}

View file

@ -367,15 +367,6 @@ extern "C" {
}
}
integer th_nspecies_(const integer* n)
{
try {
return _fth(n)->nSpecies();
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
integer th_eostype_(const integer* n)
{
try {

View file

@ -219,7 +219,7 @@ static void thermoget(int nlhs, mxArray* plhs[],
}
} else if (job < 50) {
int iok = 0;
size_t nsp = th_nSpecies(n);
size_t nsp = phase_nSpecies(n);
std::vector<double> x(nsp);
switch (job) {
case 32: