Changeset 7d11b81 in sasview for sansmodels/src/libigor
- Timestamp:
- Aug 18, 2009 11:54:39 AM (15 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 3c102d4
- Parents:
- 2cb89e7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/libigor/libCylinder.c
r975ec8e r7d11b81 113 113 114 114 //now calculate outer integral 115 arg = q*length*zi/2 ;116 if (arg == 0 ){117 si = 1 ;115 arg = q*length*zi/2.0; 116 if (arg == 0.0){ 117 si = 1.0; 118 118 }else{ 119 119 si = sin(arg) * sin(arg) / arg / arg; … … 194 194 //now calculate outer integral 195 195 arg = q*length*zi/2; 196 if (arg == 0 ){197 si = 1 ;196 if (arg == 0.0){ 197 si = 1.0; 198 198 }else{ 199 199 si = sin(arg) * sin(arg) / arg / arg; … … 278 278 answer *= delrho*delrho; 279 279 //normalize by ellipsoid volume 280 answer *= 4 *Pi/3*aa*bb*cc;280 answer *= 4.0*Pi/3.0*aa*bb*cc; 281 281 //convert to [cm-1] 282 282 answer *= 1.0e8; … … 1732 1732 vc = pi43*aa*bb*bb; 1733 1733 vt = pi43*trmaj*trmin*trmin; 1734 if (uq == 0 ){1735 siq = 1 /3;1734 if (uq == 0.0){ 1735 siq = 1.0/3.0; 1736 1736 }else{ 1737 1737 siq = (sin(uq)/uq/uq - cos(uq)/uq)/uq; 1738 1738 } 1739 if (ut == 0 ){1740 sit = 1 /3;1739 if (ut == 0.0){ 1740 sit = 1.0/3.0; 1741 1741 }else{ 1742 1742 sit = (sin(ut)/ut/ut - cos(ut)/ut)/ut; … … 1773 1773 vc = pi43*aa*aa*bb; 1774 1774 vt = pi43*trmaj*trmaj*trmin; 1775 if (uq == 0 ){1776 siq = 1 /3;1775 if (uq == 0.0){ 1776 siq = 1.0/3.0; 1777 1777 }else{ 1778 1778 siq = (sin(uq)/uq/uq - cos(uq)/uq)/uq; 1779 1779 } 1780 if (ut == 0 ){1781 sit = 1 /3;1780 if (ut == 0.0){ 1781 sit = 1.0/3.0; 1782 1782 }else{ 1783 1783 sit = (sin(ut)/ut/ut - cos(ut)/ut)/ut; … … 1885 1885 sinarg1 = qq*length*cos(dum); 1886 1886 sinarg2 = qq*(length+facthick)*cos(dum); 1887 if (besarg1 == 0 ){1887 if (besarg1 == 0.0){ 1888 1888 be1 = 0.5; 1889 1889 }else{ 1890 1890 be1 = NR_BessJ1(besarg1)/besarg1; 1891 1891 } 1892 if (besarg2 == 0 ){1892 if (besarg2 == 0.0){ 1893 1893 be2 = 0.5; 1894 1894 }else{ 1895 1895 be2 = NR_BessJ1(besarg2)/besarg2; 1896 1896 } 1897 if (sinarg1 == 0 ){1898 si1 = 1 ;1897 if (sinarg1 == 0.0){ 1898 si1 = 1.0; 1899 1899 }else{ 1900 1900 si1 = sin(sinarg1)/sinarg1; 1901 1901 } 1902 if (besarg2 == 0 ){1903 si2 = 1 ;1902 if (besarg2 == 0.0){ 1903 si2 = 1.0; 1904 1904 }else{ 1905 1905 si2 = sin(sinarg2)/sinarg2; … … 1934 1934 sinarg2 = qq*(length+thick)*cos(dum); 1935 1935 1936 if (besarg1 == 0 ){1936 if (besarg1 == 0.0){ 1937 1937 be1 = 0.5; 1938 1938 }else{ 1939 1939 be1 = NR_BessJ1(besarg1)/besarg1; 1940 1940 } 1941 if (besarg2 == 0 ){1941 if (besarg2 == 0.0){ 1942 1942 be2 = 0.5; 1943 1943 }else{ 1944 1944 be2 = NR_BessJ1(besarg2)/besarg2; 1945 1945 } 1946 if (sinarg1 == 0 ){1947 si1 = 1 ;1946 if (sinarg1 == 0.0){ 1947 si1 = 1.0; 1948 1948 }else{ 1949 1949 si1 = sin(sinarg1)/sinarg1; 1950 1950 } 1951 if (besarg2 == 0 ){1952 si2 = 1 ;1951 if (besarg2 == 0.0){ 1952 si2 = 1.0; 1953 1953 }else{ 1954 1954 si2 = sin(sinarg2)/sinarg2; … … 2024 2024 sinarg2 = qq*(length+thick)*cos(dum); 2025 2025 2026 if (besarg1 == 0 ){2026 if (besarg1 == 0.0){ 2027 2027 be1 = 0.5; 2028 2028 }else{ 2029 2029 be1 = NR_BessJ1(besarg1)/besarg1; 2030 2030 } 2031 if (besarg2 == 0 ){2031 if (besarg2 == 0.0){ 2032 2032 be2 = 0.5; 2033 2033 }else{ 2034 2034 be2 = NR_BessJ1(besarg2)/besarg2; 2035 2035 } 2036 if (sinarg1 == 0 ){2037 si1 = 1 ;2036 if (sinarg1 == 0.0){ 2037 si1 = 1.0; 2038 2038 }else{ 2039 2039 si1 = sin(sinarg1)/sinarg1; 2040 2040 } 2041 if (besarg2 == 0 ){2042 si2 = 1 ;2041 if (besarg2 == 0.0){ 2042 si2 = 1.0; 2043 2043 }else{ 2044 2044 si2 = sin(sinarg2)/sinarg2; 2045 2045 } 2046 2046 2047 t1 = 2 *area*(2*length)*dr1*(si1)*(be1);2048 t2 = 2 *area*dr2*(totald*si2-2*length*si1)*(be2);2047 t1 = 2.0*area*(2.0*length)*dr1*(si1)*(be1); 2048 t2 = 2.0*area*dr2*(totald*si2-2.0*length*si1)*(be2); 2049 2049 2050 2050 retval =((t1+t2)*(t1+t2))*sin(dum); … … 2139 2139 nu = nua/a; 2140 2140 arg = qq*a*sqrt(1+dum*dum*(nu*nu-1)); 2141 if (arg == 0 ){2142 retval =1 /3;2141 if (arg == 0.0){ 2142 retval =1.0/3.0; 2143 2143 }else{ 2144 2144 retval = (sin(arg)-arg*cos(arg))/(arg*arg*arg); 2145 2145 } 2146 2146 retval *= retval; 2147 retval *= 9 ;2147 retval *= 9.0; 2148 2148 2149 2149 return(retval); … … 2158 2158 arg1 = qq*rshell*sqrt(1-dum*dum); //1=shell (outer radius) 2159 2159 arg2 = qq*rcore*sqrt(1-dum*dum); //2=core (inner radius) 2160 if (arg1 == 0 ){2161 lam1 = 1 ;2160 if (arg1 == 0.0){ 2161 lam1 = 1.0; 2162 2162 }else{ 2163 lam1 = 2 *NR_BessJ1(arg1)/arg1;2163 lam1 = 2.0*NR_BessJ1(arg1)/arg1; 2164 2164 } 2165 if (arg2 == 0 ){2166 lam2 = 1 ;2165 if (arg2 == 0.0){ 2166 lam2 = 1.0; 2167 2167 }else{ 2168 lam2 = 2 *NR_BessJ1(arg2)/arg2;2168 lam2 = 2.0*NR_BessJ1(arg2)/arg2; 2169 2169 } 2170 2170 //Todo: Need to check psi behavior as gamma goes to 1. 2171 psi = 1 /(1-gamma*gamma)*(lam1 - gamma*gamma*lam2); //SRK 10/19/002172 sinarg = qq*length*dum/2 ;2173 if (sinarg == 0 ){2174 t2 = 1 ;2171 psi = 1.0/(1.0-gamma*gamma)*(lam1 - gamma*gamma*lam2); //SRK 10/19/00 2172 sinarg = qq*length*dum/2.0; 2173 if (sinarg == 0.0){ 2174 t2 = 1.0; 2175 2175 }else{ 2176 2176 t2 = sin(sinarg)/sinarg; … … 2193 2193 arg1 = (mu/2)*cos(Pi*uu/2); 2194 2194 arg2 = (mu*aa/2)*sin(Pi*uu/2); 2195 if(arg1==0 ) {2196 tmp1 = 1 ;2195 if(arg1==0.0) { 2196 tmp1 = 1.0; 2197 2197 } else { 2198 2198 tmp1 = sin(arg1)*sin(arg1)/arg1/arg1; 2199 2199 } 2200 2200 2201 if (arg2==0 ) {2202 tmp2 = 1 ;2201 if (arg2==0.0) { 2202 tmp2 = 1.0; 2203 2203 } else { 2204 2204 tmp2 = sin(arg2)*sin(arg2)/arg2/arg2; … … 2222 2222 arg += cc*cc*dy*dy; 2223 2223 arg = q*sqrt(arg); 2224 if (arg == 0 ){2225 val = 1 ; // as arg --> 0, val should go to 1.02224 if (arg == 0.0){ 2225 val = 1.0; // as arg --> 0, val should go to 1.0 2226 2226 }else{ 2227 val = 9 * ( (sin(arg) - arg*cos(arg))/(arg*arg*arg) ) * ( (sin(arg) - arg*cos(arg))/(arg*arg*arg) );2227 val = 9.0 * ( (sin(arg) - arg*cos(arg))/(arg*arg*arg) ) * ( (sin(arg) - arg*cos(arg))/(arg*arg*arg) ); 2228 2228 } 2229 2229 return (val); … … 2259 2259 d1 = qq * rr * sin(theta); 2260 2260 b2 = d1 * d1; 2261 if (besarg == 0 ){2261 if (besarg == 0.0){ 2262 2262 be = sin(theta); 2263 2263 }else{ 2264 2264 be = t2 / b2; 2265 2265 } 2266 if (siarg == 0 ){2267 si = 1 ;2266 if (siarg == 0.0){ 2267 si = 1.0; 2268 2268 }else{ 2269 2269 si = t1 / b1; … … 2287 2287 2288 2288 arg = qq*ra*sqrt((1+nu*nu)/2+(1-nu*nu)*cos(theta)/2); 2289 if (arg == 0 ){2290 retval = 1 ;2289 if (arg == 0.0){ 2290 retval = 1.0; 2291 2291 }else{ 2292 retval = 2 *NR_BessJ1(arg)/arg;2292 retval = 2.0*NR_BessJ1(arg)/arg; 2293 2293 } 2294 2294
Note: See TracChangeset
for help on using the changeset viewer.