Changeset d277229 in sasmodels for sasmodels/models/core_shell_cylinder.c
- Timestamp:
- Sep 7, 2018 5:29:38 AM (6 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 3c60146
- Parents:
- 2a12351b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/core_shell_cylinder.c
r71b751d rd277229 11 11 { 12 12 return M_PI*square(radius+thickness)*(length+2.0*thickness); 13 } 14 15 static double 16 radius_from_volume(double radius, double thickness, double length) 17 { 18 const double volume_outer_cyl = form_volume(radius,thickness,length); 19 return cbrt(0.75*volume_outer_cyl/M_PI); 20 } 21 22 static double 23 radius_from_diagonal(double radius, double thickness, double length) 24 { 25 const double radius_outer = radius + thickness; 26 const double length_outer = length + thickness; 27 return sqrt(radius_outer*radius_outer + 0.25*length_outer*length_outer); 28 } 29 30 static double 31 effective_radius(int mode, double radius, double thickness, double length) 32 { 33 if (mode == 1) { 34 return radius_from_volume(radius, thickness, length); 35 } else if (mode == 2) { 36 return radius + thickness; 37 } else if (mode == 3) { 38 return 0.5*length + thickness; 39 } else if (mode == 4) { 40 return (radius < 0.5*length ? radius + thickness : 0.5*length + thickness); 41 } else if (mode == 5) { 42 return (radius > 0.5*length ? radius + thickness : 0.5*length + thickness); 43 } else { 44 return radius_from_diagonal(radius,thickness,length); 45 } 13 46 } 14 47
Note: See TracChangeset
for help on using the changeset viewer.