1 | /** |
---|
2 | * Scattering model classes |
---|
3 | * The classes use the IGOR library found in |
---|
4 | * sansmodels/c_extensions/libmultifunc/librefl.h |
---|
5 | */ |
---|
6 | |
---|
7 | #include <math.h> |
---|
8 | #include "models.hh" |
---|
9 | #include "parameters.hh" |
---|
10 | #include <stdio.h> |
---|
11 | using namespace std; |
---|
12 | |
---|
13 | extern "C" { |
---|
14 | #include "sld_cal.h" |
---|
15 | } |
---|
16 | |
---|
17 | SLDCalFunc :: SLDCalFunc() { |
---|
18 | fun_type = Parameter(0); |
---|
19 | npts_inter = Parameter(21); |
---|
20 | shell_num = Parameter(1); |
---|
21 | nu_inter = Parameter(2.5); |
---|
22 | sld_left = Parameter(1.0e-06); |
---|
23 | sld_right = Parameter(2.0e-06); |
---|
24 | } |
---|
25 | |
---|
26 | /** |
---|
27 | * Function to evaluate 1D scattering function |
---|
28 | * @param q: q-value |
---|
29 | * @return: function value |
---|
30 | */ |
---|
31 | double SLDCalFunc :: operator()(double q) { |
---|
32 | SLDCalParameters dp; |
---|
33 | |
---|
34 | dp.fun_type = fun_type(); |
---|
35 | dp.npts_inter = npts_inter(); |
---|
36 | dp.shell_num = shell_num(); |
---|
37 | dp.nu_inter = nu_inter(); |
---|
38 | dp.sld_left = sld_left(); |
---|
39 | dp.sld_right = sld_right(); |
---|
40 | |
---|
41 | return sld_cal_analytical_1D(&dp, q); |
---|
42 | } |
---|
43 | |
---|
44 | /** |
---|
45 | * Function to evaluate 2D scattering function |
---|
46 | * @param q_x: value of Q along x |
---|
47 | * @param q_y: value of Q along y |
---|
48 | * @return: function value |
---|
49 | */ |
---|
50 | double SLDCalFunc :: operator()(double qx, double qy) { |
---|
51 | double q = sqrt(qx*qx + qy*qy); |
---|
52 | return (*this).operator()(q); |
---|
53 | } |
---|
54 | |
---|
55 | /** |
---|
56 | * Function to evaluate 2D scattering function |
---|
57 | * @param pars: parameters of the cylinder |
---|
58 | * @param q: q-value |
---|
59 | * @param phi: angle phi |
---|
60 | * @return: function value |
---|
61 | */ |
---|
62 | double SLDCalFunc :: evaluate_rphi(double q, double phi) { |
---|
63 | return (*this).operator()(q); |
---|
64 | } |
---|
65 | /** |
---|
66 | * Function to calculate effective radius |
---|
67 | * @return: effective radius value |
---|
68 | */ |
---|
69 | double SLDCalFunc :: calculate_ER() { |
---|
70 | //NOT implemented yet!!! |
---|
71 | return 0.0; |
---|
72 | } |
---|