27 Integrator_integrate_doc,
28 ".. function:: integrate(func, it, it_end, integration_type)\n"
30 " Returns a single value from a set of values evaluated at each 0D\n"
31 " element of this 1D element.\n"
33 " :arg func: The UnaryFunction0D used to compute a value at each\n"
35 " :type func: :class:`UnaryFunction0D`\n"
36 " :arg it: The Interface0DIterator used to iterate over the 0D\n"
37 " elements of this 1D element. The integration will occur over\n"
38 " the 0D elements starting from the one pointed by it.\n"
39 " :type it: :class:`Interface0DIterator`\n"
40 " :arg it_end: The Interface0DIterator pointing the end of the 0D\n"
41 " elements of the 1D element.\n"
42 " :type it_end: :class:`Interface0DIterator`\n"
43 " :arg integration_type: The integration method used to compute a\n"
44 " single value from a set of values.\n"
45 " :type integration_type: :class:`IntegrationType`\n"
46 " :return: The single value obtained for the 1D element. The return\n"
47 " value type is float if func is of the :class:`UnaryFunction0DDouble`\n"
48 " or :class:`UnaryFunction0DFloat` type, and int if func is of the\n"
49 " :class:`UnaryFunction0DUnsigned` type.\n"
50 " :rtype: int | float\n");
53 static const char *kwlist[] = {
"func",
"it",
"it_end",
"integration_type",
nullptr};
54 PyObject *obj1, *obj4 =
nullptr;
57 if (!PyArg_ParseTupleAndKeywords(args,
78 double res =
integrate(*fun, it, it_end, t);
79 return PyFloat_FromDouble(res);
83 float res =
integrate(*fun, it, it_end, t);
84 return PyFloat_FromDouble(res);
89 return PyLong_FromLong(res);
92 string class_name(Py_TYPE(obj1)->tp_name);
93 PyErr_SetString(PyExc_TypeError, (
"unsupported function type: " + class_name).c_str());
102 "The Blender Freestyle.Integrator submodule\n"
109# pragma clang diagnostic push
110# pragma clang diagnostic ignored "-Wcast-function-type"
112# pragma GCC diagnostic push
113# pragma GCC diagnostic ignored "-Wcast-function-type"
120 METH_VARARGS | METH_KEYWORDS,
121 Integrator_integrate_doc},
122 {
nullptr,
nullptr, 0,
nullptr},
127# pragma clang diagnostic pop
129# pragma GCC diagnostic pop
137 "Freestyle.Integrator",
152 "Class hierarchy: int > :class:`IntegrationType`\n"
154 "Different integration methods that can be invoked to integrate into a\n"
155 "single value the set of values obtained from each 0D element of an 1D\n"
158 "* IntegrationType.MEAN: The value computed for the 1D element is the\n"
159 " mean of the values obtained for the 0D elements.\n"
160 "* IntegrationType.MIN: The value computed for the 1D element is the\n"
161 " minimum of the values obtained for the 0D elements.\n"
162 "* IntegrationType.MAX: The value computed for the 1D element is the\n"
163 " maximum of the values obtained for the 0D elements.\n"
164 "* IntegrationType.FIRST: The value computed for the 1D element is the\n"
165 " first of the values obtained for the 0D elements.\n"
166 "* IntegrationType.LAST: The value computed for the 1D element is the\n"
167 " last of the values obtained for the 0D elements.\n");
169 PyVarObject_HEAD_INIT(
nullptr, 0)
171 sizeof(PyLongObject),
225#define ADD_TYPE_CONST(id) \
226 PyLong_subtype_add_to_dict( \
227 IntegrationType_Type.tp_dict, &IntegrationType_Type, STRINGIFY(id), id)
241 PyModule_AddObjectRef(
module,
"Integrator", m);
244 d = PyModule_GetDict(m);
246 f = PyDict_GetItemString(d, p->ml_name);
247 PyModule_AddObjectRef(
module, p->ml_name, f);
static PyModuleDef module_definition
static PyMethodDef module_functions[]
IntegrationType IntegrationType_from_BPy_IntegrationType(PyObject *obj)
PyTypeObject IntegrationType_Type
int IntegrationType_Init(PyObject *module)
#define ADD_TYPE_CONST(id)
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 | float\n")
static PyObject * Integrator_integrate(PyObject *, PyObject *args, PyObject *kwds)
PyTypeObject Interface0DIterator_Type
#define BPy_UnaryFunction0DDouble_Check(v)
#define BPy_UnaryFunction0DFloat_Check(v)
#define BPy_UnaryFunction0DUnsigned_Check(v)
PyTypeObject UnaryFunction0D_Type
T integrate(UnaryFunction0D< T > &fun, Interface0DIterator it, Interface0DIterator it_end, IntegrationType integration_type=MEAN)
static struct PyModuleDef module
Freestyle::Interface0DIterator * if0D_it