Debian Codegraph @

packages/seacas/applications/blot/graexp.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 GRAEXP (AXTYP, NNUM, RNUM, ATIC)
9 C=======================================================================
10
11 C --*** GRAEXP *** (GRPLIB) Choose axis exponent (PLT)
12 C -- Written by Amy Gilkey - revised 02/20/87
13 C --
14 C --GRAEXP chooses an exponent from the axes limits and sets this
15 C --value and the number of decimal digits for the given axis.
16 C --It will convert to engineering notation if possible.
17 C --
18 C --Parameters:
19 C -- AXTYP - IN - the axis (' ' for both, 'X' for X, 'Y' for Y)
20 C -- NNUM - IN - the number of numbers in the array set;
21 C -- 0 for no exponent
22 C -- RNUM - IN - the array of axes limits
23 C -- ATIC - IN - the axis tick mark interval
24
25 C --Routines Called:
26 C -- PLTSTG - (PLTLIB) Set graph parameter
27 C -- 13, 14 = (KXEXP, KYEXP) X, Y axis exponent
28 C -- 19, 20 = (KXNDIG, KYNDIG) X, Y axis number of decimal digits
29
30 PARAMETER (KXEXP=13, KYEXP=14, KXNDIG=19, KYNDIG=20)
31
32 CHARACTER AXTYP
33 INTEGER NNUM
34 REAL RNUM(*)
35 REAL ATIC
36
37 LOGICAL LDUM, PLTSTG
38 CHARACTER*12 SCRSTR
39
40 IF (NNUM .GT. 0) THEN
41
42 C --Convert all to E notation and find the minimum and maximum exponent
43 C -- MINE and MAXE are the minimum and maximum exponents
44
45 MINE = 999
46 MAXE = -999
47 DO 100 I = 1, NNUM
48 IF (RNUM(I) .NE. 0.0) THEN
49 WRITE (SCRSTR(1:8), '(0PE8.1)') RNUM(I)
50 READ (SCRSTR(6:8), '(I3)') IE
51 MINE = MIN (MINE, IE)
52 MAXE = MAX (MAXE, IE)
53 END IF
54 100 CONTINUE
55
56 IF (MAXE .GT. 0) THEN
57 IEXP = INT ((MAXE - 1) / 3) * 3
58 ELSE
59 IEXP = INT ((MAXE - 2) / 3) * 3
60 END IF
61
62 WRITE (SCRSTR(1:12), '(0PE12.5)') ATIC
63 READ (SCRSTR(10:12), '(I3)') ITICE
64 DO 110 I = 8, 3, -1
65 IF (SCRSTR(I:I) .NE. '0') GOTO 120
66 110 CONTINUE
67 120 CONTINUE
68 NSIG = MAX (2, I-3 + MAXE - ITICE)
69 NDIG = MAX (0, IEXP - MAXE + NSIG)
70
71 ELSE
72
73 C --Set exponent and number of digits to zero
74
75 IEXP = 0
76 NDIG = 0
77 END IF
78
79 IF (AXTYP .NE. 'Y') THEN
80 LDUM = PLTSTG (KXEXP, REAL(IEXP))
81 LDUM = PLTSTG (KXNDIG, REAL(NDIG))
82 END IF
83 IF (AXTYP .NE. 'X') THEN
84 LDUM = PLTSTG (KYEXP, REAL(IEXP))
85 LDUM = PLTSTG (KYNDIG, REAL(NDIG))
86 END IF
87
88 RETURN
89 END