| 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 FILTEL (IXELB, NUMLNK, LINK, VISELB, |
| 9 |
& IXNODE, IXELBO, IXELEM, NODIX, |
| 10 |
* ISEVOK, VALUES) |
| 11 |
C======================================================================= |
| 12 |
|
| 13 |
include 'ag_dbnums.blk' |
| 14 |
include 'ag_dbout.blk' |
| 15 |
include 'ag_filter.blk' |
| 16 |
|
| 17 |
INTEGER IXELB(0:NELBLK) |
| 18 |
INTEGER NUMLNK(*) |
| 19 |
INTEGER LINK(*) |
| 20 |
LOGICAL VISELB(NELBLK) |
| 21 |
INTEGER IXNODE(*) |
| 22 |
INTEGER IXELBO(0:NELBLK) |
| 23 |
INTEGER IXELEM(*) |
| 24 |
INTEGER NODIX(*) |
| 25 |
LOGICAL ISEVOK(*) |
| 26 |
REAL VALUES(*) |
| 27 |
|
| 28 |
DO 100 INP = 1, NUMNP |
| 29 |
NODIX(INP) = 0 |
| 30 |
100 CONTINUE |
| 31 |
|
| 32 |
C If (Output Element Blocks < Element Blocks) |
| 33 |
IF (NUMEQL (.TRUE., NELBLK, VISELB) .LT. NELBLK) THEN |
| 34 |
|
| 35 |
C --Identify elements of a selected element block, and save index |
| 36 |
C --Eliminate nodes that are not in an element of a selected element block |
| 37 |
|
| 38 |
NUMELO = 0 |
| 39 |
IXELBO(0) = NUMELO |
| 40 |
C Loop 1 to number of element blocks |
| 41 |
DO 130 IELB = 1, NELBLK |
| 42 |
C Write element block IELB |
| 43 |
IF (VISELB(IELB)) THEN |
| 44 |
C 0 index into cumulative count array |
| 45 |
C Loop over cumulative number of elements in element block IELB |
| 46 |
DO 120 IEL = IXELB(IELB-1)+1, IXELB(IELB) |
| 47 |
C increment number of elements to output |
| 48 |
NUMELO = NUMELO + 1 |
| 49 |
C Indices of the zoomed elements |
| 50 |
IXELEM(NUMELO) = IEL |
| 51 |
120 CONTINUE |
| 52 |
END IF |
| 53 |
C Set cumul element count for output block IELB |
| 54 |
IXELBO(IELB) = NUMELO |
| 55 |
130 CONTINUE |
| 56 |
|
| 57 |
ELSE |
| 58 |
NUMELO = 0 |
| 59 |
IXELBO(0) = NUMELO |
| 60 |
C loop from 1 to number of element blocks |
| 61 |
DO 160 IELB = 1, NELBLK |
| 62 |
C Loop over cumulative elements count in element block IELB |
| 63 |
DO 150 IEL = IXELB(IELB-1)+1, IXELB(IELB) |
| 64 |
C Increment number of elements to output |
| 65 |
NUMELO = NUMELO + 1 |
| 66 |
C Initialize indices of the zoomed elements |
| 67 |
IXELEM(NUMELO) = IEL |
| 68 |
150 CONTINUE |
| 69 |
C Set the number of elements to output for element block IELB |
| 70 |
IXELBO(IELB) = NUMELO |
| 71 |
160 CONTINUE |
| 72 |
END IF |
| 73 |
|
| 74 |
IF (ISFILTER) THEN |
| 75 |
|
| 76 |
C --Identify elements to be retained... |
| 77 |
|
| 78 |
NUMELO = 0 |
| 79 |
IXLAST = IXELBO(0) |
| 80 |
C Loop 1 to number of element blocks |
| 81 |
DO IELB = 1, NELBLK |
| 82 |
C Loop over cumulative element count in element block IELB |
| 83 |
if (isevok(ielb) .and. viselb(ielb)) then |
| 84 |
if (cmpflt .eq. 1) then |
| 85 |
call dolt(ixlast+1, ixelbo(ielb), ixelem, values, |
| 86 |
* valflt, numelo) |
| 87 |
else if (cmpflt .eq. 2) then |
| 88 |
call dole(ixlast+1, ixelbo(ielb), ixelem, values, |
| 89 |
* valflt, numelo) |
| 90 |
else if (cmpflt .eq. 3) then |
| 91 |
call doeq(ixlast+1, ixelbo(ielb), ixelem, values, |
| 92 |
* valflt, numelo) |
| 93 |
else if (cmpflt .eq. 4) then |
| 94 |
call done(ixlast+1, ixelbo(ielb), ixelem, values, |
| 95 |
* valflt, numelo) |
| 96 |
else if (cmpflt .eq. 5) then |
| 97 |
call dogt(ixlast+1, ixelbo(ielb), ixelem, values, |
| 98 |
* valflt, numelo) |
| 99 |
else if (cmpflt .eq. 6) then |
| 100 |
call doge(ixlast+1, ixelbo(ielb), ixelem, values, |
| 101 |
* valflt, numelo) |
| 102 |
end if |
| 103 |
else |
| 104 |
C ... If the variable doesn't exist on a block, retain all elements in the block |
| 105 |
DO IX = IXLAST+1, IXELBO(IELB) |
| 106 |
C iel = index of element |
| 107 |
IEL = IXELEM(IX) |
| 108 |
numelo = numelo + 1 |
| 109 |
ixelem(numelo) = iel |
| 110 |
end do |
| 111 |
end if |
| 112 |
IXLAST = IXELBO(IELB) |
| 113 |
IXELBO(IELB) = NUMELO |
| 114 |
end do |
| 115 |
END IF |
| 116 |
|
| 117 |
C --Set the selected element blocks in the zoom mesh |
| 118 |
|
| 119 |
IF (ISFILTER) THEN |
| 120 |
DO 220 IELB = 1, NELBLK |
| 121 |
NELO = IXELBO(IELB) - IXELBO(IELB-1) |
| 122 |
VISELB(IELB) = NELO .GT. 0 |
| 123 |
220 CONTINUE |
| 124 |
END IF |
| 125 |
|
| 126 |
C --Count the number of selected element blocks |
| 127 |
|
| 128 |
NELBO = NUMEQL (.TRUE., NELBLK, VISELB) |
| 129 |
|
| 130 |
C --Index nodes of selected element block within the zoom mesh |
| 131 |
NUMELO = 0 |
| 132 |
IXLAST = IXELBO(0) |
| 133 |
C Loop 1 to number of element blocks |
| 134 |
DO IELB = 1, NELBLK |
| 135 |
C Loop over cumulative element count in element block IELB |
| 136 |
DO IX = IXLAST+1, IXELBO(IELB) |
| 137 |
C iel = index of zoomed element |
| 138 |
IEL = IXELEM(IX) |
| 139 |
numelo = numelo + 1 |
| 140 |
C ixlo = 0 index for elemtn block |
| 141 |
IXL0 = IDBLNK (IELB, IEL, IXELB, NUMLNK) - 1 |
| 142 |
C Loop 1 to number of nodes per element - element block IELB |
| 143 |
DO K = 1, NUMLNK(IELB) |
| 144 |
NODIX(LINK(IXL0+K)) = -1 |
| 145 |
end do |
| 146 |
end do |
| 147 |
IXLAST = IXELBO(IELB) |
| 148 |
IXELBO(IELB) = NUMELO |
| 149 |
end do |
| 150 |
|
| 151 |
NUMNPO = 0 |
| 152 |
DO INP = 1, NUMNP |
| 153 |
IF (NODIX(INP) .NE. 0) THEN |
| 154 |
NUMNPO = NUMNPO + 1 |
| 155 |
IXNODE(NUMNPO) = INP |
| 156 |
NODIX(INP) = NUMNPO |
| 157 |
END IF |
| 158 |
end do |
| 159 |
|
| 160 |
WRITE (*, 10000) NUMNPO, NUMELO, NELBO |
| 161 |
10000 FORMAT ( |
| 162 |
& /, 1X, 'Number of output nodes =', I10 |
| 163 |
& /, 1X, 'Number of output elements =', I10 |
| 164 |
& /, 1X, 'Number of output element blocks =', I10 |
| 165 |
& ) |
| 166 |
|
| 167 |
RETURN |
| 168 |
END |
| 169 |
|
| 170 |
subroutine dolt(ibeg, iend, ixelem, values, valflt, numelo) |
| 171 |
integer ixelem(*) |
| 172 |
real values(*) |
| 173 |
|
| 174 |
DO IX = ibeg, iend |
| 175 |
C iel = index of element |
| 176 |
IEL = IXELEM(IX) |
| 177 |
if (.not.(values(iel) .lt. valflt)) then |
| 178 |
C ... retain element |
| 179 |
numelo = numelo + 1 |
| 180 |
ixelem(numelo) = iel |
| 181 |
end if |
| 182 |
end do |
| 183 |
return |
| 184 |
end |
| 185 |
|
| 186 |
subroutine dole(ibeg, iend, ixelem, values, valflt, numelo) |
| 187 |
integer ixelem(*) |
| 188 |
real values(*) |
| 189 |
|
| 190 |
DO IX = ibeg, iend |
| 191 |
C iel = index of element |
| 192 |
IEL = IXELEM(IX) |
| 193 |
if (.not.(values(iel) .le. valflt)) then |
| 194 |
C ... retain element |
| 195 |
numelo = numelo + 1 |
| 196 |
ixelem(numelo) = iel |
| 197 |
end if |
| 198 |
end do |
| 199 |
return |
| 200 |
end |
| 201 |
|
| 202 |
subroutine doeq(ibeg, iend, ixelem, values, valflt, numelo) |
| 203 |
integer ixelem(*) |
| 204 |
real values(*) |
| 205 |
|
| 206 |
DO IX = ibeg, iend |
| 207 |
C iel = index of element |
| 208 |
IEL = IXELEM(IX) |
| 209 |
if (.not.(values(iel) .eq. valflt)) then |
| 210 |
C ... retain element |
| 211 |
numelo = numelo + 1 |
| 212 |
ixelem(numelo) = iel |
| 213 |
end if |
| 214 |
end do |
| 215 |
return |
| 216 |
end |
| 217 |
|
| 218 |
subroutine done(ibeg, iend, ixelem, values, valflt, numelo) |
| 219 |
integer ixelem(*) |
| 220 |
real values(*) |
| 221 |
|
| 222 |
DO IX = ibeg, iend |
| 223 |
C iel = index of element |
| 224 |
IEL = IXELEM(IX) |
| 225 |
if (.not.(values(iel) .ne. valflt)) then |
| 226 |
C ... retain element |
| 227 |
numelo = numelo + 1 |
| 228 |
ixelem(numelo) = iel |
| 229 |
end if |
| 230 |
end do |
| 231 |
return |
| 232 |
end |
| 233 |
|
| 234 |
subroutine dogt(ibeg, iend, ixelem, values, valflt, numelo) |
| 235 |
integer ixelem(*) |
| 236 |
real values(*) |
| 237 |
|
| 238 |
DO IX = ibeg, iend |
| 239 |
C iel = index of element |
| 240 |
IEL = IXELEM(IX) |
| 241 |
if (.not.(values(iel) .gt. valflt)) then |
| 242 |
C ... retain element |
| 243 |
numelo = numelo + 1 |
| 244 |
ixelem(numelo) = iel |
| 245 |
end if |
| 246 |
end do |
| 247 |
return |
| 248 |
end |
| 249 |
|
| 250 |
subroutine doge(ibeg, iend, ixelem, values, valflt, numelo) |
| 251 |
integer ixelem(*) |
| 252 |
real values(*) |
| 253 |
|
| 254 |
DO IX = ibeg, iend |
| 255 |
C iel = index of element |
| 256 |
IEL = IXELEM(IX) |
| 257 |
if (.not.(values(iel) .ge. valflt)) then |
| 258 |
C ... retain element |
| 259 |
numelo = numelo + 1 |
| 260 |
ixelem(numelo) = iel |
| 261 |
end if |
| 262 |
end do |
| 263 |
return |
| 264 |
end |