Index: sansmodels/prototypes/src/CSimCylinder.c
===================================================================
--- sansmodels/prototypes/src/CSimCylinder.c	(revision 7df1a501e41e9dabb0c8fbd2b5a2e66a5da38a24)
+++ sansmodels/prototypes/src/CSimCylinder.c	(revision 7df1a501e41e9dabb0c8fbd2b5a2e66a5da38a24)
@@ -0,0 +1,246 @@
+/** CSimCylinder
+ *
+ * C extension 
+ *
+ * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
+ *          DO NOT MODIFY THIS FILE, MODIFY simcylinder.h
+ *          AND RE-RUN THE GENERATOR SCRIPT
+ *
+ * @author   M.Doucet / UTK
+ */
+ 
+#include <Python.h>
+#include "structmember.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <time.h>
+
+#include "simcylinder.h"
+
+static double UNDEFINED = 1000010010.1234567;
+
+/// Error object for raised exceptions
+static PyObject * CSimCylinderError = NULL;
+
+
+// Class definition
+typedef struct {
+    PyObject_HEAD
+    /// Parameters
+    PyObject * params;
+    /// Log for unit testing
+    PyObject * log;
+    /// Model parameters
+	SimCylinderParameters model_pars;
+} CSimCylinder;
+
+
+static void
+CSimCylinder_dealloc(CSimCylinder* self)
+{
+        modelcalculations_dealloc(&(self->model_pars.calcPars));
+    self->ob_type->tp_free((PyObject*)self);
+
+}
+
+static PyObject *
+CSimCylinder_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+    CSimCylinder *self;
+    
+    self = (CSimCylinder *)type->tp_alloc(type, 0);
+   
+    return (PyObject *)self;
+}
+
+static int
+CSimCylinder_init(CSimCylinder *self, PyObject *args, PyObject *kwds)
+{
+    if (self != NULL) {
+    	
+    	// Create parameters
+        self->params = PyDict_New();
+        
+        // Initialize parameter dictionary
+        PyDict_SetItemString(self->params,"phi",Py_BuildValue("d",0.000000));
+        PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000));
+        PyDict_SetItemString(self->params,"qmax",Py_BuildValue("d",0.200000));
+        PyDict_SetItemString(self->params,"length",Py_BuildValue("d",200.000000));
+        PyDict_SetItemString(self->params,"radius",Py_BuildValue("d",80.000000));
+        PyDict_SetItemString(self->params,"theta",Py_BuildValue("d",1.570000));
+
+         
+        // Create empty log
+        self->log = PyDict_New();
+        
+                modelcalculations_init(&(self->model_pars.calcPars));
+
+    }
+    return 0;
+}
+
+static PyMemberDef CSimCylinder_members[] = {
+    {"params", T_OBJECT, offsetof(CSimCylinder, params), 0,
+     "Parameters"},
+    {"log", T_OBJECT, offsetof(CSimCylinder, log), 0,
+     "Log"},
+    {NULL}  /* Sentinel */
+};
+
+/** Read double from PyObject
+    @param p PyObject
+    @return double
+*/
+double CSimCylinder_readDouble(PyObject *p) {
+    if (PyFloat_Check(p)==1) {
+        return (double)(((PyFloatObject *)(p))->ob_fval);
+    } else if (PyInt_Check(p)==1) {
+        return (double)(((PyIntObject *)(p))->ob_ival);
+    } else if (PyLong_Check(p)==1) {
+        return (double)PyLong_AsLong(p);
+    } else {
+        return 0.0;
+    }
+}
+
+
+/**
+ * Function to call to evaluate model
+ * @param args: input q or [q,phi]
+ * @return: function value
+ */
+static PyObject * run(CSimCylinder *self, PyObject *args) {
+	double q_value, phi_value;
+	PyObject* pars;
+	int npars;
+	
+	// Get parameters
+	
+	// Reader parameter dictionary
+    self->model_pars.phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "phi") );
+    self->model_pars.scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") );
+    self->model_pars.qmax = PyFloat_AsDouble( PyDict_GetItemString(self->params, "qmax") );
+    self->model_pars.length = PyFloat_AsDouble( PyDict_GetItemString(self->params, "length") );
+    self->model_pars.radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );
+    self->model_pars.theta = PyFloat_AsDouble( PyDict_GetItemString(self->params, "theta") );
+
+	
+	// Get input and determine whether we have to supply a 1D or 2D return value.
+	if ( !PyArg_ParseTuple(args,"O",&pars) ) {
+	    PyErr_SetString(CSimCylinderError, 
+	    	"CSimCylinder.run expects a q value.");
+		return NULL;
+	}
+	  
+	// Check params
+	if( PyList_Check(pars)==1) {
+		
+		// Length of list should be 2 for I(q,phi)
+	    npars = PyList_GET_SIZE(pars); 
+	    if(npars!=2) {
+	    	PyErr_SetString(CSimCylinderError, 
+	    		"CSimCylinder.run expects a double or a list of dimension 2.");
+	    	return NULL;
+	    }
+	    // We have a vector q, get the q and phi values at which
+	    // to evaluate I(q,phi)
+	    q_value = CSimCylinder_readDouble(PyList_GET_ITEM(pars,0));
+	    phi_value = CSimCylinder_readDouble(PyList_GET_ITEM(pars,1));
+	    // Skip zero
+	    if (q_value==0) {
+	    	return Py_BuildValue("d",0.0);
+	    }
+		return Py_BuildValue("d",simcylinder_analytical_2D(&(self->model_pars),q_value,phi_value));
+
+	} else {
+
+		// We have a scalar q, we will evaluate I(q)
+		q_value = CSimCylinder_readDouble(pars);		
+		
+		return Py_BuildValue("d",simcylinder_analytical_1D(&(self->model_pars),q_value));
+	}	
+}
+
+static PyObject * reset(CSimCylinder *self, PyObject *args) {
+    modelcalculations_reset(&(self->model_pars.calcPars));
+
+    return Py_BuildValue("d",0.0);
+}
+
+
+static PyMethodDef CSimCylinder_methods[] = {
+    {"run",      (PyCFunction)run     , METH_VARARGS,
+      "Evaluate the model at a given Q"},
+    {"reset",    (PyCFunction)reset   , METH_VARARGS,
+      "Reset pair correlation"},
+    //{"numerical_1D",      (PyCFunction)numerical_1D     , METH_VARARGS,
+    //  "Evaluate the 1D model at a given Q"},
+   {NULL}
+};
+
+static PyTypeObject CSimCylinderType = {
+    PyObject_HEAD_INIT(NULL)
+    0,                         /*ob_size*/
+    "CSimCylinder",             /*tp_name*/
+    sizeof(CSimCylinder),             /*tp_basicsize*/
+    0,                         /*tp_itemsize*/
+    (destructor)CSimCylinder_dealloc, /*tp_dealloc*/
+    0,                         /*tp_print*/
+    0,                         /*tp_getattr*/
+    0,                         /*tp_setattr*/
+    0,                         /*tp_compare*/
+    0,                         /*tp_repr*/
+    0,                         /*tp_as_number*/
+    0,                         /*tp_as_sequence*/
+    0,                         /*tp_as_mapping*/
+    0,                         /*tp_hash */
+    0,                         /*tp_call*/
+    0,                         /*tp_str*/
+    0,                         /*tp_getattro*/
+    0,                         /*tp_setattro*/
+    0,                         /*tp_as_buffer*/
+    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
+    "CSimCylinder objects",           /* tp_doc */
+    0,		               /* tp_traverse */
+    0,		               /* tp_clear */
+    0,		               /* tp_richcompare */
+    0,		               /* tp_weaklistoffset */
+    0,		               /* tp_iter */
+    0,		               /* tp_iternext */
+    CSimCylinder_methods,             /* tp_methods */
+    CSimCylinder_members,             /* tp_members */
+    0,                         /* tp_getset */
+    0,                         /* tp_base */
+    0,                         /* tp_dict */
+    0,                         /* tp_descr_get */
+    0,                         /* tp_descr_set */
+    0,                         /* tp_dictoffset */
+    (initproc)CSimCylinder_init,      /* tp_init */
+    0,                         /* tp_alloc */
+    CSimCylinder_new,                 /* tp_new */
+};
+
+
+static PyMethodDef module_methods[] = {
+    {NULL} 
+};
+
+/**
+ * Function used to add the model class to a module
+ * @param module: module to add the class to
+ */ 
+void addCSimCylinder(PyObject *module) {
+	PyObject *d;
+	
+    if (PyType_Ready(&CSimCylinderType) < 0)
+        return;
+
+    Py_INCREF(&CSimCylinderType);
+    PyModule_AddObject(module, "CSimCylinder", (PyObject *)&CSimCylinderType);
+    
+    d = PyModule_GetDict(module);
+    CSimCylinderError = PyErr_NewException("CSimCylinder.error", NULL, NULL);
+    PyDict_SetItemString(d, "CSimCylinderError", CSimCylinderError);
+}
+
