Changeset 890ac7f1 in sasview for sansmodels/src


Ignore:
Timestamp:
Nov 30, 2011 2:43:17 PM (13 years ago)
Author:
Mathieu Doucet <doucetm@…>
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
Message:

Re #5 fixing samsmodels compilation on MSVC

Location:
sansmodels/src/sans/models/c_extensions
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • sansmodels/src/sans/models/c_extensions/capcyl.c

    r4628e31 r890ac7f1  
    66#include "GaussWeights.h" 
    77#include "libCylinder.h" 
     8#include <stdio.h> 
    89 
    910/** 
     
    133134        double answer; 
    134135        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; 
    135140 
    136141        dp[0] = pars->scale; 
     
    141146        dp[5] = pars->sld_solv; 
    142147        dp[6] = pars->background; 
    143  
    144         //convert angle degree to radian 
    145         double pi = 4.0*atan(1.0); 
    146         double theta = pars->theta * pi/180.0; 
    147         double phi = pars->phi * pi/180.0; 
    148148 
    149149 
  • sansmodels/src/sans/models/c_extensions/csparallelepiped.c

    r4628e31 r890ac7f1  
    160160double csparallelepiped_analytical_2D_scaled(CSParallelepipedParameters *pars, double q, double q_x, double q_y) { 
    161161        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; 
    162172 
    163173        // Fill paramater array 
     
    176186        dp[12] = 0.0; 
    177187 
    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; 
    183188 
    184189        edgeA = pars->shortA; 
     
    186191        edgeC = pars->longC; 
    187192 
    188         //convert angle degree to radian 
    189         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; 
    193193 
    194194    // parallelepiped c axis orientation 
  • sansmodels/src/sans/models/c_extensions/fcc.c

    r4628e31 r890ac7f1  
    55#include "libSphere.h" 
    66#include <math.h> 
    7  
     7#include <stdio.h> 
    88 
    99/** 
     
    6868 
    6969        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; 
    7074        dp[0] = 1.0; 
    7175        dp[1] = pars->radius; 
     
    7377        dp[3] = pars->sldSolv; 
    7478        dp[4] = 0.0; 
    75         //convert angle degree to radian 
    76         double theta = pars->theta * Pi/180.0; 
    77         double phi = pars->phi * Pi/180.0; 
    78         double psi = pars->psi * Pi/180.0; 
    7979 
    8080        aa = pars->dnn; 
  • sansmodels/src/sans/models/c_extensions/onion.c

    r0164899a r890ac7f1  
    2222        int fun_type[n+2]; 
    2323        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; 
    2428 
    2529        for (i =1; i<=n; i++){ 
     
    4145        fun_type[n+1] = 0; 
    4246 
    43     double bes,fun,alpha,f,vol,vol_pre,vol_sub,qr,r,contr,f2; 
    44     double sign; 
    45     double pi; 
    4647 
    4748    pi = 4.0*atan(1.0); 
     
    5152    vol_pre = 0.0; 
    5253    vol_sub = 0.0; 
    53     double r0 = 0.0; 
    5454 
    5555    for (i =0; i<= n+1; i++){ 
  • sansmodels/src/sans/models/c_extensions/parallelepiped.c

    r4628e31 r890ac7f1  
    106106        double pi = 4.0*atan(1.0); 
    107107 
     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 
    108113        edgeA = pars->short_a; 
    109114        edgeB = pars->short_b; 
    110115        edgeC = pars->long_c; 
    111116 
    112         //convert angle degree to radian 
    113         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; 
    116117 
    117118    // parallelepiped c axis orientation 
  • sansmodels/src/sans/models/c_extensions/pearlnecklace.c

    r9cc3da6 r890ac7f1  
    3737        //total volume 
    3838        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; 
    4056        tot_vol += num_pearls * pearl_vol; 
    4157 
    42         //each masses 
    43         double m_r= contrast_string * string_vol; 
    44         double m_s= contrast_pearl * pearl_vol; 
    45  
    4658        //sine functions of a pearl 
    47         double psi; 
    4859        psi = sin(q*radius); 
    4960        psi -= q * radius * cos(q * radius); 
     
    5263 
    5364        // Note take only 20 terms in Si series: 10 terms may be enough though. 
    54         double gamma; 
    5565        gamma = Si(q* edge_separation); 
    5666        gamma /= (q* edge_separation); 
    57         double beta; 
    5867        beta = Si(q * (edge_separation + radius)); 
    5968        beta -= Si(q * radius); 
    6069        beta /= (q* edge_separation); 
    6170 
    62         //form factors 
    63         double sss; //pearls 
    64         double srr; //strings 
    65         double srs; //cross 
    6671        // center to center distance between the neighboring pearls 
    67         double A_s = edge_separation + 2.0 * radius; 
     72        A_s = edge_separation + 2.0 * radius; 
    6873 
    6974        // form factor for num_pearls 
     
    7681 
    7782        // form factor for num_strings (like thin rods) 
    78         double srr_1; 
    7983        srr_1 = -pow(sinc(q*edge_separation/2.0), 2); 
    8084 
    8185        srr_1 += 2.0 * gamma; 
    8286        srr_1 *= num_strings; 
    83         double srr_2; 
    8487        srr_2 = 2.0/(1.0-sinc(q*A_s)); 
    8588        srr_2 *= num_strings; 
    8689        srr_2 *= pow(beta, 2); 
    87         double srr_3; 
    8890        srr_3 = 1.0 - pow(sinc(q*A_s), num_strings); 
    8991        srr_3 /= pow((1.0-sinc(q*A_s)), 2); 
     
    104106        srs *= (m_r * m_s * beta * psi); 
    105107 
    106         double form_factor; 
    107108        form_factor = sss + srr + srs; 
    108109        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  
    2424 
    2525        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]; 
    2733        for (i =1; i<=n; i++){ 
    2834                sld[i] = dp[i+6]; 
     
    4046        thick_inter[n+1] = 0.0; 
    4147 
    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; 
    4748        complex  inv_n,phi1,alpha,alpha2,kn,fnm,fnp,rn,Xn,nn,nn2,an,nnp1,one,zero,two,n_sub,n_sup,knp1,Xnp1; 
    4849        pi = 4.0*atan(1.0); 
  • sansmodels/src/sans/models/c_extensions/refl_adv.c

    r96656e3 r890ac7f1  
    1616        int n = dp[0]; 
    1717        int i,j,fun_type[n+2]; 
     18        double nsl; 
    1819 
    1920        double scale = dp[1]; 
     
    2526 
    2627        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]; 
    2835        fun_coef[0] = fabs(dp[70]); 
    2936        for (i =1; i<=n; i++){ 
     
    4855        fun_coef[n+1] = 0.0; 
    4956 
    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 
    5659        complex  inv_n,phi1,alpha,alpha2,kn,fnm,fnp,rn,Xn,nn,nn2,an,nnp1,one,zero,two,n_sub,n_sup,knp1,Xnp1; 
    5760        pi = 4.0*atan(1.0); 
  • sansmodels/src/sans/models/c_extensions/sc.c

    r4628e31 r890ac7f1  
    55#include "libSphere.h" 
    66#include <math.h> 
     7#include <stdio.h> 
    78 
    89 
     
    6768 
    6869        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; 
    6974        dp[0] = 1.0; 
    7075        dp[1] = pars->radius; 
     
    7378        dp[4] = 0.0; 
    7479 
    75         //convert angle degree to radian 
    76         double theta = pars->theta * Pi/180.0; 
    77         double phi = pars->phi * Pi/180.0; 
    78         double psi = pars->psi * Pi/180.0; 
    7980 
    8081        aa = pars->dnn; 
  • sansmodels/src/sans/models/c_extensions/sld_cal.c

    r0164899a r890ac7f1  
    1717double sld_cal_analytical_1D(SLDCalParameters *pars, double x) { 
    1818        double fun, nsl, n_s, fun_coef, sld_l, sld_r, sld_out; 
     19        int fun_type; 
    1920 
    2021        fun = pars->fun_type; 
     
    2526        sld_r = pars-> sld_right; 
    2627 
    27         int fun_type = floor(fun); 
     28        fun_type = floor(fun); 
    2829 
    2930        sld_out = intersldfunc(fun_type, nsl, n_s, fun_coef, sld_l, sld_r); 
  • sansmodels/src/sans/models/c_extensions/spheresld.c

    r0164899a r890ac7f1  
    4545        int floor_nsl; 
    4646 
    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; 
    5051 
    5152    pi = 4.0*atan(1.0); 
     
    5657    vol_sub = 0.0; 
    5758    sld_f = sld_core; 
    58     double r0 = 0.0, thick_inter_f; 
    5959 
    6060        //floor_nsl = floor(nsl/2.0); 
Note: See TracChangeset for help on using the changeset viewer.