source: sasview/sansmodels/src/sans/models/c_models/CCoreShellModel.cpp @ 2605da22

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 2605da22 was 2605da22, checked in by Mathieu Doucet <doucetm@…>, 12 years ago

Re #4 Still a few more warnings

  • Property mode set to 100644
File size: 21.2 KB
Line 
1/**
2        This software was developed by the University of Tennessee as part of the
3        Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
4        project funded by the US National Science Foundation.
5
6        If you use DANSE applications to do scientific research that leads to
7        publication, we ask that you acknowledge the use of the software with the
8        following sentence:
9
10        "This work benefited from DANSE software developed under NSF award DMR-0520547."
11
12        copyright 2008, University of Tennessee
13 */
14
15/** CCoreShellModel
16 *
17 * C extension
18 *
19 * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
20 *          DO NOT MODIFY THIS FILE, MODIFY core_shell.h
21 *          AND RE-RUN THE GENERATOR SCRIPT
22 *
23 */
24#define NO_IMPORT_ARRAY
25#define PY_ARRAY_UNIQUE_SYMBOL PyArray_API_sans
26 
27extern "C" {
28#include <Python.h>
29#include <arrayobject.h>
30#include "structmember.h"
31#include <stdio.h>
32#include <stdlib.h>
33#include <math.h>
34#include <time.h>
35#include "core_shell.h"
36}
37
38#include "models.hh"
39#include "dispersion_visitor.hh"
40
41/// Error object for raised exceptions
42static PyObject * CCoreShellModelError = NULL;
43
44
45// Class definition
46typedef struct {
47    PyObject_HEAD
48    /// Parameters
49    PyObject * params;
50    /// Dispersion parameters
51    PyObject * dispersion;
52    /// Underlying model object
53    CoreShellModel * model;
54    /// Log for unit testing
55    PyObject * log;
56} CCoreShellModel;
57
58
59static void
60CCoreShellModel_dealloc(CCoreShellModel* self)
61{
62    Py_DECREF(self->params);
63    Py_DECREF(self->dispersion);
64    Py_DECREF(self->log);
65    delete self->model;
66    self->ob_type->tp_free((PyObject*)self);
67   
68
69}
70
71static PyObject *
72CCoreShellModel_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
73{
74    CCoreShellModel *self;
75   
76    self = (CCoreShellModel *)type->tp_alloc(type, 0);
77   
78    return (PyObject *)self;
79}
80
81static int
82CCoreShellModel_init(CCoreShellModel *self, PyObject *args, PyObject *kwds)
83{
84    if (self != NULL) {
85       
86        // Create parameters
87        self->params = PyDict_New();
88        self->dispersion = PyDict_New();
89        self->model = new CoreShellModel();
90       
91        // Initialize parameter dictionary
92        PyDict_SetItemString(self->params,"core_sld",Py_BuildValue("d",0.000001000000));
93        PyDict_SetItemString(self->params,"thickness",Py_BuildValue("d",10.000000000000));
94        PyDict_SetItemString(self->params,"solvent_sld",Py_BuildValue("d",0.000003000000));
95        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000000000));
96        PyDict_SetItemString(self->params,"radius",Py_BuildValue("d",60.000000000000));
97        PyDict_SetItemString(self->params,"background",Py_BuildValue("d",0.000000000000));
98        PyDict_SetItemString(self->params,"shell_sld",Py_BuildValue("d",0.000002000000));
99        // Initialize dispersion / averaging parameter dict
100        DispersionVisitor* visitor = new DispersionVisitor();
101        PyObject * disp_dict;
102        disp_dict = PyDict_New();
103        self->model->radius.dispersion->accept_as_source(visitor, self->model->radius.dispersion, disp_dict);
104        PyDict_SetItemString(self->dispersion, "radius", disp_dict);
105        disp_dict = PyDict_New();
106        self->model->thickness.dispersion->accept_as_source(visitor, self->model->thickness.dispersion, disp_dict);
107        PyDict_SetItemString(self->dispersion, "thickness", disp_dict);
108
109
110         
111        // Create empty log
112        self->log = PyDict_New();
113       
114       
115
116    }
117    return 0;
118}
119
120static char name_params[] = "params";
121static char def_params[] = "Parameters";
122static char name_dispersion[] = "dispersion";
123static char def_dispersion[] = "Dispersion parameters";
124static char name_log[] = "log";
125static char def_log[] = "Log";
126
127static PyMemberDef CCoreShellModel_members[] = {
128    {name_params, T_OBJECT, offsetof(CCoreShellModel, params), 0, def_params},
129        {name_dispersion, T_OBJECT, offsetof(CCoreShellModel, dispersion), 0, def_dispersion},     
130    {name_log, T_OBJECT, offsetof(CCoreShellModel, log), 0, def_log},
131    {NULL}  /* Sentinel */
132};
133
134/** Read double from PyObject
135    @param p PyObject
136    @return double
137*/
138double CCoreShellModel_readDouble(PyObject *p) {
139    if (PyFloat_Check(p)==1) {
140        return (double)(((PyFloatObject *)(p))->ob_fval);
141    } else if (PyInt_Check(p)==1) {
142        return (double)(((PyIntObject *)(p))->ob_ival);
143    } else if (PyLong_Check(p)==1) {
144        return (double)PyLong_AsLong(p);
145    } else {
146        return 0.0;
147    }
148}
149/**
150 * Function to call to evaluate model
151 * @param args: input numpy array q[]
152 * @return: numpy array object
153 */
154 
155static PyObject *evaluateOneDim(CoreShellModel* model, PyArrayObject *q){
156    PyArrayObject *result;
157   
158    // Check validity of array q , q must be of dimension 1, an array of double
159    if (q->nd != 1 || q->descr->type_num != PyArray_DOUBLE)
160    {
161        //const char * message= "Invalid array: q->nd=%d,type_num=%d\n",q->nd,q->descr->type_num;
162        //PyErr_SetString(PyExc_ValueError , message);
163        return NULL;
164    }
165    result = (PyArrayObject *)PyArray_FromDims(q->nd, (int *)(q->dimensions), 
166                                                                                  PyArray_DOUBLE);
167        if (result == NULL) {
168        const char * message= "Could not create result ";
169        PyErr_SetString(PyExc_RuntimeError , message);
170                return NULL;
171        }
172         for (int i = 0; i < q->dimensions[0]; i++){
173      double q_value  = *(double *)(q->data + i*q->strides[0]);
174      double *result_value = (double *)(result->data + i*result->strides[0]);
175      *result_value =(*model)(q_value);
176        }
177    return PyArray_Return(result); 
178 }
179
180 /**
181 * Function to call to evaluate model
182 * @param args: input numpy array  [x[],y[]]
183 * @return: numpy array object
184 */
185 static PyObject * evaluateTwoDimXY( CoreShellModel* model, 
186                              PyArrayObject *x, PyArrayObject *y)
187 {
188    PyArrayObject *result;
189    int i, x_len, y_len, dims[1];
190    //check validity of input vectors
191    if (x->nd != 1 || x->descr->type_num != PyArray_DOUBLE
192        || y->nd != 1 || y->descr->type_num != PyArray_DOUBLE
193        || y->dimensions[0] != x->dimensions[0]){
194        const char * message= "evaluateTwoDimXY  expect 2 numpy arrays";
195        PyErr_SetString(PyExc_ValueError , message); 
196        return NULL;
197    }
198   
199        if (PyArray_Check(x) && PyArray_Check(y)) {
200               
201            x_len = dims[0]= x->dimensions[0];
202        y_len = dims[0]= y->dimensions[0];
203           
204            // Make a new double matrix of same dims
205        result=(PyArrayObject *) PyArray_FromDims(1,dims,NPY_DOUBLE);
206        if (result == NULL){
207            const char * message= "Could not create result ";
208        PyErr_SetString(PyExc_RuntimeError , message);
209            return NULL;
210            }
211       
212        /* Do the calculation. */
213        for ( i=0; i< x_len; i++) {
214            double x_value = *(double *)(x->data + i*x->strides[0]);
215                    double y_value = *(double *)(y->data + i*y->strides[0]);
216                        double *result_value = (double *)(result->data +
217                              i*result->strides[0]);
218                        *result_value = (*model)(x_value, y_value);
219        }           
220        return PyArray_Return(result); 
221       
222        }else{
223                    PyErr_SetString(CCoreShellModelError, 
224                   "CCoreShellModel.evaluateTwoDimXY couldn't run.");
225                return NULL;
226                }       
227}
228/**
229 *  evalDistribution function evaluate a model function with input vector
230 *  @param args: input q as vector or [qx, qy] where qx, qy are vectors
231 *
232 */ 
233static PyObject * evalDistribution(CCoreShellModel *self, PyObject *args){
234        PyObject *qx, *qy;
235        PyArrayObject * pars;
236        int npars ,mpars;
237       
238        // Get parameters
239       
240            // Reader parameter dictionary
241    self->model->core_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_sld") );
242    self->model->thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thickness") );
243    self->model->solvent_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "solvent_sld") );
244    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
245    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
246    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
247    self->model->shell_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "shell_sld") );
248    // Read in dispersion parameters
249    PyObject* disp_dict;
250    DispersionVisitor* visitor = new DispersionVisitor();
251    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
252    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
253    disp_dict = PyDict_GetItemString(self->dispersion, "thickness");
254    self->model->thickness.dispersion->accept_as_destination(visitor, self->model->thickness.dispersion, disp_dict);
255
256       
257        // Get input and determine whether we have to supply a 1D or 2D return value.
258        if ( !PyArg_ParseTuple(args,"O",&pars) ) {
259            PyErr_SetString(CCoreShellModelError, 
260                "CCoreShellModel.evalDistribution expects a q value.");
261                return NULL;
262        }
263    // Check params
264       
265    if(PyArray_Check(pars)==1) {
266               
267            // Length of list should 1 or 2
268            npars = pars->nd; 
269            if(npars==1) {
270                // input is a numpy array
271                if (PyArray_Check(pars)) {
272                        return evaluateOneDim(self->model, (PyArrayObject*)pars); 
273                    }
274                }else{
275                    PyErr_SetString(CCoreShellModelError, 
276                   "CCoreShellModel.evalDistribution expect numpy array of one dimension.");
277                return NULL;
278                }
279    }else if( PyList_Check(pars)==1) {
280        // Length of list should be 2 for I(qx,qy)
281            mpars = PyList_GET_SIZE(pars); 
282            if(mpars!=2) {
283                PyErr_SetString(CCoreShellModelError, 
284                        "CCoreShellModel.evalDistribution expects a list of dimension 2.");
285                return NULL;
286            }
287             qx = PyList_GET_ITEM(pars,0);
288             qy = PyList_GET_ITEM(pars,1);
289             if (PyArray_Check(qx) && PyArray_Check(qy)) {
290                 return evaluateTwoDimXY(self->model, (PyArrayObject*)qx,
291                           (PyArrayObject*)qy);
292                 }else{
293                    PyErr_SetString(CCoreShellModelError, 
294                   "CCoreShellModel.evalDistribution expect 2 numpy arrays in list.");
295                return NULL;
296             }
297        }
298        PyErr_SetString(CCoreShellModelError, 
299                   "CCoreShellModel.evalDistribution couln't be run.");
300        return NULL;
301       
302}
303
304/**
305 * Function to call to evaluate model
306 * @param args: input q or [q,phi]
307 * @return: function value
308 */
309static PyObject * run(CCoreShellModel *self, PyObject *args) {
310        double q_value, phi_value;
311        PyObject* pars;
312        int npars;
313       
314        // Get parameters
315       
316            // Reader parameter dictionary
317    self->model->core_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_sld") );
318    self->model->thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thickness") );
319    self->model->solvent_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "solvent_sld") );
320    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
321    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
322    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
323    self->model->shell_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "shell_sld") );
324    // Read in dispersion parameters
325    PyObject* disp_dict;
326    DispersionVisitor* visitor = new DispersionVisitor();
327    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
328    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
329    disp_dict = PyDict_GetItemString(self->dispersion, "thickness");
330    self->model->thickness.dispersion->accept_as_destination(visitor, self->model->thickness.dispersion, disp_dict);
331
332       
333        // Get input and determine whether we have to supply a 1D or 2D return value.
334        if ( !PyArg_ParseTuple(args,"O",&pars) ) {
335            PyErr_SetString(CCoreShellModelError, 
336                "CCoreShellModel.run expects a q value.");
337                return NULL;
338        }
339         
340        // Check params
341        if( PyList_Check(pars)==1) {
342               
343                // Length of list should be 2 for I(q,phi)
344            npars = PyList_GET_SIZE(pars); 
345            if(npars!=2) {
346                PyErr_SetString(CCoreShellModelError, 
347                        "CCoreShellModel.run expects a double or a list of dimension 2.");
348                return NULL;
349            }
350            // We have a vector q, get the q and phi values at which
351            // to evaluate I(q,phi)
352            q_value = CCoreShellModel_readDouble(PyList_GET_ITEM(pars,0));
353            phi_value = CCoreShellModel_readDouble(PyList_GET_ITEM(pars,1));
354            // Skip zero
355            if (q_value==0) {
356                return Py_BuildValue("d",0.0);
357            }
358                return Py_BuildValue("d",(*(self->model)).evaluate_rphi(q_value,phi_value));
359
360        } else {
361
362                // We have a scalar q, we will evaluate I(q)
363                q_value = CCoreShellModel_readDouble(pars);             
364               
365                return Py_BuildValue("d",(*(self->model))(q_value));
366        }       
367}
368/**
369 * Function to call to calculate_ER
370 * @return: effective radius value
371 */
372static PyObject * calculate_ER(CCoreShellModel *self) {
373
374        // Get parameters
375       
376            // Reader parameter dictionary
377    self->model->core_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_sld") );
378    self->model->thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thickness") );
379    self->model->solvent_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "solvent_sld") );
380    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
381    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
382    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
383    self->model->shell_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "shell_sld") );
384    // Read in dispersion parameters
385    PyObject* disp_dict;
386    DispersionVisitor* visitor = new DispersionVisitor();
387    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
388    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
389    disp_dict = PyDict_GetItemString(self->dispersion, "thickness");
390    self->model->thickness.dispersion->accept_as_destination(visitor, self->model->thickness.dispersion, disp_dict);
391
392               
393        return Py_BuildValue("d",(*(self->model)).calculate_ER());
394
395}
396/**
397 * Function to call to evaluate model in cartesian coordinates
398 * @param args: input q or [qx, qy]]
399 * @return: function value
400 */
401static PyObject * runXY(CCoreShellModel *self, PyObject *args) {
402        double qx_value, qy_value;
403        PyObject* pars;
404        int npars;
405       
406        // Get parameters
407       
408            // Reader parameter dictionary
409    self->model->core_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "core_sld") );
410    self->model->thickness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "thickness") );
411    self->model->solvent_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "solvent_sld") );
412    self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
413    self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
414    self->model->background = PyFloat_AsDouble( PyDict_GetItemString(self->params, "background") );
415    self->model->shell_sld = PyFloat_AsDouble( PyDict_GetItemString(self->params, "shell_sld") );
416    // Read in dispersion parameters
417    PyObject* disp_dict;
418    DispersionVisitor* visitor = new DispersionVisitor();
419    disp_dict = PyDict_GetItemString(self->dispersion, "radius");
420    self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);
421    disp_dict = PyDict_GetItemString(self->dispersion, "thickness");
422    self->model->thickness.dispersion->accept_as_destination(visitor, self->model->thickness.dispersion, disp_dict);
423
424       
425        // Get input and determine whether we have to supply a 1D or 2D return value.
426        if ( !PyArg_ParseTuple(args,"O",&pars) ) {
427            PyErr_SetString(CCoreShellModelError, 
428                "CCoreShellModel.run expects a q value.");
429                return NULL;
430        }
431         
432        // Check params
433        if( PyList_Check(pars)==1) {
434               
435                // Length of list should be 2 for I(qx, qy))
436            npars = PyList_GET_SIZE(pars); 
437            if(npars!=2) {
438                PyErr_SetString(CCoreShellModelError, 
439                        "CCoreShellModel.run expects a double or a list of dimension 2.");
440                return NULL;
441            }
442            // We have a vector q, get the qx and qy values at which
443            // to evaluate I(qx,qy)
444            qx_value = CCoreShellModel_readDouble(PyList_GET_ITEM(pars,0));
445            qy_value = CCoreShellModel_readDouble(PyList_GET_ITEM(pars,1));
446            return Py_BuildValue("d",(*(self->model))(qx_value,qy_value));
447
448        } else {
449
450                // We have a scalar q, we will evaluate I(q)
451                qx_value = CCoreShellModel_readDouble(pars);           
452               
453                return Py_BuildValue("d",(*(self->model))(qx_value));
454        }       
455}
456
457static PyObject * reset(CCoreShellModel *self, PyObject *args) {
458   
459
460    return Py_BuildValue("d",0.0);
461}
462
463static PyObject * set_dispersion(CCoreShellModel *self, PyObject *args) {
464        PyObject * disp;
465        const char * par_name;
466
467        if ( !PyArg_ParseTuple(args,"sO", &par_name, &disp) ) {
468            PyErr_SetString(CCoreShellModelError,
469                "CCoreShellModel.set_dispersion expects a DispersionModel object.");
470                return NULL;
471        }
472        void *temp = PyCObject_AsVoidPtr(disp);
473        DispersionModel * dispersion = static_cast<DispersionModel *>(temp);
474
475
476        // Ugliness necessary to go from python to C
477            // TODO: refactor this
478    if (!strcmp(par_name, "radius")) {
479        self->model->radius.dispersion = dispersion;
480    } else    if (!strcmp(par_name, "thickness")) {
481        self->model->thickness.dispersion = dispersion;
482    } else {
483            PyErr_SetString(CCoreShellModelError,
484                "CCoreShellModel.set_dispersion expects a valid parameter name.");
485                return NULL;
486        }
487
488        DispersionVisitor* visitor = new DispersionVisitor();
489        PyObject * disp_dict = PyDict_New();
490        dispersion->accept_as_source(visitor, dispersion, disp_dict);
491        PyDict_SetItemString(self->dispersion, par_name, disp_dict);
492    return Py_BuildValue("i",1);
493}
494
495
496static PyMethodDef CCoreShellModel_methods[] = {
497    {"run",      (PyCFunction)run     , METH_VARARGS,
498      "Evaluate the model at a given Q or Q, phi"},
499    {"runXY",      (PyCFunction)runXY     , METH_VARARGS,
500      "Evaluate the model at a given Q or Qx, Qy"},
501    {"calculate_ER",      (PyCFunction)calculate_ER     , METH_VARARGS,
502      "Evaluate the model at a given Q or Q, phi"},
503     
504    {"evalDistribution",  (PyCFunction)evalDistribution , METH_VARARGS,
505      "Evaluate the model at a given Q or Qx, Qy vector "},
506    {"reset",    (PyCFunction)reset   , METH_VARARGS,
507      "Reset pair correlation"},
508    {"set_dispersion",      (PyCFunction)set_dispersion     , METH_VARARGS,
509      "Set the dispersion model for a given parameter"},
510   {NULL}
511};
512
513static PyTypeObject CCoreShellModelType = {
514    PyObject_HEAD_INIT(NULL)
515    0,                         /*ob_size*/
516    "CCoreShellModel",             /*tp_name*/
517    sizeof(CCoreShellModel),             /*tp_basicsize*/
518    0,                         /*tp_itemsize*/
519    (destructor)CCoreShellModel_dealloc, /*tp_dealloc*/
520    0,                         /*tp_print*/
521    0,                         /*tp_getattr*/
522    0,                         /*tp_setattr*/
523    0,                         /*tp_compare*/
524    0,                         /*tp_repr*/
525    0,                         /*tp_as_number*/
526    0,                         /*tp_as_sequence*/
527    0,                         /*tp_as_mapping*/
528    0,                         /*tp_hash */
529    0,                         /*tp_call*/
530    0,                         /*tp_str*/
531    0,                         /*tp_getattro*/
532    0,                         /*tp_setattro*/
533    0,                         /*tp_as_buffer*/
534    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
535    "CCoreShellModel objects",           /* tp_doc */
536    0,                         /* tp_traverse */
537    0,                         /* tp_clear */
538    0,                         /* tp_richcompare */
539    0,                         /* tp_weaklistoffset */
540    0,                         /* tp_iter */
541    0,                         /* tp_iternext */
542    CCoreShellModel_methods,             /* tp_methods */
543    CCoreShellModel_members,             /* tp_members */
544    0,                         /* tp_getset */
545    0,                         /* tp_base */
546    0,                         /* tp_dict */
547    0,                         /* tp_descr_get */
548    0,                         /* tp_descr_set */
549    0,                         /* tp_dictoffset */
550    (initproc)CCoreShellModel_init,      /* tp_init */
551    0,                         /* tp_alloc */
552    CCoreShellModel_new,                 /* tp_new */
553};
554
555
556//static PyMethodDef module_methods[] = {
557//    {NULL}
558//};
559
560/**
561 * Function used to add the model class to a module
562 * @param module: module to add the class to
563 */ 
564void addCCoreShellModel(PyObject *module) {
565        PyObject *d;
566       
567    if (PyType_Ready(&CCoreShellModelType) < 0)
568        return;
569
570    Py_INCREF(&CCoreShellModelType);
571    PyModule_AddObject(module, "CCoreShellModel", (PyObject *)&CCoreShellModelType);
572   
573    d = PyModule_GetDict(module);
574    static char error_name[] = "CCoreShellModel.error";
575    CCoreShellModelError = PyErr_NewException(error_name, NULL, NULL);
576    PyDict_SetItemString(d, "CCoreShellModelError", CCoreShellModelError);
577}
578
Note: See TracBrowser for help on using the repository browser.