26 ".. function:: integrate(func, it, it_end, integration_type)\n"
28 " Returns a single value from a set of values evaluated at each 0D\n"
29 " element of this 1D element.\n"
31 " :arg func: The UnaryFunction0D used to compute a value at each\n"
33 " :type func: :class:`UnaryFunction0D`\n"
34 " :arg it: The Interface0DIterator used to iterate over the 0D\n"
35 " elements of this 1D element. The integration will occur over\n"
36 " the 0D elements starting from the one pointed by it.\n"
37 " :type it: :class:`Interface0DIterator`\n"
38 " :arg it_end: The Interface0DIterator pointing the end of the 0D\n"
39 " elements of the 1D element.\n"
40 " :type it_end: :class:`Interface0DIterator`\n"
41 " :arg integration_type: The integration method used to compute a\n"
42 " single value from a set of values.\n"
43 " :type integration_type: :class:`IntegrationType`\n"
44 " :return: The single value obtained for the 1D element. The return\n"
45 " value type is float if func is of the :class:`UnaryFunction0DDouble`\n"
46 " or :class:`UnaryFunction0DFloat` type, and int if func is of the\n"
47 " :class:`UnaryFunction0DUnsigned` type.\n"
48 " :rtype: int or float");
52 static const char *kwlist[] = {
"func",
"it",
"it_end",
"integration_type",
nullptr};
53 PyObject *obj1, *obj4 =
nullptr;
56 if (!PyArg_ParseTupleAndKeywords(args,
77 return PyFloat_FromDouble(res);
82 return PyFloat_FromDouble(res);
86 unsigned int res =
integrate(*fun, it, it_end,
t);
87 return PyLong_FromLong(res);
90 string class_name(Py_TYPE(obj1)->tp_name);
91 PyErr_SetString(PyExc_TypeError, (
"unsupported function type: " + class_name).c_str());
104 METH_VARARGS | METH_KEYWORDS,
105 Integrator_integrate_doc},
106 {
nullptr,
nullptr, 0,
nullptr},
112 PyModuleDef_HEAD_INIT,
113 "Freestyle.Integrator",
122 "Class hierarchy: int > :class:`IntegrationType`\n"
124 "Different integration methods that can be invoked to integrate into a\n"
125 "single value the set of values obtained from each 0D element of an 1D\n"
128 "* IntegrationType.MEAN: The value computed for the 1D element is the\n"
129 " mean of the values obtained for the 0D elements.\n"
130 "* IntegrationType.MIN: The value computed for the 1D element is the\n"
131 " minimum of the values obtained for the 0D elements.\n"
132 "* IntegrationType.MAX: The value computed for the 1D element is the\n"
133 " maximum of the values obtained for the 0D elements.\n"
134 "* IntegrationType.FIRST: The value computed for the 1D element is the\n"
135 " first of the values obtained for the 0D elements.\n"
136 "* IntegrationType.LAST: The value computed for the 1D element is the\n"
137 " last of the values obtained for the 0D elements.");
140 PyVarObject_HEAD_INIT(
nullptr, 0)
"IntegrationType",
141 sizeof(PyLongObject),
190 #define BPy_IntegrationType_MEAN ((PyObject *)&_IntegrationType_MEAN)
191 #define BPy_IntegrationType_MIN ((PyObject *)&_IntegrationType_MIN)
192 #define BPy_IntegrationType_MAX ((PyObject *)&_IntegrationType_MAX)
193 #define BPy_IntegrationType_FIRST ((PyObject *)&_IntegrationType_FIRST)
194 #define BPy_IntegrationType_LAST ((PyObject *)&_IntegrationType_LAST)
222 PyModule_AddObject(
module,
"Integrator", m);
225 d = PyModule_GetDict(m);
227 f = PyDict_GetItemString(d, p->ml_name);
229 PyModule_AddObject(
module, p->ml_name, f);
static char module_docstring[]
IntegrationType IntegrationType_from_BPy_IntegrationType(PyObject *obj)
static PyLongObject _IntegrationType_MEAN
PyTypeObject IntegrationType_Type
int IntegrationType_Init(PyObject *module)
#define BPy_IntegrationType_MIN
static PyModuleDef module_definition
static PyLongObject _IntegrationType_MIN
static PyLongObject _IntegrationType_MAX
#define BPy_IntegrationType_FIRST
static PyLongObject _IntegrationType_FIRST
#define BPy_IntegrationType_MAX
PyDoc_STRVAR(Integrator_integrate_doc, ".. function:: integrate(func, it, it_end, integration_type)\n" "\n" " Returns a single value from a set of values evaluated at each 0D\n" " element of this 1D element.\n" "\n" " :arg func: The UnaryFunction0D used to compute a value at each\n" " Interface0D.\n" " :type func: :class:`UnaryFunction0D`\n" " :arg it: The Interface0DIterator used to iterate over the 0D\n" " elements of this 1D element. The integration will occur over\n" " the 0D elements starting from the one pointed by it.\n" " :type it: :class:`Interface0DIterator`\n" " :arg it_end: The Interface0DIterator pointing the end of the 0D\n" " elements of the 1D element.\n" " :type it_end: :class:`Interface0DIterator`\n" " :arg integration_type: The integration method used to compute a\n" " single value from a set of values.\n" " :type integration_type: :class:`IntegrationType`\n" " :return: The single value obtained for the 1D element. The return\n" " value type is float if func is of the :class:`UnaryFunction0DDouble`\n" " or :class:`UnaryFunction0DFloat` type, and int if func is of the\n" " :class:`UnaryFunction0DUnsigned` type.\n" " :rtype: int or float")
static PyObject * Integrator_integrate(PyObject *, PyObject *args, PyObject *kwds)
#define BPy_IntegrationType_LAST
static PyLongObject _IntegrationType_LAST
static PyMethodDef module_functions[]
#define BPy_IntegrationType_MEAN
PyTypeObject Interface0DIterator_Type
#define BPy_UnaryFunction0DDouble_Check(v)
#define BPy_UnaryFunction0DFloat_Check(v)
#define BPy_UnaryFunction0DUnsigned_Check(v)
PyTypeObject UnaryFunction0D_Type
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
T integrate(UnaryFunction0D< T > &fun, Interface0DIterator it, Interface0DIterator it_end, IntegrationType integration_type=MEAN)
static struct PyModuleDef module
Freestyle::Interface0DIterator * if0D_it