| 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 setcol(nelblk, shdcol, ishdcl, ielbst, blkcol, idelb) |
| 9 |
C----------------------------------------------------------------------- |
| 10 |
external blkdat |
| 11 |
|
| 12 |
C ... SHDCOL(1, *) = Red Component |
| 13 |
C SHDCOL(2, *) = Green Component |
| 14 |
C SHDCOL(3, *) = Blue Component |
| 15 |
C SHDCOL(4-7,*) - Future Use |
| 16 |
REAL SHDCOL(7,NELBLK) |
| 17 |
C ... ISHDCL(1, *) = -1 if color not set, >0 if color set |
| 18 |
C ISHDCL(2, *) = Number of colors to use for this block (SET if 0) |
| 19 |
C ISHDCL(3, *) = Starting location in color map (SET) |
| 20 |
INTEGER ISHDCL(3,NELBLK) |
| 21 |
INTEGER IELBST(NELBLK) |
| 22 |
INTEGER BLKCOL(0:NELBLK) |
| 23 |
INTEGER IDELB(*) |
| 24 |
LOGICAL BLKCLR |
| 25 |
integer IPARMS(3) |
| 26 |
character*80 string |
| 27 |
|
| 28 |
include 'icrnbw.blk' |
| 29 |
include 'light.blk' |
| 30 |
|
| 31 |
logical first |
| 32 |
save first |
| 33 |
data first /.TRUE./ |
| 34 |
|
| 35 |
if (FIRST) THEN |
| 36 |
FIRST = .FALSE. |
| 37 |
call grcolu('ALTERNATE') |
| 38 |
call grspar('SPECTRUM', -1, 256, STRING) |
| 39 |
end if |
| 40 |
|
| 41 |
blkclr = .FALSE. |
| 42 |
do 10 i = 1, NELBLK |
| 43 |
if (ielbst(i) .gt. 0 .and. ishdcl(1,i) .gt. 0) then |
| 44 |
blkclr =.TRUE. |
| 45 |
ishdcl(1,i) = i |
| 46 |
end if |
| 47 |
10 continue |
| 48 |
|
| 49 |
if (blkclr) then |
| 50 |
|
| 51 |
C ... Determine whether any of the block colors match. |
| 52 |
do 18 iblk = 1, nelblk |
| 53 |
if (ishdcl(1,iblk) .eq. iblk .and. ielbst(iblk) .gt. 0) then |
| 54 |
ired = int(10000 * shdcol(1,iblk)) |
| 55 |
igrn = int(10000 * shdcol(2,iblk)) |
| 56 |
iblu = int(10000 * shdcol(3,iblk)) |
| 57 |
do 16 i = iblk+1, nelblk |
| 58 |
if (ielbst(i) .gt. 0) then |
| 59 |
if (ired .eq. int(10000 * shdcol(1,i)) .and. |
| 60 |
* igrn .eq. int(10000 * shdcol(2,i)) .and. |
| 61 |
* iblu .eq. int(10000 * shdcol(3,i))) then |
| 62 |
ishdcl(1,i) = iblk |
| 63 |
ishdcl(2,iblk) = max(ishdcl(2,iblk), ishdcl(2,i)) |
| 64 |
ishdcl(2,i) = ishdcl(2,iblk) |
| 65 |
end if |
| 66 |
end if |
| 67 |
16 continue |
| 68 |
end if |
| 69 |
18 continue |
| 70 |
|
| 71 |
ncol = 0 |
| 72 |
icol = 0 |
| 73 |
do 20 iblk = 1, NELBLK |
| 74 |
if (ielbst(iblk) .gt. 0 .and. ishdcl(1,iblk) .eq. iblk) then |
| 75 |
if (ishdcl(2, iblk) .eq. 0) then |
| 76 |
icol = icol + 1 |
| 77 |
else |
| 78 |
ncol = ncol + ishdcl(2, iblk) |
| 79 |
end if |
| 80 |
end if |
| 81 |
20 continue |
| 82 |
C ... If number of colors not set for at least one block, |
| 83 |
C determine number of colors specified vs. spectrum colors, |
| 84 |
C divide remainder of colors to unspecified blocks |
| 85 |
call grgpar('SPECTRUM', 0, IPARMS, STRING) |
| 86 |
NUMCOL = IPARMS(2) |
| 87 |
IF (NCOL .GT. NUMCOL) then |
| 88 |
call prterr ('FATAL','Maximum number of colors exceeded') |
| 89 |
end if |
| 90 |
if (icol .gt. 0) then |
| 91 |
icol = (numcol - ncol) / icol |
| 92 |
ncol = numcol |
| 93 |
else |
| 94 |
C ... If number of colors set for all blocks, allocate that many colors. |
| 95 |
call grspar('SPECTRUM', -1, min(NCOL,NUMCOL), STRING) |
| 96 |
end if |
| 97 |
mincol = 0 |
| 98 |
do 30 iblk = 1, NELBLK |
| 99 |
if (ielbst(iblk) .gt. 0) then |
| 100 |
if (ishdcl(2, iblk) .eq. 0) ishdcl(2,iblk) = icol |
| 101 |
if (ishdcl(1, iblk) .eq. iblk) then |
| 102 |
ishdcl(3,iblk) = mincol |
| 103 |
mincol = mincol + ishdcl(2, iblk) |
| 104 |
else |
| 105 |
ishdcl(3,iblk) = ishdcl(3,ishdcl(1,iblk)) |
| 106 |
end if |
| 107 |
end if |
| 108 |
30 continue |
| 109 |
|
| 110 |
C ... Set the spectrum |
| 111 |
do 50 iblk = 1, nelblk |
| 112 |
if (ielbst(iblk) .gt. 0 .and. ishdcl(1,iblk) .eq. iblk) then |
| 113 |
ncol = ishdcl(2, iblk) |
| 114 |
mincol = ishdcl(3, iblk) |
| 115 |
if (ncol .gt. 1) then |
| 116 |
R = (1.0 / ambient) ** (1.0 / (ncol-1)) |
| 117 |
else |
| 118 |
R = 1.0 |
| 119 |
end if |
| 120 |
do 40 i = 0, ncol-1 |
| 121 |
if (ncol .eq. 1) then |
| 122 |
hue = 1.0 |
| 123 |
else |
| 124 |
hue = ambient * R**i |
| 125 |
end if |
| 126 |
red = min(1.0, hue * shdcol(1, iblk) ) |
| 127 |
green = min(1.0, hue * shdcol(2, iblk) ) |
| 128 |
blue = min(1.0, hue * shdcol(3, iblk) ) |
| 129 |
CALL PLTCOL (i+mincol+8, red, green, blue) |
| 130 |
40 continue |
| 131 |
end if |
| 132 |
50 continue |
| 133 |
call prnshd (nelblk, idelb, ishdcl, shdcol, ielbst) |
| 134 |
else |
| 135 |
C ... Single color for entire model |
| 136 |
mincol = 0 |
| 137 |
call grgpar('SPECTRUM', 0, IPARMS, STRING) |
| 138 |
NCOL = IPARMS(1) |
| 139 |
do 80 iblk = 1, nelblk |
| 140 |
ishdcl(2,iblk) = ncol |
| 141 |
ishdcl(3,iblk) = mincol |
| 142 |
80 continue |
| 143 |
if (ncol .gt. 1) then |
| 144 |
R = (1.0 / ambient) ** (1.0 / (ncol-1)) |
| 145 |
else |
| 146 |
R = 1.0 |
| 147 |
end if |
| 148 |
do 90 i=0, NCOL-1 |
| 149 |
hue = ambient * R**i |
| 150 |
red = min(1.0, (hue * RMULT)) |
| 151 |
green = min(1.0, (hue * GMULT)) |
| 152 |
blue = min(1.0, (hue * BMULT)) |
| 153 |
CALL PLTCOL (i+8, red, green, blue) |
| 154 |
90 continue |
| 155 |
end if |
| 156 |
call grcolu('ALTERNATE') |
| 157 |
|
| 158 |
return |
| 159 |
end |
| 160 |
C----------------------------------------------------------------------- |