Debian Codegraph @

packages/seacas/applications/blot/grfneu.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 GRFNEU (NPTS, XPTS, YPTS, PLTITL, TXLAB, TYLAB)
9 C=======================================================================
10
11 C --*** WRTNEU *** (XYPLOT) Write curve to neutral file
12 C -- Written by Amy Gilkey - revised 04/21/88
13 C --
14 C --WRTNEU writes the data for a curve to a neutral file. The first
15 C --time the routine is called, the neutral file is opened.
16 C --
17 C --The format of the neutral file is described in "GRAFAID Code User
18 C --Manual" under Neutral File Format.
19 C --
20 C --Parameters:
21 C -- NPTS - IN - the number of points on the curve
22 C -- XPTS, YPTS - IN - the points on the curve
23 C -- PLTITL - IN - the plot title describing the curve
24 C -- (e.g. "TIME vs SIGXX at ELEMENT 30")
25 C -- TXLAB, TYLAB - IN - the X and Y axis labels, either the
26 C -- user-input labels or the plot variable descriptions
27 C --
28 C --Common Variables:
29 C -- Uses TITLE, CREATE, MODIFY, DRAW of /DBTITL/
30 C -- Uses DOQA, CAPTN of /LEGOPT/
31 C -- Uses XMIN, XMAX, YMIN, YMAX of /LIMITS/
32 C -- Uses NEU, NUMCRV, INCCRV, CRVNAM of /NEUTR./
33 C -- Uses and sets NEUOPN of /NEUTR./
34
35 include 'dbname.blk'
36 include 'dbtitl.blk'
37 include 'legopt.blk'
38 include 'xylim.blk'
39 include 'neutr.blk'
40
41 REAL XPTS(NPTS), YPTS(NPTS)
42 CHARACTER*(*) PLTITL
43 CHARACTER*(*) TXLAB, TYLAB
44
45 CHARACTER*2048 FILNAM, ERRMSG
46 CHARACTER*4 XTYP
47 CHARACTER*4 AXTYP
48 CHARACTER AUX
49 CHARACTER*80 CURVE
50
51 DATA AUX /'F'/
52 DATA AXTYP /'NOLO'/
53
54 IF (.NOT. GRFOPN) THEN
55
56 C --Open the neutral file and write the title line
57
58 filnam = basenam(:lenstr(basenam)) // '.grf'
59
60 C --Open the neutral file and write the title line
61 open (unit=neugrf, file=filnam(:lenstr(filnam)),
62 * form='formatted', status='unknown', iostat=ierr)
63 IF (IERR .NE. 0) THEN
64 ERRMSG = 'Neutral file "'//FILNAM(:LENSTR(FILNAM))//
65 * '" could not be opened.'
66 CALL PRTERR ('CMDERR', ERRMSG(:LENSTR(ERRMSG)))
67 GOTO 170
68 END IF
69 GRFOPN = .TRUE.
70
71 WRITE (NEUGRF, 10000) DRAW(1)(:LENSTR(DRAW(1))),
72 & CREATE(1)(:LENSTR(CREATE(1))), CREATE(3), CREATE(4),
73 & MODIFY(1)(:LENSTR(MODIFY(1))), MODIFY(3), MODIFY(4)
74 10000 FORMAT (A, ': CREATED BY ', A, ' ', A, ' ', A,
75 & ', MODIFIED BY ', A, ' ', A, ' ', A)
76 END IF
77
78 C --Figure out if the X points are monotonic or not
79
80 XTYP = 'MONO'
81 DO 100 I = 2, NPTS
82 IF (XPTS(I-1) .GE. XPTS(I)) THEN
83 XTYP = 'NONM'
84 GOTO 110
85 END IF
86 100 CONTINUE
87 110 CONTINUE
88
89 C --Get the curve name
90
91 WRITE (CURVE, '(A32, I7)', IOSTAT=IDUM) CRVNAM, NUMCRV
92 CALL PCKSTR (1, CURVE)
93 NUMCRV = NUMCRV + INCCRV
94
95 WRITE (*, 10090) 'Writing ', PLTITL(:LENSTR(PLTITL))
96
97 C --Write the begin curve record with the curve name
98
99 WRITE (NEUGRF, 10010) 'BEGIN CURVE', CURVE
100 10010 FORMAT (A, ',', A15)
101
102 C --Write the title lines
103
104 DO 120 IEND = 3, 1, -1
105 IF (CAPTN(IEND,2) .NE. ' ') GOTO 130
106 120 CONTINUE
107 130 CONTINUE
108 IF (DOQA(2)) THEN
109 WRITE (NEUGRF, 10020) 1+MAX(IEND,1), TITLE
110 IF (IEND .GT. 0) THEN
111 DO 140 I = 1, IEND
112 WRITE (NEUGRF, 10030) CAPTN(I,2)
113 140 CONTINUE
114 ELSE
115 WRITE (NEUGRF, 10030) PLTITL
116 END IF
117 ELSE IF (IEND .GT. 0) THEN
118 WRITE (NEUGRF, 10020) IEND, CAPTN(1,2)
119 DO 150 I = 2, IEND
120 WRITE (NEUGRF, 10030) CAPTN(I,2)
121 150 CONTINUE
122 ELSE
123 WRITE (NEUGRF, 10020) 1, PLTITL
124 END IF
125 10020 FORMAT (I1, ',', A80)
126 10030 FORMAT (A80)
127
128 C --Write the X and Y labels
129
130 WRITE (NEUGRF, 10040) TXLAB
131 WRITE (NEUGRF, 10040) TYLAB
132 10040 FORMAT (A40)
133
134 C --Write the min/max, the number of points, and the auxiliary data flag
135
136 WRITE (NEUGRF, 10050) XMIN, XMAX, YMIN, YMAX, NPTS, AUX
137 10050 FORMAT (4 (1PE15.7E3, ','), I5, ',', A1)
138 WRITE (NEUGRF, 10060) AXTYP, XTYP, ' '
139 10060 FORMAT (A4, ',', A4, ',', A4)
140
141 C --Write the data points
142
143 DO 160 I = 1, NPTS
144 WRITE (NEUGRF, 10070) XPTS(I), YPTS(I)
145 10070 FORMAT (2 (1PE15.7E3, :, ','))
146 160 CONTINUE
147
148 C --Write the end curve record with the curve name
149
150 WRITE (NEUGRF, 10080) 'END CURVE', CURVE
151 10080 FORMAT (A, ',', A)
152
153 170 CONTINUE
154 RETURN
155 10090 FORMAT (1X, 5A)
156 END