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