| 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 CONRNG (ISLINE, FMINI, FMAXI, NCNTR, DELC, CMIN, CMAX) |
| 9 |
C======================================================================= |
| 10 |
|
| 11 |
C --*** CONRNG *** (DETOUR) Calculate contour range |
| 12 |
C -- Written by Amy Gilkey - revised 06/09/87 |
| 13 |
C -- |
| 14 |
C --CONRNG calculates a new contour range from the minimum and maximum |
| 15 |
C --values. Note that the contour interval and range are rounded to |
| 16 |
C --get "nice" numbers. For the line contour, the contour minimum and |
| 17 |
C --maximum should fall between the actual value range (about one-half |
| 18 |
C --an interval in). For the paint contour, the contour range must |
| 19 |
C --cover the actual value range. |
| 20 |
C -- |
| 21 |
C --Parameters: |
| 22 |
C -- ISLINE - IN - true if line contour, else paint contour |
| 23 |
C -- FMINI, FMAXI - IN - the minimum and maximum value in the contour plot |
| 24 |
C -- NCNTR - IN/OUT - the number of contours defined |
| 25 |
C -- DELC - OUT - the contour interval |
| 26 |
C -- CMIN - OUT - the minimum contour value |
| 27 |
C -- CMAX - OUT - the maximum contour value |
| 28 |
|
| 29 |
LOGICAL ISLINE |
| 30 |
|
| 31 |
CHARACTER*8 STRING |
| 32 |
|
| 33 |
IF (NCNTR .LE. 0) NCNTR = 6 |
| 34 |
|
| 35 |
C --Check for minimum equal maximum |
| 36 |
|
| 37 |
IF (FMINI .EQ. FMAXI) THEN |
| 38 |
CALL PRTERR ('CMDWARN', 'Contour variable does not vary' |
| 39 |
& // ' - an artificial range is supplied') |
| 40 |
IF (FMINI .EQ. 0.0) THEN |
| 41 |
FMIN = -1.0 |
| 42 |
FMAX = 1.0 |
| 43 |
ELSE |
| 44 |
FMIN = FMINI - .05 * ABS(FMINI) |
| 45 |
FMAX = FMINI + .05 * ABS(FMINI) |
| 46 |
END IF |
| 47 |
ELSE |
| 48 |
FMIN = FMINI |
| 49 |
FMAX = FMAXI |
| 50 |
END IF |
| 51 |
|
| 52 |
IF (ISLINE) THEN |
| 53 |
|
| 54 |
C --Compute decimal scale factor |
| 55 |
|
| 56 |
DELC = (FMAX - FMIN) / NCNTR |
| 57 |
WRITE (STRING, '(E8.1)') DELC |
| 58 |
STRING(4:4) = '1' |
| 59 |
READ (STRING, '(E8.1)') P10 |
| 60 |
|
| 61 |
C --Compute rounded increment and offset |
| 62 |
|
| 63 |
DELC = .5 * P10 * NINT (2. * DELC / P10) |
| 64 |
CMIN = .5 * |
| 65 |
& (P10 * NINT ((FMAX + FMIN) / P10) - (NCNTR-1) * DELC) |
| 66 |
CMAX = CMIN + (NCNTR-1) * DELC |
| 67 |
|
| 68 |
ELSE |
| 69 |
FRNG = FMAX - FMIN |
| 70 |
100 CONTINUE |
| 71 |
|
| 72 |
C --Compute decimal scale factor |
| 73 |
|
| 74 |
DELC = FRNG / NCNTR |
| 75 |
WRITE (STRING, '(E8.1)') DELC |
| 76 |
STRING(4:4) = '1' |
| 77 |
READ (STRING, '(E8.1)') P10 |
| 78 |
|
| 79 |
C --Compute rounded increment and offset |
| 80 |
|
| 81 |
DELC = .25 * P10 * NINT (4. * DELC / P10) |
| 82 |
CMIN = .5 * (P10 * NINT ((FMAX + FMIN) / P10) - NCNTR * DELC) |
| 83 |
IF ((FMIN .GE. 0.0) .AND. (CMIN .LT. 0.0)) CMIN = 0.0 |
| 84 |
CMAX = CMIN + NCNTR * DELC |
| 85 |
|
| 86 |
C --Adjust and recompute, if needed |
| 87 |
|
| 88 |
IF ((CMIN .GT. FMIN) .OR. (CMAX .LT. FMAX)) THEN |
| 89 |
IF (CMIN .GT. FMIN) FRNG = FRNG + .25*DELC |
| 90 |
IF (CMAX .LT. FMAX) FRNG = FRNG + .25*DELC |
| 91 |
GOTO 100 |
| 92 |
END IF |
| 93 |
|
| 94 |
END IF |
| 95 |
|
| 96 |
RETURN |
| 97 |
END |