// $Id$ // // Copyright (c) 2001-2006 greg Landrum and Rational Discovery LLC // // @@ All Rights Reserved @@ // This file is part of the RDKit. // The contents are covered by the terms of the BSD license // which is included in the file license.txt, found at the root // of the RDKit source tree. // #define PY_ARRAY_UNIQUE_SYMBOL rddatastructs_array_API #include #include #include #include #include "DataStructs.h" #include #include #include #include #include namespace python = boost::python; void wrap_SBV(); void wrap_EBV(); void wrap_BitOps(); void wrap_Utils(); void wrap_discreteValVect(); void wrap_sparseIntVect(); template void convertToNumpyArray(const T &v,python::object destArray){ if (!PyArray_Check(destArray.ptr())) { throw_value_error("Expecting a Numeric array object"); } PyArrayObject *destP=(PyArrayObject *)destArray.ptr(); npy_intp ndims[1]; ndims[0]=v.size(); PyArray_Dims dims; dims.ptr=ndims; dims.len=1; PyArray_Resize(destP,&dims,0,NPY_ANYORDER); for(unsigned int i=0;i(&translate_index_error); python::register_exception_translator(&translate_value_error); wrap_Utils(); wrap_SBV(); wrap_EBV(); wrap_BitOps(); wrap_discreteValVect(); wrap_sparseIntVect(); python::def("ConvertToNumpyArray", (void (*)(const ExplicitBitVect &,python::object))convertToNumpyArray, (python::arg("bv"),python::arg("destArray"))); python::def("ConvertToNumpyArray", (void (*)(const RDKit::DiscreteValueVect &,python::object))convertToNumpyArray, (python::arg("bv"),python::arg("destArray"))); }