Changeset 8a21ba3 in sasmodels for Kernel-Ellipse.cpp


Ignore:
Timestamp:
Jul 11, 2014 3:40:30 PM (10 years ago)
Author:
HMP1 <helen.park@…>
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:
09e15be
Parents:
496b252
Message:

Fixed Ellipse code, update comparison file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Kernel-Ellipse.cpp

    r5378e40 r8a21ba3  
    1 __kernel void EllipsoidKernel(const float radius_a_weight, const float radius_b_weight, const float axis_theta_weight, 
    2 const float axis_phi_weight, const float scale, const float radius_a, const float radius_b, const float sub, const float background, const float axis_theta, const float axis_phi, __global const float *qx, 
    3 __global const float *qy, __global float *_ptvalue, const int length, const int size) 
     1__kernel void EllipsoidKernel(const real radius_a_weight, const real radius_b_weight, const real axis_theta_weight, 
     2const real axis_phi_weight, const real scale, const real radius_a, const real radius_b, const real sub, const real axis_theta, const real axis_phi, __global const real *qx, 
     3__global const real *qy, __global real *_ptvalue, const int length, const int size) 
    44{ 
    55     int i = get_global_id(0); 
    66     if(i < length){ 
    7          float ret = 0; 
    8          float q = sqrt(qx[i]*qx[i] + qy[i]*qy[i]); 
    9          float pi = 4.0*atan(1.0); 
    10          float theta = axis_theta*pi/180.0; 
    11          float h = axis_phi*pi/180.0; 
    12          float cyl_x = cos(theta)*cos(h); 
    13          float cyl_y = sin(theta); 
    14          float cos_val = cyl_x*(qx[i]/q) + cyl_y*(qy[i]/q); 
     7         real ret = 0; 
     8         real q = sqrt(qx[i]*qx[i] + qy[i]*qy[i]); 
     9         real pi = 4.0*atan(1.0); 
     10         real theta = axis_theta*pi/180.0; 
     11         real cyl_x = cos(theta)*cos(axis_phi*pi/180.0); 
     12         real cyl_y = sin(theta); 
     13         real cos_val = cyl_x*(qx[i]/q) + cyl_y*(qy[i]/q); 
    1514 
    16          float nu = radius_a/radius_b; 
    17          float arg = q*radius_b*sqrt(1.0+(cos_val*cos_val*((nu*nu)-1.0))); 
     15         real arg = q*radius_b*sqrt(1.0+(cos_val*cos_val*(((radius_a*radius_a/(radius_b*radius_b))-1.0)))); 
    1816         if(arg == 0.0){ 
    1917             ret = 1.0/3.0; 
     
    2220             ret = (sin(arg)-arg*cos(arg))/(arg*arg*arg); 
    2321         } 
    24          ret*=ret*9.0*sub*sub; 
    25          ret*=(4.0/3.0*acos(-1.0)*radius_b*radius_b*radius_a)*scale*(1.0e8); 
    26          ret+=background; 
     22         ret*=ret*9.0*sub*sub*4.0/3.0*acos(-1.0)*radius_b*radius_b*radius_a*scale*(1.0e8); 
    2723 
    2824         _ptvalue[i] = radius_a_weight*radius_b_weight*axis_theta_weight*radius_a*axis_phi_weight*ret*pow(radius_b, 2); 
    29  
    3025         if(size > 1){ 
    3126            _ptvalue[i] *= fabs(cos(axis_theta*pi/180.0)); 
Note: See TracChangeset for help on using the changeset viewer.