COSMOS v7.655  COSMOSv7655
(AirShowerMC)
kcsr1idx.f File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine kcsr1idx (a, nrec, idx, ad)
 

Function/Subroutine Documentation

◆ kcsr1idx()

subroutine kcsr1idx ( real*8, dimension(nrec)  a,
integer  nrec,
integer, dimension(nrec)  idx,
character*(*)  ad 
)

Definition at line 42 of file kcsr1idx.f.

References false, and true.

42  implicit none
43 
44  integer nrec
45  real*8 a(nrec) ! input. unchagned
46  integer idx(nrec) ! outut. a(k) is to be moved idx(k)-th position.
47  ! ,that is, a(idx(k)) is the k-th largest or
48  ! smallest among a.
49  character*(*) ad
50 
51  integer j, k, gap, imax, i
52  real*8 x, sf/1.30/
53  logical exch, more
54 
55  gap=nrec
56  more=.true.
57  do i = 1, nrec
58  idx(i) = i
59  enddo
60 
61  do while( more )
62  gap=float(gap)/sf
63  if(gap .le. 0) then
64  gap=1
65  elseif(gap .eq. 9 .or. gap .eq. 10) then
66  gap=11
67  endif
68  imax=nrec - gap
69  exch = .false.
70  do j=1, imax
71  k=j+gap
72  if(ad .eq. 'a') then
73  if(a(idx(j)) .gt. a(idx(k))) then
74  x =idx(j)
75  idx(j) = idx(k)
76  idx(k) = x
77  exch = .true.
78  endif
79  else
80  if(a(idx(j)) .lt. a(idx(k))) then
81  x = idx(j)
82  idx(j) = idx(k)
83  idx(k) = x
84  exch = .true.
85  endif
86  endif
87  enddo
88  more=exch .or. gap .ne. 1
89  enddo
nodes i
block data cblkElemag data *AnihiE ! Eposi< 1 TeV, anihilation considered *X0/365.667/, ! radiation length of air in kg/m2 *Ecrit/81.e-3/, ! critical energy of air in GeV *MaxComptonE/1./, ! compton is considered below 1 GeV *MaxPhotoE/1.e-3/, ! above this, PhotoElectric effect neg. *MinPhotoProdE/153.e-3/, ! below 153 MeV, no gp --> hadrons ! scattering const not MeV *Knockon true
Definition: cblkElemag.h:7
averg real MaxCPU integer idx(Maxp)
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code kiron data j
Definition: cblkHeavy.h:36
real(4), save a
Definition: cNRLAtmos.f:20
block data cblkElemag data *AnihiE ! Eposi< 1 TeV, anihilation considered *X0/365.667/, ! radiation length of air in kg/m2 *Ecrit/81.e-3/, ! critical energy of air in GeV *MaxComptonE/1./, ! compton is considered below 1 GeV *MaxPhotoE/1.e-3/, ! above this, PhotoElectric effect neg. *MinPhotoProdE/153.e-3/, ! below 153 MeV, no gp --> hadrons ! scattering const not MeV *Knockon ! knockon is considered Obsolete *PhotoProd false
Definition: cblkElemag.h:7
! structure defining a particle at production ! Basic idea of what is to be contained in ! the particle structue is that dynamical ones should be included those derivable from the particle code ! is not included ******************************************************type fmom momentum sequence union map real e endmap map real * x
Definition: Zptcl.h:21