| 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 PAINT (VARNP, LENF, NLNKF, LINKF, NXFAC, IXFAC, |
| 9 |
& XN, YN, ZN, XF, YF, ZF, ISVOK, FMIN, FMAX, *) |
| 10 |
C======================================================================= |
| 11 |
|
| 12 |
C --*** PAINT *** (DETOUR) Paint contours |
| 13 |
C -- Modified by John H. Glick - 10/26/88 |
| 14 |
C -- Written by Amy Gilkey - revised 03/14/88 |
| 15 |
C -- |
| 16 |
C --PAINT paints contour sections in a color sequence. The contour |
| 17 |
C --algorithm assumes that the elements do not contain internal nodes. |
| 18 |
C --The element interpolation field is approximated by logically drawing |
| 19 |
C --lines from each node to the element center and, thusly, dividing the |
| 20 |
C --element into triangles. Contour sections are then drawn by connecting |
| 21 |
C --the intersection points of the sub-element edges and the contour |
| 22 |
C --plane. |
| 23 |
C -- |
| 24 |
C --The element block status indicates which element blocks are active |
| 25 |
C --for contours. No contours are drawn in inactive elements. |
| 26 |
C -- |
| 27 |
C --Parameters: |
| 28 |
C -- VARNP - IN - the contour function values |
| 29 |
C -- LENF - IN - the cumulative face counts by element block |
| 30 |
C -- NLNKF - IN - the number of nodes per face |
| 31 |
C -- LINKF - IN - the connectivity for all faces |
| 32 |
C -- NXFAC - IN - the number of ordered faces |
| 33 |
C -- IXFAC - IN - the indices of the ordered faces |
| 34 |
C -- XN, YN, ZN - IN - the nodal coordinates |
| 35 |
C -- XF, YF, ZF - IN - the face center coordinates |
| 36 |
C -- ISVOK - IN - ISVOK(i) is true iff the contour variable is defined |
| 37 |
C -- for element block i (always true if nodal variable) |
| 38 |
C -- FMIN, FMAX - IN - the minimum and maximum function value |
| 39 |
C -- * - return statement if the cancel function is active |
| 40 |
C -- |
| 41 |
C --Common Variables: |
| 42 |
C -- Uses NUMEL, NELBLK of /DBNUMS/ |
| 43 |
C -- Uses IS3DIM of /D3NUMS/ |
| 44 |
C -- Uses NCNTR, NOCMIN, NOCMAX of /CNTR/ |
| 45 |
|
| 46 |
include 'dbnums.blk' |
| 47 |
include 'd3nums.blk' |
| 48 |
include 'cntr.blk' |
| 49 |
|
| 50 |
REAL VARNP(*) |
| 51 |
INTEGER LENF(0:NELBLK) |
| 52 |
INTEGER NLNKF(NELBLK) |
| 53 |
INTEGER LINKF(*) |
| 54 |
INTEGER IXFAC(*) |
| 55 |
REAL XN(*), YN(*), ZN(*) |
| 56 |
REAL XF(*), YF(*), ZF(*) |
| 57 |
LOGICAL ISVOK(NELBLK) |
| 58 |
|
| 59 |
LOGICAL GRABRT |
| 60 |
|
| 61 |
C --Fill the CINTV array with the contour intervals |
| 62 |
|
| 63 |
IF (.NOT. CINTOK) THEN |
| 64 |
DO 100 NC = 1, NCNTR+1 |
| 65 |
CINTV(NC) = CNTRI (NC) |
| 66 |
100 CONTINUE |
| 67 |
END IF |
| 68 |
|
| 69 |
C --Set the contour minimum and maximum (in case NOCMIN, etc.) |
| 70 |
CNTRMN = FMIN - ABS (DELC) |
| 71 |
CNTRMX = FMAX + ABS (DELC) |
| 72 |
|
| 73 |
DO 120 IX = 1, NXFAC |
| 74 |
IFAC = IXFAC(IX) |
| 75 |
IELB = 0 |
| 76 |
IXL = IDBLNK (IELB, IFAC, LENF, NLNKF) |
| 77 |
IF (NLNKF(IELB) .LE. 2) GOTO 120 |
| 78 |
|
| 79 |
IF ((.NOT. IS3DIM) .AND. (NLNKF(IELB) .EQ. 9)) THEN |
| 80 |
NNPF = 8 |
| 81 |
ELSE |
| 82 |
NNPF = NLNKF(IELB) |
| 83 |
ENDIF |
| 84 |
|
| 85 |
IF (ISVOK(IELB)) THEN |
| 86 |
|
| 87 |
C --Compute the minimum and maximum values for the face |
| 88 |
CALL CFMAX (VARNP, NLNKF(IELB), LINKF(IXL), FEMIN, FEMAX) |
| 89 |
|
| 90 |
C --Find limiting contour intervals |
| 91 |
difx = abs(cintv(1) - femax) |
| 92 |
difn = abs(cintv(1) - femin) |
| 93 |
imaxc = 1 |
| 94 |
iminc = 1 |
| 95 |
do 10 i=2, ncntr+1 |
| 96 |
difxx = abs(cintv(i) - femax) |
| 97 |
if (difx .gt. difxx) then |
| 98 |
difx = difxx |
| 99 |
imaxc = i |
| 100 |
end if |
| 101 |
difnn = abs(cintv(i) - femin) |
| 102 |
if (difn .gt. difnn) then |
| 103 |
difn = difnn |
| 104 |
iminc = i |
| 105 |
end if |
| 106 |
10 continue |
| 107 |
IF (DELC .GE. 0.0) THEN |
| 108 |
c$$$ MINC = LOCREA (FEMIN, NCNTR+1, CINTV) |
| 109 |
c$$$ MAXC = LOCREA (FEMAX, NCNTR+1, CINTV) |
| 110 |
minc = iminc |
| 111 |
maxc = imaxc |
| 112 |
IF (FEMIN .LT. CINTV(MINC)) MINC = MINC - 1 |
| 113 |
IF (FEMAX .LT. CINTV(MAXC)) MAXC = MAXC - 1 |
| 114 |
ELSE |
| 115 |
c$$$ MINC = LOCREA (FEMAX, NCNTR+1, CINTV) |
| 116 |
c$$$ MAXC = LOCREA (FEMIN, NCNTR+1, CINTV) |
| 117 |
minc = imaxc |
| 118 |
maxc = iminc |
| 119 |
IF (FEMAX .GE. CINTV(MINC)) MINC = MINC - 1 |
| 120 |
IF (FEMIN .GE. CINTV(MAXC)) MAXC = MAXC - 1 |
| 121 |
END IF |
| 122 |
|
| 123 |
IF (NOCMIN .AND. (MINC .LT. 1)) THEN |
| 124 |
MINC = 1 |
| 125 |
IF (MINC .GT. MAXC) MAXC = MINC |
| 126 |
END IF |
| 127 |
IF (NOCMAX .AND. (MAXC .GT. NCNTR)) THEN |
| 128 |
MAXC = NCNTR |
| 129 |
IF (MINC .GT. MAXC) MINC = MAXC |
| 130 |
END IF |
| 131 |
IF ((MAXC .LT. 1) .OR. (MINC .GT. NCNTR)) THEN |
| 132 |
MINC = -1 |
| 133 |
MAXC = -1 |
| 134 |
END IF |
| 135 |
|
| 136 |
ELSE |
| 137 |
C --Not selected, paint face black |
| 138 |
MINC = -1 |
| 139 |
MAXC = -1 |
| 140 |
END IF |
| 141 |
|
| 142 |
C --Skip this contour if the values are outside the contour range |
| 143 |
|
| 144 |
IF (MINC .EQ. MAXC) THEN |
| 145 |
|
| 146 |
C --Face is entirely inside one contour area |
| 147 |
|
| 148 |
CALL GRCOLR (MINC) |
| 149 |
CALL SOLIDF (NNPF, LINKF(IXL), XN, YN, ZN) |
| 150 |
|
| 151 |
ELSE |
| 152 |
|
| 153 |
C --Face has several contour areas |
| 154 |
|
| 155 |
IF ((MINC .LT. 1) .OR. (MAXC .GT. NCNTR)) THEN |
| 156 |
|
| 157 |
C --Some part of face is outside contour limits, paint black |
| 158 |
|
| 159 |
CALL GRCOLR (-1) |
| 160 |
MINC = MAX (MINC, 1) |
| 161 |
MAXC = MIN (MAXC, NCNTR) |
| 162 |
END IF |
| 163 |
|
| 164 |
DO 110 NC = MINC, MAXC |
| 165 |
CALL GRCOLR (NC) |
| 166 |
IF (DELC .GE. 0.0) THEN |
| 167 |
CNTR0 = CNTRI (NC) |
| 168 |
IF (NOCMIN .AND. (NC .EQ. 1)) CNTR0 = CNTRMN |
| 169 |
CNTR1 = CNTRI (NC+1) |
| 170 |
IF (NOCMAX .AND. (NC .EQ. NCNTR)) CNTR1 = CNTRMX |
| 171 |
ELSE |
| 172 |
CNTR1 = CNTRI (NC) |
| 173 |
IF (NOCMIN .AND. (NC .EQ. 1)) CNTR1 = CNTRMX |
| 174 |
CNTR0 = CNTRI (NC+1) |
| 175 |
IF (NOCMAX .AND. (NC .EQ. NCNTR)) CNTR0 = CNTRMN |
| 176 |
END IF |
| 177 |
|
| 178 |
IF ((FEMIN .GE. CNTR1) .OR. (FEMAX .LT. CNTR0)) |
| 179 |
& print *, femin, cntr1, femax, cntr0 |
| 180 |
|
| 181 |
IF (GRABRT ()) RETURN 1 |
| 182 |
CALL PAINTF (CNTR0, CNTR1, |
| 183 |
& VARNP, NLNKF(IELB), LINKF(IXL), |
| 184 |
& XN, YN, ZN, XF(IFAC), YF(IFAC), ZF(IFAC)) |
| 185 |
110 CONTINUE |
| 186 |
END IF |
| 187 |
120 CONTINUE |
| 188 |
|
| 189 |
CALL PLTFLU |
| 190 |
|
| 191 |
RETURN |
| 192 |
END |