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

Go to the source code of this file.

Functions/Subroutines

program __smashskelsmallfileno.f__
 
subroutine distribute (n)
 
subroutine memoforcpu (n)
 
subroutine issuemsg (n)
 
subroutine sortbyerg
 
subroutine movetrack (f, t)
 

Function/Subroutine Documentation

◆ __smashskelsmallfileno.f__()

program __smashskelsmallfileno.f__ ( )

Definition at line 42 of file smashSkelSmallFileNo.f.

References cerrormsg(), copenf(), copenfw2(), cpupw(), distribute(), i, issuemsg(), kgetenv2(), klena(), ksplit(), maxp, memoforcpu(), movetrack(), n, sortbyerg(), and true.

42  type(child):: cc
Definition: Zprivate.h:25
Here is the call graph for this function:

◆ distribute()

subroutine distribute ( integer  n)

Definition at line 207 of file smashSkelSmallFileNo.f.

References cerrormsg(), cpupw(), erg, idx(), idxlocal(), kqsortd(), ksortinv(), sumergi(), and sumergw().

207  implicit none
208 #include "Ztrack.h"
209  include "../../SkelFlesh/Zprivate.h"
210  include "Zprivate2.h"
211  integer i, k
212  integer n, j
213 
214  do i = 1, ncpu
215  sumergi(i)= 0.
216  sumergw(i) = 0.
217  noncpu(i) = 0
218  enddo
219  do i = 1, n
220 ! max energy ptcl for i-th cpu
221  sumergi(i) = erg(idx(i))
222  sumergw(i) = erg(idx(i)) / cpupw(i)
223  noncpu(i) = 1
224  idxlist(1, i) = idx(i)
225  idxlocal(i) = i
226  enddo
227 ! if all cpupw =1, next two not needed
228  call kqsortd(sumergw, idxlocal, n)
229  call ksortinv(idxlocal, n)
230 
231 !///////////
232 ! write(0,*) ' top E=',(sumergi(i), i=1, n)
233 ! write(0,*) ' idx=',(idx(i), i=1, n)
234 !////////
235 ! next explanation is for cpupw = 1
236 ! erg idx sumergi idxlocal nOnCpu idxlist
237 ! 1,1
238 ! 1 9 5 30 1 1 5
239 ! 2 1 3 18 2 1 3
240 ! n 3 18 7 15 3 1 7
241 ! 4 5 8
242 ! 5 30 1
243 ! 6 4 4
244 ! 7 15
245 ! 8 13
246 ! .
247 ! .
248 ! . 6
249 ! ctc . 2
250 !
251 ! after j= 4
252 ! sumergi idxlocal nOnCpu idxlist
253 ! 1 2
254 ! 30 1 1 5
255 ! 18 2 1 3
256 ! 28 3 2 7 8
257 ! after j=5
258 ! sumergi idxlocal nOnCpu idxlist
259 ! 1 2
260 ! 30 1 1 5
261 ! 27 3 2 3 1
262 ! 28 2 2 7 8
263 ! after j=6
264 ! sumergi idxlocal nOnCpu idxlist
265 ! 1 2 3
266 ! 30 1 1 5
267 ! 32 3 3 3 1 4
268 ! 28 2 2 7 8
269 !
270  do j = n+1, ctc
271  if(n .ge. 2) then
272  if( sumergw( idxlocal(n) ) .gt.
273  * sumergw( idxlocal(n-1) ) ) then
274  call kqsortd(sumergw, idxlocal, n)
275  call ksortinv(idxlocal, n)
276  endif
277  endif
278  k = idxlocal(n)
279  noncpu( k ) = noncpu( k ) + 1
280  if( noncpu( k ) .gt. maxptclpercpu ) then
281  write(msg, *)
282  * '# of ptcls on a cpu', k, ' exceeded limit=',
283  * maxptclpercpu
284  call cerrormsg(msg, 1)
285  call cerrormsg('Enlarge MaxPtclPerCpu in Zprivate2.h',0)
286  endif
287  idxlist( noncpu(k), k ) = idx(j)
288  sumergw(k) = sumergw(k) + erg(idx(j))/cpupw(k)
289  sumergi(k) = sumergi(k) + erg(idx(j))
290  enddo
291 
subroutine cerrormsg(msg, needrtn)
Definition: cerrorMsg.f:4
nodes i
averg real * sumergi(MaxCPU)
averg real MaxCPU integer idx(Maxp)
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code kiron data j
Definition: cblkHeavy.h:36
subroutine kqsortd(A, ORD, N)
Definition: kqsortd.f:23
subroutine ksortinv(idx, n)
Definition: ksortinv.f:2
averg real sumergw(MaxCPU)
averg real MaxCPU integer idxlocal(MaxCPU) integer numba(MaxCPU) integer ctc
float erg[maxp]
Definition: Zprivate.h:7
averg real cpupw(MaxCPU) integer nOnCpu(MaxCPU) integer idxlist(MaxPtclPerCpu
integer n
Definition: Zcinippxc.h:1
Here is the call graph for this function:

◆ issuemsg()

subroutine issuemsg ( integer  n)

Definition at line 342 of file smashSkelSmallFileNo.f.

References cerrormsg(), cpupw(), and sumergi().

342  implicit none
343 #include "Ztrack.h"
344  include "../../SkelFlesh/Zprivate.h"
345  include "Zprivate2.h"
346 
347  integer n
348  integer i
349 
350  msg = ' cpu# cpuPW Sum E # of ptcls'
351 ! msg = 'cpu# Sum E # of ptcls'
352  call cerrormsg(msg, 1)
353  do i = 1, n
354  write(msg,'(i4, f7.1, g16.7, i9)')
355 ! write(msg,'(i3, g16.7, i9)')
356  * i, cpupw(i), sumergi(i), noncpu(i)
357 ! * i, sumergi(i), nOnCpu(i)
358  call cerrormsg(msg, 1)
359  enddo
subroutine cerrormsg(msg, needrtn)
Definition: cerrorMsg.f:4
nodes i
averg real * sumergi(MaxCPU)
averg real cpupw(MaxCPU) integer nOnCpu(MaxCPU) integer idxlist(MaxPtclPerCpu
integer n
Definition: Zcinippxc.h:1
Here is the call graph for this function:

◆ memoforcpu()

subroutine memoforcpu ( integer  n)

Definition at line 295 of file smashSkelSmallFileNo.f.

295  implicit none
296 #include "Ztrack.h"
297  include "../../SkelFlesh/Zprivate.h"
298  include "Zprivate2.h"
299 
300  integer n
301  integer navob, navobc
302  integer i, j
303 
304 
305 
306 ! we distribute Np observed ptcls (at skeleton making time)
307 ! almost equally to n cpu;
308 ! number of average ptcls
309 
310 ! navob = max(Np/n, 1)
311  navob = max(np/ncpu, 1)
312  if( np .eq. 0 ) navob = 0
313  navobc = 0
314  do i = 1, ncpu
315  if(navobc+navob .gt. np .or. i .eq. n ) then
316  navob = np - navobc
317  endif
318  write(basefn+i) navob
319  do j = navobc +1, navobc+navob
320 
321  write(basefn+i) oo(j)
322  enddo
323  navobc = navobc + navob
324  enddo
325  do i = 1, ncpu
326 !cc if(i .eq. 1) then
327 ! for the first skeleton, put observed ptcls
328 !c write(basefn+i) Np
329 !c do j = 1, Np
330 !c write(basefn+1) oo(j)
331 !c enddo
332 !c else
333 !c write(basefn+i) 0
334 !c endif
335  write(basefn+i) noncpu(i)
336  do j = 1, noncpu(i)
337  write(basefn+i) ct( idxlist(j, i) )
338  enddo
339  enddo
nodes i
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code kiron data j
Definition: cblkHeavy.h:36
integer n
Definition: Zcinippxc.h:1

◆ movetrack()

subroutine movetrack ( type(child f,
type(track t 
)

Definition at line 399 of file smashSkelSmallFileNo.f.

References asflag, charge, code, colheight, cresetdirec(), depth, height, mass, p, r, radiallen, subcode, sys, wgt, and xyz.

399  implicit none
400 #include "Ztrack.h"
401 #include "Zearth.h"
402  include "../../SkelFlesh/Zprivate.h"
403  include "Zprivate2.h"
404 
405  type(child):: f
406  type(track):: t
407 
408  t.p.code = f.code
409  t.p.subcode = f.subcode
410  t.p.charge = f.charge
411  t.p.fm.p(1) = f.fm(1)
412  t.p.fm.p(2) = f.fm(2)
413  t.p.fm.p(3) = f.fm(3)
414  t.p.fm.p(4) = f.fm(4)
415  t.p.mass = f.mass
416  t.pos.xyz.r(1) = pp.posx
417  t.pos.xyz.r(2) = pp.posy
418  t.pos.xyz.r(3) = pp.posz
419 
420  t.pos.depth = pp.depth
421  t.pos.height = pp.height
422  t.pos.colheight = pp.colheight
423  t.t = pp.atime
424  t.where = pp.where
425  t.pos.radiallen =
426  * eradius + pp.height
427  t.pos.xyz.sys = 'xyz'
428  t.vec.w.sys = 'xyz'
429  t.wgt = 1.0
430  t.asflag = 0
431 ! t.user = pp.user
432  call cresetdirec( t )
*Zfirst p fm *Zfirst p Zfirst p Zfirst p *Zfirst p *Zfirst pos xyz Zfirst pos xyz *Zfirst pos *Zfirst pos depth
Definition: ZavoidUnionMap.h:1
*Zfirst p fm *Zfirst p Zfirst p Zfirst p *Zfirst p *Zfirst pos xyz Zfirst pos xyz *Zfirst pos *Zfirst pos Zfirst pos *Zfirst pos colheight
Definition: ZavoidUnionMap.h:1
*Zfirst p fm *Zfirst p Zfirst p Zfirst p *Zfirst p *Zfirst pos xyz r
Definition: ZavoidUnionMap.h:1
latitude latitude this system is used *****************************************************************! type coord sequence union map real z z in m endmap xyz map real ! latitude in deg is to the north ! longitude in deg is to the east *h ! height in m endmap llh map real ! polar angle ! azimuthal angle *radius ! radial distance endmap sph endunion character *sys ! which system xyz
Definition: Zcoord.h:25
Definition: Ztrack.h:44
*Zfirst p fm *Zfirst p Zfirst p Zfirst p *Zfirst p *Zfirst pos xyz Zfirst pos xyz sys
Definition: ZavoidUnionMap.h:1
subroutine cresetdirec(aTrack)
Definition: cresetDirec.f:5
********************block data cblkHeavy ********************integer j data *HeavyG2symbol p
Definition: cblkHeavy.h:7
*Zfirst p fm *Zfirst p Zfirst p Zfirst p *Zfirst p *Zfirst pos xyz Zfirst pos xyz *Zfirst pos *Zfirst pos Zfirst pos *Zfirst pos *Zfirst Zfirst vec w *Zfirst vec w Zfirst vec *Zfirst Zfirst Zfirst asflag
Definition: ZavoidUnionMap.h:1
*Zfirst p fm *Zfirst p Zfirst p code
Definition: ZavoidUnionMap.h:1
*Zfirst p fm *Zfirst p Zfirst p Zfirst p *Zfirst p *Zfirst pos xyz Zfirst pos xyz *Zfirst pos *Zfirst pos Zfirst pos height
Definition: ZavoidUnionMap.h:1
*Zfirst p fm *Zfirst p Zfirst p Zfirst p *Zfirst p charge
Definition: ZavoidUnionMap.h:1
Definition: Zprivate.h:25
nodes t
*Zfirst p fm *Zfirst p mass
Definition: ZavoidUnionMap.h:1
*Zfirst p fm *Zfirst p Zfirst p Zfirst p *Zfirst p *Zfirst pos xyz Zfirst pos xyz *Zfirst pos *Zfirst pos Zfirst pos *Zfirst pos *Zfirst Zfirst vec w *Zfirst vec w Zfirst vec *Zfirst wgt
Definition: ZavoidUnionMap.h:1
*Zfirst p fm *Zfirst p Zfirst p Zfirst p subcode
Definition: ZavoidUnionMap.h:1
dE dx *! Nuc Int sampling table f
Definition: cblkMuInt.h:130
*Zfirst p fm *Zfirst p Zfirst p Zfirst p *Zfirst p *Zfirst pos xyz Zfirst pos xyz *Zfirst pos radiallen
Definition: ZavoidUnionMap.h:1
Here is the call graph for this function:

◆ sortbyerg()

subroutine sortbyerg ( )

Definition at line 364 of file smashSkelSmallFileNo.f.

References cerrormsg(), erg, idx(), kqsortd(), ksortinv(), and p.

364  implicit none
365 #include "Ztrack.h"
366  include "../../SkelFlesh/Zprivate.h"
367  include "Zprivate2.h"
368 
369  integer i
370 
371  averg = 0.
372  do i = 1, ctc
373  erg(i) = ct(i).p.fm.p(4)
374  averg = averg + erg(i)
375  enddo
376  call kqsortd(erg, idx, ctc)
377 ! high to low
378  call ksortinv(idx, ctc)
379  if(ctc .gt. 0.) then
380 ! average total energy on 1 cpu
381  averg = averg/ctc * ncpu
382  else
383  call cerrormsg('no child',1)
384  return
385  endif
386  if( erg(idx(ctc) ) .gt. averg*1.1 ) then
387 ! max energy is too large. issue
388 ! warning
389  write(msg,*) 'WARGNING: max E=', erg(idx(i)),
390  * ' is > average total energy for 1 cpu=',
391  * averg
392  call cerrormsg(msg, 1)
393  endif
subroutine cerrormsg(msg, needrtn)
Definition: cerrorMsg.f:4
nodes i
averg real MaxCPU integer idx(Maxp)
********************block data cblkHeavy ********************integer j data *HeavyG2symbol p
Definition: cblkHeavy.h:7
subroutine kqsortd(A, ORD, N)
Definition: kqsortd.f:23
subroutine ksortinv(idx, n)
Definition: ksortinv.f:2
float erg[maxp]
Definition: Zprivate.h:7
Here is the call graph for this function: