Changeset b1174ec in sasview for sansmodels/src/c_gen
- Timestamp:
- Jan 10, 2013 5:17:32 PM (12 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:
- 1b28ff5
- Parents:
- dbc01f2
- Location:
- sansmodels/src/c_gen
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/c_gen/sld2i.cpp
r318b5bbb rb1174ec 29 29 */ 30 30 GenI :: GenI(int npix, double* x, double* y, double* z, double* sldn, 31 double* mx, double* my, double* mz, 31 double* mx, double* my, double* mz, double* voli, 32 32 double in_spin, double out_spin, 33 33 double s_theta) { … … 43 43 this->my_val = my; 44 44 this->mz_val = mz; 45 this->vol_pix = voli; 45 46 this->inspin = in_spin; 46 47 this->outspin = out_spin; … … 52 53 */ 53 54 void GenI :: genicom(int npoints, double *qx, double *qy, double *I_out){ 55 // Assumes that q doesn't have qz component and sld_n is all real 54 56 double q = 0.0; 55 57 //double Pi = 4.0*atan(1.0); … … 66 68 complex temp_fi; 67 69 68 int count =0;69 //Assume that all pixels are in same size and int * 1A70 double count = 0.0; 71 //Assume that pixel volumes are given in vol_pix in A^3 unit 70 72 //int x_size = 0; //in Ang 71 73 //int y_size = 0; //in Ang … … 81 83 sumj_dd = cassign(0.0, 0.0); 82 84 //printf ("%d ", i); 83 q = sqrt(qx[i]*qx[i] + qy[i]*qy[i]); 85 q = sqrt(qx[i]*qx[i] + qy[i]*qy[i]); // + qz[i]*qz[i]); 84 86 85 87 for(int j=0; j<n_pix; j++){ … … 98 100 comp_sld = cassign(b_sld.uu, 0.0); 99 101 temp_fi = cplx_mult(comp_sld, ephase); 102 temp_fi = rcmult(vol_pix[j],temp_fi); 100 103 sumj_uu = cplx_add(sumj_uu, temp_fi); 101 104 } … … 104 107 comp_sld = cassign(b_sld.dd, 0.0); 105 108 temp_fi = cplx_mult(comp_sld, ephase); 109 temp_fi = rcmult(vol_pix[j],temp_fi); 106 110 sumj_dd = cplx_add(sumj_dd, temp_fi); 107 111 } … … 110 114 comp_sld = cassign(b_sld.re_ud, b_sld.im_ud); 111 115 temp_fi = cplx_mult(comp_sld, ephase); 116 temp_fi = rcmult(vol_pix[j],temp_fi); 112 117 sumj_ud = cplx_add(sumj_ud, temp_fi); 113 118 } … … 116 121 comp_sld = cassign(b_sld.re_du, b_sld.im_du); 117 122 temp_fi = cplx_mult(comp_sld, ephase); 123 temp_fi = rcmult(vol_pix[j],temp_fi); 118 124 sumj_du = cplx_add(sumj_du, temp_fi); 119 125 } 120 126 if (i == 0){ 121 count += 1;127 count += vol_pix[j]; 122 128 } 123 129 } -
sansmodels/src/c_gen/sld2i.hh
r318b5bbb rb1174ec 26 26 double* my_val; 27 27 double* mz_val; 28 double* vol_pix; 28 29 // spin ratios 29 30 double inspin; … … 34 35 // Constructor 35 36 GenI(int npix, double* x, double* y, double* z, double* sldn, 36 double* mx, double* my, double* mz, 37 double* mx, double* my, double* mz, double* voli, 37 38 double in_spin, double out_spin, 38 39 double s_theta); -
sansmodels/src/c_gen/sld2i_module.cpp
r318b5bbb rb1174ec 42 42 PyObject *my_val_obj; 43 43 PyObject *mz_val_obj; 44 PyObject *vol_pix_obj; 44 45 Py_ssize_t n_x; 45 46 //PyObject rlimit_obj; … … 55 56 double* my_val; 56 57 double* mz_val; 58 double* vol_pix; 57 59 double inspin; 58 60 double outspin; 59 61 double stheta; 60 62 61 if (!PyArg_ParseTuple(args, "iOOOOOOO ddd", &n_pix, &x_val_obj, &y_val_obj, &z_val_obj, &sldn_val_obj, &mx_val_obj, &my_val_obj, &mz_val_obj, &inspin, &outspin, &stheta)) return NULL;63 if (!PyArg_ParseTuple(args, "iOOOOOOOOddd", &n_pix, &x_val_obj, &y_val_obj, &z_val_obj, &sldn_val_obj, &mx_val_obj, &my_val_obj, &mz_val_obj, &vol_pix_obj, &inspin, &outspin, &stheta)) return NULL; 62 64 OUTVECTOR(x_val_obj, x_val, n_x); 63 65 OUTVECTOR(y_val_obj, y_val, n_x); … … 67 69 OUTVECTOR(my_val_obj, my_val, n_x); 68 70 OUTVECTOR(mz_val_obj, mz_val, n_x); 69 GenI* sld2i = new GenI(n_pix,x_val,y_val,z_val,sldn_val,mx_val,my_val,mz_val,inspin,outspin,stheta); 71 OUTVECTOR(vol_pix_obj, vol_pix, n_x); 72 GenI* sld2i = new GenI(n_pix,x_val,y_val,z_val,sldn_val,mx_val,my_val,mz_val,vol_pix,inspin,outspin,stheta); 70 73 return PyCObject_FromVoidPtr(sld2i, del_sld2i); 71 74 }
Note: See TracChangeset
for help on using the changeset viewer.