Changeset 5eb9154 in sasview for sansmodels/src/sans/models/c_models/spheroid.cpp
- Timestamp:
- Aug 31, 2009 3: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/spheroid.cpp
r14c3887 r5eb9154 29 29 extern "C" { 30 30 #include "libCylinder.h" 31 #include "libStructureFactor.h" 31 32 #include "spheroid.h" 32 33 } … … 140 141 */ 141 142 double CoreShellEllipsoidModel :: evaluate_rphi(double q, double phi) { 142 return (*this).operator()(q); 143 } 144 145 143 double qx = q*cos(phi); 144 double qy = q*sin(phi); 145 return (*this).operator()(qx, qy); 146 } 147 148 /** 149 * Function to evaluate 2D scattering function 150 * @param q_x: value of Q along x 151 * @param q_y: value of Q along y 152 * @return: function value 153 */ 146 154 double CoreShellEllipsoidModel :: operator()(double qx, double qy) { 147 155 SpheroidParameters dp; … … 154 162 dp.contrast = contrast(); 155 163 dp.sld_solvent = sld_solvent(); 156 dp.background = background();164 dp.background = 0.0; 157 165 dp.axis_theta = axis_theta(); 158 166 dp.axis_phi = axis_phi(); … … 237 245 } 238 246 247 /** 248 * Function to calculate effective radius 249 * @param pars: parameters of the sphere 250 * @return: effective radius value 251 */ 252 double CoreShellEllipsoidModel :: calculate_ER() { 253 SpheroidParameters dp; 254 255 dp.equat_shell = equat_shell(); 256 dp.polar_shell = polar_shell(); 257 258 double rad_out = 0.0; 259 260 // Perform the computation, with all weight points 261 double sum = 0.0; 262 double norm = 0.0; 263 264 // Get the dispersion points for the major shell 265 vector<WeightPoint> weights_equat_shell; 266 equat_shell.get_weights(weights_equat_shell); 267 268 // Get the dispersion points for the minor shell 269 vector<WeightPoint> weights_polar_shell; 270 polar_shell.get_weights(weights_polar_shell); 271 272 // Loop over major shell weight points 273 for(int i=0; i< (int)weights_equat_shell.size(); i++) { 274 dp.equat_shell = weights_equat_shell[i].value; 275 for(int k=0; k< (int)weights_polar_shell.size(); k++) { 276 dp.polar_shell = weights_polar_shell[k].value; 277 //Note: output of "DiamEllip(dp.polar_shell,dp.equat_shell)" is DIAMETER. 278 sum +=weights_equat_shell[i].weight 279 * weights_polar_shell[k].weight*DiamEllip(dp.polar_shell,dp.equat_shell)/2.0; 280 norm += weights_equat_shell[i].weight* weights_polar_shell[k].weight; 281 } 282 } 283 if (norm != 0){ 284 //return the averaged value 285 rad_out = sum/norm;} 286 else{ 287 //return normal value 288 //Note: output of "DiamEllip(dp.polar_shell,dp.equat_shell)" is DIAMETER. 289 rad_out = DiamEllip(dp.polar_shell,dp.equat_shell)/2.0;} 290 291 return rad_out; 292 }
Note: See TracChangeset
for help on using the changeset viewer.