source: sans/XOP_Dev/MonteCarlo/MonteCarlo.h @ 677

Last change on this file since 677 was 623, checked in by srkline, 13 years ago

Updated the MonteCarlo? code to allow 4 processors, but simply copying the function 4 times, and defining 4 different random number generators. Still can't figure out what the problem is with threading a single version, but not worth the effort. Copy/paste is way faster.

Also added some simple (non-optimized) calculations for using Debye's sphere method. These are largely undocumented at this point - so see the code. These are XOP versions of the old ipf code I've used in the past, and stripped of the now-obsolete AltiVec? code (I now lose the 4x speedup from the vectorization...)

File size: 1.6 KB
Line 
1/*
2 *  MonteCarlo.h
3 *  SANSAnalysis
4 *
5 *  Created by Steve Kline on 10/16/08.
6 *  Copyright 2008 __MyCompanyName__. All rights reserved.
7 *
8 */
9
10#include <math.h>
11#include <ctype.h>
12
13#include <stdlib.h>
14#include <stdio.h>
15
16#ifdef _WIN32
17#include <float.h>
18#include "winFuncs.h"
19#endif
20 
21/* Prototypes */
22HOST_IMPORT void main(IORecHandle ioRecHandle);
23
24 
25#define OLD_IGOR 1 + FIRST_XOP_ERR
26#define NON_EXISTENT_WAVE 2 + FIRST_XOP_ERR
27#define NEEDS_2D_WAVE 3 + FIRST_XOP_ERR
28
29
30// All structures passed to Igor are two-byte aligned.
31#include "XOPStructureAlignmentTwoByte.h"
32
33struct MC_Params {     // This structure must be 2-byte-aligned because it receives parameters from Igor.
34        waveHndl resultsH;      // results of MC
35        waveHndl MC_linear_dataH;               //this is a 2D WAVE
36        waveHndl nnH;
37        waveHndl j2H;
38        waveHndl j1H;
39        waveHndl ntH;
40        waveHndl ran_devH;
41        waveHndl inputWaveH;
42        void* tp;                               //unused void for ThreadSafe functions
43        double retVal;          // return value is unused, save for error if needed
44};
45typedef struct MC_Params MC_Params;
46typedef struct MC_Params *MC_ParamsPtr;
47
48#include "XOPStructureAlignmentReset.h"
49
50
51// function prototypes
52int Monte_SANSX(MC_ParamsPtr p);
53int Monte_SANSX2(MC_ParamsPtr p);
54int Monte_SANSX3(MC_ParamsPtr p);
55int Monte_SANSX4(MC_ParamsPtr p);
56int FindPixel(double testQ, double testPhi, double lam, double sdd, double pixSize, double xCtr, double yCtr, long *xPixel, long *yPixel);
57int NewDirection(double *vx, double *vy, double *vz, double theta, double phi);
58double path_len(double aval, double sig_tot);
59float ran1(long *idum);
60float ran3(long *idum);
61float ran1a(long *idum);
62float ran3a(long *idum);
63double locate_interp(double xx[], long n, double x);
Note: See TracBrowser for help on using the repository browser.