Debian Codegraph @

packages/seacas/applications/blot/spcomd.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 SPCOMD (A, INLINE,
9 & INVERB, IFLD, INTYP, CFIELD, IFIELD, RFIELD,
10 & NAMES, LENE, NLNKE, LINKE, XN, YN, ZN, XE, YE, ZE,
11 & ISEVOK, IE2ELB, NENUM, LIDSP, MAPEL, MAPND, NAMLEN)
12 C=======================================================================
13
14 C --*** SPCOMD *** (SPLOT) Process SPLOT commands
15 C -- Modified by John Glick - 11/1/88
16 C -- Written by Amy Gilkey - revised 05/31/88
17 C --
18 C --SPCOMD interprets SPLOT commands.
19 C --
20 C --The commands are listed below with their parameters and their
21 C --function.
22 C --
23 C --Plot curve selection
24 C -- ADD Save plot curves, otherwise a new plot set
25 C -- is started if a curve is defined
26 C -- REMOVE {n} Delete plot curve n
27 C -- SYPLOT {variable} Specify plot variable
28 C -- variable Specify time plot
29 C -- NODES {# range} Select node numbers
30 C -- ELEMENTS {# range} Select element numbers
31 C --
32 C --Display Control
33 C -- DISPVAR [ADD] {var1,...} Selects history variables, global
34 C -- variables, and/or TIME whose values
35 C -- will be displayed on the plot legend.
36 C --
37 C --Display
38 C -- reset Reset plot parameters
39 C -- postmesh Initialize after mesh plot
40 C -- postplot Initialize after plot
41 C -- initprog Initialize for program change
42 C -- initres Initialize for program change and reset
43 C -- PLOT Exit to plot the plot set
44 C -- HARDCOPY Exit to plot the plot set on hardcopy device
45 C -- NEUTRAL Exit to write the plot set to neutral file
46 C --
47 C --Mesh Display
48 C -- ECHO Plot mesh with selected nodes/elements
49 C --
50 C --Information
51 C -- show {option} Display plot parameters and information
52 C -- help {option} Display system dependent HELP
53 C --
54 C --This routine uses MDFIND to find the following dynamic memory arrays:
55 C -- IPATH - optimization information for FNDPTH
56 C --
57 C --Parameters:
58 C -- A - IN - the dynamic memory base array
59 C -- INLINE - IN/OUT - the parsed input lines for the log file
60 C -- INVERB - IN/OUT - the command verb
61 C -- IFLD, INTYP, CFIELD, IFIELD, RFIELD - IN/OUT - the free-field
62 C -- reader index and fields
63 C -- NAMES - IN - the variable names
64 C -- LENE - IN - the cumulative element counts by element block
65 C -- NLNKE - IN - the number of nodes per element
66 C -- LINKE - IN - the element connectivity
67 C -- XN, YN, ZN - IN - the nodal mesh coordinates
68 C -- XE, YE, ZE - IN - the element centroid mesh coordinates
69 C -- ISEVOK - IN - the element block variable truth table;
70 C -- variable i of block j exists iff ISEVOK(j,i)
71 C -- IE2ELB - IN - the element block for each element
72 C -- NENUM - IN/OUT - the selected node/element numbers
73 C -- LIDSP(0:*) - IN/OUT - the indices of the selected variables
74 C -- whose values will be displayed on the plot legend.
75 C -- LIDSP(0) = the number of variables in the list.
76 C -- LIDSP(i) identifies the ith variable in the list.
77 C -- If LIDSP(i) > 0, LIDSP(i) is the id of a history variable.
78 C -- If LIDSP(i) < 0, -LIDSP(i) is the id of a global variable.
79 C -- If LIDSP(i) = 0, TIME is to be displayed on the plot legend.
80 C --
81 C --Common Variables:
82 C -- Uses NVARNP, NVAREL of /DBNUMS/
83 C -- Uses NPTIMS of /TIMES/
84 C -- Sets NTIMIN, HISTOK of /TIMES/
85 C -- Sets NODVAR, NNENUM of /SELNE/
86 C -- Sets NSPVAR of /SPVARS/
87 C -- Sets OVERLY, OVERTM of /XYOPT/
88
89 include 'params.blk'
90 include 'dbnums.blk'
91 include 'times.blk'
92 include 'selne.blk'
93 include 'spvars.blk'
94 include 'xyopt.blk'
95
96 DIMENSION A(*)
97 CHARACTER*(*) INLINE(*)
98 CHARACTER*(*) INVERB
99 INTEGER INTYP(*)
100 CHARACTER*(*) CFIELD(*)
101 INTEGER IFIELD(*)
102 REAL RFIELD(*)
103 CHARACTER*(*) NAMES(*)
104 INTEGER LENE(0:NELBLK), LINKE(*)
105 INTEGER NLNKE(NELBLK)
106 REAL XN(*), YN(*), ZN(*)
107 REAL XE(*), YE(*), ZE(*)
108 LOGICAL ISEVOK(NELBLK,NVAREL)
109 INTEGER IE2ELB(*)
110 INTEGER NENUM(*)
111 INTEGER LIDSP(0:*)
112 INTEGER MAPEL(*)
113 INTEGER MAPND(*)
114
115 LOGICAL FFEXST, FFMATC
116
117 CHARACTER*(MXNAME) VERB, WORD
118 CHARACTER*5 STRA
119 CHARACTER TYP
120 LOGICAL HELP
121 LOGICAL ADDCRV
122 LOGICAL ISON, ISPATH
123
124 LOGICAL FIRST
125 SAVE FIRST, ADDCRV
126 C --FIRST - true iff first time through routine
127
128 CHARACTER*(MXSTLN) CMDTBL(15)
129 SAVE CMDTBL
130 C --CMDTBL - the valid commands table
131
132 DATA FIRST /.TRUE./
133
134 C --Command table follows. Remember to change the dimensioned size when
135 C --changing the table.
136 DATA CMDTBL /
137 1 'ADD ',
138 * 'REMOVE ',
139 * 'delete ',
140 2 'SYPLOT ',
141 * 'NODES ',
142 * 'ELEMENTS ',
143 * 'DISPVAR ',
144 3 'PLOT ',
145 * 'HARDCOPY ',
146 * 'NEUTRAL ',
147 * 'GRAFAID ',
148 * 'XMGR ',
149 * 'CSV ',
150 * 'ECHO ',
151 4 ' ' /
152
153 C --Get the command verb, which may be a variable name
154
155 WORD = INVERB
156 CALL ABRSTR (VERB, WORD, CMDTBL)
157 IF (VERB .EQ. ' ') THEN
158 CALL DBVIX_BL ('N', 1, INV)
159 CALL DBVIX_BL ('E', 1, IEV)
160 IF ((LOCSTR (WORD, NVARNP, NAMES(INV)) .GT. 0)
161 & .OR. (LOCSTR (WORD, NVAREL, NAMES(IEV)) .GT. 0)) THEN
162 VERB = 'SYPLOT'
163 IFLD = IFLD - 1
164 ELSE
165 VERB = WORD
166 END IF
167 END IF
168
169 C *** Initialization ***
170
171 IF ((VERB .EQ. 'postmesh')
172 & .OR. (VERB .EQ. 'postplot') .OR. (VERB .EQ. 'initprog')
173 & .OR. (VERB .EQ. 'initres') .OR. (VERB .EQ. 'reset')) THEN
174 INVERB = VERB
175
176 C --Initialize parameters first time through, then reset
177
178 IF (FIRST) THEN
179
180 C --Change the command table to upper case
181
182 L = LOCSTR (' ', 999, CMDTBL) - 1
183 DO 100 I = 1, L
184 CALL EXUPCS (CMDTBL(I))
185 100 CONTINUE
186
187 VERB = 'initres'
188 END IF
189
190 C --Initialize time step selection default
191
192 IF ((VERB .EQ. 'initprog') .OR. (VERB .EQ. 'initres')) THEN
193
194 C --Set default time step selection to 10 times with delta interval
195 HISTOK = .FALSE.
196 NTIMIN = 10
197 END IF
198
199 C --Initialize for program change
200
201 IF (VERB .EQ. 'initprog') THEN
202 CONTINUE
203 END IF
204
205 C --Reset parameters
206
207 IF ((VERB .EQ. 'reset') .OR. (VERB .EQ. 'initres')) THEN
208
209 IF (VERB .EQ. 'reset') THEN
210 C --reset display variable list
211 CALL DISPV (.TRUE., INLINE, IFLD, INTYP,
212 & CFIELD, NAMES, LIDSP, NAMLEN)
213 ENDIF
214
215 SELOK = .FALSE.
216 NODVAR = .TRUE.
217 NNENUM = 0
218 NSPVAR = 0
219
220 FIRST = .FALSE.
221 END IF
222
223 C --Initialize for new plot set
224
225 IF (VERB .EQ. 'postplot') THEN
226 CONTINUE
227 END IF
228
229 C --Initialize after mesh plot
230
231 IF (VERB .EQ. 'postmesh') THEN
232 SELOK = .FALSE.
233 END IF
234
235 ADDCRV = .FALSE.
236
237 VERB = ' '
238
239 C *** Plot variable selection ***
240
241 ELSE IF (VERB .EQ. 'ADD') THEN
242 CALL FFADDC (VERB, INLINE(1))
243 INVERB = ' '
244
245 VERB = 'PLOT'
246 ADDCRV = .TRUE.
247
248 ELSE IF (VERB .EQ. 'REMOVE') THEN
249 CALL FFADDC (VERB, INLINE(1))
250 INVERB = ' '
251
252 VERB = 'PLOT'
253
254 110 CONTINUE
255 IF (FFEXST (IFLD, INTYP)) THEN
256 CALL FFINTG (IFLD, INTYP, IFIELD,
257 & 'number of the curve to delete', 0, ICRV, *130)
258 IF (ICRV .LT. 0) THEN
259 NDEL = MIN (-ICRV, NSPVAR)
260 CALL FFADDI (-NDEL, INLINE(1))
261 NSPVAR = NSPVAR - NDEL
262 ELSE
263 IF ((ICRV .LT. 1) .OR. (ICRV .GT. NSPVAR)) THEN
264 CALL INTSTR (1, 0, ICRV, STRA, L)
265 CALL PRTERR ('CMDWARN', 'Curve number ' // STRA(:L) //
266 & ' is invalid, ignored')
267 GOTO 120
268 END IF
269 CALL FFADDI (ICRV, INLINE(1))
270 ISVID(ICRV) = 0
271 END IF
272 120 CONTINUE
273 GOTO 110
274 END IF
275
276 130 CONTINUE
277 ICRV = 0
278 DO 140 NP = 1, NSPVAR
279 IF (ISVID(NP) .GT. 0) THEN
280 ICRV = ICRV + 1
281 IF (ICRV .NE. NP) THEN
282 ISVID(ICRV) = ISVID(NP)
283 END IF
284 END IF
285 140 CONTINUE
286 NSPVAR = ICRV
287
288 else if (verb .eq. 'DELETE') then
289 call prterr ('CMDREQ', 'Please use the REMOVE command')
290
291 call ffaddc (verb, inline(1))
292 inverb = ' '
293
294 verb = 'PLOT'
295 call ffintg (ifld, intyp, ifield,
296 & 'number of curves to delete', 1, ndel, *180)
297 ndel = max (0, min (ndel, nspvar))
298 call ffaddi (ndel, inline(1))
299 nspvar = nspvar - ndel
300
301 ELSE IF (VERB .EQ. 'SYPLOT') THEN
302 CALL FFADDC (VERB, INLINE(1))
303 INVERB = ' '
304
305 IF (.NOT. ADDCRV) THEN
306 NSPVAR = 0
307 ADDCRV = .TRUE.
308 END IF
309
310 IF (NNENUM .EQ. 0) THEN
311 CALL PRTERR ('CMDERR',
312 & 'A NODES/ELEMENTS command must be issued')
313 GOTO 180
314 END IF
315
316 C --Get variable name
317
318 CALL FFCHAR (IFLD, INTYP, CFIELD, ' ', WORD)
319 CALL FFADDC (WORD, INLINE(1))
320
321 IVAR = LOCSTR (WORD, NVARHI+NVARGL+NVARNP+NVAREL, NAMES)
322 IF (IVAR .LE. 0) THEN
323 CALL PRTERR ('CMDERR', '"' // WORD(:LENSTR(WORD))
324 & // '" is an invalid variable name')
325 GOTO 180
326 END IF
327
328 C --Get variable type
329
330 CALL DBVTYP_BL (IVAR, TYP, IDUM)
331
332 IF (NODVAR) THEN
333 IF (TYP .NE. 'N') THEN
334 CALL PRTERR ('CMDERR',
335 & 'Only nodal variables may be specified')
336 GOTO 180
337 END IF
338 ELSE
339 IF (TYP .NE. 'E') THEN
340 CALL PRTERR ('CMDERR',
341 & 'Only element variables may be specified')
342 GOTO 180
343 END IF
344 END IF
345
346 C --Add variable to the plot variable list
347
348 IF (NSPVAR .GE. MXSVAR) THEN
349 CALL PRTERR ('CMDERR', 'Too many plot variables')
350 GOTO 180
351 END IF
352 NSPVAR = NSPVAR + 1
353 ISVID(NSPVAR) = IVAR
354
355 C --Set Y axis to automatic scaling, etc if not set
356 INVERB = 'yaxis'
357
358 ELSE IF ((VERB .EQ. 'NODES') .OR. (VERB .EQ. 'ELEMENTS')) THEN
359 CALL FFADDC (VERB, INLINE(1))
360 INVERB = ' '
361
362 ISON = (VERB .EQ. 'NODES')
363 C --Change the verb to lower-case for SHOW
364 WORD = VERB
365 CALL LOWSTR (VERB, WORD)
366
367 ISPATH = FFMATC (IFLD, INTYP, CFIELD, 'PATH', 1)
368 IF (ISPATH) CALL FFADDC ('PATH', INLINE(1))
369
370 C --Make a list of the selected nodes
371
372 IF (FFEXST (IFLD, INTYP)) THEN
373 IF (ISON) THEN
374 CALL RXINTA (INLINE(1), IFLD, INTYP, CFIELD, IFIELD,
375 & 'node number', NUMNP, NNENUM, NENUM, MAPND, *180)
376 ELSE
377 CALL RXINTA (INLINE(1), IFLD, INTYP, CFIELD, IFIELD,
378 & 'element number', NUMEL, NNENUM, NENUM, MAPEL, *180)
379 END IF
380 END IF
381
382 IF (ISON .NEQV. NODVAR) NSPVAR = 0
383 NODVAR = ISON
384
385 C --Determine a path between the nodes/element, if requested
386
387 IF (ISPATH) THEN
388 C --Get memory for path efficiency information
389 CALL MDFIND ('IPATH', KIPATH, L)
390 IF (L .LE. 0) THEN
391 CALL MDLONG ('IPATH', KIPATH, 2*NUMNP)
392 END IF
393 CALL MDSTAT (NERR, MEM)
394 IF (NERR .GT. 0) GOTO 200
395
396 IF (NODVAR) THEN
397 CALL FNDPTH (NODVAR, LENE, NLNKE, LINKE, XN, YN, ZN,
398 & A(KIPATH), NUMNP, NNENUM, NENUM)
399 ELSE
400 CALL FNDPTH (NODVAR, LENE, NLNKE, LINKE, XE, YE, ZE,
401 & A(KIPATH), NUMEL, NNENUM, NENUM)
402 END IF
403 END IF
404
405 C --Set X axis to automatic scaling, etc if not set
406 INVERB = 'xaxis'
407
408 C *** Display control ***
409
410 ELSE IF (VERB .EQ. 'DISPVAR') THEN
411 CALL FFADDC (VERB, INLINE(1))
412 CALL DISPV (.FALSE., INLINE, IFLD, INTYP,
413 & CFIELD, NAMES, LIDSP, NAMLEN)
414 INVERB = ' '
415
416 C *** Display ***
417
418 ELSE IF ((VERB .EQ. 'PLOT') .OR. (VERB .EQ. 'HARDCOPY') .OR.
419 & (VERB .EQ. 'NEUTRAL') .OR. (VERB .EQ. 'GRAFAID') .OR.
420 * (VERB .EQ. 'XMGR') .OR. (VERB .EQ. 'CSV')) THEN
421 CALL FFADDC (VERB, INLINE(1))
422 INVERB = ' '
423
424 IF (NNENUM .EQ. 0) THEN
425 CALL PRTERR ('CMDERR', 'No nodes or elements are selected')
426 GOTO 180
427 END IF
428 IF (NSPVAR .EQ. 0) THEN
429 CALL PRTERR ('CMDERR', 'No curves are defined')
430 GOTO 180
431 END IF
432 IF (NPTIMS .EQ. 0) THEN
433 CALL PRTERR ('CMDERR', 'No times are selected')
434 VERB = ' '
435 GOTO 180
436 END IF
437
438 C --Check that at least one selected element is defined for each selected
439 C --element variable
440
441 IF (.NOT. NODVAR) THEN
442 NBAD = 0
443 DO 170 IP = 1, NSPVAR
444 CALL DBVTYP_BL (ISVID(IP), TYP, IVAR)
445 IF (NUMEQL (.FALSE., NELBLK, ISEVOK(1,IVAR)) .GT. 0) THEN
446 DO 150 IX = 1, NNENUM
447 IF (ISEVOK(IE2ELB(NENUM(IX)),IVAR)) GOTO 160
448 150 CONTINUE
449 NBAD = NBAD + 1
450 160 CONTINUE
451 END IF
452 170 CONTINUE
453 IF (NBAD .GT. 0) THEN
454 IF (NBAD .GE. NSPVAR) THEN
455 CALL PRTERR ('CMDERR',
456 & 'All of the curve variables are undefined'
457 & // ' for the requested elements')
458 GOTO 180
459 ELSE
460 CALL PRTERR ('CMDERR',
461 & 'Some of the curve variables are undefined'
462 & // ' for the requested elements')
463 END IF
464 END IF
465 END IF
466
467 C --PLOT, HARDCOPY, and NEUTRAL are to be passed as lower-case commands
468 CALL LOWSTR (INVERB, VERB)
469 VERB = ' '
470
471 C *** Mesh display commands ***
472
473 ELSE IF (VERB .EQ. 'ECHO') THEN
474 CALL FFADDC (VERB, INLINE(1))
475 INVERB = ' '
476
477 IF (NNENUM .EQ. 0) THEN
478 CALL PRTERR ('CMDERR', 'No nodes or elements are selected')
479 GOTO 180
480 END IF
481 SELOK = .TRUE.
482
483 INVERB = 'mesh'
484 VERB = ' '
485
486 C *** Information ***
487
488 ELSE IF (VERB .EQ. 'show') THEN
489
490 CALL FFCHAR (IFLD, INTYP, CFIELD, ' ', WORD)
491 CALL ABRSTR (VERB, WORD, CMDTBL)
492 IF (VERB .NE. ' ') THEN
493 CALL SPSHOW (VERB, NAMES, NENUM, LIDSP)
494 INVERB = ' '
495 END IF
496 VERB = ' '
497
498 ELSE IF (VERB .EQ. 'help') THEN
499
500 ISON = HELP ('BLOT', 'COMMANDS', CFIELD(IFLD))
501 IF (.NOT. ISON)
502 & CALL SHOCMD ('SPLOT Commands', CMDTBL)
503 VERB = ' '
504
505 ELSE
506 VERB = ' '
507 END IF
508
509 GOTO 190
510
511 180 CONTINUE
512 INLINE(1) = ' '
513
514 190 CONTINUE
515 IF (VERB .NE. ' ') THEN
516 CALL SPSHOW (VERB, NAMES, NENUM, LIDSP)
517 END IF
518
519 200 CONTINUE
520 RETURN
521 END