SPEED
WRITE_FILEOUT.f90 File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine write_fileout (file_name, count, proc, nv, vec)
 Writes output results for Restart.
 

Function/Subroutine Documentation

◆ write_fileout()

subroutine write_fileout ( character*70  file_name,
integer*4  count,
integer*4  proc,
integer*4  nv,
real*8, dimension(nv)  vec 
)

Writes output results for Restart.

Author
Ilario Mazzieri
Date
September, 2013
Version
1.0
Parameters
[in,out]file_namedirectory where saving files
[in]countindex for snapshot
[in]procmpi process id
[in]nvnumber of values to print
[in]vecvalues to print

Definition at line 29 of file WRITE_FILEOUT.f90.

30
31
32 character*70 :: file_name
33
34 integer*4 :: count,proc,nv
35 real*8, dimension(nv) :: vec
36
37 character*70 :: out_file
38 integer*4 :: i,lname
39
40 lname = len_trim(file_name)
41 out_file = file_name(1:lname) // '000000_0000.out'
42
43 if (proc .lt. 10) then
44 write(out_file(lname+6:lname+6),'(i1)') proc
45 else if (proc .lt. 100) then
46 write(out_file(lname+5:lname+6),'(i2)') proc
47 else if (proc .lt. 1000) then
48 write(out_file(lname+4:lname+6),'(i3)') proc
49 else if (proc .lt. 10000) then
50 write(out_file(lname+3:lname+6),'(i4)') proc
51 else if (proc .lt. 100000) then
52 write(out_file(lname+2:lname+6),'(i5)') proc
53 else
54 write(out_file(lname+1:lname+6),'(i6)') proc
55 endif
56
57 if (count .lt. 10) then
58 write(out_file(lname+11:lname+11),'(i1)') count
59 else if (proc .lt. 100) then
60 write(out_file(lname+10:lname+11),'(i2)') count
61 else if (proc .lt. 1000) then
62 write(out_file(lname+9:lname+11),'(i3)') count
63 else
64 write(out_file(lname+8:lname+11),'(i4)') count
65 endif
66
67 open(20+proc, file=out_file)
68
69 do i = 1,nv
70 write(20+proc,*) vec(i)
71 enddo
72
73 close(20+proc)
74
75 return
76