Debian Codegraph @

packages/seacas/applications/ex1ex2v2/ex1_dbinam.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 DBINAM (NDB, OPTION, NDIM, NELBLK,
9 & NNDIM, NNELB, NVARHI, NVARGL, NVARNP, NVAREL,
10 & NAMECO, NAMELB, VNAMES, IXHV, IXGV, IXNV, IXEV,
11 & IA, KIEVOK, EXODUS, *)
12 C=======================================================================
13
14 C --*** DBINAM *** (EXOLIB) Read database names
15 C -- Written by Amy Gilkey - revised 02/08/88
16 C --
17 C --DBINAM reads the names of the coordinates, the element block types,
18 C --and the database variables from the database. All names are converted
19 C --to uppercase and all embedded blanks within a name are removed.
20 C --The element block variable truth table is also read.
21 C --
22 C --Note that the numbers of variables are read in this routine.
23 C --
24 C --This routine calls DBIV1 if the truth table is read.
25 C --
26 C --This routine calls DBVINI and uses DBVIX to get the variable name
27 C --indices.
28 C --
29 C --Dynamic memory is reserved in this routine. If there is a problem,
30 C --the routine returns normally without printing an error message.
31 C --
32 C --Parameters:
33 C -- NDB - IN - the database number
34 C -- OPTION - IN - ' ' to not store, '*' to store all, else store options:
35 C -- 'C' to store coordinate names
36 C -- 'B' to store element block names
37 C -- 'V' to store variables names
38 C -- 'T' to store element block variable truth table
39 C -- NDIM - IN - the number of coordinates per node
40 C -- NELBLK - IN - the number of element blocks
41 C -- NNDIM - OUT - the number of coordinates per node; <0 if end-of-file
42 C -- NNELB - OUT - the number of element blocks; <0 if end-of-file
43 C -- NVARHI - OUT - the number of history variables; <0 if end-of-file
44 C -- NVARGL - OUT - the number of global variables; <0 if end-of-file
45 C -- NVARNP - OUT - the number of nodal variables; <0 if end-of-file
46 C -- NVAREL - OUT - the number of element variables; <0 if end-of-file
47 C -- NAMECO - OUT - the names of the coordinates; max size = 6 (if OPTION)
48 C -- NAMELB - OUT - the names of the element block types; max size = 256
49 C -- (if OPTION)
50 C -- VNAMES - OUT - the names of the global, nodal, and element variables;
51 C -- max size = 256 (if OPTION)
52 C -- IXHV - OUT - the VNAMES index of the history variable names (if OPTION)
53 C -- IXGV - OUT - the VNAMES index of the global variable names (if OPTION)
54 C -- IXNV - OUT - the VNAMES index of the nodal variable names (if OPTION)
55 C -- IXEV - OUT - the VNAMES index of the element variable names (if OPTION)
56 C -- A - OUT - the dynamic memory base array
57 C -- KIEVOK - OUT - the dynamic memory index of the element block variable
58 C -- truth table; (if OPTION)
59 C -- variable i of block j exists iff ISEVOK(j,i)
60 C -- EXODUS - OUT - false if GENESIS file, true if EXODUS file so far
61 C -- * - return statement if error encountered, including end-of-file;
62 C -- NOT used if valid GENESIS file; message is printed
63 C --
64 C --Database must be positioned in front of coordinate names upon entry;
65 C --upon exit positioned after names.
66
67 C --Routines Called:
68 C -- EXUPCS - (SUPES) Convert to uppercase and blank non-standard
69 C -- MDRSRV - (SUPES) Reserve dynamic memory
70 C -- PCKSTR - (STRLIB) Remove embedded blanks
71
72 PARAMETER (MAXDIM=6, MAXELB=512, MAXVAR=512)
73
74 INTEGER NDB
75 CHARACTER*(*) OPTION
76 INTEGER NDIM, NELBLK
77 INTEGER NNDIM, NNELB
78 CHARACTER*8 NAMECO(*)
79 CHARACTER*8 NAMELB(*)
80 CHARACTER*8 VNAMES(*)
81 INTEGER NVARHI, NVARGL, NVARNP, NVAREL
82 INTEGER IXHV, IXGV, IXNV, IXEV
83 INTEGER IA(*)
84 INTEGER KIEVOK
85 LOGICAL EXODUS
86
87 CHARACTER*80 ERRMSG
88 INTEGER LDUM
89
90 EXODUS = .FALSE.
91 NNDIM = -999
92 NNELB = -999
93 NVARHI = -999
94 NVARGL = -999
95 NVARNP = -999
96 NVAREL = -999
97
98 C --Read and pack coordinate names
99
100 IF ((OPTION .EQ. '*') .OR. (INDEX (OPTION, 'C') .GT. 0)) THEN
101 IF (NDIM .GT. MAXDIM) CALL PRTERR ('WARNING',
102 & 'Too many coordinate names in the database')
103
104 READ (NDB, END=160, ERR=170, IOSTAT=IERR)
105 & (NAMECO(I), I=1,MIN(NDIM,MAXDIM))
106
107 DO 100 I = 1, MIN(NDIM,MAXDIM)
108 CALL EXUPCS (NAMECO(I))
109 100 CONTINUE
110 CALL PCKSTR (MIN(NDIM,MAXDIM), NAMECO)
111 ELSE
112 READ (NDB, END=160, ERR=160, IOSTAT=IERR)
113 END IF
114 NNDIM = NDIM
115
116 C --Read and pack element block type names
117
118 IF ((OPTION .EQ. '*') .OR. (INDEX (OPTION, 'B') .GT. 0)) THEN
119 IF (NELBLK .GT. MAXELB) CALL PRTERR ('WARNING',
120 & 'Too many element block names in the database')
121
122 READ (NDB, END=160, ERR=180, IOSTAT=IERR)
123 & (NAMELB(I), I=1,MIN(NELBLK,MAXELB))
124
125 DO 110 I = 1, MIN(NELBLK,MAXELB)
126 CALL EXUPCS (NAMELB(I))
127 110 CONTINUE
128 CALL PCKSTR (MIN(NELBLK,MAXELB), NAMELB)
129 ELSE
130 READ (NDB, END=160, ERR=180, IOSTAT=IERR)
131 END IF
132 NNELB = NELBLK
133
134 C --Read the number of variables
135
136 READ (NDB, END=160, ERR=190, IOSTAT=IERR)
137 & NVARHI, NVARGL, NVARNP, NVAREL
138 if ((nvarhi + nvargl + nvarnp + nvarel) .eq. 0) go to 160
139
140 EXODUS = .TRUE.
141
142 C --Initialize for DBVTYP and DBVIX
143
144 CALL DBVINI (NVARHI, NVARGL, NVARNP, NVAREL)
145
146 IF ((OPTION .EQ. '*') .OR. (INDEX (OPTION, 'V') .GT. 0)) THEN
147 IF (NVARHI + NVARGL + NVARNP + NVAREL .GT. MAXVAR)
148 & CALL PRTERR ('WARNING',
149 & 'Too many variable names in the database')
150
151 C --Get the name indices
152
153 CALL DBVIX ('H', 1, IXHV)
154 CALL DBVIX ('H', NVARHI, IXHVE)
155 IXHVE = MIN(IXHVE,MAXVAR)
156 CALL DBVIX ('G', 1, IXGV)
157 CALL DBVIX ('G', NVARGL, IXGVE)
158 IXGVE = MIN(IXGVE,MAXVAR)
159 CALL DBVIX ('N', 1, IXNV)
160 CALL DBVIX ('N', NVARNP, IXNVE)
161 IXNVE = MIN(IXNVE,MAXVAR)
162 CALL DBVIX ('E', 1, IXEV)
163 CALL DBVIX ('E', NVAREL, IXEVE)
164 IXEVE = MIN(IXEVE,MAXVAR)
165
166 C --Read and pack variable names
167
168 READ (NDB, END=200, ERR=200, IOSTAT=IERR)
169 & (VNAMES(I), I=IXHV,IXHVE),
170 & (VNAMES(I), I=IXGV,IXGVE),
171 & (VNAMES(I), I=IXNV,IXNVE),
172 & (VNAMES(I), I=IXEV,IXEVE)
173
174 DO 120 I = IXHV, IXHVE
175 CALL EXUPCS (VNAMES(I))
176 120 CONTINUE
177 CALL PCKSTR (NVARHI, VNAMES(IXHV))
178
179 DO 130 I = IXGV, IXGVE
180 CALL EXUPCS (VNAMES(I))
181 130 CONTINUE
182 CALL PCKSTR (NVARGL, VNAMES(IXGV))
183
184 DO 140 I = IXNV, IXNVE
185 CALL EXUPCS (VNAMES(I))
186 140 CONTINUE
187 CALL PCKSTR (NVARNP, VNAMES(IXNV))
188
189 DO 150 I = IXEV, IXEVE
190 CALL EXUPCS (VNAMES(I))
191 150 CONTINUE
192 CALL PCKSTR (NVAREL, VNAMES(IXEV))
193
194 ELSE
195 READ (NDB, END=200, ERR=200, IOSTAT=IERR)
196 END IF
197
198 C --Read the element block variable truth table
199
200 IF ((OPTION .EQ. '*') .OR. (INDEX (OPTION, 'T') .GT. 0)) THEN
201 CALL MDRSRV ('ISEVOK', KIEVOK, NELBLK * NVAREL)
202 CALL MDSTAT (NERR, MEM)
203 IF (NERR .GT. 0) GOTO 160
204
205 CALL DBINM1 (NDB, OPTION, NELBLK, NVAREL, IA(KIEVOK),
206 * IA(KIEVOK), IERR, MAX(NELBLK,1), *210)
207
208 C --Call DBIV1
209
210 CALL DBIV1 (NELBLK,
211 & NVARHI, NVARGL, NVARNP, NVAREL, IA(KIEVOK))
212
213 ELSE
214 CALL DBINM1 (NDB, OPTION, NELBLK, NVAREL, LDUM, IDUM,
215 & IERR, MAX(NELBLK,1), *210)
216 END IF
217
218 160 CONTINUE
219 RETURN
220
221 170 CONTINUE
222 ERRMSG = 'COORDINATE NAMES'
223 GOTO 220
224 180 CONTINUE
225 ERRMSG = 'ELEMENT BLOCK NAMES'
226 GOTO 220
227 190 CONTINUE
228 ERRMSG = 'NUMBER OF VARIABLES'
229 GOTO 220
230 200 CONTINUE
231 ERRMSG = 'VARIABLE NAMES'
232 GOTO 220
233 210 CONTINUE
234 ERRMSG = 'ELEMENT BLOCK VARIABLE TRUTH TABLE'
235 GOTO 220
236 220 CONTINUE
237 CALL DBERR (IERR, ERRMSG)
238 RETURN 1
239 END