Ignore:
Timestamp:
Nov 28, 2007 1:36:27 PM (15 years ago)
Author:
srkline
Message:

Several disjoint changes:

1) Threaded the 1D Cylinder_PolyRadius function
2) in Wrapper, popping the data set list now will auto-pop the function, then the coef to properly update the table of coefficients.
3) tick units in the plots are suppressed (y-axis)
4) Killing data (PlotManager?) now kills the dependent variable so that the rest can be killed
5) Ellipsoid_2D function now has the correct notation of the rotation axis in the parameter names.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/Cylinder_PolyRadius.ipf

    r166 r211  
    7777         
    7878 
    79  
     79// non-threaded version, use the threaded version instead... 
     80// 
    8081//AAO version, uses XOP if available 
    8182// simply calls the original single point calculation with 
    8283// a wave assignment (this will behave nicely if given point ranges) 
    83 Function Cyl_PolyRadius(cw,yw,xw) : FitFunc 
     84Function xCyl_PolyRadius(cw,yw,xw) : FitFunc 
    8485        Wave cw,yw,xw 
    8586         
     
    274275        return(0) 
    275276End 
     277 
     278 
     279 
     280//// experimental threaded version... 
     281// don't try to thread the smeared calculation, it's good enough 
     282// to thread the unsmeared version 
     283 
     284//threaded version of the function 
     285ThreadSafe Function Cyl_PolyRadius_T(cw,yw,xw,p1,p2) 
     286        WAVE cw,yw,xw 
     287        Variable p1,p2 
     288         
     289#if exists("Cyl_PolyRadiusX") 
     290        yw[p1,p2] = Cyl_PolyRadiusX(cw,xw) 
     291#else 
     292        yw[p1,p2] = fCyl_PolyRadius(cw,xw) 
     293#endif 
     294 
     295        return 0 
     296End 
     297 
     298// 
     299//  Fit function that is actually a wrapper to dispatch the calculation to N threads 
     300// 
     301// nthreads is 1 or an even number, typically 2 
     302// it doesn't matter if npt is odd. In this case, fractional point numbers are passed 
     303// and the wave indexing works just fine - I tested this with test waves of 7 and 8 points 
     304// and the points "2.5" and "3.5" evaluate correctly as 2 and 3 
     305// 
     306Function Cyl_PolyRadius(cw,yw,xw) : FitFunc 
     307        Wave cw,yw,xw 
     308         
     309        Variable npt=numpnts(yw) 
     310        Variable i,nthreads= ThreadProcessorCount 
     311        variable mt= ThreadGroupCreate(nthreads) 
     312 
     313//      Variable t1=StopMSTimer(-2) 
     314         
     315        for(i=0;i<nthreads;i+=1) 
     316        //      Print (i*npt/nthreads),((i+1)*npt/nthreads-1) 
     317                ThreadStart mt,i,Cyl_PolyRadius_T(cw,yw,xw,(i*npt/nthreads),((i+1)*npt/nthreads-1)) 
     318        endfor 
     319 
     320        do 
     321                variable tgs= ThreadGroupWait(mt,100) 
     322        while( tgs != 0 ) 
     323 
     324        variable dummy= ThreadGroupRelease(mt) 
     325         
     326//      Print "elapsed time = ",(StopMSTimer(-2) - t1)/1e6 
     327         
     328        return(0) 
     329End 
Note: See TracChangeset for help on using the changeset viewer.