Changeset 2f5c6d4 in sasmodels for sasmodels/models/hollow_cylinder.c


Ignore:
Timestamp:
Jul 25, 2016 10:38:21 PM (8 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
a3a0c5c
Parents:
a4280bd
Message:

move valid parameter test to macro

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/hollow_cylinder.c

    r43b7eea r2f5c6d4  
    1 static double _hollow_cylinder_kernel(double q, double core_radius, double radius,  
    2         double length, double dum); 
    3 static double hollow_cylinder_analytical_2D_scaled(double q, double q_x, double q_y, double radius, double core_radius, double length, double sld, 
    4         double solvent_sld, double theta, double phi); 
    5 static double hollow_cylinder_scaling(double integrand, double delrho, double volume); 
    6          
    71double form_volume(double radius, double core_radius, double length); 
    82 
     
    126        double solvent_sld, double theta, double phi); 
    137 
     8#define INVALID(v) (v.core_radius >= v.radius || v.radius >= v.length) 
     9 
    1410// From Igor library 
    15 static double _hollow_cylinder_kernel(double q, double core_radius, double radius,  
     11static double hollow_cylinder_scaling(double integrand, double delrho, double volume) 
     12{ 
     13        double answer; 
     14        // Multiply by contrast^2 
     15        answer = integrand*delrho*delrho; 
     16 
     17        //normalize by cylinder volume 
     18        answer *= volume*volume; 
     19 
     20        //convert to [cm-1] 
     21        answer *= 1.0e-4; 
     22 
     23        return answer; 
     24} 
     25 
     26static double _hollow_cylinder_kernel(double q, double core_radius, double radius, 
    1627        double length, double dum) 
    1728{ 
     
    6879        cos_val = cyl_x*q_x + cyl_y*q_y;// + cyl_z*q_z; 
    6980 
    70         // The following test should always pass 
    71         if (fabs(cos_val)>1.0) { 
    72                 //printf("core_shell_cylinder_analytical_2D: Unexpected error: cos(alpha)=%g\n", cos_val); 
    73                 return NAN; 
    74         } 
    75  
    7681        answer = _hollow_cylinder_kernel(q, core_radius, radius, length, cos_val); 
    7782 
     
    7984        answer = hollow_cylinder_scaling(answer, delrho, vol); 
    8085 
    81         return answer; 
    82 } 
    83 static double hollow_cylinder_scaling(double integrand, double delrho, double volume) 
    84 { 
    85         double answer; 
    86         // Multiply by contrast^2 
    87         answer = integrand*delrho*delrho; 
    88  
    89         //normalize by cylinder volume 
    90         answer *= volume*volume; 
    91  
    92         //convert to [cm-1] 
    93         answer *= 1.0e-4; 
    94          
    9586        return answer; 
    9687} 
     
    113104        double summ,answer,delrho;                      //running tally of integration 
    114105        double norm,volume;     //final calculation variables 
    115          
    116         if (core_radius >= radius || radius >= length) { 
    117                 return NAN; 
    118         } 
    119106         
    120107        delrho = solvent_sld - sld; 
Note: See TracChangeset for help on using the changeset viewer.