next up previous contents index
Next: Loops over a particle Up: Direct access to particles Previous: Example: Loop over all   Contents   Index


Particle name versus integer particle code - time consumption

Using character particle names in function calls makes the code easier to read, but it implies a lookup in a table. Although the lookup is fast, in nested loops it may be desirable to save this time. Consequently, some (not all) functions are provided in two versions: one which expects the particle name as an argument and another which expects the corresponding integer particle code and thus saves the lookup time. The second version is denoted by a ``C'' (= ``Code'') as the 2nd character of the function name.

Using integer particle codes, the example given in section 7.4.2 becomes:


        C ... somewhere in the job or subroutine initialization:
              IP = KPART ('E+')
        C ...
              ITK = KCDIR (IP, KMONTE)
         10   IF (ITK .EQ. 0)  GO TO 90
        C     ... analysis of the e+ ...
              ITK = KFOLLO (ITK)
              GO TO 10
 
         90   CONTINUE ...
IP = KPART('name')
must be called before IP is used. The particle name is the basic reference to a particle. The integer code may change from one job to another.
KCDIR (IP, ICLASS)
First particle with the given particle code in class ICLASS.


next up previous contents index
Next: Loops over a particle Up: Direct access to particles Previous: Example: Loop over all   Contents   Index
Joel Closier
2000-02-07