Changeset 8a20be5 in sasmodels for Kernel-Cylinder.cpp
- Timestamp:
- Jul 10, 2014 3:05:08 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:
- 8faffcd
- Parents:
- 5378e40
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Kernel-Cylinder.cpp
r5378e40 r8a20be5 1 __kernel void CylinderKernel(__global const float *qx, global const float *qy, __global float *_ptvalue, const floatsub,2 const float rr, const float h, const float scale, const float radius_weight, const floatlength_weight,3 const float theta_weight, const float phi_weight, const floatcyl_theta,4 const floatcyl_phi, const int count, const int size)1 __kernel void CylinderKernel(__global const real *qx, global const real *qy, __global real *_ptvalue, const real sub, 2 const real rr, const real h, const real scale, const real radius_weight, const real length_weight, 3 const real theta_weight, const real phi_weight, const real cyl_theta, 4 const real cyl_phi, const int count, const int size) 5 5 { 6 6 // qq is the q-value for the calculation (1/A) … … 11 11 if(i < count) 12 12 { 13 floatqq = sqrt(qx[i]*qx[i]+qy[i]*qy[i]);13 real qq = sqrt(qx[i]*qx[i]+qy[i]*qy[i]); 14 14 15 floatpi = 4.0*atan(1.0);16 floattheta = cyl_theta*pi/180.0;17 floatphi = cyl_phi*pi/180.0;15 real pi = 4.0*atan(1.0); 16 real theta = cyl_theta*pi/180.0; 17 real phi = cyl_phi*pi/180.0; 18 18 19 floatcyl_x = cos(theta)*cos(phi);20 floatcyl_y = sin(theta);21 floatcos_val = cyl_x*(qx[i]/qq) + cyl_y*(qy[i]/qq);19 real cyl_x = cos(theta)*cos(phi); 20 real cyl_y = sin(theta); 21 real cos_val = cyl_x*(qx[i]/qq) + cyl_y*(qy[i]/qq); 22 22 23 floatalpha = acos(cos_val);23 real alpha = acos(cos_val); 24 24 if(alpha == 0.0){ 25 25 alpha = 1.0e-26; 26 26 } 27 float besarg = qq*rr*sin(alpha); 28 float siarg = qq*h/2*cos(alpha); 27 real besarg = qq*rr*sin(alpha); 28 real siarg = qq*h/2*cos(alpha); 29 real be=0.0; real si=0.0; 29 30 30 float xx=0.0; float y=0.0; float bj=0.0; float ans1=0.0; float ans2=0.0; float z=0.0; float answer=0.0; 31 float contrast=0.0; float form=0.0; float be=0.0; float si=0.0; 31 real bj = NR_BessJ1(besarg); 32 32 33 float ax = fabs(besarg);33 real d1 = qq*rr*sin(alpha); 34 34 35 if(ax < 8.0) { 36 y=besarg*besarg; 37 ans1=besarg*(72362614232.0+y*(-7895059235.0+y*(242396853.1+y*(-2972611.439+y*(15704.48260+y*(-30.16036606)))))); 38 ans2=144725228442.0+y*(2300535178.0+y*(18583304.74+y*(99447.43394+y*(376.9991397+y*1.0)))); 39 bj=ans1/ans2; 35 if (besarg == 0.0){ 36 be = sin(alpha); 40 37 } 41 38 else{ 42 z=8.0/ax; 43 y=z*z; 44 xx=ax - 2.356194491; 45 ans1=1.0+y*(0.183105e-2+y*(-0.3516396496e-4+y*(0.2457520174e-5+y*(-0.240337019e-6)))); 46 ans2=0.04687499995+y*(-0.2002690873e-3+y*(0.8449199096e-5+y*(-0.88228987e-6+y*0.105787412e-6))); 47 bj=sqrt(0.636619772/ax)*(cos(xx)*ans1-z*sin(xx)*ans2); 48 49 if(besarg < 0.0){bj*=-1;} 39 be = bj*bj*4.0*sin(alpha)/(d1*d1); 40 } 41 if(siarg == 0.0){ 42 si = 1.0; 43 } 44 else{ 45 si = sin(siarg)*sin(siarg)/(siarg*siarg); 50 46 } 51 47 52 float d1 = qq*rr*sin(alpha); 53 54 if (besarg == 0.0) {be = sin(alpha);} 55 else {be = bj*bj*4.0*sin(alpha)/(d1*d1);} 56 if(siarg == 0.0) {si = 1.0;} 57 else{si = sin(siarg)*sin(siarg)/(siarg*siarg);} 58 59 form = be*si/sin(alpha); 60 answer = sub*sub*form*acos(-1.0)*rr*rr*h*1.0e8*scale; 48 real form = be*si/sin(alpha); 49 real answer = sub*sub*form*acos(-1.0)*rr*rr*h*1.0e8*scale; 61 50 62 51 _ptvalue[i] = radius_weight*length_weight*theta_weight*phi_weight*answer*pow(rr,2)*h; … … 64 53 _ptvalue[i] *= fabs(cos(cyl_theta*pi/180.0)); 65 54 } 66 }55 } 67 56 } 68 57
Note: See TracChangeset
for help on using the changeset viewer.