Changeset 8a21ba3 in sasmodels for Kernel-Ellipse.cpp
- Timestamp:
- Jul 11, 2014 3:40:30 PM (10 years ago)
- 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
- 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 floataxis_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, 2 const 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) 4 4 { 5 5 int i = get_global_id(0); 6 6 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); 15 14 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)))); 18 16 if(arg == 0.0){ 19 17 ret = 1.0/3.0; … … 22 20 ret = (sin(arg)-arg*cos(arg))/(arg*arg*arg); 23 21 } 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); 27 23 28 24 _ptvalue[i] = radius_a_weight*radius_b_weight*axis_theta_weight*radius_a*axis_phi_weight*ret*pow(radius_b, 2); 29 30 25 if(size > 1){ 31 26 _ptvalue[i] *= fabs(cos(axis_theta*pi/180.0));
Note: See TracChangeset
for help on using the changeset viewer.