| 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 ZMFIXD (XN, YN, ZN, IXELB, NUMLNK, LINK, VISELB, |
| 9 |
& IXNODE, IXELBO, IXELEM, NODIX) |
| 10 |
C======================================================================= |
| 11 |
|
| 12 |
C --*** ZMFIXD *** (ALGEBRA) Zoom database fixed arrays |
| 13 |
C -- Written by Amy Gilkey - revised 05/18/88 |
| 14 |
C -- |
| 15 |
C --ZMFIXD finds the nodes within the zoomed coordinates and the elements |
| 16 |
C --within the zoomed mesh (if any nodes are in). The connectivity |
| 17 |
C --array is fixed to point to the renumbered nodes. The number of |
| 18 |
C --element blocks is recalculated. |
| 19 |
C -- |
| 20 |
C --Parameters: |
| 21 |
C -- XN, YN, ZN, - IN - the coordinates |
| 22 |
C -- IXELB - IN - the cumulative element counts for each element block |
| 23 |
C -- NUMLNK - IN - the number of nodes per element in each element block |
| 24 |
C -- LINK - IN - the connectivity for all elements |
| 25 |
C -- VISELB(i) - IN/OUT - true iff element block i is to be written |
| 26 |
C -- IXNODE - OUT - the indices of the zoomed nodes (iff ISZOOM) |
| 27 |
C -- IXELBO - OUT - the cumulative element counts for each output block |
| 28 |
C -- IXELEM - OUT - the indices of the zoomed elements (iff ISZOOM) |
| 29 |
C -- NODIX(i) - OUT - the zoom mesh index for each node (iff ISZOOM) |
| 30 |
C -- |
| 31 |
C --Common Variables: |
| 32 |
C -- Uses NDIM, NUMNP, NUMEL, NELBLK of /DBNUMS/ |
| 33 |
C -- Sets NUMNPO, NUMELO, NELBO of /DBOUT/ |
| 34 |
C -- Uses ISZOOM, ZMLIM of /ZOOM/ |
| 35 |
|
| 36 |
include 'ag_dbnums.blk' |
| 37 |
include 'ag_dbout.blk' |
| 38 |
include 'ag_zoom.blk' |
| 39 |
|
| 40 |
REAL XN(*), YN(*), ZN(*) |
| 41 |
INTEGER IXELB(0:NELBLK) |
| 42 |
INTEGER NUMLNK(*) |
| 43 |
INTEGER LINK(*) |
| 44 |
LOGICAL VISELB(NELBLK) |
| 45 |
INTEGER IXNODE(*) |
| 46 |
INTEGER IXELBO(0:NELBLK) |
| 47 |
INTEGER IXELEM(*) |
| 48 |
INTEGER NODIX(*) |
| 49 |
|
| 50 |
LOGICAL NODEIN |
| 51 |
|
| 52 |
C If (Output Element Blocks < Element Blocks) |
| 53 |
IF (NUMEQL (.TRUE., NELBLK, VISELB) .LT. NELBLK) THEN |
| 54 |
|
| 55 |
C --Identify elements of a selected element block, and save index |
| 56 |
C --Eliminate nodes that are not in an element of a selected element block |
| 57 |
|
| 58 |
C initialize zoom mesh index for each node |
| 59 |
DO 100 INP = 1, NUMNP |
| 60 |
NODIX(INP) = 0 |
| 61 |
100 CONTINUE |
| 62 |
|
| 63 |
NUMELO = 0 |
| 64 |
IXELBO(0) = NUMELO |
| 65 |
C Loop 1 to number of element blocks |
| 66 |
DO 130 IELB = 1, NELBLK |
| 67 |
C Write element block IELB |
| 68 |
IF (VISELB(IELB)) THEN |
| 69 |
C 0 index into cumulative count array |
| 70 |
IXL0 = IDBLNK (IELB, 0, IXELB, NUMLNK) - 1 |
| 71 |
C Loop over cumulative number of elements in element block IELB |
| 72 |
DO 120 IEL = IXELB(IELB-1)+1, IXELB(IELB) |
| 73 |
C increment number of elements to output |
| 74 |
NUMELO = NUMELO + 1 |
| 75 |
C Indices of the zoomed elements |
| 76 |
IXELEM(NUMELO) = IEL |
| 77 |
C Loop 1 to number of nodes per element in elem blk IELB |
| 78 |
DO 110 K = 1, NUMLNK(IELB) |
| 79 |
C initialize zoom mesh index for each node |
| 80 |
NODIX(LINK(IXL0+K)) = 1 |
| 81 |
110 CONTINUE |
| 82 |
C increment IXLO by the number of nodes per element block |
| 83 |
IXL0 = IXL0 + NUMLNK(IELB) |
| 84 |
120 CONTINUE |
| 85 |
END IF |
| 86 |
C Set cumul element count for output block IELB |
| 87 |
IXELBO(IELB) = NUMELO |
| 88 |
130 CONTINUE |
| 89 |
|
| 90 |
ELSE |
| 91 |
C initialize the zoom mesh index from 1 to number of nodes |
| 92 |
DO 140 INP = 1, NUMNP |
| 93 |
NODIX(INP) = 1 |
| 94 |
140 CONTINUE |
| 95 |
|
| 96 |
NUMELO = 0 |
| 97 |
IXELBO(0) = NUMELO |
| 98 |
C loop from 1 to number of element blocks |
| 99 |
DO 160 IELB = 1, NELBLK |
| 100 |
C Loop over cumulative elements count in element block IELB |
| 101 |
DO 150 IEL = IXELB(IELB-1)+1, IXELB(IELB) |
| 102 |
C Increment number of elements to output |
| 103 |
NUMELO = NUMELO + 1 |
| 104 |
C Initialize indices of the zoomed elements |
| 105 |
IXELEM(NUMELO) = IEL |
| 106 |
150 CONTINUE |
| 107 |
C Set the number of elements to output for element block IELB |
| 108 |
IXELBO(IELB) = NUMELO |
| 109 |
160 CONTINUE |
| 110 |
END IF |
| 111 |
|
| 112 |
IF (ISZOOM) THEN |
| 113 |
|
| 114 |
C --Eliminate nodes outside the zoom mesh |
| 115 |
|
| 116 |
C Loop from 1 to total number of nodes |
| 117 |
DO INP = 1, NUMNP |
| 118 |
IF (NODIX(INP) .GE. 1) THEN |
| 119 |
IF (NDIM .EQ. 2) THEN |
| 120 |
NODEIN = |
| 121 |
& (XN(INP) .GE. ZMLIM(1)) .AND. |
| 122 |
& (XN(INP) .LE. ZMLIM(2)) .AND. |
| 123 |
& (YN(INP) .GE. ZMLIM(3)) .AND. |
| 124 |
& (YN(INP) .LE. ZMLIM(4)) |
| 125 |
ELSE IF (NDIM .GE. 3) THEN |
| 126 |
NODEIN = |
| 127 |
& (XN(INP) .GE. ZMLIM(1)) .AND. |
| 128 |
& (XN(INP) .LE. ZMLIM(2)) .AND. |
| 129 |
& (YN(INP) .GE. ZMLIM(3)) .AND. |
| 130 |
& (YN(INP) .LE. ZMLIM(4)) .AND. |
| 131 |
& (ZN(INP) .GE. ZMLIM(5)) .AND. |
| 132 |
& (ZN(INP) .LE. ZMLIM(6)) |
| 133 |
ELSE |
| 134 |
NODEIN = .TRUE. |
| 135 |
END IF |
| 136 |
C Reset NODIX variable |
| 137 |
if (zoomin) then |
| 138 |
IF (.NOT. NODEIN) NODIX(INP) = 0 |
| 139 |
else |
| 140 |
IF (NODEIN) NODIX(INP) = 0 |
| 141 |
end if |
| 142 |
END IF |
| 143 |
END DO |
| 144 |
|
| 145 |
C --Identify elements within the zoom mesh, and save index |
| 146 |
|
| 147 |
NUMELO = 0 |
| 148 |
IXLAST = IXELBO(0) |
| 149 |
C Loop 1 to number of element blocks |
| 150 |
DO 210 IELB = 1, NELBLK |
| 151 |
C Loop over cumulative element count in element block IELB |
| 152 |
DO 200 IX = IXLAST+1, IXELBO(IELB) |
| 153 |
C iel = index of zoomed element |
| 154 |
IEL = IXELEM(IX) |
| 155 |
C ixlo = 0 index for elemtn block |
| 156 |
IXL0 = IDBLNK (IELB, IEL, IXELB, NUMLNK) - 1 |
| 157 |
N = 0 |
| 158 |
C Loop 1 to number of nodes per element - element block IELB |
| 159 |
DO 180 K = 1, NUMLNK(IELB) |
| 160 |
C If (NODIX(node#)>0) increment number of nodes to output |
| 161 |
C for element block IELB |
| 162 |
IF (NODIX(LINK(IXL0+K)) .GT. 0) N = N + 1 |
| 163 |
180 CONTINUE |
| 164 |
IF (N .GT. 0) THEN |
| 165 |
C if (output nodes/element < nodes/element) |
| 166 |
IF (N .LT. NUMLNK(IELB)) THEN |
| 167 |
C Loop 1 to number of nodes per element - element block IELB |
| 168 |
DO 190 K = 1, NUMLNK(IELB) |
| 169 |
C if node is not to be output |
| 170 |
C set nodix = -1 |
| 171 |
IF (NODIX(LINK(IXL0+K)) .EQ. 0) |
| 172 |
& NODIX(LINK(IXL0+K)) = -1 |
| 173 |
190 CONTINUE |
| 174 |
END IF |
| 175 |
C Increment number of elements to output |
| 176 |
NUMELO = NUMELO + 1 |
| 177 |
IXELEM(NUMELO) = IEL |
| 178 |
END IF |
| 179 |
200 CONTINUE |
| 180 |
IXLAST = IXELBO(IELB) |
| 181 |
IXELBO(IELB) = NUMELO |
| 182 |
210 CONTINUE |
| 183 |
END IF |
| 184 |
|
| 185 |
C --Set the selected element blocks in the zoom mesh |
| 186 |
|
| 187 |
IF (ISZOOM) THEN |
| 188 |
DO 220 IELB = 1, NELBLK |
| 189 |
NELO = IXELBO(IELB) - IXELBO(IELB-1) |
| 190 |
VISELB(IELB) = NELO .GT. 0 |
| 191 |
220 CONTINUE |
| 192 |
END IF |
| 193 |
|
| 194 |
C --Count the number of selected element blocks |
| 195 |
|
| 196 |
NELBO = NUMEQL (.TRUE., NELBLK, VISELB) |
| 197 |
|
| 198 |
C --Index nodes of selected element block within the zoom mesh |
| 199 |
|
| 200 |
NUMNPO = 0 |
| 201 |
DO 230 INP = 1, NUMNP |
| 202 |
IF (NODIX(INP) .NE. 0) THEN |
| 203 |
NUMNPO = NUMNPO + 1 |
| 204 |
IXNODE(NUMNPO) = INP |
| 205 |
NODIX(INP) = NUMNPO |
| 206 |
END IF |
| 207 |
230 CONTINUE |
| 208 |
|
| 209 |
WRITE (*, 10000, IOSTAT=IDUM) NUMNPO, NUMELO, NELBO |
| 210 |
10000 FORMAT ( |
| 211 |
& /, 1X, 'Number of output nodes =', I10 |
| 212 |
& /, 1X, 'Number of output elements =', I10 |
| 213 |
& /, 1X, 'Number of output element blocks =', I10 |
| 214 |
& ) |
| 215 |
|
| 216 |
RETURN |
| 217 |
END |