Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/core_shell_parallelepiped.c

    r71b751d ree60aa7  
    2525        2.0 * length_a * length_b * thick_rim_c; 
    2626#endif 
     27} 
     28 
     29static double 
     30radius_from_volume(double length_a, double length_b, double length_c, 
     31                   double thick_rim_a, double thick_rim_b, double thick_rim_c) 
     32{ 
     33    const double volume = form_volume(length_a, length_b, length_c, thick_rim_a, thick_rim_b, thick_rim_c); 
     34    return cbrt(volume/M_4PI_3); 
     35} 
     36 
     37static double 
     38radius_from_crosssection(double length_a, double length_b, double thick_rim_a, double thick_rim_b) 
     39{ 
     40    const double area_xsec_paral = length_a*length_b + 2.0*thick_rim_a*length_b + 2.0*thick_rim_b*length_a; 
     41    return sqrt(area_xsec_paral/M_PI); 
     42} 
     43 
     44static double 
     45effective_radius(int mode, double length_a, double length_b, double length_c, 
     46                 double thick_rim_a, double thick_rim_b, double thick_rim_c) 
     47{ 
     48    switch (mode) { 
     49    case 1: // equivalent sphere 
     50        return radius_from_volume(length_a, length_b, length_c, thick_rim_a, thick_rim_b, thick_rim_c); 
     51    case 2: // half outer length a 
     52        return 0.5 * length_a + thick_rim_a; 
     53    case 3: // half outer length b 
     54        return 0.5 * length_b + thick_rim_b; 
     55    case 4: // half outer length c 
     56        return 0.5 * length_c + thick_rim_c; 
     57    case 5: // equivalent circular cross-section 
     58        return radius_from_crosssection(length_a, length_b, thick_rim_a, thick_rim_b); 
     59    case 6: // half outer ab diagonal 
     60        return 0.5*sqrt(square(length_a+ 2.0*thick_rim_a) + square(length_b+ 2.0*thick_rim_b)); 
     61    case 7: // half outer diagonal 
     62        return 0.5*sqrt(square(length_a+ 2.0*thick_rim_a) + square(length_b+ 2.0*thick_rim_b) + square(length_c+ 2.0*thick_rim_c)); 
     63    } 
    2764} 
    2865 
Note: See TracChangeset for help on using the changeset viewer.