Changeset d277229 in sasmodels for sasmodels/models/hollow_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/hollow_cylinder.c
r71b751d rd277229 22 22 } 23 23 24 static double 25 radius_from_volume(double radius, double thickness, double length) 26 { 27 const double volume_outer_cyl = M_PI*square(radius + thickness)*length; 28 return cbrt(0.75*volume_outer_cyl/M_PI); 29 } 30 31 static double 32 radius_from_diagonal(double radius, double thickness, double length) 33 { 34 return sqrt(square(radius + thickness) + 0.25*square(length)); 35 } 36 37 static double 38 effective_radius(int mode, double radius, double thickness, double length) 39 { 40 if (mode == 1) { 41 return radius_from_volume(radius, thickness, length); 42 } else if (mode == 2) { 43 return radius + thickness; 44 } else if (mode == 3) { 45 return 0.5*length; 46 } else if (mode == 4) { 47 return (radius + thickness < 0.5*length ? radius + thickness : 0.5*length); 48 } else if (mode == 5) { 49 return (radius + thickness > 0.5*length ? radius + thickness : 0.5*length); 50 } else { 51 return radius_from_diagonal(radius,thickness,length); 52 } 53 } 24 54 25 55 static void
Note: See TracChangeset
for help on using the changeset viewer.