| 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 REMEL (IXELB, NUMLNK, LINK, VISELB, |
| 9 |
& IXNODE, IXELBO, IXELEM, NODIX, MAPEL) |
| 10 |
C======================================================================= |
| 11 |
|
| 12 |
include 'ag_dbnums.blk' |
| 13 |
include 'ag_dbout.blk' |
| 14 |
include 'ag_remove.blk' |
| 15 |
|
| 16 |
INTEGER IXELB(0:NELBLK) |
| 17 |
INTEGER NUMLNK(*) |
| 18 |
INTEGER LINK(*) |
| 19 |
LOGICAL VISELB(NELBLK) |
| 20 |
INTEGER IXNODE(*) |
| 21 |
INTEGER IXELBO(0:NELBLK) |
| 22 |
INTEGER IXELEM(*) |
| 23 |
INTEGER NODIX(*) |
| 24 |
INTEGER MAPEL(*) |
| 25 |
|
| 26 |
LOGICAL REMOVE |
| 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 (ISREMOVE) THEN |
| 75 |
|
| 76 |
C --Identify elements to be removed... |
| 77 |
|
| 78 |
NUMELO = 0 |
| 79 |
IXLAST = IXELBO(0) |
| 80 |
C Loop 1 to number of element blocks |
| 81 |
DO IELB = 1, NELBLK |
| 82 |
DO IX = IXLAST+1, IXELBO(IELB) |
| 83 |
C iel = index of element |
| 84 |
IEL = IXELEM(IX) |
| 85 |
if (idsglobal) then |
| 86 |
IGEL = MAPEL(IEL) |
| 87 |
else |
| 88 |
igel = iel |
| 89 |
end if |
| 90 |
remove = .false. |
| 91 |
do ir = 1, irmcnt |
| 92 |
if (igel .eq. idsrem(ir)) then |
| 93 |
write (*,999) iel, mapel(iel) |
| 94 |
999 FORMAT(' Removed element with local id ',I10, |
| 95 |
* ', global id ',I10) |
| 96 |
remove = .true. |
| 97 |
go to 99 |
| 98 |
end if |
| 99 |
end do |
| 100 |
99 continue |
| 101 |
if (.not. remove) then |
| 102 |
numelo = numelo + 1 |
| 103 |
ixelem(numelo) = iel |
| 104 |
end if |
| 105 |
end do |
| 106 |
IXLAST = IXELBO(IELB) |
| 107 |
IXELBO(IELB) = NUMELO |
| 108 |
end do |
| 109 |
END IF |
| 110 |
|
| 111 |
C --Set the selected element blocks in the zoom mesh |
| 112 |
|
| 113 |
IF (ISREMOVE) THEN |
| 114 |
DO 220 IELB = 1, NELBLK |
| 115 |
NELO = IXELBO(IELB) - IXELBO(IELB-1) |
| 116 |
VISELB(IELB) = NELO .GT. 0 |
| 117 |
220 CONTINUE |
| 118 |
END IF |
| 119 |
|
| 120 |
C --Count the number of selected element blocks |
| 121 |
|
| 122 |
NELBO = NUMEQL (.TRUE., NELBLK, VISELB) |
| 123 |
|
| 124 |
C --Index nodes of selected element block within the zoom mesh |
| 125 |
NUMELO = 0 |
| 126 |
IXLAST = IXELBO(0) |
| 127 |
C Loop 1 to number of element blocks |
| 128 |
DO IELB = 1, NELBLK |
| 129 |
C Loop over cumulative element count in element block IELB |
| 130 |
DO IX = IXLAST+1, IXELBO(IELB) |
| 131 |
C iel = index of zoomed element |
| 132 |
IEL = IXELEM(IX) |
| 133 |
numelo = numelo + 1 |
| 134 |
C ixlo = 0 index for elemtn block |
| 135 |
IXL0 = IDBLNK (IELB, IEL, IXELB, NUMLNK) - 1 |
| 136 |
C Loop 1 to number of nodes per element - element block IELB |
| 137 |
DO K = 1, NUMLNK(IELB) |
| 138 |
NODIX(LINK(IXL0+K)) = -1 |
| 139 |
end do |
| 140 |
end do |
| 141 |
IXLAST = IXELBO(IELB) |
| 142 |
IXELBO(IELB) = NUMELO |
| 143 |
end do |
| 144 |
|
| 145 |
NUMNPO = 0 |
| 146 |
DO INP = 1, NUMNP |
| 147 |
IF (NODIX(INP) .NE. 0) THEN |
| 148 |
NUMNPO = NUMNPO + 1 |
| 149 |
IXNODE(NUMNPO) = INP |
| 150 |
NODIX(INP) = NUMNPO |
| 151 |
END IF |
| 152 |
end do |
| 153 |
|
| 154 |
WRITE (*, 10000) NUMNPO, NUMELO, NELBO |
| 155 |
10000 FORMAT ( |
| 156 |
& /, 1X, 'Number of output nodes =', I10 |
| 157 |
& /, 1X, 'Number of output elements =', I10 |
| 158 |
& /, 1X, 'Number of output element blocks =', I10 |
| 159 |
& ) |
| 160 |
|
| 161 |
RETURN |
| 162 |
END |