Can this be solved in a better way? [message #33206] |
Thu, 12 December 2002 01:59 |
Ingo Salzmann
Messages: 10 Registered: December 2002
|
Junior Member |
|
|
Hi!
I am developing software for x-ray diffraction pole figure analysis in order
to simulate the position of the peaks in the pole figures. Therefore I'm
often concerned with arrays like 'allindices_local' generated by this
function below. Its dimension is always different and there are if..then
conditions during the array construction. Meanwhile the whole stuff works
fine, but I'm sure that I could have optimized many things using IDL array
orerations...
Maybe you could give me a hint how to optimize a code like the one below ...
in front of all the way to concentrate arrays seems to me a bit quick'n
dirty ;-)
*****************************************
FUNCTION AutoGenerateHKL, info
i = info.crystaltrigger - 1 ; is just an integer
dummy = 0
FOR h = info.hmin[i],info.hmax[i] DO BEGIN
FOR k = info.kmin[i],info.kmax[i] DO BEGIN
FOR l = info.lmin[i],info.lmax[i] DO BEGIN
IF (dummy EQ 0) THEN BEGIN
dummy = 1
allindices_local =
[info.hmin[i],info.kmin[i],info.lmin[i],1,info.higherharm[i] ]
ENDIF ELSE BEGIN
IF (NOT((h EQ 0) AND (k EQ 0) AND (l EQ 0))) THEN allindices_local =
[[allindices_local], [h,k,l,1,info.higherharm[i]]]
ENDELSE
ENDFOR
ENDFOR
ENDFOR
RETURN, allindices_local
END
*****************************************
Thanx for your effort
Regards,
Ingo
--------------------------------------------------
Ingo Salzmann
Graz University of Technology
Petersgasse 16
Graz - Austria
ingo.salzmann@tugraz.at
--------------------------------------------------
|
|
|