Changeset e08bd5b in sasview for sansmodels/src/c_models/hollowcylinder.cpp
- Timestamp:
- Feb 29, 2012 8:48:08 AM (13 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:
- 2d6f1f1
- Parents:
- 6319646
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/c_models/hollowcylinder.cpp
r82c11d3 re08bd5b 372 372 return rad_out; 373 373 } 374 /** 375 * Function to calculate volf_ratio for shell 376 * @return: volf_ratio value 377 */ 378 double HollowCylinderModel :: calculate_VR() { 379 HollowCylinderParameters dp; 380 dp.core_radius = core_radius(); 381 dp.radius = radius(); 382 dp.length = length(); 383 384 double rad_out = 0.0; 385 386 // Perform the computation, with all weight points 387 double sum_tot = 0.0; 388 double sum_shell = 0.0; 389 390 // Get the dispersion points for the major shell 391 vector<WeightPoint> weights_length; 392 length.get_weights(weights_length); 393 394 // Get the dispersion points for the minor shell 395 vector<WeightPoint> weights_radius ; 396 radius.get_weights(weights_radius); 397 398 // Get the dispersion points for the core radius 399 vector<WeightPoint> weights_core_radius; 400 core_radius.get_weights(weights_core_radius); 401 402 // Loop over major shell weight points 403 for(int i=0; i< (int)weights_length.size(); i++) { 404 dp.length = weights_length[i].value; 405 for(int k=0; k< (int)weights_radius.size(); k++) { 406 dp.radius = weights_radius[k].value; 407 for(int j=0; j<(int)weights_core_radius.size(); j++) { 408 dp.core_radius = weights_core_radius[j].value; 409 sum_tot +=weights_length[i].weight* weights_core_radius[j].weight 410 * weights_radius[k].weight*pow(dp.radius, 2); 411 sum_shell += weights_length[i].weight* weights_core_radius[j].weight 412 * weights_radius[k].weight*(pow(dp.radius, 2)-pow(dp.core_radius, 2)); 413 } 414 } 415 } 416 if (sum_tot == 0.0){ 417 //return the default value 418 rad_out = 1.0;} 419 else{ 420 //return ratio value 421 return sum_shell/sum_tot; 422 } 423 }
Note: See TracChangeset
for help on using the changeset viewer.