Changeset ee60aa7 in sasmodels for sasmodels/models/hollow_cylinder.c


Ignore:
Timestamp:
Sep 10, 2018 4:16:46 PM (6 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
d299327
Parents:
3f818b2
Message:

clean up effective radius functions; improve mono_gauss_coil accuracy; start moving VR into C

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/hollow_cylinder.c

    rd277229 ree60aa7  
    1515} 
    1616 
     17// TODO: interface to form_volume/shell_volume not yet settled 
     18static double 
     19shell_volume(double *total, double radius, double thickness, double length) 
     20{ 
     21    *total = M_PI*length*square(radius+thickness); 
     22    return *total - M_PI*length*radius*radius; 
     23} 
     24 
    1725static double 
    1826form_volume(double radius, double thickness, double length) 
    1927{ 
    20     double v_shell = M_PI*length*(square(radius+thickness) - radius*radius); 
    21     return v_shell; 
     28    double total; 
     29    return shell_volume(&total, radius, thickness, length); 
    2230} 
    2331 
     
    3846effective_radius(int mode, double radius, double thickness, double length) 
    3947{ 
    40     if (mode == 1) { 
     48    switch (mode) { 
     49    case 1: // equivalent sphere 
    4150        return radius_from_volume(radius, thickness, length); 
    42     } else if (mode == 2) { 
     51    case 2: // outer radius 
    4352        return radius + thickness; 
    44     } else if (mode == 3) { 
     53    case 3: // half length 
    4554        return 0.5*length; 
    46     } else if (mode == 4) { 
     55    case 4: // half outer min dimension 
    4756        return (radius + thickness < 0.5*length ? radius + thickness : 0.5*length); 
    48     } else if (mode == 5) { 
     57    case 5: // half outer max dimension 
    4958        return (radius + thickness > 0.5*length ? radius + thickness : 0.5*length); 
    50     } else { 
     59    case 6: // half outer diagonal 
    5160        return radius_from_diagonal(radius,thickness,length); 
    5261    } 
Note: See TracChangeset for help on using the changeset viewer.