Screamer Project  V3.3.1
Screamer Structure
 All Files Functions Variables
rdpwlprm.f
Go to the documentation of this file.
1  subroutine read_pwl_parms (parms, nparams, eofflg, nlines,
2  & numerr)
3 
4 c Modification log
5 c
6 c 2008-07-17 RBS: Changed the length of currline to 120 from 80
7 c 2014-02-06 RBS: Changed real*4 to real
8 c
9 c Define passed variables
10 c
11  real parms(*)
12  integer nparams, eofflg, nlines, numerr
13 c
14  character currline*120
15 c
16 c This subroutine reads in a set of (X,Y) values to be used in a
17 c piecewise linear model. Up to 201 (X,Y) pairs
18 c may be entered, two per line.
19 c The first coefficient on each line is X and the second is Y.
20 c The subroutine quits reading when an error is detected (there were
21 c not two numbers on the line). If the error is because there was
22 c the keyword 'LAS*T' is on the line, then it returns normally with the X,Y
23 c array entered properly. If the error is caused by something besides the
24 c keyword as the first data on the line, an error is signalled and the
25 c subroutine exits and not all the X,Y may have been read.
26 c If more than 201 pairs are read in,
27 c only the first 201 area kept and an error is signalled.
28 c X1 is parms(1), Y1 is parms(2), X2 is parms(3), Y2 is parms(4), ...
29 c num_parms is twice the number of pairs read in.
30 c
31 c
32 c Include the common block containing the keywords.
33 c
34  include 'zdemparm.h'
35  include 'zdempprm.h'
36 c
37 c Various parameters and variable types.
38 c
39  integer flag1, flag2
40  integer noerr, error, notext
41  parameter(noerr = 0, error = 1, notext = 0)
42  parameter(max_pwl_pairs = 401)
43  parameter(max_pwl_parms = max_pwl_pairs*2)
44  parameter(max_fields = 10)
45  character field(max_fields)*80, keyword*(keyword_len)
46 c
47 c Set the counter for the number of elements read and the limit check to
48 c no error
49 c
50  nparams = 0
51  limit = noerr
52 c
53 c Get the line.
54 c
55  200 continue
56  call get_next_line(currline, field, nlines, eofflg, max_fields)
57  if (eofflg .eq. error) then
58  return
59  end if
60 c
61  if (nparams .lt. max_pwl_parms) then
62 c
63 c Attempt to convert each field into a real number.
64 c
65  call text_to_real(field(1), parms(nparams+1), flag1)
66  call text_to_real(field(2), parms(nparams+2), flag2)
67 c
68 c If we failed to convert a number, see if we had the last entry keyword.
69 c If so, then set the number of parameters entered, else signal an error.
70 c If we did fail, this will cause the subroutine to exit.
71 c
72  if ((flag1+flag2) .eq. noerr) then
73  nparams = nparams +2
74  else
75  keyword = field(1)(1:keyword_len)
76  if (keyword .ne. k_last_entry) then
77  call print_bad_line(currline, nlines, numerr)
78  end if
79  go to 1000
80  end if
81 c
82 c If we have read in the maximum number of pairs, check this line
83 c for LAST keyword. If not LAST do not use anything on the line.
84 c
85  else
86  keyword = field(1)(1:keyword_len)
87  if (keyword .ne. k_last_entry) then
88  numerr = numerr + 1
89  limit = error
90  else
91  go to 1000
92  end if
93 c
94  end if
95  go to 200
96 c
97 c If we were over the limit, send a message and tell what the current limit
98 c is.
99 c
100  1000 continue
101  eofflg = noerr
102  if (limit .eq. error) then
103  write(9,41) max_pwl_pairs
104  41 format ('0', 'Error, too many table values entered, only ',
105  & i3, ' points allowed!')
106  end if
107 c
108 c return
109  end
c *****************************************************************************c Various format statements for read_screamer_data output c To get these into made format to be characters c for each line corrected spelling errors in format added statement for Zflow Plasma Loss Model added format for CSV output type fixed more lines longer than characters added format for Measure Zflow Block and forward c reverse current directions in Zflow plasma loss c and Zflow POS models added format for SFC output type c removed from all code calls c c c c c a80 c i10 c No grids on plots c Do not write files containing the plotted points c Execute only one cycle c Do not echo the setup parameters and indicies c i3
Definition: zdemfmt.h:36
subroutine get_next_line(currline, field, nlines, eofflg, max_fields)
Definition: getnxtln.f:1
subroutine print_bad_line(currline, nlines, numerr)
Definition: prtbadln.f:1
subroutine text_to_real(text, rvalue, flag)
Definition: txt2real.f:1
subroutine read_pwl_parms(parms, nparams, eofflg, nlines, numerr)
Definition: rdpwlprm.f:1