Debian Codegraph @

packages/seacas/applications/blot/dbinm1.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 DBINM1 (NDB, OPTION, NELBLK, NVAREL, ISEVOK, IEVOK,
9 & ITMP, IERR, NELBDM, IDELB, ISHEX, HEXID, A,
10 & IA, *)
11 C=======================================================================
12 C --*** DBINM1 *** (EXOLIB) Internal to DBINAM
13 C -- Written by Amy Gilkey - revised 02/18/88
14 C --
15 C --DBINM1 reads the element block variable truth table.
16 C --
17 C --Parameters:
18 C -- NDB - IN - the database number
19 C -- OPTION - IN - ' ' to not store, '*' to store all, else store options:
20 C -- 'T' to store element block variable truth table
21 C -- NELBLK - IN - the number of element blocks
22 C -- NVAREL - IN - the number of element variables
23 C -- ISEVOK - OUT - the element block variable truth table;
24 C -- variable i of block j exists iff ISEVOK(j,i)
25 C -- IEVOK - OUT - the element block variable truth table;
26 C -- variable i of block j exists iff ISEVOK(j,i) is NOT 0
27 C -- IERR - OUT - the returned read error flag
28 C -- * - OUT - return statement if error encountered
29 C -- NO message is printed
30 C --
31 C --Database must be positioned in front of truth table upon entry;
32 C --upon exit positioned after table.
33
34 include 'exodusII.inc'
35 DIMENSION A(*), IA(*)
36 INTEGER NDB
37 CHARACTER*(*) OPTION
38 INTEGER NELBLK, NVAREL
39 LOGICAL ISEVOK(NELBDM,*)
40 INTEGER IEVOK(NELBDM,*)
41 INTEGER ITMP(NVAREL,NELBDM)
42 INTEGER IERR
43 INTEGER IDELB(*)
44 INTEGER ISHEX
45 INTEGER HEXID(*)
46
47 IF ((OPTION .EQ. '*') .OR. (INDEX (OPTION, 'T') .GT. 0)) THEN
48 CALL EXGVTT(NDB, NELBLK-ISHEX, NVAREL, ITMP, IERR)
49 C If ishex>0 then new element blocks have been created for
50 C HEXSHELL elements
51 IF (ISHEX .GT. 0) THEN
52 C Reserve scratch space to create new element variable truth table
53 CALL MDRSRV ('IETSCR', IETSCR, NELBLK*NVAREL)
54 CALL MDSTAT (NERR, MEM)
55 IF (NERR .GT. 0) RETURN 1
56 CALL MODEVTT(NELBLK, NVAREL, ISHEX, IDELB, HEXID, ITMP,
57 & IA(IETSCR))
58 CALL MDDEL ('IETSCR')
59 CALL MDSTAT (NERR, MEM)
60 IF (NERR .GT. 0) RETURN 1
61 ENDIF
62 IF (ierr .eq. 17) then
63 DO 20 I = 1, NVAREL
64 DO 10 IELB = 1, NELBLK
65 ISEVOK(IELB,I) = .true.
66 10 CONTINUE
67 20 CONTINUE
68 ELSE
69 DO 110 I = 1, NVAREL
70 DO 100 IELB = 1, NELBLK
71 ISEVOK(IELB,I) = (ITMP(I,IELB) .NE. 0)
72 100 CONTINUE
73 110 CONTINUE
74 ENDIF
75
76 END IF
77
78 RETURN
79
80 END
81
82 SUBROUTINE MODEVTT(NELBLK, NVAREL, ISHEX, IDELB, HEXID, IEVTT,
83 & TTSCR)
84 C Add rows to element variable truth table for the SHELL
85 C element blocks of the HEXSHELL. IEVTT contains the element variable
86 C truth table from the exodusII file. HEXID contains the ID of
87 C the HEXSHELL element blocks. TTSCR is a scratch array for the
88 C element variable truth table.
89 C Design - loop over the number of element blocks. If the element
90 C block id in the IDELB matches the element block id in HEXID, copy the
91 C row from the IEVTT array to the TTSCR array and then add a
92 C row of zeros into the TTSCR array for the next element block
93 C to account for the SHELL element block. Otherwise, copy the
94 C row from the IEVTT array to the TTSCR array.
95
96 C ... Current truth table is filled in (NVAREL,NELBLK-ISHEX)
97 C and contains valid values only for the non-hexshell-shell blocks
98 C (if a block was originally a shell, it has variables, if shell
99 C block created from hexshell, then no variables)
100 C ... The IDELB has both hexshell-shell and hex ids already in it
101 C so it's rows don't necessarily correspond to the truth table
102 C rows.
103
104 INTEGER NELBLK, NVAREL, ISHEX
105 INTEGER IDELB(*), HEXID(*)
106 INTEGER IEVTT(NVAREL,NELBLK), TTSCR(NVAREL,NELBLK)
107
108 C Index into HEXID array
109 IHEX = 1
110 C Index into truth table array (IEVTT), max value = NELBLK-ISHEX
111 IFROM = 1
112 C Index into block id array (IDELB)
113 IID = 1
114 C Index into TTSCR array
115 ITO = 1
116
117 200 CONTINUE
118 C Exit condition
119 IF (IFROM .GT. NELBLK-ISHEX) GOTO 300
120
121 C HEXSHELL element block ID - HEX element block ID
122 IF (IHEX .GT. ISHEX) THEN
123 IDH = 0
124 ELSE
125 IDH = HEXID(IHEX)
126 ENDIF
127
128 IF (IDELB(IID) .EQ. IDH) THEN
129 C Element block id matches hexshell element
130 DO 210 J = 1, NVAREL
131 C Row for HEX element in element variable truth table
132 TTSCR(J,ITO) = IEVTT(J,IFROM)
133 C Row for SHELL element in element variable truth table
134 TTSCR(J,ITO+1) = 0
135 210 CONTINUE
136 ITO = ITO + 2
137 IHEX = IHEX + 1
138 C ... Skip past hexshell-shell id in idelb
139 IID = IID + 2
140 ELSE
141 C Element block id doesn't match hexshell element. Copy Element
142 C variable truth table values.
143 DO 220 J = 1, NVAREL
144 TTSCR(J,ITO) = IEVTT(J,IFROM)
145 220 CONTINUE
146 ITO = ITO + 1
147 IID = IID + 1
148 ENDIF
149 IFROM = IFROM + 1
150 GOTO 200
151 300 CONTINUE
152
153 C Copy TTSCR back to IEVTT
154 DO 230 I = 1, NELBLK
155 DO 240 J = 1, NVAREL
156 IEVTT(J,I) = TTSCR(J,I)
157 240 CONTINUE
158 230 CONTINUE
159
160 RETURN
161 END