Guest User

Untitled

a guest
Dec 14th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. subroutine output_header(filename)
  2. use amr_commons
  3. use hydro_commons
  4. use pm_commons
  5. implicit none
  6. include "mpif.h"
  7. integer::info
  8. character(LEN=*)::filename
  9.  
  10. integer::ilun
  11. integer::npart_family_loc(-5:5), npart_family(-5:5), npart_all_loc, npart_all
  12. integer :: ifam, ipart
  13.  
  14. if(verbose)write(*,*)'Entering output_header'
  15.  
  16. ! Compute total number of particles
  17. ! Count number of particles
  18. npart_family_loc = 0; npart_all_loc = 0
  19. [ doing some stuff ]
  20.  
  21. ! myid contains the id of the thread
  22. if (myid == 1) then
  23. ! Open file
  24. open(newunit=ilun,file=trim(filename),form='formatted',status='replace')
  25.  
  26. write(ilun, '(a1,a12,a10)') '#', 'Family', 'Count'
  27. do ifam = -NFAMILIES, NFAMILIES
  28. write(ilun, '(a13, i10)') &
  29. trim(particle_family_keys(ifam)), npart_family(ifam)
  30. end do
  31. write(ilun, '(a13, i10)') &
  32. 'undefined', npart_all - sum(npart_family)
  33.  
  34. [ do more stuff here ]
  35. close(ilun)
  36.  
  37. endif
  38.  
  39. end subroutine output_header
Add Comment
Please, Sign In to add comment