Debian Codegraph @

packages/seacas/applications/blot/tplab.F

raw
1 C Copyright(C) 1999-2020 National Technology & Engineering Solutions
2 C of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
3 C NTESS, the U.S. Government retains certain rights in this software.
4 C
5 C See packages/seacas/LICENSE for details
6
7 C=======================================================================
8 SUBROUTINE TPLAB (IPVAR, NCRV, NUMCRV, TIMLIM, NAMES,
9 & TXLAB, TYLAB, BLKCOL, MAPEL, MAPND, *)
10 C=======================================================================
11
12 C --*** TPLAB *** (TPLOT) Label plot
13 C -- Written by Amy Gilkey - revised 05/02/88
14 C --
15 C --TPLAB erases the display surface then labels the plot legend
16 C --with the following:
17 C --
18 C -- BANNER - the title, creator, modifier, and drawn-by information.
19 C -- Constant for entire run. If QA only.
20 C -- CAPTION - the plot caption.
21 C -- LABEL - the plot variable names.
22 C --
23 C --It is assumed that time curves and X-Y curves are not overlaid.
24 C --
25 C --The vertical-to-horizontal aspect ratio is assumed to be 0.75.
26 C --Label locations are set for a horizontal layout.
27 C --
28 C --Parameters:
29 C -- IPVAR - IN - the /TPVARS/ index of the starting plot variable
30 C -- NCRV - IN - the number of curves on the plot
31 C -- NUMCRV - IN - true iff curves are to be numbered
32 C -- TIMLIM - IN - the starting and ending time of a
33 C -- variable-versus-variable plot
34 C -- NAMES - IN - the variable names
35 C -- TXLAB, TYLAB - OUT - labels for the X and Y axis
36 C -- BLKCOL - IN/OUT - the user selected colors of the element blocks.
37 C -- BLKCOL(0) = 1 if the user defined material
38 C -- colors should be used in mesh plots.
39 C -- = -1 if program selected colors should
40 C -- be used.
41 C -- BLKCOL(i) = the user selected color of element
42 C -- block i:
43 C -- -2 - no color selected by user.
44 C -- -1 - black
45 C -- 0 - white
46 C -- 1 - red
47 C -- 2 - green
48 C -- 3 - yellow
49 C -- 4 - blue
50 C -- 5 - cyan
51 C -- 6 - magenta
52 C -- * - the return statement if the cancel function is active
53 C --
54 C --Common Variables:
55 C -- Uses TITLE, CREATE, MODIFY, DRAW of /DBTITL/
56 C -- Uses TIMPLT, ITVID, ITVNE of /TPVARS/
57 C -- Uses DOQA, DOLEG, CAPTN of /LEGOPT/
58 C -- Uses LINTYP, ISYTYP of /XYOPT/
59 C -- Uses XLAB, YLAB of /XYLAB/
60 C -- Uses CHLSIZ, DBORD0, DVIEW0 of /LAYOUT/
61
62 PARAMETER (KLFT=1, KRGT=2, KBOT=3, KTOP=4)
63
64 PARAMETER (NUMSYM = 6, NUMLIN = 6)
65
66 include 'params.blk'
67 include 'dbnums.blk'
68 include 'dbtitl.blk'
69 include 'tpvars.blk'
70 include 'legopt.blk'
71 include 'xyopt.blk'
72 include 'xylab.blk'
73 include 'layout.blk'
74 include 'debug.blk'
75
76 LOGICAL NUMCRV
77 REAL TIMLIM(2)
78 CHARACTER*(*) NAMES(*)
79 CHARACTER*(*) TXLAB, TYLAB
80 INTEGER BLKCOL(0:NELBLK)
81 INTEGER MAPEL(*), MAPND(*)
82
83 LOGICAL GRABRT
84 CHARACTER*80 LABSTR
85 REAL DLEGND(KTOP)
86 CHARACTER*20 RSTR(2)
87 CHARACTER*10 FMT
88
89 CHARACTER*3 SYMBOL(NUMSYM)
90 CHARACTER*7 LTYPES(NUMLIN)
91 SAVE SYMBOL, LTYPES
92
93 #if NeedsDoubleEscape
94 DATA SYMBOL / '\\SQ', '\\DI', '\\CS', '\\X ', '\\TR', '\\CI' /
95 DATA LTYPES / '\\SLINE ', '\\DLINE ', '\\DDLINE',
96 & '\\SDLINE', '\\LDLINE', '\\MDLINE' /
97 #else
98 DATA SYMBOL / '\SQ', '\DI', '\CS', '\X ', '\TR', '\CI' /
99 DATA LTYPES / '\SLINE ', '\DLINE ', '\DDLINE',
100 & '\SDLINE', '\LDLINE', '\MDLINE' /
101 #endif
102
103 C --Set up axes labeling (needed before standard labeling)
104
105 IF (XLAB .NE. ' ') THEN
106 TXLAB = XLAB
107 ELSE IF (TIMPLT) THEN
108 TXLAB = 'TIME'
109 ELSE
110 N = IPVAR
111 ID = ITVID(N)
112 DO 100 NP = 2, NCRV
113 N = N + 2
114 IF (ITVID(N) .NE. ID) ID = 0
115 100 CONTINUE
116 IF (ID .NE. 0) THEN
117 TXLAB = NAMES(ID)
118 ELSE
119 TXLAB = ' '
120 END IF
121 END IF
122
123 IF (YLAB .NE. ' ') THEN
124 TYLAB = YLAB
125 ELSE
126 N = IPVAR
127 IF (.NOT. TIMPLT) N = N + 1
128 ID = ITVID(N)
129 DO 110 NP = 2, NCRV
130 N = N + 1
131 IF (.NOT. TIMPLT) N = N + 1
132 IF (ITVID(N) .NE. ID) ID = 0
133 110 CONTINUE
134 IF (ID .NE. 0) THEN
135 TYLAB = NAMES(ID)
136 ELSE
137 TYLAB = ' '
138 END IF
139 END IF
140
141 C *** Standard plot labeling ***
142
143 CALL QALAB (DBORD0, DVIEW0, CHLSIZ,
144 & DOQA(2), DOAXIS(2), (TXLAB .NE. ' '),
145 & CAPTN(1,2), TITLE, CREATE, MODIFY, DRAW, DLEGND,
146 & BLKCOL, *140)
147
148 C *** Plot legend ***
149
150 IF (.NOT. DOLEG(2)) GOTO 130
151
152 C --Find middle of the remaining legend area and set limits
153
154 IF (TIMPLT) THEN
155 NLINE = NCRV
156 ELSE
157 NLINE = 2*NCRV + 3
158 END IF
159 DTOP = DLEGND(KTOP) - CHLSIZ
160 DBOT = DLEGND(KBOT)
161 IF (DOQA(2)) THEN
162 DTOP = DTOP - 2*CHLSIZ
163 DBOT = DBOT + 2*CHLSIZ
164 END IF
165 CALL GRYCEN (CHLSIZ, DTOP, DBOT, NLINE, NOVER)
166 IF (DOQA(2) .AND. (NOVER .GT. 0)) NOVER = NOVER - 2
167 C --Allow 2 extra lines if QA (DBOT is invalid)
168
169 C --Display plot item(s) (variable name and number) for each curve
170
171 NC = NCRV
172 IF (NOVER .GT. 0) THEN
173 IF (TIMPLT) THEN
174 NC = NCRV - NOVER - 1
175 ELSE
176 NC = NCRV - (NOVER+1)/2 - 1
177 END IF
178 END IF
179
180 N = IPVAR
181 DO 120 NP = 1, NC
182 IF (GRABRT ()) RETURN 1
183 CALL GRCOLR (NP)
184
185 IF (NUMCRV) THEN
186 IF (NP .LE. 1) THEN
187 IF (NC .LT. 10) THEN
188 FMT = '(I1)'
189 ELSE
190 FMT = '(I2)'
191 END IF
192 END IF
193 WRITE (LABSTR, FMT, IOSTAT=IDUM) NP
194 CALL GRCALN (LABSTR, L)
195 CALL TPLABV (0, ITVID(N), NAMES(ITVID(N)), ITVNE(N),
196 & LABSTR(L+2:), MAPEL, MAPND)
197 ELSE
198 CALL TPLABV (0, ITVID(N), NAMES(ITVID(N)), ITVNE(N), LABSTR,
199 * MAPEL, MAPND)
200 END IF
201
202 IF (GRABRT ()) RETURN 1
203 IF ((NCRV .LE. 1)
204 & .OR. ((ISYTYP .GE. 0) .AND. (LINTYP .GE. 0))) THEN
205 CALL GRTEXT (DLEGND(KLFT), DTOP, LABSTR)
206 ELSE
207 CALL PLTXSE (DX, RDUM)
208 IF (LINTYP .LT. 0) THEN
209 ITYP = MOD (NP-1, NUMLIN) + 1
210 CALL PLTXTS (DLEGND(KLFT), DTOP,
211 & LTYPES(ITYP)(:LENSTR(LTYPES(ITYP))))
212 CALL PLTXSE (DX, RDUM)
213 END IF
214 IF (ISYTYP .LT. 0) THEN
215 ISYM = MOD (NP-1, NUMSYM) + 1
216 IF (LINTYP .GE. 0) THEN
217 CALL PLTXTS (DLEGND(KLFT), DTOP,
218 & SYMBOL(ISYM)(:LENSTR(SYMBOL(ISYM))))
219 CALL PLTXSE (DX, RDUM)
220 ELSE
221 DXX = 0.5 * (DLEGND(KLFT) + DX)
222 & - 0.75 * 5.0/7.0*CHLSIZ
223 CALL PLTXTS (DXX, DTOP,
224 & SYMBOL(ISYM)(:LENSTR(SYMBOL(ISYM))))
225 END IF
226 END IF
227 CALL GRTEXT (DX, DTOP, ' ' // LABSTR)
228 END IF
229 DTOP = DTOP - CHLSIZ
230 N = N + 1
231
232 IF (.NOT. TIMPLT) THEN
233 IF (GRABRT ()) RETURN 1
234 CALL TPLABV (0, ITVID(N), NAMES(ITVID(N)), ITVNE(N), LABSTR,
235 * MAPEL, MAPND)
236 CALL GRTEXT (DLEGND(KLFT), DTOP, ' ' // LABSTR)
237 DTOP = DTOP - CHLSIZ
238 N = N + 1
239 END IF
240 120 CONTINUE
241
242 CALL UGRCOL (0, BLKCOL)
243
244 IF (NC .LT. NCRV) THEN
245 IF (GRABRT ()) RETURN 1
246 CALL GRTEXT (DLEGND(KLFT), DTOP, '...')
247 DTOP = DTOP - CHLSIZ
248 END IF
249
250 C --Display times for variable-versus-variable plot
251
252 DTOP = DTOP - CHLSIZ
253
254 IF (.NOT. TIMPLT) THEN
255 CALL NUMSTR (2, 4, TIMLIM, RSTR, LSTR)
256 CALL PCKSTR (2, RSTR)
257 CALL GRTEXT (DLEGND(KLFT), DTOP, 'TIMES ' // RSTR(1))
258 DTOP = DTOP - CHLSIZ
259 CALL GRTEXT (DLEGND(KLFT), DTOP, ' TO ' // RSTR(2))
260 DTOP = DTOP - CHLSIZ
261 END IF
262
263 130 CONTINUE
264
265 C --Flush buffer, so label is complete at this point
266 CALL PLTFLU
267
268 RETURN
269
270 140 CONTINUE
271 RETURN 1
272 END