SPEED
WRITE_FILEOUT_PG.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
28
29 subroutine write_fileout_pg(monitor_file,file_name,proc,nv,vec,nvec)
30
31 character*70 :: file_name,monitor_file
32 character*70 :: out_file, out_file_new
33
34 integer*4 :: proc,nv,count,nvec
35 integer*4 :: i,lname
36
37 real*8 :: val
38 real*8, dimension(nv,nvec) :: vec
39
40 count = 0
41 lname = len_trim(file_name)
42 out_file = file_name(1:lname) // '_000_00000.MAP'
43
44 if (count.lt.10) then
45 write(out_file(lname+4:lname+4),'(i1)')count
46 else if (count.le.99) then
47 write(out_file(lname+3:lname+4),'(i2)')count
48 else if (count.le.999) then
49 write(out_file(lname+2:lname+4),'(i3)')count
50 endif
51
52 if (proc.lt.10) then
53 write(out_file(lname+10:lname+10),'(i1)')proc
54 else if (proc.le.99) then
55 write(out_file(lname+9:lname+10),'(i2)')proc
56 else if (proc.le.999) then
57 write(out_file(lname+8:lname+10),'(i3)')proc
58 else if (proc.le.9999) then
59 write(out_file(lname+7:lname+10),'(i4)')proc
60 else if (proc.le.99999) then
61 write(out_file(lname+6:lname+10),'(i5)')proc
62 endif
63
64 if(len_trim(monitor_file) .ne. 70) then
65 out_file_new = monitor_file(1:len_trim(monitor_file)) // '/' // out_file
66 else
67 out_file_new = out_file
68 endif
69
70
71 open(20,file=out_file_new,form='formatted')
72
73 do i = 1,nv
74 if (nvec.eq.9) then
75 write(20,'(1E14.8,1X,1E14.8,1X,1E14.8,1X,1E14.8,1X,1E14.8,1X,1E14.8,1X,1E14.8,1X,1E14.8,1X,1E14.8)') &
76 vec(i,1),vec(i,2),vec(i,3),vec(i,4),vec(i,5), &
77 vec(i,6),vec(i,7),vec(i,8),vec(i,9)
78 endif
79
80 if (nvec.eq.3) then
81 write(20,'(1E14.8,1X,1E14.8,1X,1E14.8)') vec(i,1),vec(i,2),vec(i,3)
82 endif
83 enddo
84
85 close(20)
86
87 return
88
89 end subroutine write_fileout_pg