source: sasview/sansmodels/src/sans/models/c_extensions/sld_cal.c @ a24f530

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 a24f530 was 890ac7f1, checked in by Mathieu Doucet <doucetm@…>, 13 years ago

Re #5 fixing samsmodels compilation on MSVC

  • 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 */
17double sld_cal_analytical_1D(SLDCalParameters *pars, double x) {
18        double fun, nsl, n_s, fun_coef, sld_l, sld_r, sld_out;
19        int fun_type;
20
21        fun = pars->fun_type;
22        nsl = pars->npts_inter;
23        n_s = pars->shell_num;
24        fun_coef = pars->nu_inter;
25        sld_l = pars-> sld_left;
26        sld_r = pars-> sld_right;
27
28        fun_type = floor(fun);
29
30        sld_out = intersldfunc(fun_type, nsl, n_s, fun_coef, sld_l, sld_r);
31
32        return sld_out;
33}
34
35/**
36 * Function to evaluate 2D scattering function
37 * @param pars: parameters
38 * @param q: q-value
39 * @return: function value
40 */
41double sld_cal_analytical_2D(SLDCalParameters *pars, double x, double phi) {
42        return sld_cal_analytical_1D(pars,x);
43}
44
45double sld_cal_analytical_2DXY(SLDCalParameters *pars, double xx, double xy){
46        return sld_cal_analytical_1D(pars,sqrt(xx*xx+xy*xy));
47}
Note: See TracBrowser for help on using the repository browser.