Removed duplicate clib/Python interface to class Bdry1D

This commit is contained in:
Ray Speth 2012-11-14 21:07:10 +00:00
parent 49ff2c4dbf
commit e6999d1ac8
4 changed files with 0 additions and 286 deletions

View file

@ -1,146 +0,0 @@
/**
* @file ctbdry.cpp
*/
#define CANTERA_USE_INTERNAL
#include "ctbdry.h"
// Cantera includes
#include "cantera/oneD/OneDim.h"
#include "cantera/oneD/Inlet1D.h"
#include "cantera/kinetics/InterfaceKinetics.h"
#include "Cabinet.h"
using namespace std;
using namespace Cantera;
typedef Cabinet<Bdry1D> BoundaryCabinet;
template<> BoundaryCabinet* BoundaryCabinet::__storage = 0;
extern "C" {
int bndry_new(int itype)
{
try {
Bdry1D* s;
switch (itype) {
case 1:
s = new Inlet1D();
break;
case 2:
s = new Symm1D();
break;
case 3:
s = new Surf1D();
break;
case 4:
s = new ReactingSurf1D();
break;
default:
return -2;
}
int i = BoundaryCabinet::add(s);
return i;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
int bndry_del(int i)
{
try {
BoundaryCabinet::del(i);
return 0;
} catch (...) {
return handleAllExceptions(-1, ERR);
}
}
double bndry_temperature(int i)
{
try {
return BoundaryCabinet::item(i).temperature();
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
int bndry_settemperature(int i, double t)
{
try {
BoundaryCabinet::item(i).setTemperature(t);
} catch (...) {
return Cantera::handleAllExceptions(-1, ERR);
}
return 0;
}
double bndry_spreadrate(int i)
{
try {
return BoundaryCabinet::get<Inlet1D>(i).spreadRate();
} catch (...) {
return Cantera::handleAllExceptions(-1, ERR);
}
return 0;
}
int bndry_setSpreadRate(int i, double v)
{
try {
BoundaryCabinet::get<Inlet1D>(i).setSpreadRate(v);
} catch (...) {
return Cantera::handleAllExceptions(-1, ERR);
}
return 0;
}
int bndry_setmdot(int i, double mdot)
{
try {
BoundaryCabinet::item(i).setMdot(mdot);
} catch (...) {
return Cantera::handleAllExceptions(-1, ERR);
}
return 0;
}
double bndry_mdot(int i)
{
try {
return BoundaryCabinet::item(i).mdot();
} catch (...) {
return handleAllExceptions(DERR, DERR);
}
}
int bndry_setxin(int i, double* xin)
{
try {
BoundaryCabinet::item(i).setMoleFractions(xin);
} catch (...) {
return Cantera::handleAllExceptions(-1, ERR);
}
return 0;
}
int bndry_setxinbyname(int i, char* xin)
{
try {
BoundaryCabinet::item(i).setMoleFractions(xin);
} catch (...) {
return Cantera::handleAllExceptions(-1, ERR);
}
return 0;
}
int surf_setkinetics(int i, int j)
{
try {
InterfaceKinetics& k = Cabinet<Kinetics>::get<InterfaceKinetics>(j);
BoundaryCabinet::get<ReactingSurf1D>(i).setKineticsMgr(&k);
} catch (...) {
return Cantera::handleAllExceptions(-1, ERR);
}
return 0;
}
}

View file

@ -1,128 +0,0 @@
static PyObject*
py_bndry_new(PyObject* self, PyObject* args)
{
int itype;
if (!PyArg_ParseTuple(args, "i:bndry_new", &itype)) {
return NULL;
}
int iok = bndry_new(itype);
if (iok < 0) {
return reportError(iok);
}
return Py_BuildValue("i",iok);
}
static PyObject*
py_bndry_del(PyObject* self, PyObject* args)
{
int n;
if (!PyArg_ParseTuple(args, "i:bndry_del", &n)) {
return NULL;
}
bndry_del(n);
return Py_BuildValue("i",0);
}
static PyObject*
py_bndry_temperature(PyObject* self, PyObject* args)
{
int n;
if (!PyArg_ParseTuple(args, "i:bndry_temperature", &n)) {
return NULL;
}
double t = bndry_temperature(n);
return Py_BuildValue("d",t);
}
static PyObject*
py_bndry_settemperature(PyObject* self, PyObject* args)
{
int n;
double t;
if (!PyArg_ParseTuple(args, "id:bndry_settemperature", &n, &t)) {
return NULL;
}
int iok = bndry_settemperature(n, t);
if (iok < 0) {
return reportError(iok);
}
return Py_BuildValue("i",0);
}
static PyObject*
py_bndry_setspreadrate(PyObject* self, PyObject* args)
{
int n;
double v;
if (!PyArg_ParseTuple(args, "id:bndry_setspreadrate", &n, &v)) {
return NULL;
}
int iok = bndry_setSpreadRate(n, v);
if (iok < 0) {
return reportError(iok);
}
return Py_BuildValue("i",0);
}
static PyObject*
py_bndry_mdot(PyObject* self, PyObject* args)
{
int n;
if (!PyArg_ParseTuple(args, "i:bndry_mdot", &n)) {
return NULL;
}
double mdot = bndry_mdot(n);
return Py_BuildValue("d",mdot);
}
static PyObject*
py_bndry_setmdot(PyObject* self, PyObject* args)
{
int n;
double mdot;
if (!PyArg_ParseTuple(args, "id:bndry_setmdot", &n, &mdot)) {
return NULL;
}
int iok = bndry_setmdot(n, mdot);
if (iok < 0) {
return reportError(iok);
}
return Py_BuildValue("i",0);
}
static PyObject*
py_bndry_setxinbyname(PyObject* self, PyObject* args)
{
int n;
char* xin;
//PyObject* o;
if (!PyArg_ParseTuple(args, "is:bndry_setxin", &n, &xin)) {
return NULL;
}
//double* x = (double*)((PyArrayObject*)o)->data;
int iok = bndry_setxinbyname(n, xin);
if (iok < 0) {
return reportError(iok);
}
return Py_BuildValue("i",0);
}
static PyObject*
py_bndry_setxin(PyObject* self, PyObject* args)
{
int n;
PyObject* xin;
if (!PyArg_ParseTuple(args, "iO:bndry_setxin", &n, &xin)) {
return NULL;
}
double* x = (double*)((PyArrayObject*)xin)->data;
int iok = bndry_setxin(n, x);
if (iok < 0) {
return reportError(iok);
}
return Py_BuildValue("i",0);
}

View file

@ -191,16 +191,6 @@ static PyMethodDef ct_methods[] = {
{"rdiag_setFlowType", py_rdiag_setFlowType, METH_VARARGS},
{"rdiag_setLabelThreshold", py_rdiag_setLabelThreshold, METH_VARARGS},
// {"bndry_temperature", py_bndry_temperature, METH_VARARGS},
// {"bndry_setxin", py_bndry_setxin, METH_VARARGS},
// {"bndry_setxinbyname", py_bndry_setxinbyname, METH_VARARGS},
// {"bndry_settemperature", py_bndry_settemperature, METH_VARARGS},
// {"bndry_setspreadrate", py_bndry_setspreadrate, METH_VARARGS},
// {"bndry_new", py_bndry_new, METH_VARARGS},
// {"bndry_del", py_bndry_del, METH_VARARGS},
// {"bndry_mdot", py_bndry_mdot, METH_VARARGS},
// {"bndry_setmdot", py_bndry_setmdot, METH_VARARGS},
{"flowdev_ready", py_flowdev_ready, METH_VARARGS},
{"reactornet_setInitialTime", py_reactornet_setInitialTime, METH_VARARGS},
{"reactornet_setTolerances", py_reactornet_setTolerances, METH_VARARGS},

View file

@ -24,7 +24,6 @@
#include "clib/ct.h"
#include "clib/ctxml.h"
#include "clib/ctsurf.h"
#include "clib/ctbdry.h"
#include "clib/ctrpath.h"
#include "clib/ctreactor.h"
#include "clib/ctfunc.h"
@ -47,7 +46,6 @@ static PyObject* ErrorObject;
#include "ctxml_methods.cpp"
#include "ctfuncs.cpp"
#include "ctsurf_methods.cpp"
//#include "ctbndry_methods.cpp"
#include "ctrpath_methods.cpp"
#include "ctreactor_methods.cpp"
#include "ctfunc_methods.cpp"