| 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 FACE3D (A, LENE, NLNKE, LINKE, |
| 9 |
& NFACES, LENLNK, LENSC, NLNKSC, LINKSC, IF2ESC, NAMELB) |
| 10 |
C======================================================================= |
| 11 |
|
| 12 |
C --*** FACE3D *** (MESH) Break 3D elements into faces |
| 13 |
C -- Written by Amy Gilkey - revised 03/29/88 |
| 14 |
C -- Sam Key, 04/85 |
| 15 |
C -- |
| 16 |
C --FACE3D finds all the faces in the 3D mesh. |
| 17 |
C -- |
| 18 |
C --Dynamic memory is manipulated by the routine and should be checked |
| 19 |
C --for errors after call. |
| 20 |
C -- |
| 21 |
C --Parameters: |
| 22 |
C -- A - IN - the dynamic memory base array |
| 23 |
C -- LENE - IN - the cumulative element counts by element block |
| 24 |
C -- NLNKE - IN - the number of nodes per element |
| 25 |
C -- LINKE - IN - the original connectivity; connectivity all zero |
| 26 |
C -- if element is undefined |
| 27 |
C -- NFACES - OUT - returned number of non-duplicate faces |
| 28 |
C -- LENLNK - OUT - the length of the face connectivity array without |
| 29 |
C -- duplicates |
| 30 |
C -- LENSC - OUT - the cumulative face counts by element block |
| 31 |
C -- NLNKSC - OUT - the number of nodes per face |
| 32 |
C -- LINKSC - OUT - the face connectivity |
| 33 |
C -- IF2ESC - OUT - the element number(s) of each face in LINKSC; |
| 34 |
C -- size = 2*NFACES |
| 35 |
C -- IF2ESC(2,x) = 0 iff surface face |
| 36 |
C -- IF2ESC(2,x) > 0 iff interior face |
| 37 |
C -- IF2ESC(2,x) < 0 iff duplicate interior face |
| 38 |
C -- |
| 39 |
C --Common Variables: |
| 40 |
C -- Uses NUMNP, NELBLK of /DBNUMS/ |
| 41 |
|
| 42 |
common /debugc/ cdebug |
| 43 |
common /debugn/ idebug |
| 44 |
character*8 cdebug |
| 45 |
|
| 46 |
include 'params.blk' |
| 47 |
include 'dbnums.blk' |
| 48 |
include 'd3nums.blk' |
| 49 |
include 'minmax.blk' |
| 50 |
|
| 51 |
DIMENSION A(*) |
| 52 |
INTEGER LENE(0:NELBLK), LINKE(*) |
| 53 |
INTEGER NLNKE(NELBLK) |
| 54 |
INTEGER LENSC(0:NELBLK), LINKSC(*) |
| 55 |
INTEGER NLNKSC(NELBLK) |
| 56 |
INTEGER IF2ESC(2,*) |
| 57 |
CHARACTER*(MXSTLN) NAMELB(*) |
| 58 |
|
| 59 |
logical hastet |
| 60 |
|
| 61 |
INTEGER NPFRAT(8) |
| 62 |
SAVE NPFRAT |
| 63 |
|
| 64 |
C --NPFRAT(i) is the maximum number of faces that a node can be |
| 65 |
C in if the number of elements that the node is in = i |
| 66 |
C NOTE: Will fail for collapsed hexes... |
| 67 |
C For i <= 4, assumes possible strange connections, for |
| 68 |
C i > 4, assumes a somewhat regular connectivity |
| 69 |
DATA NPFRAT / 3, 6, 9, 12, 12, 12, 12, 12 / |
| 70 |
C --Reserve storage for node-to-face pointers |
| 71 |
|
| 72 |
C --MAXNPF is the maximum number of faces with a given node |
| 73 |
C --that are unmatched as the face matching routine is executed |
| 74 |
CALL MDRSRV ('NFPN', KNFPN, 1+NUMNP) |
| 75 |
CALL MDSTAT (NERR, MEM) |
| 76 |
IF (NERR .GT. 0) GOTO 150 |
| 77 |
CALL INIINT (1+NUMNP, 0, A(KNFPN)) |
| 78 |
MAXEPN = 0 |
| 79 |
HASTET = .FALSE. |
| 80 |
DO 100 IELB = 1, NELBLK |
| 81 |
IXL = IDBLNK (IELB, 0, LENE, NLNKE) |
| 82 |
NUME = LENE(IELB) - LENE(IELB-1) |
| 83 |
CALL MXEPN (NUME, NLNKE(IELB), LINKE(IXL), A(KNFPN)) |
| 84 |
if (namelb(ielb)(:3) .eq. 'TET') hastet = .true. |
| 85 |
100 CONTINUE |
| 86 |
MAXEPN = MXEPNMX(A(KNFPN)) |
| 87 |
|
| 88 |
C ... NOTE: I think this needs to be fixed for tet elements. |
| 89 |
IF (MAXEPN .LE. 8) THEN |
| 90 |
MAXNPF = NPFRAT(MAXEPN) |
| 91 |
ELSE |
| 92 |
if (hastet) then |
| 93 |
C ... Not sure whether this is the correct number or not... |
| 94 |
MAXNPF = MAXEPN * 3 |
| 95 |
else |
| 96 |
MAXNPF = (MAXEPN * 3) / 2 |
| 97 |
end if |
| 98 |
END IF |
| 99 |
CALL MDDEL ('NFPN') |
| 100 |
|
| 101 |
CALL MDRSRV ('NPFS', KNPFS, (1+MAXNPF) * NUMNP) |
| 102 |
CALL MDSTAT (NERR, MEM) |
| 103 |
IF (NERR .GT. 0) GOTO 150 |
| 104 |
|
| 105 |
C --Find all faces, matching faces in same element block |
| 106 |
|
| 107 |
LENSC(0) = 0 |
| 108 |
IXL = 1 |
| 109 |
minnod = 1 |
| 110 |
maxnod = numnp |
| 111 |
DO 110 IELB = 1, NELBLK |
| 112 |
IXE = IDBLNK (IELB, 0, LENE, NLNKE) |
| 113 |
NUME = LENE(IELB) - LENE(IELB-1) |
| 114 |
CALL FACELB (IELB, LENE, NLNKE(IELB), LINKE(IXE), |
| 115 |
& NLNKSC(IELB), LINKSC(IXL), IF2ESC(1,LENSC(IELB-1)+1), |
| 116 |
& MAXNPF, A(KNPFS), NFELB, NAMELB(IELB)) |
| 117 |
LENSC(IELB) = LENSC(IELB-1) + NFELB |
| 118 |
IXL = IXL + NLNKSC(IELB) * NFELB |
| 119 |
110 CONTINUE |
| 120 |
|
| 121 |
NFACES = LENSC(NELBLK) |
| 122 |
LENLNK = IXL - 1 |
| 123 |
|
| 124 |
C --Match faces in different element blocks |
| 125 |
|
| 126 |
NOVER = 0 |
| 127 |
minnod = 1 |
| 128 |
maxnod = numnp |
| 129 |
|
| 130 |
DO 140 IELBLK = 1, NELBLK |
| 131 |
if (nlnksc(ielblk) .ge. 4) then |
| 132 |
CALL ININPF (minnod, maxnod, MAXNPF, A(KNPFS)) |
| 133 |
minnod = numnp |
| 134 |
maxnod = 1 |
| 135 |
DO 130 IELB = IELBLK, NELBLK |
| 136 |
IF ((NLNKSC(IELB) .EQ. NLNKSC(IELBLK)) |
| 137 |
& .AND. (NAMELB(IELB)(:3) .NE. 'SHE') |
| 138 |
$ .AND. (NAMELB(IELB) .EQ. NAMELB(IELBLK))) THEN |
| 139 |
IXL = IDBLNK (IELB, 0, LENSC, NLNKSC) |
| 140 |
DO 120 IFAC = LENSC(IELB-1)+1, LENSC(IELB) |
| 141 |
IF (IF2ESC(2,IFAC) .EQ. 0) THEN |
| 142 |
IF (IELB .NE. IELBLK) THEN |
| 143 |
if (NAMELB(IELB)(:3) .eq. 'TET') THEN |
| 144 |
IMATCH = MATFAT |
| 145 |
$ (LINKSC(IXL), MAXNPF, A(KNPFS), |
| 146 |
$ IF2ESC(1,IFAC), numnp, IERR) |
| 147 |
ELSE |
| 148 |
IMATCH = MATFAC |
| 149 |
& (LINKSC(IXL), MAXNPF, A(KNPFS), |
| 150 |
* IF2ESC(1,IFAC), numnp, IERR) |
| 151 |
END IF |
| 152 |
ELSE |
| 153 |
IMATCH = 0 |
| 154 |
END IF |
| 155 |
|
| 156 |
IF (IMATCH .GT. 0) THEN |
| 157 |
NFACES = NFACES - 1 |
| 158 |
LENLNK = LENLNK - NLNKSC(IELB) |
| 159 |
IF2ESC(2,IMATCH) = IF2ESC(1,IFAC) |
| 160 |
IF2ESC(1,IFAC) = -999 |
| 161 |
IF2ESC(2,IFAC) = -999 |
| 162 |
ELSE |
| 163 |
CALL FILNPF (NLNKSC(IELB), LINKSC(IXL), IFAC, |
| 164 |
& MAXNPF, A(KNPFS), NOVER, numnp) |
| 165 |
END IF |
| 166 |
END IF |
| 167 |
IXL = IXL + NLNKSC(IELB) |
| 168 |
120 CONTINUE |
| 169 |
END IF |
| 170 |
130 CONTINUE |
| 171 |
end if |
| 172 |
140 CONTINUE |
| 173 |
|
| 174 |
CALL MDDEL ('NPFS') |
| 175 |
150 CONTINUE |
| 176 |
RETURN |
| 177 |
END |