blender/extern/mantaflow/helper/pwrapper/numpyWrap.h
Sebastián Barschkis 4ff7c5eed6 Mantaflow [Part 1]: Added preprocessed Mantaflow source files
Includes preprocessed Mantaflow source files for both OpenMP and TBB (if OpenMP is not present, TBB files will be used instead).

These files come directly from the Mantaflow repository. Future updates to the core fluid solver will take place by updating the files.

Reviewed By: sergey, mont29

Maniphest Tasks: T59995

Differential Revision: https://developer.blender.org/D3850
2019-12-16 16:27:26 +01:00

87 lines
1.8 KiB
C++

/******************************************************************************
*
* MantaFlow fluid solver framework
* Copyright 2017 Steffen Wiewel, Moritz Baecher, Rachel Chu
*
* This program is free software, distributed under the terms of the
* Apache License, Version 2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Convert mantaflow grids to/from numpy arrays
*
******************************************************************************/
#ifdef _PCONVERT_H
# ifndef _NUMPYCONVERT_H
# define _NUMPYCONVERT_H
enum NumpyTypes {
N_BOOL = 0,
N_BYTE,
N_UBYTE,
N_SHORT,
N_USHORT,
N_INT,
N_UINT,
N_LONG,
N_ULONG,
N_LONGLONG,
N_ULONGLONG,
N_FLOAT,
N_DOUBLE,
N_LONGDOUBLE,
N_CFLOAT,
N_CDOUBLE,
N_CLONGDOUBLE,
N_OBJECT = 17,
N_STRING,
N_UNICODE,
N_VOID,
/*
* New 1.6 types appended, may be integrated
* into the above in 2.0.
*/
N_DATETIME,
N_TIMEDELTA,
N_HALF,
N_NTYPES,
N_NOTYPE,
N_CHAR, /* special flag */
N_USERDEF = 256, /* leave room for characters */
/* The number of types not including the new 1.6 types */
N_NTYPES_ABI_COMPATIBLE = 21
};
namespace Manta {
class PyArrayContainer {
public:
/// Constructors
PyArrayContainer(void *_pParentPyArray);
PyArrayContainer(const PyArrayContainer &_Other);
~PyArrayContainer();
/// Operators
PyArrayContainer &operator=(const PyArrayContainer &_Other);
private:
void ExtractData(void *_pParentPyArray);
public:
void *pData;
NumpyTypes DataType;
unsigned int TotalSize;
std::vector<long> Dims;
private:
void *pParentPyArray;
};
// template<> PyArrayContainer* fromPyPtr<PyArrayContainer>(PyObject* obj, std::vector<void*>*
// tmp);
template<> PyArrayContainer fromPy<PyArrayContainer>(PyObject *obj);
} // namespace Manta
# endif
#endif