core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change
on this file since 496b252 was
5378e40,
checked in by Helen Park <HMP1@…>, 10 years ago
|
Initial commit
|
-
Property mode set to
100644
|
File size:
1.4 KB
|
Line | |
---|
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) |
---|
4 | { |
---|
5 | int i = get_global_id(0); |
---|
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); |
---|
15 | |
---|
16 | float nu = radius_a/radius_b; |
---|
17 | float arg = q*radius_b*sqrt(1.0+(cos_val*cos_val*((nu*nu)-1.0))); |
---|
18 | if(arg == 0.0){ |
---|
19 | ret = 1.0/3.0; |
---|
20 | } |
---|
21 | else{ |
---|
22 | ret = (sin(arg)-arg*cos(arg))/(arg*arg*arg); |
---|
23 | } |
---|
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; |
---|
27 | |
---|
28 | _ptvalue[i] = radius_a_weight*radius_b_weight*axis_theta_weight*radius_a*axis_phi_weight*ret*pow(radius_b, 2); |
---|
29 | |
---|
30 | if(size > 1){ |
---|
31 | _ptvalue[i] *= fabs(cos(axis_theta*pi/180.0)); |
---|
32 | } |
---|
33 | } |
---|
34 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.