Debian Codegraph @

packages/seacas/applications/blot/wrtneu.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 WRTNEU (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 which is
15 C --readable by the xmgr program. The first
16 C --time the routine is called, the neutral file is opened.
17 C --
18 C --Parameters:
19 C -- NPTS - IN - the number of points on the curve
20 C -- XPTS, YPTS - IN - the points on the curve
21 C -- PLTITL - IN - the plot title describing the curve
22 C -- (e.g. "TIME vs SIGXX at ELEMENT 30")
23 C -- TXLAB, TYLAB - IN - the X and Y axis labels, either the
24 C -- user-input labels or the plot variable descriptions
25 C --
26 C --Common Variables:
27 C -- Uses TITLE, CREATE, MODIFY, DRAW of /DBTITL/
28 C -- Uses DOQA, CAPTN of /LEGOPT/
29 C -- Uses XMIN, XMAX, YMIN, YMAX of /LIMITS/
30 C -- Uses NEU, NUMCRV, INCCRV, CRVNAM of /NEUTR./
31 C -- Uses and sets NEUOPN of /NEUTR./
32
33 include 'dbname.blk'
34 include 'dbtitl.blk'
35 include 'legopt.blk'
36 include 'xylim.blk'
37 include 'neutr.blk'
38
39 CHARACTER*2048 filnam, errmsg
40 REAL XPTS(NPTS), YPTS(NPTS)
41 CHARACTER*(*) PLTITL
42 CHARACTER*(*) TXLAB, TYLAB
43
44 CHARACTER*15 CURVE
45 integer numgrf
46 save numgrf
47
48 IF (.NOT. NEUOPN) THEN
49 filnam = basenam(:lenstr(basenam)) // '.xmgr'
50
51 C --Open the neutral file and write the title line
52 write (*,*) "Neutral File: ", filnam
53 open (unit=neu, file=filnam(:lenstr(filnam)), form='formatted',
54 * status='unknown', iostat=ierr)
55 IF (IERR .NE. 0) THEN
56 ERRMSG = 'Neutral file "'//FILNAM(:LENSTR(FILNAM))//
57 * '" could not be opened.'
58 CALL PRTERR ('CMDERR', ERRMSG(:LENSTR(ERRMSG)))
59 GOTO 170
60 END IF
61 NEUOPN = .TRUE.
62
63 WRITE (NEU, 10000) 'Written by: ',
64 * DRAW(1), DRAW(3)(:LENSTR(DRAW(3))), DRAW(4)(:LENSTR(DRAW(4)))
65 WRITE (NEU, 10000) 'Created by: ',
66 * CREATE(1), CREATE(3)(:LENSTR(CREATE(3))),
67 * CREATE(4)(:LENSTR(CREATE(4)))
68 WRITE (NEU, 10000) 'Modified by: ',
69 & MODIFY(1), MODIFY(3)(:LENSTR(MODIFY(3))),
70 * MODIFY(4)(:LENSTR(MODIFY(4)))
71 10000 FORMAT ('# ',A, A, A, ' ', A, ' ', A)
72
73 C--Write header information.
74 numgrf = 0
75 numcrv = 31
76 C... Set world min/max values to appropriate values.
77 WXMIN = 1.0E30
78 WXMAX = -1.0E30
79 WYMIN = 1.0E30
80 WYMAX = -1.0E30
81 END IF
82 C --If numcrv >= 30, increment grf number and print header.
83 if (numcrv .ge. 30 .or.
84 * (inccrv .lt. 0 .and. numcrv .gt. abs(inccrv))) then
85 numcrv = 1
86 write (curve, '(A1, I7)') 'g', numgrf
87 CALL PCKSTR (1, CURVE)
88 WRITE (NEU, 10100) curve
89 10100 FORMAT ('@ with ',A,/
90 * '@ legend on'/
91 * '@ legend loctype view'/
92 * '@ legend char size 0.75')
93 numgrf = numgrf + 1
94 end if
95 C --Get the curve name
96 WRITE (CURVE, '(A1, I7)') 's', NUMCRV-1
97 CALL PCKSTR (1, CURVE)
98
99 WRITE (*, 10090) PLTITL(:LENSTR(PLTITL)), numgrf-1, numcrv-1
100 10090 FORMAT (' Writing "',A,'" to Graph ',i2,', Set ',i2)
101
102 C --Write the begin curve record with the curve name
103 WRITE (NEU, 10020) 'title', TITLE(:lenstr(title))
104 WRITE (NEU, 10020) 'subtitle', PLTITL(:lenstr(pltitl))
105
106 ncol = mod(numcrv-1,15) + 1
107 WRITE (NEU, 10010) CURVE, 'color', ncol
108 10010 FORMAT ('@ ',A, A, I7)
109
110 C --Write the title lines
111
112 10020 FORMAT ('@ ',A,' "', A,'"')
113
114 C --Write the X and Y labels
115
116 WRITE (NEU, 10040) '@ xaxis label', TXLAB(:lenstr(txlab))
117 WRITE (NEU, 10040) '@ yaxis label', TYLAB(:lenstr(tylab))
118 10040 FORMAT (A,' "',A,'"')
119 write (neu, 10050) numcrv-1, TYLAB(:lenstr(tylab))
120 10050 FORMAT ('@ legend string ',i5,' "',A,'"')
121 write (neu, 10060) curve, TYLAB(:lenstr(tylab))
122 10060 FORMAT ('@ ',A,' comment "',A,'"')
123 C --Write the min/max, the number of points, and the auxiliary data flag
124
125 C --Write the data points
126
127 DO 160 I = 1, NPTS
128 WXMAX = MAX(WXMAX, XPTS(I))
129 WXMIN = MIN(WXMIN, XPTS(I))
130 WYMAX = MAX(WYMAX, YPTS(I))
131 WYMIN = MIN(WYMIN, YPTS(I))
132 WRITE (NEU, 10070) XPTS(I), YPTS(I)
133 10070 FORMAT (1PE15.7E3,4x,1pe15.7E3)
134 160 CONTINUE
135 WRITE (NEU, '(A)') '&'
136 170 CONTINUE
137 NUMCRV = NUMCRV + 1
138 RETURN
139 END