Changeset f425805 in sasview for sansmodels/src


Ignore:
Timestamp:
Jan 4, 2012 4:51:34 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:
43ccd258
Parents:
acd0fd10
Message:

C refactor on BarBell?

Location:
sansmodels/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • sansmodels/src/c_extensions/barbell.h

    r67424cd rf425805  
    11#if !defined(barbell_h) 
    22#define barbell_h 
    3  
     3#include "parameters.hh" 
    44/** 
    55 * Structure definition for BarBell parameters 
     
    2929 //[ORIENTATION_PARAMS]= <text> phi; theta; phi.width; theta.width</text> 
    3030 
    31 typedef struct { 
    32     /// Scale factor 
    33     //  [DEFAULT]=scale= 1.0 
    34     double scale; 
     31class BarBellModel { 
     32public: 
     33  // Model parameters 
    3534 
    36     /// rad_bar [A] 
    37     //  [DEFAULT]=rad_bar=20.0 [A] 
    38     double rad_bar; 
     35  /// Scale factor 
     36  //  [DEFAULT]=scale= 1.0 
     37  Parameter scale; 
    3938 
    40     /// length of the bar [A] 
    41     //  [DEFAULT]=len_bar=400.0 [A] 
    42     double len_bar; 
     39  /// rad_bar [A] 
     40  //  [DEFAULT]=rad_bar=20.0 [A] 
     41  Parameter rad_bar; 
    4342 
    44     /// Radius of sphere [A] 
    45     //  [DEFAULT]=rad_bell=40.0 [A] 
    46     double rad_bell; 
     43  /// length of the bar [A] 
     44  //  [DEFAULT]=len_bar=400.0 [A] 
     45  Parameter len_bar; 
    4746 
    48     /// sld_barbell [1/A^(2)] 
    49     //  [DEFAULT]=sld_barbell= 1.0e-6 [1/A^(2)] 
    50     double sld_barbell; 
     47  /// Radius of sphere [A] 
     48  //  [DEFAULT]=rad_bell=40.0 [A] 
     49  Parameter rad_bell; 
    5150 
    52     /// sld_solv [1/A^(2)] 
    53     //  [DEFAULT]=sld_solv= 6.3e-6 [1/A^(2)] 
    54     double sld_solv; 
     51  /// sld_barbell [1/A^(2)] 
     52  //  [DEFAULT]=sld_barbell= 1.0e-6 [1/A^(2)] 
     53  Parameter sld_barbell; 
    5554 
    56         /// Incoherent Background [1/cm] 
    57         //  [DEFAULT]=background=0.0 [1/cm] 
    58         double background; 
     55  /// sld_solv [1/A^(2)] 
     56  //  [DEFAULT]=sld_solv= 6.3e-6 [1/A^(2)] 
     57  Parameter sld_solv; 
    5958 
    60     /// Angle of the main axis against z-axis in detector plane [deg] 
    61     //  [DEFAULT]=theta=0.0 [deg] 
    62     double theta; 
    63     /// Azimuthal angle around z-axis in detector plane [deg] 
    64     //  [DEFAULT]=phi=0.0 [deg] 
    65     double phi; 
     59  /// Incoherent Background [1/cm] 
     60  //  [DEFAULT]=background=0.0 [1/cm] 
     61  Parameter background; 
    6662 
    67 } BarBellParameters; 
     63  /// Angle of the main axis against z-axis in detector plane [deg] 
     64  //  [DEFAULT]=theta=0.0 [deg] 
     65  Parameter theta; 
    6866 
     67  /// Azimuthal angle around z-axis in detector plane [deg] 
     68  //  [DEFAULT]=phi=0.0 [deg] 
     69  Parameter phi; 
    6970 
     71  // Constructor 
     72  BarBellModel(); 
    7073 
    71 /// 1D scattering function 
    72 double barbell_analytical_1D(BarBellParameters *pars, double q); 
    73  
    74 /// 2D scattering function 
    75 double barbell_analytical_2D(BarBellParameters *pars, double q, double phi); 
    76 double barbell_analytical_2DXY(BarBellParameters *pars, double qx, double qy); 
    77 double barbell_analytical_2D_scaled(BarBellParameters *pars, double q, double q_x, double q_y); 
     74  // Operators to get I(Q) 
     75  double operator()(double q); 
     76  double operator()(double qx, double qy); 
     77  double calculate_ER(); 
     78  double evaluate_rphi(double q, double phi); 
     79}; 
    7880 
    7981#endif 
  • sansmodels/src/c_models/barbell.cpp

    r85b856b rf425805  
    2121 
    2222#include <math.h> 
    23 #include "models.hh" 
     23//#include "models.hh" 
    2424#include "parameters.hh" 
    2525#include <stdio.h> 
  • sansmodels/src/c_models/models.hh

    r67424cd rf425805  
    4141        // Constructor 
    4242        CylinderModel(); 
    43  
    44         // Operators to get I(Q) 
    45         double operator()(double q); 
    46         double operator()(double qx, double qy); 
    47         double calculate_ER(); 
    48         double evaluate_rphi(double q, double phi); 
    49 }; 
    50  
    51 class BarBellModel{ 
    52 public: 
    53         // Model parameters 
    54         Parameter scale; 
    55         Parameter rad_bar; 
    56         Parameter len_bar; 
    57         Parameter rad_bell; 
    58         Parameter sld_barbell; 
    59         Parameter sld_solv; 
    60         Parameter background; 
    61         Parameter theta; 
    62         Parameter phi; 
    63  
    64         // Constructor 
    65         BarBellModel(); 
    6643 
    6744        // Operators to get I(Q) 
  • sansmodels/src/python_wrapper/CBarBellModel.cpp

    r85b856b rf425805  
    1818 * 
    1919 * WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY 
    20  *          DO NOT MODIFY THIS FILE, MODIFY barbell.h 
     20 *          DO NOT MODIFY THIS FILE, MODIFY [INCLUDE_FILE] 
    2121 *          AND RE-RUN THE GENERATOR SCRIPT 
    2222 * 
     
    3333#include <math.h> 
    3434#include <time.h> 
    35 //#include "barbell.h" 
    36 } 
    37  
    38 #include "models.hh" 
     35 
     36} 
     37 
     38#include "barbell.h" 
    3939#include "dispersion_visitor.hh" 
    4040 
Note: See TracChangeset for help on using the changeset viewer.