source: sasmodels/Kernel/Kernel-Ellipse.cpp @ a7684e5

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since a7684e5 was ae7d639, checked in by HMP1 <helen.park@…>, 10 years ago

Ellipse now MUCH faster!

  • Property mode set to 100644
File size: 1.2 KB
Line 
1__kernel void EllipsoidKernel(const real radius_a_weight, const real radius_b_weight,
2const real axis_theta_weight,
3const real axis_phi_weight, const real scale, const real radius_a, const real radius_b,
4 const real sub, const real axis_theta, const real axis_phi, __global const real *qx,
5__global const real *qy, __global real *_ptvalue, const int length, const int size)
6{
7     int i = get_global_id(0);
8     if(i < length){
9         real ret = 0;
10         real q = sqrt(qx[i]*qx[i] + qy[i]*qy[i]);
11         real pi = 4.0*atan(1.0);
12         real theta = axis_theta*pi/180.0;
13         real cos_val = cos(theta)*cos(axis_phi*pi/180.0)*(qx[i]/q) + sin(theta)*(qy[i]/q);
14
15         real arg = q*radius_b*sqrt(1.0+(cos_val*cos_val*(((radius_a*radius_a/(radius_b*radius_b))-1.0))));
16         if(arg == 0.0){
17             ret = 1.0/3.0;
18         }
19         else{
20             ret = (sin(arg)-arg*cos(arg))/(arg*arg*arg);
21         }
22         ret*=ret*9.0*sub*sub*4.0/3.0*acos(-1.0)*radius_b*radius_b*radius_a*scale*(1.0e8);
23
24         _ptvalue[i] += radius_a_weight*radius_b_weight*axis_theta_weight*radius_a*axis_phi_weight*ret*pow(radius_b, 2);
25         //if(size > 1){
26          //  _ptvalue[i] *= fabs(cos(axis_theta*pi/180.0));
27         //}
28     }
29}
Note: See TracBrowser for help on using the repository browser.