mantaflow  0.10
A framework for fluid simulation
numpyWrap.h
Go to the documentation of this file.
1 
2 /******************************************************************************
3 *
4 * MantaFlow fluid solver framework
5 * Copyright 2017 Steffen Wiewel, Moritz Baecher, Rachel Chu
6 *
7 * This program is free software, distributed under the terms of the
8 * GNU General Public License (GPL)
9 * http://www.gnu.org/licenses
10 *
11 * Convert mantaflow grids to/from numpy arrays
12 *
13 ******************************************************************************/
14 
15 #ifdef _PCONVERT_H
16 #ifndef _NUMPYCONVERT_H
17 #define _NUMPYCONVERT_H
18 
19 enum NumpyTypes
20 {
21  N_BOOL = 0,
22  N_BYTE, N_UBYTE,
23  N_SHORT, N_USHORT,
24  N_INT, N_UINT,
25  N_LONG, N_ULONG,
26  N_LONGLONG, N_ULONGLONG,
27  N_FLOAT, N_DOUBLE, N_LONGDOUBLE,
28  N_CFLOAT, N_CDOUBLE, N_CLONGDOUBLE,
29  N_OBJECT = 17,
30  N_STRING, N_UNICODE,
31  N_VOID,
32  /*
33  * New 1.6 types appended, may be integrated
34  * into the above in 2.0.
35  */
36  N_DATETIME, N_TIMEDELTA, N_HALF,
37 
38  N_NTYPES,
39  N_NOTYPE,
40  N_CHAR, /* special flag */
41  N_USERDEF = 256, /* leave room for characters */
42 
43  /* The number of types not including the new 1.6 types */
44  N_NTYPES_ABI_COMPATIBLE = 21
45 };
46 
47 namespace Manta
48 {
49  struct PyArrayContainer
50  {
51  unsigned int TotalSize;
52  NumpyTypes DataType;
53  void* pData;
54  };
55 
56  template<> PyArrayContainer* fromPyPtr<PyArrayContainer>(PyObject* obj, std::vector<void*>* tmp);
57  template<> PyArrayContainer fromPy<PyArrayContainer>(PyObject* obj);
58 } // namespace
59 
60 #endif
61 #endif
62 
63 
Definition: commonkernels.h:22