Changeset 8343e18 in sasview for sansmodels/src/c_extensions


Ignore:
Timestamp:
Jan 4, 2012 6:16:15 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:
df88829
Parents:
0c2389e
Message:

refactored parallelepiped

Location:
sansmodels/src/c_extensions
Files:
1 deleted
1 edited

Legend:

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

    r67424cd r8343e18  
    1 /* 
    2         TODO: Add 2D model 
    3 */ 
    4  
    51#if !defined(parallelepiped_h) 
    62#define parallelepiped_h 
     3#include "parameters.hh" 
     4 
    75/** Structure definition for Parallelepiped parameters 
    86 * [PYTHONCLASS] = ParallelepipedModel 
     
    2321 
    2422 **/ 
    25 typedef struct { 
    26     /// Scale factor 
    27     //  [DEFAULT]=scale=1.0 
    28     double scale; 
    29     ///  Length of short edge of the parallelepiped [A] 
    30     //  [DEFAULT]=short_a=35 [A] 
    31     double short_a; 
    32         /// Length of short edge edge of the parallelepiped [A] 
    33     //  [DEFAULT]=short_b=75 [A] 
    34     double short_b; 
    35         /// Length of long edge of the parallelepiped [A] 
    36     //  [DEFAULT]=long_c=400 [A] 
    37     double long_c; 
    38     /// SLD_Pipe [1/A^(2)] 
    39     //  [DEFAULT]=sldPipe=6.3e-6 [1/A^(2)] 
    40     double sldPipe; 
    41     /// sldSolv [1/A^(2)] 
    42     //  [DEFAULT]=sldSolv=1.0e-6 [1/A^(2)] 
    43     double sldSolv; 
    44         /// Incoherent Background [1/cm] 
    45         //  [DEFAULT]=background=0.0 [1/cm] 
    46         double background; 
    47     /// Orientation of the parallelepiped axis w/respect incoming beam [deg] 
    48     //  [DEFAULT]=parallel_theta=0.0 [deg] 
    49     double parallel_theta; 
    50     /// Orientation of the longitudinal axis of the parallelepiped in the plane of the detector [deg] 
    51     //  [DEFAULT]=parallel_phi=0.0 [deg] 
    52     double parallel_phi; 
    53     /// Orientation of the cross-sectional minor axis of the parallelepiped in the plane of the detector [deg] 
    54     //  [DEFAULT]=parallel_psi=0.0 [deg] 
    55     double parallel_psi; 
    5623 
     24class ParallelepipedModel{ 
     25public: 
     26  // Model parameters 
     27  /// Scale factor 
     28  //  [DEFAULT]=scale=1.0 
     29  Parameter scale; 
     30  ///  Length of short edge of the parallelepiped [A] 
     31  //  [DEFAULT]=short_a=35 [A] 
     32  Parameter short_a; 
     33  /// Length of short edge edge of the parallelepiped [A] 
     34  //  [DEFAULT]=short_b=75 [A] 
     35  Parameter short_b; 
     36  /// Length of long edge of the parallelepiped [A] 
     37  //  [DEFAULT]=long_c=400 [A] 
     38  Parameter long_c; 
     39  /// SLD_Pipe [1/A^(2)] 
     40  //  [DEFAULT]=sldPipe=6.3e-6 [1/A^(2)] 
     41  Parameter sldPipe; 
     42  /// sldSolv [1/A^(2)] 
     43  //  [DEFAULT]=sldSolv=1.0e-6 [1/A^(2)] 
     44  Parameter sldSolv; 
     45  /// Incoherent Background [1/cm] 
     46  //  [DEFAULT]=background=0.0 [1/cm] 
     47  Parameter background; 
     48  /// Orientation of the parallelepiped axis w/respect incoming beam [deg] 
     49  //  [DEFAULT]=parallel_theta=0.0 [deg] 
     50  Parameter parallel_theta; 
     51  /// Orientation of the longitudinal axis of the parallelepiped in the plane of the detector [deg] 
     52  //  [DEFAULT]=parallel_phi=0.0 [deg] 
     53  Parameter parallel_phi; 
     54  /// Orientation of the cross-sectional minor axis of the parallelepiped in the plane of the detector [deg] 
     55  //  [DEFAULT]=parallel_psi=0.0 [deg] 
     56  Parameter parallel_psi; 
    5757 
    58 } ParallelepipedParameters; 
     58  // Constructor 
     59  ParallelepipedModel(); 
    5960 
    60  
    61  
    62 /// 1D scattering function 
    63 double parallelepiped_analytical_1D(ParallelepipedParameters *pars, double q); 
    64  
    65 /// 2D scattering function 
    66 double parallelepiped_analytical_2D(ParallelepipedParameters *pars, double q, double phi); 
    67 double parallelepiped_analytical_2DXY(ParallelepipedParameters *pars, double qx, double qy); 
    68 double parallelepiped_analytical_2D_scaled(ParallelepipedParameters *pars, double q, double q_x, double q_y); 
     61  // Operators to get I(Q) 
     62  double operator()(double q); 
     63  double operator()(double qx, double qy); 
     64  double calculate_ER(); 
     65  double evaluate_rphi(double q, double phi); 
     66}; 
    6967#endif 
Note: See TracChangeset for help on using the changeset viewer.