1 | // -*- C++ -*- |
---|
2 | // |
---|
3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
4 | // |
---|
5 | // Michael A.G. Aivazis |
---|
6 | // California Institute of Technology |
---|
7 | // (C) 1998-2005 All Rights Reserved |
---|
8 | // |
---|
9 | // <LicenseText> |
---|
10 | // |
---|
11 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
12 | // |
---|
13 | |
---|
14 | //#include <portinfo> |
---|
15 | #include <Python.h> |
---|
16 | |
---|
17 | #include "misc.h" |
---|
18 | #include "iq.h" |
---|
19 | |
---|
20 | |
---|
21 | // copyright |
---|
22 | |
---|
23 | char pyiqPy_copyright__doc__[] = ""; |
---|
24 | char pyiqPy_copyright__name__[] = "copyright"; |
---|
25 | |
---|
26 | static char pyiqPy_copyright_note[] = |
---|
27 | "iqPy python module: Copyright (c) 1998-2005 Michael A.G. Aivazis"; |
---|
28 | |
---|
29 | |
---|
30 | PyObject * pyiqPy_copyright(PyObject *, PyObject *) |
---|
31 | { |
---|
32 | return Py_BuildValue("s", pyiqPy_copyright_note); |
---|
33 | } |
---|
34 | |
---|
35 | // iq(int numI,double qmin,double qmax) |
---|
36 | char pyiqPy_new_iq__doc__[] = "wrap class iq in C++"; |
---|
37 | char pyiqPy_new_iq__name__[] = "new_iq"; |
---|
38 | |
---|
39 | PyObject * pyiqPy_new_iq(PyObject *, PyObject *args) |
---|
40 | { |
---|
41 | int py_numI; |
---|
42 | double py_qmin, py_qmax; |
---|
43 | int ok = PyArg_ParseTuple(args,"idd",&py_numI, &py_qmin, &py_qmax); |
---|
44 | if(!ok) return 0; |
---|
45 | |
---|
46 | IQ *iq = new IQ(py_numI,py_qmin,py_qmax); |
---|
47 | |
---|
48 | return PyCObject_FromVoidPtr(iq, NULL); |
---|
49 | } |
---|
50 | |
---|
51 | //output iq to file |
---|
52 | extern char pyiqPy_OutputIQ__name__[] = "OutputIQ"; |
---|
53 | extern char pyiqPy_OutputIQ__doc__[] = ""; |
---|
54 | |
---|
55 | PyObject * pyiqPy_OutputIQ(PyObject *, PyObject *args){ |
---|
56 | PyObject *pyiq = 0; |
---|
57 | char *outfile; |
---|
58 | int ok = PyArg_ParseTuple(args,"Os", &pyiq, &outfile); |
---|
59 | if(!ok) return NULL; |
---|
60 | |
---|
61 | void *temp = PyCObject_AsVoidPtr(pyiq); |
---|
62 | |
---|
63 | IQ * thisiq = static_cast<IQ *>(temp); |
---|
64 | |
---|
65 | thisiq->OutputIQ(outfile); |
---|
66 | |
---|
67 | return Py_BuildValue("i",0); |
---|
68 | } |
---|
69 | |
---|
70 | //release the iq object |
---|
71 | static void PyDeliq(void *ptr) |
---|
72 | { |
---|
73 | std::cout<<"Called PyDeliq()\n"; //Good to see once |
---|
74 | IQ * oldiq = static_cast<IQ *>(ptr); |
---|
75 | delete oldiq; |
---|
76 | return; |
---|
77 | } |
---|
78 | |
---|
79 | // version |
---|
80 | // $Id$ |
---|
81 | |
---|
82 | // End of file |
---|