/[MITgcm]/MITgcm/eesupp/src/nml_filter.F
ViewVC logotype

Contents of /MITgcm/eesupp/src/nml_filter.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Thu Feb 1 19:32:52 2001 UTC (23 years, 3 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint34
Handling of namelist read.

1 C $Header: $
2
3 #include "CPP_OPTIONS.h"
4
5 #define FTN_NML_F90
6
7 subroutine nml_filter(
8 I fname
9 O , outunit
10 I , myThid
11 & )
12
13 c ==================================================================
14 c SUBROUTINE nml_filter
15 c ==================================================================
16 c
17 c o
18 c
19 c started: Ralf.Giering@FastOpt.de 15-Mai-2000
20 c
21 c - remove comments from namelist file
22 c - usage
23 c
24 c call nml_filter( 'datafile', iunit, myThid )
25 c read ( unit = iunit, nml = the_namelist )
26 c close ( iunit )
27 c
28 c ==================================================================
29 c SUBROUTINE nml_filter
30 c ==================================================================
31
32 implicit none
33
34 c == global variables ==
35
36 #include "EEPARAMS.h"
37
38 c == routine arguments ==
39 character*(*) fname
40 integer outunit
41 integer myThid
42
43 c == local variables ==
44 integer errio
45 integer il
46 integer inunit
47
48 character*(MAX_LEN_MBUF) msgBuf
49 character*(MAX_LEN_PREC) record
50
51 c == external ==
52
53 integer ilnblnk
54 external ilnblnk
55
56 c == end of interface ==
57
58 c-- open the data file
59
60 call mdsfindunit( inunit, mythid )
61
62 open( unit = inunit
63 & , file = fname
64 & , status = 'old'
65 & , iostat = errio
66 & )
67
68 c-- open the filtered data file
69 call mdsfindunit( outunit, mythid )
70 open( unit=outunit, status='scratch' )
71
72 if ( errio .lt. 0 ) then
73 write(msgBuf,'(A)') 'S/R nml_filter'
74 call PRINT_ERROR( msgBuf , 1)
75 write(msgBuf,'(A)') 'Unable to open execution environment'
76 call PRINT_ERROR( msgBuf , 1)
77 write(msgBuf,'(3a)') 'namelist file "', fname, '"'
78 call PRINT_ERROR( msgBuf , 1)
79 close(outunit)
80 outunit = 0
81 stop ' stopped in nml_filter'
82 endif
83
84 do while ( .true. )
85 read(inunit, fmt='(a)', iostat=errio) record
86 if ( errio .ne. 0 ) then
87 goto 1001
88 end if
89 il = max(ilnblnk(record),1)
90 if ( record(1:1) .eq. commentcharacter ) then
91 else if ( record(1:1) .eq. '/' ) then
92 #ifdef FTN_NML_F90
93 write(outunit, fmt='(a)') record(:il)
94 #else
95 write(outunit, fmt='(a)') ' &'
96 #endif
97 else if ( record(1:2) .eq. ' /' ) then
98 #ifdef FTN_NML_F90
99 write(outunit, fmt='(a)') record(:il)
100 #else
101 write(outunit, fmt='(a)') ' &'
102 #endif
103 else
104 write(outunit, fmt='(a)') record(:il)
105 end if
106 enddo
107 1001 continue
108 close( inunit )
109
110 rewind( outunit )
111
112 end
113

  ViewVC Help
Powered by ViewVC 1.1.22