source: sasview/src/sas/sascalc/simulation/analmodelpy/analmodelpymodule/misc.cc @ 6afc14b

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.2.2ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since 6afc14b was d85c194, checked in by Piotr Rozyczko <piotr.rozyczko@…>, 9 years ago

Remaining modules refactored

  • Property mode set to 100644
File size: 2.4 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 "analytical_model.h"
19#include "geo_shape.h"
20#include "iq.h"
21
22// copyright
23
24char pyanalmodelpy_copyright__doc__[] = "";
25char pyanalmodelpy_copyright__name__[] = "copyright";
26
27static char pyanalmodelpy_copyright_note[] = 
28    "analmodelpy python module: Copyright (c) 1998-2005 Michael A.G. Aivazis";
29
30
31PyObject * pyanalmodelpy_copyright(PyObject *, PyObject *)
32{
33    return Py_BuildValue("s", pyanalmodelpy_copyright_note);
34}
35
36//extern char pyanalmodelpy_GetRadius__name__[] = "";
37//extern char pyanalmodelpy_GetRadius__doc__[] = "GetRadius";
38//PyObject * pyanalmodelpy_GetRadius(PyObject *, PyObject *args){
39//  double r = Sphere::GetRadius();
40// 
41//  return PyBuildValue("d", r);
42//}
43
44
45   
46// analytical_model class constructor  AnalyticalModel(Sphere &)
47
48char pyanalmodelpy_new_analmodel__doc__[] = "";
49char pyanalmodelpy_new_analmodel__name__[] = "new_analmodel";
50
51PyObject * pyanalmodelpy_new_analmodel(PyObject *, PyObject *args)
52{
53  PyObject *pyshape = 0;
54  int ok = PyArg_ParseTuple(args, "O", &pyshape);
55  if(!ok) return NULL;
56
57  void *temp = PyCObject_AsVoidPtr(pyshape);
58
59  GeoShape *shape = static_cast<GeoShape *>(temp);
60
61  AnalyticalModel *newanal = new AnalyticalModel(*shape);
62
63  return PyCObject_FromVoidPtr(newanal, NULL);
64}
65
66//AnalyticalModel method: CalculateIQ(IQ *)
67char pyanalmodelpy_CalculateIQ__doc__[] = "";
68char pyanalmodelpy_CalculateIQ__name__[] = "CalculateIQ";
69
70PyObject * pyanalmodelpy_CalculateIQ(PyObject *, PyObject *args)
71{
72  PyObject *pyanal = 0, *pyiq = 0;
73  int ok = PyArg_ParseTuple(args, "OO", &pyanal, &pyiq);
74  if(!ok) return NULL;
75                                                                 
76  void *temp = PyCObject_AsVoidPtr(pyanal);
77  void *temp2 = PyCObject_AsVoidPtr(pyiq);
78                                         
79  AnalyticalModel * thisanal = static_cast<AnalyticalModel *>(temp);
80  IQ * thisiq = static_cast<IQ *>(temp2);
81
82  thisanal->CalculateIQ(thisiq);
83                       
84  return Py_BuildValue("i",0);
85
86}
87   
88// version
89// $Id$
90
91// End of file
Note: See TracBrowser for help on using the repository browser.