Changeset 997 for sans/XOP_Dev/MonteCarlo
- Timestamp:
- May 11, 2016 3:39:08 PM (7 years ago)
- Location:
- sans/XOP_Dev/MonteCarlo
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/XOP_Dev/MonteCarlo/DebyeSpheres.c
r834 r997 10 10 11 11 // Prototypes 12 HOST_IMPORT int main(IORecHandle ioRecHandle);12 HOST_IMPORT int XOPMain(IORecHandle ioRecHandle); 13 13 14 14 // Custom error codes … … 34 34 double ival; //output intensity value 35 35 double *xv,*yv,*zv,*rv; //pointers to input xyz-rho coordinates 36 int i,j;37 int npt;36 CountInt i,j; 37 CountInt npt; 38 38 double rval,grid,vol,fQR,dum,dij; 39 39 … … 106 106 107 107 // 108 npt = ( int) WavePoints(p->xwavH); //wavePoints returns long, number of XYZ points108 npt = (CountInt) WavePoints(p->xwavH); //wavePoints returns long, number of XYZ points 109 109 xv = (double*)WaveData(p->xwavH); //xyz locations 110 110 yv = (double*)WaveData(p->ywavH); … … 170 170 double dmax,dij; //output dmax value, dij 171 171 double *xv,*yv,*zv; //pointers to input xyz coordinates 172 int i,j;173 int npt;174 int p1,p2;172 CountInt i,j; 173 CountInt npt; 174 CountInt p1,p2; 175 175 176 176 // check for all of the required waves … … 203 203 204 204 // 205 npt = ( int) WavePoints(p->xwavH); //wavePoints returns long, number of XYZ points205 npt = (CountInt) WavePoints(p->xwavH); //wavePoints returns long, number of XYZ points 206 206 xv = (double*)WaveData(p->xwavH); //xyz locations 207 207 yv = (double*)WaveData(p->ywavH); 208 208 zv = (double*)WaveData(p->zwavH); 209 209 210 p1 = ( int) p->p1;211 p2 = ( int) p->p2;210 p1 = (CountInt) p->p1; 211 p2 = (CountInt) p->p2; 212 212 213 213 dmax = 0; … … 240 240 { 241 241 double *xv,*yv,*zv,*bv; //pointers to input xyz coordinates 242 int i,j;243 int npt,numBins,binIndex;242 CountInt i,j; 243 CountInt npt,numBins,binIndex; 244 244 double grid,binWidth,val; 245 int p1,p2;245 CountInt p1,p2; 246 246 247 247 … … 284 284 285 285 // 286 npt = ( int) WavePoints(p->xwavH); //wavePoints returns long, number of XYZ points287 numBins = ( int) WavePoints(p->bwavH); //wavePoints returns long, number of points in bin wave288 p1 = ( int) p->p1;289 p2 = ( int) p->p2;286 npt = (CountInt) WavePoints(p->xwavH); //wavePoints returns long, number of XYZ points 287 numBins = (CountInt) WavePoints(p->bwavH); //wavePoints returns long, number of points in bin wave 288 p1 = (CountInt) p->p1; 289 p2 = (CountInt) p->p2; 290 290 291 291 … … 302 302 for(j=(i+1);j<npt;j+=1) { 303 303 val = XYZDistance(xv[i],xv[j],yv[i],yv[j],zv[i],zv[j])*grid; 304 binIndex = ( int)(val/binWidth-0.5);304 binIndex = (CountInt)(val/binWidth-0.5); 305 305 if(binIndex > numBins -1 ) { 306 306 //Print "bad index" … … 332 332 double *xv,*yv,*zv; //pointers to input xyz coordinates 333 333 double *rho,*SLDLook,*PSFid; // rho and the SLD lookup vector 334 int i,j;335 int npt,numBins,binIndex;334 CountInt i,j; 335 CountInt npt,numBins,binIndex; 336 336 double grid,binWidth,val,retVal; 337 int p1,p2;338 int intSLD;337 CountInt p1,p2; 338 CountInt intSLD; 339 339 340 340 … … 344 344 // long dimensionSizes[MAX_DIMENSIONS+1]; 345 345 double value[2]; // Pointers used for double data. 346 longindices[MAX_DIMENSIONS];346 IndexInt indices[MAX_DIMENSIONS]; 347 347 // 348 longrhoi,rhoj,rii,rji,PSFIndex;348 CountInt rhoi,rhoj,rii,rji,PSFIndex; 349 349 350 350 … … 417 417 PSFwavH = p->PSFidH; 418 418 419 npt = ( int) WavePoints(p->xwavH); //wavePoints returns long, number of XYZ points420 numBins = ( int) WavePoints(p->bwavH); //wavePoints returns long, number of points in bin wave419 npt = (CountInt) WavePoints(p->xwavH); //wavePoints returns long, number of XYZ points 420 numBins = (CountInt) WavePoints(p->bwavH); //wavePoints returns long, number of points in bin wave 421 421 422 422 xv = (double*)WaveData(p->xwavH); //xyz locations … … 427 427 PSFid = (double*)WaveData(p->PSFidH); //this one is 2D 428 428 429 p1 = ( int) p->p1;430 p2 = ( int) p->p2;431 432 intSLD = ( int) p->minSLD; //convert to int for use as index429 p1 = (CountInt) p->p1; 430 p2 = (CountInt) p->p2; 431 432 intSLD = (CountInt) p->minSLD; //convert to int for use as index 433 433 434 434 grid = p->grid; … … 439 439 for(j=(i+1);j<npt;j+=1) { 440 440 val = XYZDistance(xv[i],xv[j],yv[i],yv[j],zv[i],zv[j])*grid; 441 binIndex = ( int)(val/binWidth-0.5);441 binIndex = (CountInt)(val/binWidth-0.5); 442 442 if(binIndex > numBins -1 ) { 443 443 //Print "bad index" 444 444 } else { 445 rhoi = ( long) rho[i]; //get the rho value at i and j446 rhoj = ( long) rho[j];447 rii = ( long) SLDLook[rhoi+intSLD]; //rho i index448 rji = ( long) SLDLook[rhoj+intSLD]; //rho j index445 rhoi = (CountInt) rho[i]; //get the rho value at i and j 446 rhoj = (CountInt) rho[j]; 447 rii = (CountInt) SLDLook[rhoi+intSLD]; //rho i index 448 rji = (CountInt) SLDLook[rhoj+intSLD]; //rho j index 449 449 MemClear(indices, sizeof(indices)); // Must be 0 for unused dimensions. 450 indices[0] = rii;451 indices[1] = rji;450 indices[0] = (IndexInt)rii; 451 indices[1] = (IndexInt)rji; 452 452 if (retVal = MDGetNumericWavePointValue(PSFwavH, indices, value)) 453 453 return retVal; 454 454 //PSFIndex = (long) PSFid[rii][rji]; //doesn't work 455 PSFIndex = ( long) value[0];455 PSFIndex = (CountInt) value[0]; 456 456 457 457 //now do the assignment to the 2D … … 459 459 460 460 MemClear(indices, sizeof(indices)); // Must be 0 for unused dimensions. 461 indices[0] = binIndex;462 indices[1] = PSFIndex;461 indices[0] = (IndexInt)binIndex; 462 indices[1] = (IndexInt)PSFIndex; 463 463 if (retVal = MDGetNumericWavePointValue(wavH, indices, value)) 464 464 return retVal; -
sans/XOP_Dev/MonteCarlo/MonteCarlo.c
r834 r997 32 32 double retVal; //return value 33 33 34 longimon;34 SInt64 imon; 35 35 double r1,r2,xCtr,yCtr,sdd,pixSize,thick,wavelength,sig_incoh,sig_sas; 36 longind,index,n_index;36 IndexInt ind,index,n_index; 37 37 double qmax,theta_max,q0,zpow; 38 longn1,n2,n3;38 CountInt n1,n2,n3; 39 39 double dth,zz,xx,yy,phi; 40 40 double theta,ran,ll,rr; 41 longdone,find_theta,err; //used as logicals42 longxPixel,yPixel;41 int done,find_theta,err; //used as logicals 42 int xPixel,yPixel; 43 43 double vx,vy,vz,theta_z; 44 44 double sig_abs,ratio,sig_total; 45 45 double testQ,testPhi,left,delta,dummy,pi; 46 46 double sigabs_0,num_bins; 47 longNSingleIncoherent,NSingleCoherent,NScatterEvents,incoherentEvent,coherentEvent;48 longNDoubleCoherent,NMultipleScatter,isOn,xCtr_long,yCtr_long;49 longNMultipleCoherent,NCoherentEvents;47 CountInt NSingleIncoherent,NSingleCoherent,NScatterEvents,incoherentEvent,coherentEvent; 48 CountInt NDoubleCoherent,NMultipleScatter,isOn,xCtr_long,yCtr_long; 49 CountInt NMultipleCoherent,NCoherentEvents; 50 50 double deltaLam,v1,v2,currWavelength,rsq,fac; //for simulating wavelength distribution 51 51 double ssd, sourAp, souXX, souYY, magn; //source-to-sample, and source Ap radius for initlal trajectory … … 63 63 // long dataOffset; 64 64 // long numRows, numColumns; 65 longnumRows_ran_dev;65 CountInt numRows_ran_dev; 66 66 // double *dp0, *dp; 67 67 double value[2]; // Pointers used for double data. 68 longseed;69 longindices[MAX_DIMENSIONS];68 SInt32 seed; 69 IndexInt indices[MAX_DIMENSIONS]; 70 70 71 71 // char buf[256]; … … 120 120 results = (double*)WaveData(p->resultsH); 121 121 122 seed = ( long)results[0];122 seed = (SInt32)results[0]; 123 123 124 124 // sprintf(buf, "input seed = %ld\r", seed); … … 132 132 seed = 12348765; //non-negative after that does nothing 133 133 134 imon = ( int)inputWave[0];134 imon = (SInt64)inputWave[0]; 135 135 r1 = inputWave[1]; 136 136 r2 = inputWave[2]; … … 147 147 sourAp = inputWave[13]; // radius, in cm, like r1 and r2 148 148 149 xCtr_long = ( long)(xCtr+0.5); //round() not defined in VC8150 yCtr_long = ( long)(yCtr+0.5); // and is probably wrong to use anyways (returns double!)149 xCtr_long = (CountInt)(xCtr+0.5); //round() not defined in VC8 150 yCtr_long = (CountInt)(yCtr+0.5); // and is probably wrong to use anyways (returns double!) 151 151 152 152 dummy = MDGetWaveScaling(p->ran_devH, 0, &delta, &left); //0 is the rows … … 378 378 //Choose index for scattering angle array. 379 379 //IND = NINT(THETA_z/DTH + 0.4999999) 380 ind = ( long)(theta_z/dth + 0.4999999); //round is eqivalent to nint()380 ind = (IndexInt)(theta_z/dth + 0.4999999); //round is eqivalent to nint() 381 381 nt[ind] += 1; //Increment bin for angle. 382 382 //Increment angle array for single scattering events. -
sans/XOP_Dev/MonteCarlo/MonteCarlo.h
r834 r997 21 21 /* Prototypes */ 22 22 // for TK6 23 HOST_IMPORT int main(IORecHandle ioRecHandle);23 HOST_IMPORT int XOPMain(IORecHandle ioRecHandle); 24 24 25 25 26 //#define OLD_IGOR 1 + FIRST_XOP_ERR26 #define OLD_IGOR 1 + FIRST_XOP_ERR 27 27 #define NON_EXISTENT_WAVE 2 + FIRST_XOP_ERR 28 28 #define NEEDS_2D_WAVE 3 + FIRST_XOP_ERR … … 55 55 int Monte_SANSX4(MC_ParamsPtr p); 56 56 57 longMC_round(double x);58 int FindPixel(double testQ, double testPhi, double lam, double yg_d, double sdd, double pixSize, double xCtr, double yCtr, long *xPixel, long*yPixel);57 int MC_round(double x); 58 int FindPixel(double testQ, double testPhi, double lam, double yg_d, double sdd, double pixSize, double xCtr, double yCtr, int *xPixel, int *yPixel); 59 59 int NewDirection(double *vx, double *vy, double *vz, double theta, double phi); 60 60 double path_len(double aval, double sig_tot); 61 float ran1( long*idum);62 float ran3( long*idum);63 float ran1a( long*idum);64 float ran3a( long*idum);65 double locate_interp(double xx[], longn, double x);61 float ran1(SInt32 *idum); 62 float ran3(SInt32 *idum); 63 float ran1a(SInt32 *idum); 64 float ran3a(SInt32 *idum); 65 double locate_interp(double xx[], IndexInt n, double x); -
sans/XOP_Dev/MonteCarlo/MonteCarlo.r
r974 r997 8 8 9 9 resource 'vers' (2) { /* Igor version info */ 10 0x05, 0x00, release, 0x00, 0, /* version bytes and country integer */11 "5.00",12 "(for Igor 5.00 or later)"10 0x06, 0x20, release, 0x00, 0, /* version bytes and country integer */ 11 "6.20", 12 "(for Igor 6.20 or later)" 13 13 }; 14 14 … … 16 16 { 17 17 /* [1] */ 18 "SANSMonteCarlo requires Igor Pro 6. 1or later.",18 "SANSMonteCarlo requires Igor Pro 6.2 or later.", 19 19 /* [2] */ 20 20 "Wave does not exist.", -
sans/XOP_Dev/MonteCarlo/MonteCarlo2.c
r834 r997 35 35 double retVal; //return value 36 36 37 longimon;37 SInt64 imon; 38 38 double r1,r2,xCtr,yCtr,sdd,pixSize,thick,wavelength,sig_incoh,sig_sas; 39 longind,index,n_index;39 IndexInt ind,index,n_index; 40 40 double qmax,theta_max,q0,zpow; 41 longn1,n2,n3;41 CountInt n1,n2,n3; 42 42 double dth,zz,xx,yy,phi; 43 43 double theta,ran,ll,rr; 44 longdone,find_theta,err; //used as logicals45 longxPixel,yPixel;44 int done,find_theta,err; //used as logicals 45 int xPixel,yPixel; 46 46 double vx,vy,vz,theta_z; 47 47 double sig_abs,ratio,sig_total; 48 48 double testQ,testPhi,left,delta,dummy,pi; 49 49 double sigabs_0,num_bins; 50 longNSingleIncoherent,NSingleCoherent,NScatterEvents,incoherentEvent,coherentEvent;51 longNDoubleCoherent,NMultipleScatter,isOn,xCtr_long,yCtr_long;52 longNMultipleCoherent,NCoherentEvents;50 CountInt NSingleIncoherent,NSingleCoherent,NScatterEvents,incoherentEvent,coherentEvent; 51 CountInt NDoubleCoherent,NMultipleScatter,isOn,xCtr_long,yCtr_long; 52 CountInt NMultipleCoherent,NCoherentEvents; 53 53 double deltaLam,v1,v2,currWavelength,rsq,fac; //for simulating wavelength distribution 54 54 double ssd, sourAp, souXX, souYY, magn; //source-to-sample, and source Ap radius for initlal trajectory … … 66 66 // long dataOffset; 67 67 // long numRows, numColumns; 68 longnumRows_ran_dev;68 CountInt numRows_ran_dev; 69 69 // double *dp0, *dp; 70 70 double value[2]; // Pointers used for double data. 71 longseed;72 longindices[MAX_DIMENSIONS];71 SInt32 seed; 72 IndexInt indices[MAX_DIMENSIONS]; 73 73 74 74 // char buf[256]; … … 123 123 results = (double*)WaveData(p->resultsH); 124 124 125 seed = ( long)results[0];125 seed = (SInt32)results[0]; 126 126 127 127 // sprintf(buf, "input seed = %ld\r", seed); … … 135 135 seed = 12348765; //non-negative after that does nothing 136 136 137 imon = ( int)inputWave[0];137 imon = (SInt64)inputWave[0]; 138 138 r1 = inputWave[1]; 139 139 r2 = inputWave[2]; … … 150 150 sourAp = inputWave[13]; // radius, in cm, like r1 and r2 151 151 152 xCtr_long = ( long)(xCtr+0.5);153 yCtr_long = ( long)(yCtr+0.5);152 xCtr_long = (CountInt)(xCtr+0.5); 153 yCtr_long = (CountInt)(yCtr+0.5); 154 154 155 155 dummy = MDGetWaveScaling(p->ran_devH, 0, &delta, &left); //0 is the rows … … 380 380 //Choose index for scattering angle array. 381 381 //IND = NINT(THETA_z/DTH + 0.4999999) 382 ind = ( long)(theta_z/dth + 0.4999999); //round is eqivalent to nint()382 ind = (IndexInt)(theta_z/dth + 0.4999999); //round is eqivalent to nint() 383 383 nt[ind] += 1; //Increment bin for angle. 384 384 //Increment angle array for single scattering events. -
sans/XOP_Dev/MonteCarlo/MonteCarlo3.c
r834 r997 34 34 double retVal; //return value 35 35 36 longimon;36 SInt64 imon; 37 37 double r1,r2,xCtr,yCtr,sdd,pixSize,thick,wavelength,sig_incoh,sig_sas; 38 longind,index,n_index;38 IndexInt ind,index,n_index; 39 39 double qmax,theta_max,q0,zpow; 40 longn1,n2,n3;40 CountInt n1,n2,n3; 41 41 double dth,zz,xx,yy,phi; 42 42 double theta,ran,ll,rr; 43 longdone,find_theta,err; //used as logicals44 longxPixel,yPixel;43 int done,find_theta,err; //used as logicals 44 int xPixel,yPixel; 45 45 double vx,vy,vz,theta_z; 46 46 double sig_abs,ratio,sig_total; 47 47 double testQ,testPhi,left,delta,dummy,pi; 48 48 double sigabs_0,num_bins; 49 longNSingleIncoherent,NSingleCoherent,NScatterEvents,incoherentEvent,coherentEvent;50 longNDoubleCoherent,NMultipleScatter,isOn,xCtr_long,yCtr_long;51 longNMultipleCoherent,NCoherentEvents;49 CountInt NSingleIncoherent,NSingleCoherent,NScatterEvents,incoherentEvent,coherentEvent; 50 CountInt NDoubleCoherent,NMultipleScatter,isOn,xCtr_long,yCtr_long; 51 CountInt NMultipleCoherent,NCoherentEvents; 52 52 double deltaLam,v1,v2,currWavelength,rsq,fac; //for simulating wavelength distribution 53 53 double ssd, sourAp, souXX, souYY, magn; //source-to-sample, and source Ap radius for initlal trajectory … … 64 64 // long dataOffset; 65 65 // long numRows, numColumns; 66 longnumRows_ran_dev;66 CountInt numRows_ran_dev; 67 67 // double *dp0, *dp; 68 68 double value[2]; // Pointers used for double data. 69 longseed;70 longindices[MAX_DIMENSIONS];69 SInt32 seed; 70 IndexInt indices[MAX_DIMENSIONS]; 71 71 72 72 // char buf[256]; … … 121 121 results = (double*)WaveData(p->resultsH); 122 122 123 seed = ( long)results[0];123 seed = (SInt32)results[0]; 124 124 125 125 // sprintf(buf, "input seed = %ld\r", seed); … … 133 133 seed = 12348765; //non-negative after that does nothing 134 134 135 imon = ( int)inputWave[0];135 imon = (SInt64)inputWave[0]; 136 136 r1 = inputWave[1]; 137 137 r2 = inputWave[2]; … … 148 148 sourAp = inputWave[13]; // radius, in cm, like r1 and r2 149 149 150 xCtr_long = ( long)(xCtr+0.5);151 yCtr_long = ( long)(yCtr+0.5);150 xCtr_long = (CountInt)(xCtr+0.5); 151 yCtr_long = (CountInt)(yCtr+0.5); 152 152 153 153 dummy = MDGetWaveScaling(p->ran_devH, 0, &delta, &left); //0 is the rows … … 377 377 //Choose index for scattering angle array. 378 378 //IND = NINT(THETA_z/DTH + 0.4999999) 379 ind = ( long)(theta_z/dth + 0.4999999); //round is eqivalent to nint()379 ind = (IndexInt)(theta_z/dth + 0.4999999); //round is eqivalent to nint() 380 380 nt[ind] += 1; //Increment bin for angle. 381 381 //Increment angle array for single scattering events. -
sans/XOP_Dev/MonteCarlo/MonteCarlo4.c
r834 r997 35 35 double retVal; //return value 36 36 37 longimon;37 SInt64 imon; 38 38 double r1,r2,xCtr,yCtr,sdd,pixSize,thick,wavelength,sig_incoh,sig_sas; 39 longind,index,n_index;39 IndexInt ind,index,n_index; 40 40 double qmax,theta_max,q0,zpow; 41 longn1,n2,n3;41 CountInt n1,n2,n3; 42 42 double dth,zz,xx,yy,phi; 43 43 double theta,ran,ll,rr; 44 longdone,find_theta,err; //used as logicals45 longxPixel,yPixel;44 int done,find_theta,err; //used as logicals 45 int xPixel,yPixel; 46 46 double vx,vy,vz,theta_z; 47 47 double sig_abs,ratio,sig_total; 48 48 double testQ,testPhi,left,delta,dummy,pi; 49 49 double sigabs_0,num_bins; 50 longNSingleIncoherent,NSingleCoherent,NScatterEvents,incoherentEvent,coherentEvent;51 longNDoubleCoherent,NMultipleScatter,isOn,xCtr_long,yCtr_long;52 longNMultipleCoherent,NCoherentEvents;50 CountInt NSingleIncoherent,NSingleCoherent,NScatterEvents,incoherentEvent,coherentEvent; 51 CountInt NDoubleCoherent,NMultipleScatter,isOn,xCtr_long,yCtr_long; 52 CountInt NMultipleCoherent,NCoherentEvents; 53 53 double deltaLam,v1,v2,currWavelength,rsq,fac; //for simulating wavelength distribution 54 54 double ssd, sourAp, souXX, souYY, magn; //source-to-sample, and source Ap radius for initlal trajectory … … 65 65 // long dataOffset; 66 66 // long numRows, numColumns; 67 longnumRows_ran_dev;67 CountInt numRows_ran_dev; 68 68 // double *dp0, *dp; 69 69 double value[2]; // Pointers used for double data. 70 longseed;71 longindices[MAX_DIMENSIONS];70 SInt32 seed; 71 IndexInt indices[MAX_DIMENSIONS]; 72 72 73 73 // char buf[256]; … … 122 122 results = (double*)WaveData(p->resultsH); 123 123 124 seed = ( long)results[0];124 seed = (SInt32)results[0]; 125 125 126 126 // sprintf(buf, "input seed = %ld\r", seed); … … 134 134 seed = 12348765; //non-negative after that does nothing 135 135 136 imon = ( int)inputWave[0];136 imon = (SInt64)inputWave[0]; 137 137 r1 = inputWave[1]; 138 138 r2 = inputWave[2]; … … 149 149 sourAp = inputWave[13]; // radius, in cm, like r1 and r2 150 150 151 xCtr_long = ( long)(xCtr+0.5);152 yCtr_long = ( long)(yCtr+0.5);151 xCtr_long = (CountInt)(xCtr+0.5); 152 yCtr_long = (CountInt)(yCtr+0.5); 153 153 154 154 dummy = MDGetWaveScaling(p->ran_devH, 0, &delta, &left); //0 is the rows … … 379 379 //Choose index for scattering angle array. 380 380 //IND = NINT(THETA_z/DTH + 0.4999999) 381 ind = ( long)(theta_z/dth + 0.4999999); //round is eqivalent to nint()381 ind = (IndexInt)(theta_z/dth + 0.4999999); //round is eqivalent to nint() 382 382 nt[ind] += 1; //Increment bin for angle. 383 383 //Increment angle array for single scattering events. -
sans/XOP_Dev/MonteCarlo/MonteCarlo_Main.c
r974 r997 21 21 // rounds away from zero 22 22 // -- only used in FindPixel 23 longMC_round(double x)23 int MC_round(double x) 24 24 { 25 25 if(x == 0) { 26 return ( long)(0);26 return (int)(0); 27 27 } 28 28 if(x > 0) { 29 return ( long)(x + 0.5f);29 return (int)(x + 0.5f); 30 30 } else { // x < 0 31 return ( long)(x - 0.5f);31 return (int)(x - 0.5f); 32 32 } 33 33 } … … 38 38 int 39 39 FindPixel(double testQ, double testPhi, double lam, double yg_d, double sdd, 40 double pixSize, double xCtr, double yCtr, long *xPixel, long*yPixel) {40 double pixSize, double xCtr, double yCtr, int *xPixel, int *yPixel) { 41 41 42 42 // double theta,dy,dx,qx,qy,pi; … … 152 152 #define RNMX (1.0-EPS) 153 153 154 float ran1( long*idum)154 float ran1(SInt32 *idum) 155 155 { 156 156 int j; 157 longk;158 static longiy=0;159 static longiv[NTAB];157 SInt32 k; 158 static SInt32 iy=0; 159 static SInt32 iv[NTAB]; 160 160 float temp; 161 161 … … 202 202 #define RNMX2 (1.0-EPS2) 203 203 204 float ran1a( long*idum)204 float ran1a(SInt32 *idum) 205 205 { 206 206 int j; 207 longk;208 static longiy=0;209 static longiv[NTAB2];207 SInt32 k; 208 static SInt32 iy=0; 209 static SInt32 iv[NTAB2]; 210 210 float temp; 211 211 … … 248 248 #define FAC (1.0/MBIG) 249 249 250 float ran3( long*idum)250 float ran3(SInt32 *idum) 251 251 { 252 252 static int inext,inextp; 253 static longma[56];253 static SInt32 ma[56]; 254 254 static int iff=0; 255 longmj,mk;255 SInt32 mj,mk; 256 256 int i,ii,k; 257 257 … … 296 296 #define FAC2 (1.0/MBIG2) 297 297 298 float ran3a( long*idum)298 float ran3a(SInt32 *idum) 299 299 { 300 300 static int inext,inextp; 301 static longma[56];301 static SInt32 ma[56]; 302 302 static int iff=0; 303 longmj,mk;303 SInt32 mj,mk; 304 304 int i,ii,k; 305 305 … … 340 340 341 341 // returns the interpolated point value in xx[0,n-1] that has the value x 342 double locate_interp(double xx[], longn, double x)343 { 344 unsigned longju,jm,jl,j;342 double locate_interp(double xx[], IndexInt n, double x) 343 { 344 UInt32 ju,jm,jl,j; 345 345 int ascnd; 346 346 double pt; … … 376 376 XFUNCs added by this XOP. See XOP manual regarding "Direct XFUNCs". 377 377 */ 378 static long378 static XOPIORecResult 379 379 RegisterFunction() 380 380 { 381 381 int funcIndex; 382 382 383 funcIndex = GetXOPItem(0); // Which function is Igor asking about?383 funcIndex = (int)GetXOPItem(0); // Which function is Igor asking about? 384 384 switch (funcIndex) { 385 385 case 0: // 386 return(( long)Monte_SANSX);386 return((XOPIORecResult)Monte_SANSX); 387 387 break; 388 388 case 1: // 389 return(( long)Monte_SANSX2);389 return((XOPIORecResult)Monte_SANSX2); 390 390 break; 391 391 case 2: // 392 return(( long)DebyeSpheresX);392 return((XOPIORecResult)DebyeSpheresX); 393 393 break; 394 394 case 3: // 395 return(( long)Monte_SANSX3);395 return((XOPIORecResult)Monte_SANSX3); 396 396 break; 397 397 case 4: // 398 return(( long)Monte_SANSX4);398 return((XOPIORecResult)Monte_SANSX4); 399 399 break; 400 400 case 5: // 401 return(( long)maxDistanceX);401 return((XOPIORecResult)maxDistanceX); 402 402 break; 403 403 case 6: // 404 return(( long)binDistanceX);404 return((XOPIORecResult)binDistanceX); 405 405 break; 406 406 case 7: // 407 return(( long)SobolX);407 return((XOPIORecResult)SobolX); 408 408 break; 409 409 case 8: // 410 return(( long)binSLDDistanceX);410 return((XOPIORecResult)binSLDDistanceX); 411 411 break; 412 412 case 9: // 413 return(( long)MetropolisX);414 break; 415 } 416 return( NIL);413 return((XOPIORecResult)MetropolisX); 414 break; 415 } 416 return(0); 417 417 } 418 418 … … 421 421 This is the entry point from the host application to the XOP for all messages after the 422 422 INIT message. 423 424 updated for TK7 May2016 423 425 */ 426 //extern "C" void //only use this if file is .cpp 424 427 static void 425 428 XOPEntry(void) 426 429 { 427 longresult = 0;430 XOPIORecResult result = 0; 428 431 429 432 switch (GetXOPMessage()) { … … 445 448 */ 446 449 HOST_IMPORT int 447 main(IORecHandle ioRecHandle)450 XOPMain(IORecHandle ioRecHandle) 448 451 { 449 452 XOPInit(ioRecHandle); // Do standard XOP initialization. 450 453 SetXOPEntry(XOPEntry); // Set entry point for future calls. 451 454 452 if (igorVersion < 6 00) { // Requires Igor Pro 6.00 or later.453 SetXOPResult( IGOR_OBSOLETE);455 if (igorVersion < 620) { // Requires Igor Pro 6.00 or later. 456 SetXOPResult(OLD_IGOR); 454 457 return EXIT_FAILURE; 455 458 }
Note: See TracChangeset
for help on using the changeset viewer.