Ignore:
Timestamp:
Aug 3, 2009 5:41:22 PM (15 years ago)
Author:
Jae Cho <jhjcho@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
e6fa43e
Parents:
2a1be2d9
Message:

done corrections and 2d extension on this model function

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansmodels/src/sans/models/c_models/flexiblecylinder.cpp

    r5068697 rea07075  
    1919 * 
    2020 *      TODO: refactor so that we pull in the old sansmodels.c_extensions 
    21  *      TODO: add 2d  
     21 *      TODO: add 2d 
    2222 */ 
    2323 
     
    4343        contrast   = Parameter(5.3e-6); 
    4444        background = Parameter(0.0001); 
    45         axis_theta  = Parameter(0.0, true); 
    46         axis_phi    = Parameter(0.0, true); 
    4745} 
    4846 
     
    10199 */ 
    102100double FlexibleCylinderModel :: operator()(double qx, double qy) { 
    103         FlexibleCylinderParameters dp; 
    104         // Fill parameter array 
    105         dp.scale      = scale(); 
    106         dp.length     = length(); 
    107         dp.kuhn_length= kuhn_length(); 
    108         dp.radius     = radius(); 
    109         dp.contrast   = contrast(); 
    110         dp.background = background(); 
    111         dp.axis_theta  = axis_theta(); 
    112         dp.axis_phi    = axis_phi(); 
    113  
    114         // Get the dispersion points for the length 
    115         vector<WeightPoint> weights_length; 
    116         length.get_weights(weights_length); 
    117  
    118         // Get the dispersion points for the radius 
    119         vector<WeightPoint> weights_radius; 
    120         radius.get_weights(weights_radius); 
    121  
    122         // Get angular averaging for theta 
    123         vector<WeightPoint> weights_theta; 
    124         axis_theta.get_weights(weights_theta); 
    125  
    126         // Get angular averaging for phi 
    127         vector<WeightPoint> weights_phi; 
    128         axis_phi.get_weights(weights_phi); 
    129  
    130         // Perform the computation, with all weight points 
    131         double sum = 0.0; 
    132         double norm = 0.0; 
    133  
    134         // Loop over length weight points 
    135         for(int i=0; i< (int)weights_length.size(); i++) { 
    136                 dp.length = weights_length[i].value; 
    137  
    138                 // Loop over radius weight points 
    139                 for(int j=0; j< (int)weights_radius.size(); j++) { 
    140                         dp.radius = weights_radius[j].value; 
    141  
    142                                 // Average over theta distribution 
    143                                 for(int k=0; k< (int)weights_theta.size(); k++) { 
    144                                         dp.axis_theta = weights_theta[k].value; 
    145  
    146                                         // Average over phi distribution 
    147                                         for(int l=0; l <(int)weights_phi.size(); l++) { 
    148                                                 dp.axis_phi = weights_phi[l].value; 
    149  
    150                                                 double _ptvalue = weights_length[i].weight 
    151                                                         * weights_radius[j].weight 
    152                                                         * weights_theta[k].weight 
    153                                                         * weights_phi[l].weight 
    154                                                         * flexible_cylinder_analytical_2DXY(&dp, qx, qy); 
    155                                                 if (weights_theta.size()>1) { 
    156                                                         _ptvalue *= sin(weights_theta[k].value); 
    157                                                 } 
    158                                                 sum += _ptvalue; 
    159  
    160                                                 norm += weights_length[i].weight 
    161                                                         * weights_radius[j].weight 
    162                                                         * weights_theta[k].weight 
    163                                                         * weights_phi[l].weight; 
    164                                 } 
    165                         } 
    166                 } 
    167         } 
    168         // Averaging in theta needs an extra normalization 
    169         // factor to account for the sin(theta) term in the 
    170         // integration (see documentation). 
    171         if (weights_theta.size()>1) norm = norm / asin(1.0); 
    172         return sum/norm + background(); 
     101        double q = sqrt(qx*qx + qy*qy); 
     102        return (*this).operator()(q); 
    173103} 
    174104 
     
    181111 */ 
    182112double FlexibleCylinderModel :: evaluate_rphi(double q, double phi) { 
    183         double qx = q*cos(phi); 
    184         double qy = q*sin(phi); 
    185         return (*this).operator()(qx, qy); 
     113        //double qx = q*cos(phi); 
     114        //double qy = q*sin(phi); 
     115        return (*this).operator()(q); 
    186116} 
Note: See TracChangeset for help on using the changeset viewer.