)
INCLUDE_DIRECTORIES(
- ${PYTHON_INCLUDE_DIRS}
${NUMPY_INCLUDE_DIR}
+ ${PYTHON_INCLUDE_DIRS}
${PTHREAD_INCLUDE_DIR} # pthread dependency due to python2.7 library
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
IF(WIN32)
SET_PROPERTY(SOURCE MEDCouplingRemapper.i PROPERTY COMPILE_DEFINITIONS WIN32)
ENDIF()
-IF ("${PYTHON_VERSION_MAJOR}" STREQUAL "3")
- SET_SOURCE_FILES_PROPERTIES(MEDCouplingRemapper.i PROPERTIES SWIG_FLAGS "-py3")
-ELSE()
- SET_SOURCE_FILES_PROPERTIES(MEDCouplingRemapper.i PROPERTIES SWIG_DEFINITIONS "-shadow")
-ENDIF()
-SET(SWIG_MODULE_MEDCouplingRemapper_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS}")
-IF(MEDCOUPLING_USE_64BIT_IDS)
- STRING(APPEND SWIG_MODULE_MEDCouplingRemapper_EXTRA_FLAGS ";-DMEDCOUPLING_USE_64BIT_IDS")
-ENDIF(MEDCOUPLING_USE_64BIT_IDS)
+#IF ("${PYTHON_VERSION_MAJOR}" STREQUAL "3")
+# SET_SOURCE_FILES_PROPERTIES(MEDCouplingRemapper.i PROPERTIES SWIG_FLAGS "-py3")
+#ELSE()
+# SET_SOURCE_FILES_PROPERTIES(MEDCouplingRemapper.i PROPERTIES SWIG_DEFINITIONS "-shadow")
+#ENDIF()
+#SET(SWIG_MODULE_MEDCouplingRemapper_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS}")
+#IF(MEDCOUPLING_USE_64BIT_IDS)
+# STRING(APPEND SWIG_MODULE_MEDCouplingRemapper_EXTRA_FLAGS ";-DMEDCOUPLING_USE_64BIT_IDS")
+#ENDIF(MEDCOUPLING_USE_64BIT_IDS)
# _ABR_ Ensure dependency mechanism on all SWIG files and headers
SET (SWIG_MODULE_MEDCouplingRemapper_EXTRA_DEPS ${MEDCoupling_SWIG_DPYS_FILES}
${interpkernel_HEADERS_HXX} ${interpkernel_HEADERS_TXX})
-IF(${CMAKE_VERSION} VERSION_LESS "3.8.0")
- SWIG_ADD_MODULE(MEDCouplingRemapper python MEDCouplingRemapper.i)
-ELSE()
- SWIG_ADD_LIBRARY(MEDCouplingRemapper LANGUAGE python SOURCES MEDCouplingRemapper.i)
-ENDIF()
+#IF(${CMAKE_VERSION} VERSION_LESS "3.8.0")
+# SWIG_ADD_MODULE(MEDCouplingRemapper python MEDCouplingRemapper.i)
+#ELSE()
+# SWIG_ADD_LIBRARY(MEDCouplingRemapper LANGUAGE python SOURCES MEDCouplingRemapper.i)
+#ENDIF()
-IF(WIN32 OR CYGWIN)
- SWIG_LINK_LIBRARIES(MEDCouplingRemapper ${PYTHON_LIBRARIES} medcouplingremapper)
-ELSE(WIN32 OR CYGWIN)
- # ${PYTHON_LIBRARIES} not needed see https://www.python.org/dev/peps/pep-0513/#libpythonx-y-so-1
- SWIG_LINK_LIBRARIES(MEDCouplingRemapper medcouplingremapper)
-ENDIF(WIN32 OR CYGWIN)
+#IF(WIN32 OR CYGWIN)
+# SWIG_LINK_LIBRARIES(MEDCouplingRemapper ${PYTHON_LIBRARIES} medcouplingremapper)
+#ELSE(WIN32 OR CYGWIN)
+# # ${PYTHON_LIBRARIES} not needed see https://www.python.org/dev/peps/pep-0513/#libpythonx-y-so-1
+# SWIG_LINK_LIBRARIES(MEDCouplingRemapper medcouplingremapper)
+#ENDIF(WIN32 OR CYGWIN)
IF(WIN32)
SET_TARGET_PROPERTIES(_MEDCouplingRemapper PROPERTIES DEBUG_OUTPUT_NAME _MEDCouplingRemapper_d)
SET_TARGET_PROPERTIES(_${MEDCouling_target_name} PROPERTIES DEBUG_OUTPUT_NAME _${MEDCouling_target_name}_d)
ENDIF(WIN32)
-INSTALL(TARGETS ${SWIG_MODULE_${MEDCouling_target_name}_REAL_NAME} ${SWIG_MODULE_MEDCouplingRemapper_REAL_NAME} DESTINATION ${MEDCOUPLING_INSTALL_PYTHON})
+INSTALL(TARGETS ${SWIG_MODULE_${MEDCouling_target_name}_REAL_NAME} DESTINATION ${MEDCOUPLING_INSTALL_PYTHON})
+#INSTALL(TARGETS ${SWIG_MODULE_${MEDCouling_target_name}_REAL_NAME} ${SWIG_MODULE_MEDCouplingRemapper_REAL_NAME} DESTINATION ${MEDCOUPLING_INSTALL_PYTHON})
-SET(PYFILES_TO_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/MEDCouplingRemapper.py)
+#SET(PYFILES_TO_INSTALL ${CMAKE_CURRENT_BINARY_DIR}/MEDCouplingRemapper.py)
IF(WIN32)
SET(PYFILES_TO_INSTALL ${PYFILES_TO_INSTALL} ${CMAKE_CURRENT_BINARY_DIR}/MEDCouplingCompat.py)
ELSE()
}
template<class MCData, class T>
-MCData *BuildNewInstance(PyObject *elt0, int npyObjectType, PyTypeObject *pytype, const char *msg)
+MCData *BuildNewInstance(PyObject *elt0Arr, int npyObjectType, PyTypeObject *pytype, const char *msg)
{
+ PyArrayObject *elt0 = reinterpret_cast<PyArrayObject *>( elt0Arr );//PyObject_HEAD on top of struct tagPyArrayObject
int ndim=PyArray_NDIM(elt0);
if(ndim!=1 && ndim!=2)
throw INTERP_KERNEL::Exception("Input numpy array should have dimension equal to 1 or 2 !");
npy_intp sz0=PyArray_DIM(elt0,0);
npy_intp sz1=ndim==2?PyArray_DIM(elt0,1):1;
//
- int itemSize=PyArray_ITEMSIZE(elt0);
+ auto itemSize=PyArray_ITEMSIZE(elt0);
if(itemSize!=sizeof(T))
{
std::ostringstream oss; oss << "Input numpy array has not itemSize set to " << sizeof(T) << " !";
PyArrayObject *eltOwning=(PyArray_FLAGS(elt0C) & MED_NUMPY_OWNDATA)?elt0C:NULL;
int mask=MED_NUMPY_OWNDATA; mask=~mask;
elt0C->flags&=mask;
- PyObject *deepestObj=elt0;
+ PyObject *deepestObj=elt0Arr;
PyObject *base=elt0C->base;
if(base) deepestObj=base;
bool isSpetialCase(false);
PyCallBackDataArraySt<MCData> *cb=PyObject_GC_New(PyCallBackDataArraySt<MCData>,pytype);
cb->_pt_mc=ret;
ret->useArray(reinterpret_cast<const T *>(data),true,MEDCoupling::DeallocType::C_DEALLOC,sz0,sz1);
- PyObject *ref=PyWeakref_NewRef(deepestObj,(PyObject *)cb);
+ PyObject *ref=PyWeakref_NewRef(reinterpret_cast<PyObject *>(deepestObj),(PyObject *)cb);
void **objs=new void *[2]; objs[0]=cb; objs[1]=ref;
mma.setParameterForDeallocator(objs);
mma.setSpecificDeallocator(numarrdeal2<MCData>);