3 #ifdef CYCLUS_WITH_PYTHON 20 #if PY_MAJOR_VERSION < 3 23 PyImport_AppendInittab(
"_cyclus_eventhooks", PyInit_eventhooks);
24 PyImport_AppendInittab(
"_cyclus_pyinfile", PyInit_pyinfile);
25 PyImport_AppendInittab(
"_cyclus_pymodule", PyInit_pymodule);
30 #if PY_MAJOR_VERSION < 3 35 PyImport_ImportModule(
"_cyclus_eventhooks");
36 PyImport_ImportModule(
"_cyclus_pyinfile");
37 PyImport_ImportModule(
"_cyclus_pymodule");
43 #if PY_MAJOR_VERSION < 3 56 if (!PY_INTERP_INIT) {
61 PY_INTERP_INIT =
true;
70 if (PY_INTERP_INIT && PY_INTERP_COUNT < 0) {
102 #else // else CYCLUS_WITH_PYTHON 106 int PY_INTERP_COUNT = 0;
107 bool PY_INTERP_INIT =
false;
134 "Cyclus was not built with Python bindings.");
140 "Cyclus was not built with Python bindings.");
148 #endif // ends CYCLUS_WITH_PYTHON
PyMODINIT_FUNC initpymodule(void)
__PYX_EXTERN_C std::string CyclusPyToJson(std::string)
void PyImportInit(void)
Convience function for import initialization.
For validating files received via IO.
std::string PyFindModule(std::string lib)
Finds a Python module and returns its filename.
void ClearPyAgentRefs(void)
Removes all Python agents from the internal cache.
void PyImportCallInit(void)
Convience function for imports when Python has already been started.
Agent * MakePyAgent(std::string lib, std::string agent, void *ctx)
Finds a Python module and returns an agent pointer from it.
void PyAppendInitTab(void)
Convience function for appending to import table for initialization.
__PYX_EXTERN_C void CyclusPyDelAgent(int)
__PYX_EXTERN_C void CyclusEventLoopHook(void)
__PYX_EXTERN_C void CyclusInitFromPyAgent(cyclus::Agent *, cyclus::Agent *, void *)
void PyStop(void)
Closes the current Python session.
__PYX_EXTERN_C void CyclusPyCallListeners(std::string, cyclus::Agent *, void *, int, boost::spirit::hold_any)
PyMODINIT_FUNC initpyinfile(void)
__PYX_EXTERN_C cyclus::Agent * CyclusMakePyAgent(std::string, std::string, void *)
PyMODINIT_FUNC initeventhooks(void)
void PyStart(void)
Initialize Python functionality, this is a no-op if Python was not installed along with Cyclus...
The abstract base class used by all types of agents that live and interact in a simulation.
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or.org/Osi/browser/trunk.
__PYX_EXTERN_C std::string CyclusJsonToPy(std::string)
__PYX_EXTERN_C void CyclusClearPyAgentRefs(void)
void PyDelAgent(int i)
Removes a single Python agent from the reference cache.
__PYX_EXTERN_C std::string CyclusPyFindModule(std::string)
void InitFromPyAgent(Agent *src, Agent *dst, void *ctx)
Initializes a Python agent fron another agent.
bool PY_INTERP_INIT
Whether or not the Python interpreter has been initilized.
int PY_INTERP_COUNT
Because of NumPy #7595, we can only initialize & finalize the Python interpreter once.