Changeset 5eb9154 in sasview for sansmodels/src/sans/models/c_models/CStickyHSStructure.cpp
- Timestamp:
- Aug 31, 2009 5:25:44 PM (15 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 5be36bb
- Parents:
- 572beba
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/c_models/CStickyHSStructure.cpp
r870f131 r5eb9154 18 18 * 19 19 * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY 20 * DO NOT MODIFY THIS FILE, MODIFY StickyHS.h20 * DO NOT MODIFY THIS FILE, MODIFY stickyHS.h 21 21 * AND RE-RUN THE GENERATOR SCRIPT 22 22 * … … 33 33 #include <math.h> 34 34 #include <time.h> 35 #include " StickyHS.h"35 #include "stickyHS.h" 36 36 } 37 37 … … 86 86 87 87 // Initialize parameter dictionary 88 PyDict_SetItemString(self->params,"radius",Py_BuildValue("d",50.000000));89 88 PyDict_SetItemString(self->params,"stickiness",Py_BuildValue("d",0.200000)); 89 PyDict_SetItemString(self->params,"effect_radius",Py_BuildValue("d",50.000000)); 90 90 PyDict_SetItemString(self->params,"volfraction",Py_BuildValue("d",0.100000)); 91 91 PyDict_SetItemString(self->params,"perturb",Py_BuildValue("d",0.050000)); … … 94 94 PyObject * disp_dict; 95 95 disp_dict = PyDict_New(); 96 self->model-> radius.dispersion->accept_as_source(visitor, self->model->radius.dispersion, disp_dict);97 PyDict_SetItemString(self->dispersion, " radius", disp_dict);96 self->model->effect_radius.dispersion->accept_as_source(visitor, self->model->effect_radius.dispersion, disp_dict); 97 PyDict_SetItemString(self->dispersion, "effect_radius", disp_dict); 98 98 99 99 … … 227 227 228 228 // Reader parameter dictionary 229 self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );230 229 self->model->stickiness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "stickiness") ); 230 self->model->effect_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "effect_radius") ); 231 231 self->model->volfraction = PyFloat_AsDouble( PyDict_GetItemString(self->params, "volfraction") ); 232 232 self->model->perturb = PyFloat_AsDouble( PyDict_GetItemString(self->params, "perturb") ); … … 234 234 PyObject* disp_dict; 235 235 DispersionVisitor* visitor = new DispersionVisitor(); 236 disp_dict = PyDict_GetItemString(self->dispersion, " radius");237 self->model-> radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);236 disp_dict = PyDict_GetItemString(self->dispersion, "effect_radius"); 237 self->model->effect_radius.dispersion->accept_as_destination(visitor, self->model->effect_radius.dispersion, disp_dict); 238 238 239 239 … … 298 298 299 299 // Reader parameter dictionary 300 self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );301 300 self->model->stickiness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "stickiness") ); 301 self->model->effect_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "effect_radius") ); 302 302 self->model->volfraction = PyFloat_AsDouble( PyDict_GetItemString(self->params, "volfraction") ); 303 303 self->model->perturb = PyFloat_AsDouble( PyDict_GetItemString(self->params, "perturb") ); … … 305 305 PyObject* disp_dict; 306 306 DispersionVisitor* visitor = new DispersionVisitor(); 307 disp_dict = PyDict_GetItemString(self->dispersion, " radius");308 self->model-> radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict);307 disp_dict = PyDict_GetItemString(self->dispersion, "effect_radius"); 308 self->model->effect_radius.dispersion->accept_as_destination(visitor, self->model->effect_radius.dispersion, disp_dict); 309 309 310 310 … … 344 344 } 345 345 } 346 347 /** 348 * Function to call to evaluate model in cartesian coordinates 349 * @param args: input q or [qx, qy]] 350 * @return: function value 351 */ 352 static PyObject * runXY(CStickyHSStructure *self, PyObject *args) { 353 double qx_value, qy_value; 346 /** 347 * Function to call to calculate_ER 348 * @return: effective radius value 349 */ 350 static PyObject * calculate_ER(CStickyHSStructure *self) { 351 354 352 PyObject* pars; 355 353 int npars; … … 358 356 359 357 // Reader parameter dictionary 360 self->model->radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "radius") );361 358 self->model->stickiness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "stickiness") ); 359 self->model->effect_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "effect_radius") ); 362 360 self->model->volfraction = PyFloat_AsDouble( PyDict_GetItemString(self->params, "volfraction") ); 363 361 self->model->perturb = PyFloat_AsDouble( PyDict_GetItemString(self->params, "perturb") ); … … 365 363 PyObject* disp_dict; 366 364 DispersionVisitor* visitor = new DispersionVisitor(); 367 disp_dict = PyDict_GetItemString(self->dispersion, "radius"); 368 self->model->radius.dispersion->accept_as_destination(visitor, self->model->radius.dispersion, disp_dict); 365 disp_dict = PyDict_GetItemString(self->dispersion, "effect_radius"); 366 self->model->effect_radius.dispersion->accept_as_destination(visitor, self->model->effect_radius.dispersion, disp_dict); 367 368 369 return Py_BuildValue("d",(*(self->model)).calculate_ER()); 370 371 } 372 /** 373 * Function to call to evaluate model in cartesian coordinates 374 * @param args: input q or [qx, qy]] 375 * @return: function value 376 */ 377 static PyObject * runXY(CStickyHSStructure *self, PyObject *args) { 378 double qx_value, qy_value; 379 PyObject* pars; 380 int npars; 381 382 // Get parameters 383 384 // Reader parameter dictionary 385 self->model->stickiness = PyFloat_AsDouble( PyDict_GetItemString(self->params, "stickiness") ); 386 self->model->effect_radius = PyFloat_AsDouble( PyDict_GetItemString(self->params, "effect_radius") ); 387 self->model->volfraction = PyFloat_AsDouble( PyDict_GetItemString(self->params, "volfraction") ); 388 self->model->perturb = PyFloat_AsDouble( PyDict_GetItemString(self->params, "perturb") ); 389 // Read in dispersion parameters 390 PyObject* disp_dict; 391 DispersionVisitor* visitor = new DispersionVisitor(); 392 disp_dict = PyDict_GetItemString(self->dispersion, "effect_radius"); 393 self->model->effect_radius.dispersion->accept_as_destination(visitor, self->model->effect_radius.dispersion, disp_dict); 369 394 370 395 … … 422 447 // Ugliness necessary to go from python to C 423 448 // TODO: refactor this 424 if (!strcmp(par_name, " radius")) {425 self->model-> radius.dispersion = dispersion;449 if (!strcmp(par_name, "effect_radius")) { 450 self->model->effect_radius.dispersion = dispersion; 426 451 } else { 427 452 PyErr_SetString(CStickyHSStructureError, … … 443 468 {"runXY", (PyCFunction)runXY , METH_VARARGS, 444 469 "Evaluate the model at a given Q or Qx, Qy"}, 470 {"calculate_ER", (PyCFunction)calculate_ER , METH_VARARGS, 471 "Evaluate the model at a given Q or Q, phi"}, 445 472 446 473 {"evalDistribution", (PyCFunction)evalDistribution , METH_VARARGS,
Note: See TracChangeset
for help on using the changeset viewer.