9 #include "../BPy_Convert.h"
10 #include "../BPy_IntegrationType.h"
11 #include "../BPy_Interface1D.h"
41 "Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DFloat`\n"
43 "Base class for unary functions (functors) that work on\n"
44 ":class:`Interface1D` and return a float value.\n"
46 ".. method:: __init__()\n"
47 " __init__(integration_type)\n"
49 " Builds a unary 1D function using the default constructor\n"
50 " or the integration method given as an argument.\n"
52 " :arg integration_type: An integration method.\n"
53 " :type integration_type: :class:`IntegrationType`\n";
59 static const char *kwlist[] = {
"integration",
nullptr};
60 PyObject *obj =
nullptr;
62 if (!PyArg_ParseTupleAndKeywords(
74 self->uf1D_float->py_uf1D = (PyObject *)
self;
81 delete self->uf1D_float;
87 return PyUnicode_FromFormat(
"type: %s - address: %p", Py_TYPE(
self)->tp_name,
self->uf1D_float);
94 static const char *kwlist[] = {
"inter",
nullptr};
95 PyObject *obj =
nullptr;
97 if (!PyArg_ParseTupleAndKeywords(args, kwds,
"O!", (
char **)kwlist, &
Interface1D_Type, &obj)) {
102 PyErr_SetString(PyExc_TypeError,
"__call__ method not properly overridden");
106 if (!PyErr_Occurred()) {
107 string class_name(Py_TYPE(
self)->tp_name);
108 PyErr_SetString(PyExc_RuntimeError, (class_name +
" __call__ method failed").c_str());
112 return PyFloat_FromDouble(
self->uf1D_float->result);
118 "The integration method.\n"
120 ":type: :class:`IntegrationType`");
132 PyErr_SetString(PyExc_TypeError,
"value must be an IntegrationType");
143 integration_type_doc,
145 {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr}
151 PyVarObject_HEAD_INIT(
nullptr, 0)
"UnaryFunction1DFloat",
169 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
PyObject * BPy_IntegrationType_from_IntegrationType(IntegrationType i)
IntegrationType IntegrationType_from_BPy_IntegrationType(PyObject *obj)
PyTypeObject IntegrationType_Type
#define BPy_IntegrationType_Check(v)
PyTypeObject Interface1D_Type
PyDoc_STRVAR(integration_type_doc, "The integration method.\n" "\n" ":type: :class:`IntegrationType`")
PyTypeObject UnaryFunction1DFloat_Type
static int UnaryFunction1DFloat___init__(BPy_UnaryFunction1DFloat *self, PyObject *args, PyObject *kwds)
static int integration_type_set(BPy_UnaryFunction1DFloat *self, PyObject *value, void *UNUSED(closure))
static PyObject * integration_type_get(BPy_UnaryFunction1DFloat *self, void *UNUSED(closure))
int UnaryFunction1DFloat_Init(PyObject *module)
static PyObject * UnaryFunction1DFloat___repr__(BPy_UnaryFunction1DFloat *self)
static PyGetSetDef BPy_UnaryFunction1DFloat_getseters[]
static void UnaryFunction1DFloat___dealloc__(BPy_UnaryFunction1DFloat *self)
static char UnaryFunction1DFloat___doc__[]
static PyObject * UnaryFunction1DFloat___call__(BPy_UnaryFunction1DFloat *self, PyObject *args, PyObject *kwds)
PyTypeObject UnaryFunction1D_Type
static struct PyModuleDef module