Changeset 974 for sans/XOP_Dev/MonteCarlo
 Timestamp:
 Jan 19, 2016 11:48:55 AM (7 years ago)
 Location:
 sans/XOP_Dev/MonteCarlo
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

sans/XOP_Dev/MonteCarlo/MonteCarlo.r
r815 r974 4 4 0x01, 0x00, final, 0x00, 0, /* version bytes and country integer */ 5 5 "1.00", 6 "1.00, ©1993 WaveMetrics, Inc., all rights reserved."6 "1.00, ï¿œ 1993 WaveMetrics, Inc., all rights reserved." 7 7 }; 8 8 … … 155 155 NT_FP64, // stop index 156 156 }, 157 157 158 "MetropolisX", /* function name */ 159 F_UTIL  F_THREADSAFE  F_EXTERNAL, /* function category == UTILITY */ 160 NT_FP64, /* return value type */ 161 { 162 NT_FP64 + WAVE_TYPE, // UofR 163 NT_FP64 + WAVE_TYPE, // XYZ waves 164 NT_FP64 + WAVE_TYPE, 165 NT_FP64 + WAVE_TYPE, 166 NT_FP64 + WAVE_TYPE, // energy wave 167 NT_FP64, // radius 168 NT_FP64, // tVox 169 NT_FP64, // nVox 170 NT_FP64, // nIterations 171 NT_FP64, // gCount 172 }, 158 173 } 159 174 }; 
sans/XOP_Dev/MonteCarlo/MonteCarlo_Main.c
r834 r974 15 15 #include "MonteCarlo.h" 16 16 #include "DebyeSpheres.h" 17 #include "Metropolis.h" 17 18 18 19 … … 33 34 34 35 36 // corrected Feb 2013 to return values in [0,127] rather than detector coordinates (which are passed in) 37 //  also corrected the pixel calculation 35 38 int 36 39 FindPixel(double testQ, double testPhi, double lam, double yg_d, double sdd, 37 40 double pixSize, double xCtr, double yCtr, long *xPixel, long *yPixel) { 38 41 39 double theta,dy,dx,qx,qy,pi; 40 pi = 4.0*atan(1.0); 42 // double theta,dy,dx,qx,qy,pi; 43 double pi,two_theta,dist,dx,dy; 44 45 pi = 4.0*atan(1.0); 46 47 /* OLD way 41 48 //decompose to qx,qy 42 49 qx = testQ*cos(testPhi); … … 57 64 // *xPixel = lround(xCtr + dx/pixSize); 58 65 *xPixel = MC_round(xCtr + dx/pixSize); 66 67 */ 68 69 // corrected way Feb 2013 70 two_theta = 2.0*asin(testQ*lam/4.0/pi); 71 dist = sdd*tan(two_theta); //hypot in det plane 72 73 dx = dist*cos(testPhi); 74 dy = dist*sin(testPhi); 75 *xPixel = MC_round(dx/pixSize + xCtr); 76 *yPixel = MC_round(dy/pixSize + yCtr + yg_d/pixSize); //shift down due to gravity 77 78 // to array coordinates rather than detector coordinates 79 *xPixel = 1; 80 *yPixel = 1; 81 59 82 60 83 //if on detector, return xPix and yPix values, otherwise 1 … … 387 410 return((long)binSLDDistanceX); 388 411 break; 412 case 9: // 413 return((long)MetropolisX); 414 break; 389 415 } 390 416 return(NIL);
Note: See TracChangeset
for help on using the changeset viewer.