SPEED
WRITE_FILEOUT_GRID_SV.f90
Go to the documentation of this file.
1! Copyright (C) 2012 The SPEED FOUNDATION
2! Author: Ilario Mazzieri
3!
4! This file is part of SPEED.
5!
6! SPEED is free software; you can redistribute it and/or modify it
7! under the terms of the GNU Affero General Public License as
8! published by the Free Software Foundation, either version 3 of the
9! License, or (at your option) any later version.
10!
11! SPEED is distributed in the hope that it will be useful, but
12! WITHOUT ANY WARRANTY; without even the implied warranty of
13! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14! Affero General Public License for more details.
15!
16! You should have received a copy of the GNU Affero General Public License
17! along with SPEED. If not, see <http://www.gnu.org/licenses/>.
18
30
31 subroutine write_fileout_grid_sv(file_name,file_xyz,count, proc, nv,ncol, &
32 vec,xx,yy,zz,loc_n_num,tstart)
33
34
35
36 character*70 :: file_name, file_xyz
37
38 integer*4 :: count,proc,nv, ncol
39
40 real*8 :: tstart
41 real*8, dimension(nv,ncol) :: vec
42
43 real*8, dimension(nv/6) :: xx,yy,zz
44 integer*4, dimension(nv/6) :: loc_n_num
45
46 character*70 :: out_file, xyz_file
47 integer*4 :: i,lname, lnamexyz
48
49 lname = len_trim(file_name)
50 lnamexyz = len_trim(file_xyz)
51
52 out_file = file_name(1:lname) // '000000_000000.out'
53 xyz_file = file_xyz(1:lname) // '000000.out'
54
55 if (proc .lt. 10) then
56 write(out_file(lname+6:lname+6),'(i1)') proc
57 if(tstart .eq. 0.d0) write(xyz_file(lname+6:lname+6),'(i1)') proc
58 else if (proc .lt. 100) then
59 write(out_file(lname+5:lname+6),'(i2)') proc
60 if(tstart .eq. 0.d0) write(xyz_file(lname+5:lname+6),'(i2)') proc
61 else if (proc .lt. 1000) then
62 write(out_file(lname+4:lname+6),'(i3)') proc
63 if(tstart .eq. 0.d0) write(xyz_file(lname+4:lname+6),'(i3)') proc
64 else if (proc .lt. 10000) then
65 write(out_file(lname+3:lname+6),'(i4)') proc
66 if(tstart .eq. 0.d0) write(xyz_file(lname+3:lname+6),'(i4)') proc
67 else if (proc .lt. 100000) then
68 write(out_file(lname+2:lname+6),'(i5)') proc
69 if(tstart .eq. 0.d0) write(xyz_file(lname+2:lname+6),'(i5)') proc
70 else
71 write(out_file(lname+1:lname+6),'(i6)') proc
72 if(tstart .eq. 0.d0) write(xyz_file(lname+1:lname+6),'(i6)') proc
73 endif
74
75 if (count .lt. 10) then
76 write(out_file(lname+13:lname+13),'(i1)') count
77 else if (count .lt. 100) then
78 write(out_file(lname+12:lname+13),'(i2)') count
79 else if (count .lt. 1000) then
80 write(out_file(lname+11:lname+13),'(i3)') count
81 else if (count .lt. 10000) then
82 write(out_file(lname+10:lname+13),'(i4)') count
83 else if (count .lt. 100000) then
84 write(out_file(lname+9:lname+13),'(i5)') count
85 else
86 write(out_file(lname+8:lname+13),'(i6)') count
87 endif
88
89 open(20+proc, file=out_file)
90 do i = 1,nv
91 write(20+proc,*) vec(i,:)
92 enddo
93 close(20+proc)
94
95
96! write(20+proc,*) loc_n_num(i), xx(i), yy(i), zz(i), &
97! vec(3*(i-1)+1), vec(3*(i-1)+2),vec(3*(i-1)+3)
98 open(20+proc, file=xyz_file)
99 do i = 1,nv/6
100 write(20+proc,*) loc_n_num(i), xx(i), yy(i), zz(i)
101 enddo
102 close(20+proc)
103
104
105
106 return
107
108 end subroutine write_fileout_grid_sv
109
subroutine write_fileout_grid_sv(file_name, file_xyz, count, proc, n
Writes output results for Restart.