1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
|
// qwt3d_python.cpp:
// - return a handle to the data of contiguous numarray and Numeric arrays.
//
// Copyright (C) 2004-2007 Gerard Vermeulen
//
// This file is part of PyQwt3D.
//
// PyQwt3D is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// PyQwt3D is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with PyQwt3D; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include <qwt3d_python.h>
#include <qwt3d_numarray.h>
#include <qwt3d_numeric.h>
#include <qwt3d_numpy.h>
int try_PyObject_to_PyArrayContiguousFloat2D(
PyObject *in,
PyObject **out, double **data, unsigned int *nx, unsigned int *ny)
{
int result;
#ifdef HAS_NUMPY
if ((result = try_PyObject_to_NumPyArrayContiguousFloat2D(
in, out, data, nx, ny)))
return result;
#endif
#ifdef HAS_NUMERIC
if ((result = try_PyObject_to_NumericArrayContiguousFloat2D(
in, out, data, nx, ny)))
return result;
#endif
#ifdef HAS_NUMARRAY
if ((result = try_PyObject_to_NumarrayArrayContiguousFloat2D(
in, out, data, nx, ny)))
return result;
#endif
PyErr_SetString(PyExc_TypeError, "expected is a sequency convertible to\n"
#ifdef HAS_NUMPY
"(*) a NumPy 2D array of PyArray_DOUBLE.\n"
#else
"(!) rebuild PyQwt3D to support NumPy arrays.\n"
#endif
#ifdef HAS_NUMERIC
"(*) a Numeric 2D array of PyArray_DOUBLE.\n"
#else
"(!) rebuild PyQwt3D to support Numeric arrays.\n"
#endif
#ifdef HAS_NUMARRAY
"(*) a numarray 2D array of PyArray_DOUBLE.\n"
#else
"(!) rebuild PyQwt3D to support numarray arrays.\n"
#endif
);
return -1;
}
int try_PyObject_to_PyArrayContiguousFloat3D(
PyObject *in,
PyObject **out, double **data, unsigned int *nx, unsigned int *ny, unsigned int *nz)
{
int result;
#ifdef HAS_NUMPY
if ((result = try_PyObject_to_NumPyArrayContiguousFloat3D(
in, out, data, nx, ny, nz)))
return result;
#endif
#ifdef HAS_NUMERIC
if ((result = try_PyObject_to_NumericArrayContiguousFloat3D(
in, out, data, nx, ny, nz)))
return result;
#endif
#ifdef HAS_NUMARRAY
if ((result = try_PyObject_to_NumarrayArrayContiguousFloat3D(
in, out, data, nx, ny, nz)))
return result;
#endif
PyErr_SetString(PyExc_TypeError, "expected is a sequency convertible to\n"
#ifdef HAS_NUMPY
"(*) a contiguous NumPy 3D array of PyArray_DOUBLE.\n"
#else
"(!) rebuild PyQwt3D to support NumPy arrays.\n"
#endif
#ifdef HAS_NUMERIC
"(*) a contiguous Numeric 3D array of PyArray_DOUBLE.\n"
#else
"(!) rebuild PyQwt3D to support Numeric arrays.\n"
#endif
#ifdef HAS_NUMARRAY
"(*) a contiguous numarray 3D array of PyArray_DOUBLE.\n"
#else
"(!) rebuild PyQwt3D to support numarray arrays.\n"
#endif
);
return -1;
}
// Local Variables:
// mode: C++
// c-file-style: "stroustrup"
// indent-tabs-mode: nil
// End:
|