Changeset 890ac7f1 in sasview for sansmodels
- Timestamp:
- Nov 30, 2011 2:43:17 PM (13 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:
- 2138c061
- Parents:
- e161fac
- Location:
- sansmodels/src/sans/models/c_extensions
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/c_extensions/capcyl.c
r4628e31 r890ac7f1 6 6 #include "GaussWeights.h" 7 7 #include "libCylinder.h" 8 #include <stdio.h> 8 9 9 10 /** … … 133 134 double answer; 134 135 double dp[7]; 136 //convert angle degree to radian 137 double pi = 4.0*atan(1.0); 138 double theta = pars->theta * pi/180.0; 139 double phi = pars->phi * pi/180.0; 135 140 136 141 dp[0] = pars->scale; … … 141 146 dp[5] = pars->sld_solv; 142 147 dp[6] = pars->background; 143 144 //convert angle degree to radian145 double pi = 4.0*atan(1.0);146 double theta = pars->theta * pi/180.0;147 double phi = pars->phi * pi/180.0;148 148 149 149 -
sansmodels/src/sans/models/c_extensions/csparallelepiped.c
r4628e31 r890ac7f1 160 160 double csparallelepiped_analytical_2D_scaled(CSParallelepipedParameters *pars, double q, double q_x, double q_y) { 161 161 double dp[13]; 162 double cparallel_x, cparallel_y, cparallel_z, bparallel_x, bparallel_y, parallel_x, parallel_y, parallel_z; 163 double q_z; 164 double alpha, vol, cos_val_c, cos_val_b, cos_val_a, edgeA, edgeB, edgeC; 165 166 double answer; 167 //convert angle degree to radian 168 double pi = 4.0*atan(1.0); 169 double theta = pars->parallel_theta * pi/180.0; 170 double phi = pars->parallel_phi * pi/180.0; 171 double psi = pars->parallel_psi* pi/180.0; 162 172 163 173 // Fill paramater array … … 176 186 dp[12] = 0.0; 177 187 178 double cparallel_x, cparallel_y, cparallel_z, bparallel_x, bparallel_y, parallel_x, parallel_y, parallel_z;179 double q_z;180 double alpha, vol, cos_val_c, cos_val_b, cos_val_a, edgeA, edgeB, edgeC;181 182 double answer;183 188 184 189 edgeA = pars->shortA; … … 186 191 edgeC = pars->longC; 187 192 188 //convert angle degree to radian189 double pi = 4.0*atan(1.0);190 double theta = pars->parallel_theta * pi/180.0;191 double phi = pars->parallel_phi * pi/180.0;192 double psi = pars->parallel_psi* pi/180.0;193 193 194 194 // parallelepiped c axis orientation -
sansmodels/src/sans/models/c_extensions/fcc.c
r4628e31 r890ac7f1 5 5 #include "libSphere.h" 6 6 #include <math.h> 7 7 #include <stdio.h> 8 8 9 9 /** … … 68 68 69 69 double dp[5]; 70 //convert angle degree to radian 71 double theta = pars->theta * Pi/180.0; 72 double phi = pars->phi * Pi/180.0; 73 double psi = pars->psi * Pi/180.0; 70 74 dp[0] = 1.0; 71 75 dp[1] = pars->radius; … … 73 77 dp[3] = pars->sldSolv; 74 78 dp[4] = 0.0; 75 //convert angle degree to radian76 double theta = pars->theta * Pi/180.0;77 double phi = pars->phi * Pi/180.0;78 double psi = pars->psi * Pi/180.0;79 79 80 80 aa = pars->dnn; -
sansmodels/src/sans/models/c_extensions/onion.c
r0164899a r890ac7f1 22 22 int fun_type[n+2]; 23 23 int i,j; 24 double bes,fun,alpha,f,vol,vol_pre,vol_sub,qr,r,contr,f2; 25 double sign; 26 double pi; 27 double r0 = 0.0; 24 28 25 29 for (i =1; i<=n; i++){ … … 41 45 fun_type[n+1] = 0; 42 46 43 double bes,fun,alpha,f,vol,vol_pre,vol_sub,qr,r,contr,f2;44 double sign;45 double pi;46 47 47 48 pi = 4.0*atan(1.0); … … 51 52 vol_pre = 0.0; 52 53 vol_sub = 0.0; 53 double r0 = 0.0;54 54 55 55 for (i =0; i<= n+1; i++){ -
sansmodels/src/sans/models/c_extensions/parallelepiped.c
r4628e31 r890ac7f1 106 106 double pi = 4.0*atan(1.0); 107 107 108 //convert angle degree to radian 109 double theta = pars->parallel_theta * pi/180.0; 110 double phi = pars->parallel_phi * pi/180.0; 111 double psi = pars->parallel_psi * pi/180.0; 112 108 113 edgeA = pars->short_a; 109 114 edgeB = pars->short_b; 110 115 edgeC = pars->long_c; 111 116 112 //convert angle degree to radian113 double theta = pars->parallel_theta * pi/180.0;114 double phi = pars->parallel_phi * pi/180.0;115 double psi = pars->parallel_psi * pi/180.0;116 117 117 118 // parallelepiped c axis orientation -
sansmodels/src/sans/models/c_extensions/pearlnecklace.c
r9cc3da6 r890ac7f1 37 37 //total volume 38 38 double tot_vol; 39 tot_vol = num_strings * string_vol; 39 //each masses 40 double m_r= contrast_string * string_vol; 41 double m_s= contrast_pearl * pearl_vol; 42 double psi; 43 double gamma; 44 double beta; 45 //form factors 46 double sss; //pearls 47 double srr; //strings 48 double srs; //cross 49 double A_s; 50 double srr_1; 51 double srr_2; 52 double srr_3; 53 double form_factor; 54 55 tot_vol = num_strings * string_vol; 40 56 tot_vol += num_pearls * pearl_vol; 41 57 42 //each masses43 double m_r= contrast_string * string_vol;44 double m_s= contrast_pearl * pearl_vol;45 46 58 //sine functions of a pearl 47 double psi;48 59 psi = sin(q*radius); 49 60 psi -= q * radius * cos(q * radius); … … 52 63 53 64 // Note take only 20 terms in Si series: 10 terms may be enough though. 54 double gamma;55 65 gamma = Si(q* edge_separation); 56 66 gamma /= (q* edge_separation); 57 double beta;58 67 beta = Si(q * (edge_separation + radius)); 59 68 beta -= Si(q * radius); 60 69 beta /= (q* edge_separation); 61 70 62 //form factors63 double sss; //pearls64 double srr; //strings65 double srs; //cross66 71 // center to center distance between the neighboring pearls 67 doubleA_s = edge_separation + 2.0 * radius;72 A_s = edge_separation + 2.0 * radius; 68 73 69 74 // form factor for num_pearls … … 76 81 77 82 // form factor for num_strings (like thin rods) 78 double srr_1;79 83 srr_1 = -pow(sinc(q*edge_separation/2.0), 2); 80 84 81 85 srr_1 += 2.0 * gamma; 82 86 srr_1 *= num_strings; 83 double srr_2;84 87 srr_2 = 2.0/(1.0-sinc(q*A_s)); 85 88 srr_2 *= num_strings; 86 89 srr_2 *= pow(beta, 2); 87 double srr_3;88 90 srr_3 = 1.0 - pow(sinc(q*A_s), num_strings); 89 91 srr_3 /= pow((1.0-sinc(q*A_s)), 2); … … 104 106 srs *= (m_r * m_s * beta * psi); 105 107 106 double form_factor;107 108 form_factor = sss + srr + srs; 108 109 form_factor /= (tot_vol * 1.0e-8); // norm by volume and A^-1 to cm^-1 -
sansmodels/src/sans/models/c_extensions/refl.c
r0164899a r890ac7f1 24 24 25 25 double sld[n+2],thick_inter[n+2],thick[n+2],total_thick; 26 fun_type[0] = dp[3]; 26 double nsl=21.0; //nsl = Num_sub_layer: 27 int n_s; 28 double sld_i,sldim_i,dz,phi,R,ko2; 29 double sign,erfunc, fun; 30 double pi; 31 32 fun_type[0] = dp[3]; 27 33 for (i =1; i<=n; i++){ 28 34 sld[i] = dp[i+6]; … … 40 46 thick_inter[n+1] = 0.0; 41 47 42 double nsl=21.0; //nsl = Num_sub_layer:43 int n_s;44 double sld_i,sldim_i,dz,phi,R,ko2;45 double sign,erfunc, fun;46 double pi;47 48 complex inv_n,phi1,alpha,alpha2,kn,fnm,fnp,rn,Xn,nn,nn2,an,nnp1,one,zero,two,n_sub,n_sup,knp1,Xnp1; 48 49 pi = 4.0*atan(1.0); -
sansmodels/src/sans/models/c_extensions/refl_adv.c
r96656e3 r890ac7f1 16 16 int n = dp[0]; 17 17 int i,j,fun_type[n+2]; 18 double nsl; 18 19 19 20 double scale = dp[1]; … … 25 26 26 27 double sld[n+2],sld_im[n+2],thick_inter[n+2],thick[n+2],fun_coef[n+2],total_thick; 27 fun_type[0] = dp[3]; 28 29 int n_s; 30 double sld_i,sldim_i,dz,phi,R,ko2; 31 double sign,erfunc; 32 double pi; 33 34 fun_type[0] = dp[3]; 28 35 fun_coef[0] = fabs(dp[70]); 29 36 for (i =1; i<=n; i++){ … … 48 55 fun_coef[n+1] = 0.0; 49 56 50 double nsl=npts;//21.0; //nsl = Num_sub_layer: MUST ODD number in double //no other number works now 51 int n_s; 52 53 double sld_i,sldim_i,dz,phi,R,ko2; 54 double sign,erfunc; 55 double pi; 57 nsl=npts;//21.0; //nsl = Num_sub_layer: MUST ODD number in double //no other number works now 58 56 59 complex inv_n,phi1,alpha,alpha2,kn,fnm,fnp,rn,Xn,nn,nn2,an,nnp1,one,zero,two,n_sub,n_sup,knp1,Xnp1; 57 60 pi = 4.0*atan(1.0); -
sansmodels/src/sans/models/c_extensions/sc.c
r4628e31 r890ac7f1 5 5 #include "libSphere.h" 6 6 #include <math.h> 7 #include <stdio.h> 7 8 8 9 … … 67 68 68 69 double dp[5]; 70 //convert angle degree to radian 71 double theta = pars->theta * Pi/180.0; 72 double phi = pars->phi * Pi/180.0; 73 double psi = pars->psi * Pi/180.0; 69 74 dp[0] = 1.0; 70 75 dp[1] = pars->radius; … … 73 78 dp[4] = 0.0; 74 79 75 //convert angle degree to radian76 double theta = pars->theta * Pi/180.0;77 double phi = pars->phi * Pi/180.0;78 double psi = pars->psi * Pi/180.0;79 80 80 81 aa = pars->dnn; -
sansmodels/src/sans/models/c_extensions/sld_cal.c
r0164899a r890ac7f1 17 17 double sld_cal_analytical_1D(SLDCalParameters *pars, double x) { 18 18 double fun, nsl, n_s, fun_coef, sld_l, sld_r, sld_out; 19 int fun_type; 19 20 20 21 fun = pars->fun_type; … … 25 26 sld_r = pars-> sld_right; 26 27 27 intfun_type = floor(fun);28 fun_type = floor(fun); 28 29 29 30 sld_out = intersldfunc(fun_type, nsl, n_s, fun_coef, sld_l, sld_r); -
sansmodels/src/sans/models/c_extensions/spheresld.c
r0164899a r890ac7f1 45 45 int floor_nsl; 46 46 47 double sld_i,sld_f,dz,bes,fun,f,vol,vol_pre,vol_sub,qr,r,contr,f2; 48 double sign,slope=0.0; 49 double pi; 47 double sld_i,sld_f,dz,bes,fun,f,vol,vol_pre,vol_sub,qr,r,contr,f2; 48 double sign,slope=0.0; 49 double pi; 50 double r0 = 0.0, thick_inter_f; 50 51 51 52 pi = 4.0*atan(1.0); … … 56 57 vol_sub = 0.0; 57 58 sld_f = sld_core; 58 double r0 = 0.0, thick_inter_f;59 59 60 60 //floor_nsl = floor(nsl/2.0);
Note: See TracChangeset
for help on using the changeset viewer.