source: sasview/src/sas/sascalc/simulation/iqPy/iqPymodule/misc.cc @ 06aaa75d

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since 06aaa75d was d85c194, checked in by Piotr Rozyczko <piotr.rozyczko@…>, 9 years ago

Remaining modules refactored

  • Property mode set to 100644
File size: 1.8 KB
Line 
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
23char pyiqPy_copyright__doc__[] = "";
24char pyiqPy_copyright__name__[] = "copyright";
25
26static char pyiqPy_copyright_note[] = 
27    "iqPy python module: Copyright (c) 1998-2005 Michael A.G. Aivazis";
28
29
30PyObject * pyiqPy_copyright(PyObject *, PyObject *)
31{
32    return Py_BuildValue("s", pyiqPy_copyright_note);
33}
34   
35// iq(int numI,double qmin,double qmax)
36char pyiqPy_new_iq__doc__[] = "wrap class iq in C++";
37char pyiqPy_new_iq__name__[] = "new_iq";
38
39PyObject * 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
52extern char pyiqPy_OutputIQ__name__[] = "OutputIQ";
53extern char pyiqPy_OutputIQ__doc__[] = "";
54
55PyObject * 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
71static 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
Note: See TracBrowser for help on using the repository browser.