ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change
on this file since 57ca7f3 was
0164899a,
checked in by Jae Cho <jhjcho@…>, 14 years ago
|
new models and some bug fixes
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | /** |
---|
2 | * SLD Calculator |
---|
3 | * @author: Jae Hie Cho / UTK |
---|
4 | */ |
---|
5 | |
---|
6 | #include "sld_cal.h" |
---|
7 | #include "libmultifunc/librefl.h" |
---|
8 | #include <math.h> |
---|
9 | |
---|
10 | |
---|
11 | /** |
---|
12 | * Function to calculate sld |
---|
13 | * @param pars: parameters |
---|
14 | * @param x: independent param-value |
---|
15 | * @return: sld value |
---|
16 | */ |
---|
17 | double sld_cal_analytical_1D(SLDCalParameters *pars, double x) { |
---|
18 | double fun, nsl, n_s, fun_coef, sld_l, sld_r, sld_out; |
---|
19 | |
---|
20 | fun = pars->fun_type; |
---|
21 | nsl = pars->npts_inter; |
---|
22 | n_s = pars->shell_num; |
---|
23 | fun_coef = pars->nu_inter; |
---|
24 | sld_l = pars-> sld_left; |
---|
25 | sld_r = pars-> sld_right; |
---|
26 | |
---|
27 | int fun_type = floor(fun); |
---|
28 | |
---|
29 | sld_out = intersldfunc(fun_type, nsl, n_s, fun_coef, sld_l, sld_r); |
---|
30 | |
---|
31 | return sld_out; |
---|
32 | } |
---|
33 | |
---|
34 | /** |
---|
35 | * Function to evaluate 2D scattering function |
---|
36 | * @param pars: parameters |
---|
37 | * @param q: q-value |
---|
38 | * @return: function value |
---|
39 | */ |
---|
40 | double sld_cal_analytical_2D(SLDCalParameters *pars, double x, double phi) { |
---|
41 | return sld_cal_analytical_1D(pars,x); |
---|
42 | } |
---|
43 | |
---|
44 | double sld_cal_analytical_2DXY(SLDCalParameters *pars, double xx, double xy){ |
---|
45 | return sld_cal_analytical_1D(pars,sqrt(xx*xx+xy*xy)); |
---|
46 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.