Files
cantera/Cantera/python/src/pycantera.cpp

104 lines
2.4 KiB
C++
Raw Normal View History

2003-04-14 17:57:48 +00:00
/**
* @file pycantera.cpp
*
* This is the main file for the Python interface module.
*
*/
// turn off warnings about long names under Windows
#ifdef WIN32
#pragma warning(disable:4786)
#pragma warning(disable:4503)
#endif
#include "cantera/config.h"
2003-04-14 17:57:48 +00:00
#include "Python.h"
2004-12-10 19:54:49 +00:00
#ifdef HAS_NUMERIC
2003-04-14 17:57:48 +00:00
#include "Numeric/arrayobject.h"
2004-12-10 19:54:49 +00:00
#else
2006-11-08 01:15:13 +00:00
//#ifdef HAS_NUMARRAY
2004-12-10 19:54:49 +00:00
#include "numarray/arrayobject.h"
2006-11-08 01:15:13 +00:00
//#else
//#include "numpy/arrayobject.h"
//#endif
2004-12-10 19:54:49 +00:00
#endif
2003-04-14 17:57:48 +00:00
#include "ct.h"
#include "ctxml.h"
#include "ctsurf.h"
#include "ctbdry.h"
#include "ctrpath.h"
#include "ctreactor.h"
#include "ctfunc.h"
2003-09-04 23:25:08 +00:00
#include "ctonedim.h"
2004-12-01 22:57:23 +00:00
#include "ctmultiphase.h"
2003-04-14 17:57:48 +00:00
#include <iostream>
using namespace std;
// constants defined in the module
static PyObject *ErrorObject;
// local includes
#include "pyutils.h"
#include "ctphase_methods.cpp"
#include "ctthermo_methods.cpp"
#include "ctkinetics_methods.cpp"
2003-04-14 17:57:48 +00:00
#include "cttransport_methods.cpp"
#include "ctxml_methods.cpp"
#include "ctfuncs.cpp"
#include "ctsurf_methods.cpp"
2004-07-27 14:22:16 +00:00
//#include "ctbndry_methods.cpp"
2003-04-14 17:57:48 +00:00
#include "ctrpath_methods.cpp"
#include "ctreactor_methods.cpp"
#include "ctfunc_methods.cpp"
2003-09-04 23:25:08 +00:00
#include "ctonedim_methods.cpp"
2004-12-01 22:57:23 +00:00
#include "ctmultiphase_methods.cpp"
2003-04-14 17:57:48 +00:00
2004-02-22 17:10:05 +00:00
#ifdef INCL_USER_PYTHON
#include "ctuser.h"
#include "ctuser_methods.cpp"
#endif
2003-04-14 17:57:48 +00:00
#include "methods.h"
#include "pylogger.h"
//#include "../../src/global.h"
2003-04-14 17:57:48 +00:00
extern "C" {
/* Initialization function for the module */
DL_EXPORT(void) init_cantera(void)
{
PyObject *m, *d;
/* Initialize the type of the new type object here; doing it here
* is required for portability to Windows without requiring C++. */
/* Create the module and add the functions */
m = Py_InitModule("_cantera", ct_methods);
import_array();
Cantera::Logger* pylog = new Cantera::Py_Logger;
2004-10-16 09:12:47 +00:00
setLogWriter(pylog);
2003-04-14 17:57:48 +00:00
/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);
ErrorObject = PyErr_NewException("cantera.error", NULL, NULL);
PyDict_SetItemString(d, "error", ErrorObject);
#ifdef HAS_NUMERIC
PyDict_SetItemString(d, "nummod",PyString_FromString("Numeric"));
#else
2006-11-08 01:15:13 +00:00
//#ifdef HAS_NUMARRAY
PyDict_SetItemString(d, "nummod",PyString_FromString("numarray"));
2006-11-08 01:15:13 +00:00
//#else
//PyDict_SetItemString(d, "nummod",PyString_FromString("numpy"));
//#endif
#endif
2003-04-14 17:57:48 +00:00
}
}