AQUAgpusph 5.0.4
Loading...
Searching...
No Matches
Python.cpp File Reference

Python script execution tool. (See Aqua::CalcServer::Python for details) More...

#include <numpy/npy_no_deprecated_api.h>
#include <numpy/ndarraytypes.h>
#include <numpy/ufuncobject.h>
#include <numpy/npy_3kcompat.h>
#include <sstream>
#include "aquagpusph/AuxiliarMethods.hpp"
#include "aquagpusph/InputOutput/Logger.hpp"
#include "Python.hpp"
#include "SetScalar.hpp"
Include dependency graph for Python.cpp:

Namespaces

namespace  Aqua
 Main AQUAgpusph namespace.
namespace  Aqua::CalcServer
 Calculation server name space.

Macros

#define PY_ARRAY_UNIQUE_SYMBOL   AQUA_ARRAY_API
 Define the extension module which this Python stuff should be linked to.

Functions

static PyObject * get (PyObject UNUSED_PARAM *self, PyObject *args, PyObject *keywds)
 Get a variable by its name.
static PyObject * set (PyObject UNUSED_PARAM *self, PyObject *args, PyObject *keywds)
 Set a variable by its name.
static PyObject * logMsg (PyObject UNUSED_PARAM *self, PyObject *args, PyObject *keywds)
 Log a message from the Python.
PyMODINIT_FUNC PyInit_aquagpusph (void)
 Module initialization.

Variables

const char * _stdout_redirect
 stdout Python redirector.
const char * _stderr_redirect
 stderr Python redirector.
static PyMethodDef methods []
 List of methods declared in the module.

Detailed Description

Python script execution tool. (See Aqua::CalcServer::Python for details)

Macro Definition Documentation

◆ PY_ARRAY_UNIQUE_SYMBOL

#define PY_ARRAY_UNIQUE_SYMBOL   AQUA_ARRAY_API

Define the extension module which this Python stuff should be linked to.

In AQUAgpusph all the Python stuff is linked in the same group AQUA_ARRAY_API

See also
http://docs.scipy.org/doc/numpy/reference/c-api.array.html#importing-the-api

Function Documentation

◆ get()

PyObject * get ( PyObject UNUSED_PARAM * self,
PyObject * args,
PyObject * keywds )
static

Get a variable by its name.

Parameters
selfModule.
argsPositional arguments.
keywdsKeyword arguments.
Returns
Computed value, NULL if errors have been detected.
Here is the call graph for this function:

◆ logMsg()

PyObject * logMsg ( PyObject UNUSED_PARAM * self,
PyObject * args,
PyObject * keywds )
static

Log a message from the Python.

In AQUAgpusph the Python stdout and stderr are redirected to this function, such that:

  • stdout messages will be logged with level 0
  • stderr messages will be logged with level 3
    Parameters
    selfModule.
    argsPositional arguments.
    keywdsKeyword arguments.
    Returns
    Computed value, NULL if errors have been detected.

◆ PyInit_aquagpusph()

PyMODINIT_FUNC PyInit_aquagpusph ( void )

Module initialization.

◆ set()

PyObject * set ( PyObject UNUSED_PARAM * self,
PyObject * args,
PyObject * keywds )
static

Set a variable by its name.

Parameters
selfModule.
argsPositional arguments.
keywdsKeyword arguments.
Returns
Computed value, NULL if errors have been detected.
Here is the call graph for this function:

Variable Documentation

◆ _stderr_redirect

const char* _stderr_redirect
Initial value:
= " \n\
class stderrWriter(object): \n\
def write(self, data): \n\
aquagpusph.log(0, data) \n\
def flush(self): \n\
pass \n\
\n"

stderr Python redirector.

See also
logMsg

◆ _stdout_redirect

const char* _stdout_redirect
Initial value:
= " \n\
class stdoutWriter(object): \n\
def write(self, data): \n\
aquagpusph.log(0, data) \n\
def flush(self): \n\
pass \n\
\n"

stdout Python redirector.

See also
logMsg

◆ methods

PyMethodDef methods[]
static
Initial value:
= {
{ "get",
(PyCFunction)get,
METH_VARARGS | METH_KEYWORDS,
"Get a variable" },
{ "set",
(PyCFunction)set,
METH_VARARGS | METH_KEYWORDS,
"Set a variable" },
{ "log",
(PyCFunction)logMsg,
METH_VARARGS | METH_KEYWORDS,
"Log a message" },
{ NULL, NULL, 0, NULL }
}
static PyObject * get(PyObject UNUSED_PARAM *self, PyObject *args, PyObject *keywds)
Get a variable by its name.
Definition Python.cpp:73
static PyObject * set(PyObject UNUSED_PARAM *self, PyObject *args, PyObject *keywds)
Set a variable by its name.
Definition Python.cpp:108
static PyObject * logMsg(PyObject UNUSED_PARAM *self, PyObject *args, PyObject *keywds)
Log a message from the Python.
Definition Python.cpp:161

List of methods declared in the module.