Changeset 5eb9154 in sasview for sansmodels/src/sans/models/c_models/cylinder.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/cylinder.cpp
r0f5bc9f r5eb9154 29 29 extern "C" { 30 30 #include "libCylinder.h" 31 #include "libStructureFactor.h" 31 32 #include "cylinder.h" 32 33 } … … 233 234 return 0; 234 235 } 236 /** 237 * Function to calculate effective radius 238 * @param pars: parameters of the sphere 239 * @return: effective radius value 240 */ 241 double CylinderModel :: calculate_ER() { 242 CylinderParameters dp; 243 244 dp.radius = radius(); 245 dp.length = length(); 246 double rad_out = 0.0; 247 248 // Perform the computation, with all weight points 249 double sum = 0.0; 250 double norm = 0.0; 251 252 // Get the dispersion points for the major shell 253 vector<WeightPoint> weights_length; 254 length.get_weights(weights_length); 255 256 // Get the dispersion points for the minor shell 257 vector<WeightPoint> weights_radius ; 258 radius.get_weights(weights_radius); 259 260 // Loop over major shell weight points 261 for(int i=0; i< (int)weights_length.size(); i++) { 262 dp.length = weights_length[i].value; 263 for(int k=0; k< (int)weights_radius.size(); k++) { 264 dp.radius = weights_radius[k].value; 265 //Note: output of "DiamCyl(dp.length,dp.radius)" is DIAMETER. 266 sum +=weights_length[i].weight 267 * weights_radius[k].weight*DiamCyl(dp.length,dp.radius)/2.0; 268 norm += weights_length[i].weight* weights_radius[k].weight; 269 } 270 } 271 if (norm != 0){ 272 //return the averaged value 273 rad_out = sum/norm;} 274 else{ 275 //return normal value 276 //Note: output of "DiamCyl(dp.length,dp.radius)" is DIAMETER. 277 rad_out = DiamCyl(dp.length,dp.radius)/2.0;} 278 279 return rad_out; 280 }
Note: See TracChangeset
for help on using the changeset viewer.