Debian Codegraph @

packages/seacas/applications/blot/scolor.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 SCOLOR (INIT, INLINE, IFLD, INTYP, RFIELD, IFIELD,
9 & CFIELD, SHDCOL, ISHDCL, IDELB)
10 C============================================================================
11
12 C --*** BCOLOR *** (BLOT) Process BLKCOL command
13 C -- Written by John Glick - 11/22/88
14 C --
15 C --Parameters:
16 C -- INIT - IN - .TRUE. iff the purpose of the call is to
17 C -- initialize the BLKCOL array and not to modify it.
18 C -- INLINE - IN/OUT - the parsed input lines for the log file
19 C -- IFLD, INTYP, IFIELD, CFIELD, - IN/OUT - the free-field reader
20 C -- index and character field.
21 C -- BLKCOL - IN/OUT - the user selected colors of the element blocks.
22 C -- BLKCOL(0) = 1 if the user defined material
23 C -- colors should be used in mesh plots.
24 C -- = -1 if program selected colors should
25 C -- be used.
26 C -- BLKCOL(i) = the user selected color of element
27 C -- block i:
28 C -- -2 - no color selected by user.
29 C -- -1 - black
30 C -- 0 - white
31 C -- 1 - red
32 C -- 2 - green
33 C -- 3 - yellow
34 C -- 4 - blue
35 C -- 5 - cyan
36 C -- 6 - magenta
37 LOGICAL INIT
38 CHARACTER*(*) INLINE(*)
39 INTEGER IFLD, INTYP(*), IFIELD(*)
40 REAL RFIELD(*)
41 CHARACTER*(*) CFIELD(*)
42 REAL SHDCOL(7, *)
43 INTEGER ISHDCL(3, *)
44 INTEGER IDELB(*)
45
46 include 'dbnums.blk'
47 include 'bcolr.blk'
48
49 LOGICAL FFMATC, FFEXST
50 INTEGER IDCOL, LOCSTR
51
52 CHARACTER*8 COLA, COLF
53
54 include 'shades.blk'
55
56 C *****************************************************************
57
58 BCOLCH = .TRUE.
59
60 IF (INIT) THEN
61
62 DO 100 I = 1, NELBLK
63 ISHDCL(1,I) = -1
64 ISHDCL(2,I) = 0
65 ISHDCL(3,I) = 0
66 100 CONTINUE
67
68 ELSE
69
70 C If there are no fields on the BLKCOL command line,
71 C toggle the ON/OFF flag.
72
73 IF (INTYP(IFLD) .LE. -1) THEN
74 DO 110 I = 1, NELBLK
75 ISHDCL(1,I) = -ISHDCL(1,I)
76 110 CONTINUE
77
78 C Check for ON flag.
79
80 ELSE IF (FFMATC (IFLD, INTYP, CFIELD, 'OFF', 2)) THEN
81 do 120 I = 1, NELBLK
82 ISHDCL(1, I) = -1
83 ISHDCL(2,I) = 0
84 ISHDCL(3,I) = 0
85 120 CONTINUE
86 CALL FFADDC ('OFF', INLINE(1))
87
88 C Check for RESET flag.
89
90 ELSE IF (FFMATC (IFLD, INTYP, CFIELD, 'RESET', 2)) THEN
91 CALL FFADDC ('RESET', INLINE(1))
92 do 130 I = 1, NELBLK
93 ISHDCL(1, I) = -1
94 ISHDCL(2,I) = 0
95 ISHDCL(3,I) = 0
96 130 CONTINUE
97
98 ELSE IF (FFMATC (IFLD, INTYP, CFIELD, 'SHOW', 2)) THEN
99 CALL FFADDC ('SHOW', INLINE(1))
100 CALL SHOCMD ('Valid predefined colors', SHDLST)
101
102 ELSE
103
104 ibeg = 0
105 iend = 0
106
107 IF (FFMATC (IFLD, INTYP, CFIELD, 'ALL', 2)) THEN
108 CALL FFADDC ('ALL', INLINE(1))
109 IBEG = 1
110 IEND = NELBLK
111
112 ELSE IF (FFEXST (IFLD, INTYP)) THEN
113
114 CALL FFINTG (IFLD, INTYP, IFIELD,
115 * 'block id', 0, IDBLK, *170)
116 CALL FFADDI (IDBLK, INLINE)
117 iblk = locint (idblk, nelblk, idelb)
118 if (iblk .eq. 0) then
119 write (*, 900) idblk
120 900 FORMAT (1x, 'Material ID', I5,
121 * ' is not a valid material id.')
122 go to 170
123 end if
124 IBEG = IBLK
125 IEND = IBLK
126 end if
127
128 C Get color to assign to the specified blocks.
129 C Check that next field has characters in it.
130
131 if (ibeg .ne. 0 .and. iend .ne. 0) then
132 IF (INTYP(IFLD) .EQ. 0) THEN
133 COLA = CFIELD(IFLD)
134 IFLD = IFLD + 1
135 CALL ABRSTR (COLF, COLA, SHDLST)
136 IF (COLF .EQ. ' ') THEN
137 WRITE (*, 10000) COLA
138 10000 FORMAT (1X, A, ' not a valid color name.',
139 & ' Rest of command not processed.')
140 GO TO 170
141 ELSE
142 IDCOL = LOCSTR (COLF, NCLSHD, SHDLST)
143 RMULT = shades(1,IDCOL)
144 GMULT = shades(2,IDCOL)
145 BMULT = shades(3,IDCOL)
146 END IF
147 CALL FFADDC (COLF, INLINE)
148 ELSE
149 C ... Color is specified by RGB components.
150 CALL FFREAL (IFLD, INTYP, RFIELD,
151 * 'Red Multiplier', 1.0, RMULT, *170)
152 CALL FFADDR (RMULT, INLINE(1))
153 CALL FFREAL (IFLD, INTYP, RFIELD,
154 * 'Green Multiplier', 1.0, GMULT, *170)
155 CALL FFADDR (GMULT, INLINE(1))
156 CALL FFREAL (IFLD, INTYP, RFIELD,
157 * 'Blue Multiplier', 1.0, BMULT, *170)
158 CALL FFADDR (BMULT, INLINE(1))
159 ENDIF
160 ELSE
161 WRITE (*, 10020)
162 10020 FORMAT (1X,
163 * 'No color specified following block id specifications')
164 GO TO 170
165 ENDIF
166
167 call ffintg(ifld, intyp, ifield,
168 * 'number of colors', 0, NCOL, *170)
169 call ffaddi (NCOL, INLINE(1))
170 C ... Get diffuse and specular values.
171 CALL FFREAL (IFLD, INTYP, RFIELD,
172 * 'Diffuse Proportion', 0.0, PDIFF, *170)
173 CALL FFADDR (PDIFF, INLINE(1))
174 CALL FFREAL (IFLD, INTYP, RFIELD,
175 * 'Specular Proportion', 0.0, PSPEC, *170)
176 CALL FFADDR (PSPEC, INLINE(1))
177 CALL FFREAL (IFLD, INTYP, RFIELD,
178 * 'Specular Exponent', 0.0, SPEXP, *170)
179 CALL FFADDR (SPEXP, INLINE(1))
180
181 do 140 iblk = ibeg, iend
182 ISHDCL(1, IBLK) = 1
183 ISHDCL(2, IBLK) = NCOL
184 C ... RGB Components of color
185 SHDCOL(1, IBLK) = RMULT
186 SHDCOL(2, iblk) = GMULT
187 SHDCOL(3, iblk) = BMULT
188 C ... Diffuse and Specular Values, Specular Exponent.
189 SHDCOL(4, IBLK) = PDIFF
190 SHDCOL(5, iblk) = PSPEC
191 SHDCOL(6, iblk) = SPEXP
192 140 continue
193 ENDIF
194
195 ENDIF
196
197 170 CONTINUE
198 RETURN
199 END