Changeset 0ba3b08 in sasview for sansmodels/src/c_models/sld_cal.cpp


Ignore:
Timestamp:
Jan 5, 2012 12:16:29 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:
011e0e4
Parents:
bbbed8c
Message:

refactored bunch of models

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansmodels/src/c_models/sld_cal.cpp

    r67424cd r0ba3b08  
    66 
    77#include <math.h> 
    8 #include "models.hh" 
    98#include "parameters.hh" 
    109#include <stdio.h> 
    1110using namespace std; 
     11#include "sld_cal.h" 
    1212 
    1313extern "C" { 
    14         #include "sld_cal.h" 
     14#include "libmultifunc/librefl.h" 
     15} 
     16 
     17// Convenience structure 
     18typedef struct { 
     19    double fun_type; 
     20    double npts_inter; 
     21    double shell_num; 
     22    double nu_inter; 
     23    double sld_left; 
     24    double sld_right; 
     25} SLDCalParameters; 
     26 
     27/** 
     28 * Function to calculate sld 
     29 * @param pars: parameters 
     30 * @param x: independent param-value 
     31 * @return: sld value 
     32 */ 
     33static double sld_cal_analytical_1D(SLDCalParameters *pars, double x) { 
     34  double fun, nsl, n_s, fun_coef, sld_l, sld_r, sld_out; 
     35  int fun_type; 
     36 
     37  fun = pars->fun_type; 
     38  nsl = pars->npts_inter; 
     39  n_s = pars->shell_num; 
     40  fun_coef = pars->nu_inter; 
     41  sld_l = pars-> sld_left; 
     42  sld_r = pars-> sld_right; 
     43 
     44  fun_type = floor(fun); 
     45 
     46  sld_out = intersldfunc(fun_type, nsl, n_s, fun_coef, sld_l, sld_r); 
     47 
     48  return sld_out; 
    1549} 
    1650 
Note: See TracChangeset for help on using the changeset viewer.