| 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, NUMNPS, NUMESS, |
| 9 |
* NNDIM, NNELB, NVARGL, NVARNP, NVAREL, NVARNS, NVARSS, |
| 10 |
& IXGV, IXNV, IXEV, IXNSV, IXSSV, A, IA, |
| 11 |
* KIEVOK, KNSVOK, KSSVOK, |
| 12 |
* C, KNAMES, EXODUS, *) |
| 13 |
C======================================================================= |
| 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 --Dynamic memory is reserved in this routine. If there is a problem, |
| 25 |
C --the routine returns normally without printing an error message. |
| 26 |
C -- |
| 27 |
C --Parameters: |
| 28 |
C -- NDB - IN - the database number |
| 29 |
C -- OPTION - IN - ' ' to not store, '*' to store all, else store options: |
| 30 |
C -- 'C' to store coordinate names |
| 31 |
C -- 'B' to store element block names |
| 32 |
C -- 'V' to store variables names |
| 33 |
C -- 'T' to store element block variable truth table |
| 34 |
C -- NDIM - IN - the number of coordinates per node |
| 35 |
C -- NELBLK - IN - the number of element blocks |
| 36 |
C -- NNDIM - OUT - the number of coordinates per node; <0 if end-of-file |
| 37 |
C -- NNELB - OUT - the number of element blocks; <0 if end-of-file |
| 38 |
C -- NVARGL - OUT - the number of global variables; <0 if end-of-file |
| 39 |
C -- NVARNP - OUT - the number of nodal variables; <0 if end-of-file |
| 40 |
C -- NVAREL - OUT - the number of element variables; <0 if end-of-file |
| 41 |
C -- NVARNS - OUT - the number of nodeset variables; <0 if end-of-file |
| 42 |
C -- NVARSS - OUT - the number of sideset variables; <0 if end-of-file |
| 43 |
C -- IXGV - OUT - the VNAMES index of the global var names (if OPTION) |
| 44 |
C -- IXNV - OUT - the VNAMES index of the nodal var names (if OPTION) |
| 45 |
C -- IXEV - OUT - the VNAMES index of the element var names (if OPTION) |
| 46 |
C -- IXNSV - OUT - the VNAMES index of the nodeset var names (if OPTION) |
| 47 |
C -- IXSSV - OUT - the VNAMES index of the sideset var names (if OPTION) |
| 48 |
C -- A - OUT - the dynamic memory base array |
| 49 |
C -- KIEVOK - OUT - the dynamic memory index of the element block variable |
| 50 |
C -- truth table; (if OPTION) |
| 51 |
C -- variable i of block j exists iff ISEVOK(j,i) |
| 52 |
C -- KNSVOK - OUT - the dynamic memory index of the nodeset variable |
| 53 |
C -- truth table; (if OPTION) |
| 54 |
C -- variable i of block j exists iff ISEVOK(j,i) |
| 55 |
C -- KSSVOK - OUT - the dynamic memory index of the sideset variable |
| 56 |
C -- truth table; (if OPTION) |
| 57 |
C -- variable i of block j exists iff ISEVOK(j,i) |
| 58 |
C -- C - OUT - the dynamic memory base array (character) |
| 59 |
C -- KNAMES - OUT - the dynamic memory index of the variable names. |
| 60 |
C -- EXODUS - OUT - false if GENESIS file, true if EXODUS file so far |
| 61 |
C -- * - OUT - return statement if error encountered |
| 62 |
C -- NOT used if valid GENESIS file; message is printed |
| 63 |
C -- |
| 64 |
C --Routines Called: |
| 65 |
C -- EXUPCS - (SUPES) Convert to uppercase and blank non-standard |
| 66 |
C -- MDRSRV - (SUPES) Reserve dynamic memory |
| 67 |
C -- PCKSTR - (STRLIB) Remove embedded blanks |
| 68 |
|
| 69 |
include 'exodusII.inc' |
| 70 |
include 'gp_namlen.blk' |
| 71 |
|
| 72 |
PARAMETER (MAXDIM=6) |
| 73 |
|
| 74 |
INTEGER NDB |
| 75 |
CHARACTER*(*) OPTION |
| 76 |
INTEGER NDIM, NELBLK |
| 77 |
INTEGER NNDIM, NNELB |
| 78 |
INTEGER NVARGL, NVARNP, NVAREL, NVARNS, NVARSS |
| 79 |
INTEGER IXGV, IXNV, IXEV, IXNSV, IXSSV |
| 80 |
DIMENSION A(*), IA(*) |
| 81 |
INTEGER KIEVOK, KNSVOK, KSSVOK |
| 82 |
CHARACTER*1 C(*) |
| 83 |
INTEGER KNAMES |
| 84 |
LOGICAL EXODUS |
| 85 |
|
| 86 |
CHARACTER*80 ERRMSG |
| 87 |
EXODUS = .FALSE. |
| 88 |
NNDIM = -999 |
| 89 |
NNELB = -999 |
| 90 |
NVARGL = -999 |
| 91 |
NVARNP = -999 |
| 92 |
NVAREL = -999 |
| 93 |
|
| 94 |
NNDIM = NDIM |
| 95 |
|
| 96 |
C --Read the number of variables |
| 97 |
|
| 98 |
call exgvp(ndb, 'G', nvargl, ierr) |
| 99 |
call exgvp(ndb, 'N', nvarnp, ierr) |
| 100 |
call exgvp(ndb, 'E', nvarel, ierr) |
| 101 |
call exgvp(ndb, 'M', nvarns, ierr) |
| 102 |
call exgvp(ndb, 'S', nvarss, ierr) |
| 103 |
if ((nvargl + nvarnp + nvarel + nvarns + nvarss) .eq. 0) return |
| 104 |
|
| 105 |
EXODUS = .TRUE. |
| 106 |
|
| 107 |
IF ((OPTION .EQ. '*') .OR. (INDEX (OPTION, 'V') .GT. 0)) THEN |
| 108 |
|
| 109 |
C --Get the name indices |
| 110 |
IXGV = 1 |
| 111 |
IXGVE = IXGV + NVARGL - 1 |
| 112 |
IXNV = IXGVE + 1 |
| 113 |
IXNVE = IXNV + NVARNP - 1 |
| 114 |
IXEV = IXNVE + 1 |
| 115 |
IXEVE = IXEV + NVAREL - 1 |
| 116 |
IXNSV= IXEVE + 1 |
| 117 |
IXNSE = IXNSV + NVARNS - 1 |
| 118 |
IXSSV = IXNSE + 1 |
| 119 |
IXSSE = IXSSV + NVARSS - 1 |
| 120 |
|
| 121 |
C ... Allocate space for variable names |
| 122 |
nname = nvargl + nvarnp + nvarel + nvarns + nvarss |
| 123 |
call mcrsrv('NAMES', knames, nname*maxnam) |
| 124 |
call mcstat(nerr, nused) |
| 125 |
if (nerr .gt. 0) go to 180 |
| 126 |
|
| 127 |
C ... Read variable names (wrapper used to get character length correct) |
| 128 |
ioff = 0 |
| 129 |
call rdnam2(ndb, c(knames+ioff), nvargl, 'g', ierr) |
| 130 |
if (ierr .ne. 0) go to 180 |
| 131 |
|
| 132 |
ioff = ioff + (nvargl * maxnam) |
| 133 |
call rdnam2(ndb, c(knames+ioff), nvarnp, 'n', ierr) |
| 134 |
if (ierr .ne. 0) go to 180 |
| 135 |
|
| 136 |
ioff = ioff + (nvarnp * maxnam) |
| 137 |
call rdnam2(ndb, c(knames+ioff), nvarel, 'e', ierr) |
| 138 |
if (ierr .ne. 0) go to 180 |
| 139 |
|
| 140 |
ioff = ioff + (nvarel * maxnam) |
| 141 |
call rdnam2(ndb, c(knames+ioff), nvarns, 'm', ierr) |
| 142 |
if (ierr .ne. 0) go to 180 |
| 143 |
|
| 144 |
ioff = ioff + (nvarns * maxnam) |
| 145 |
call rdnam2(ndb, c(knames+ioff), nvarss, 's', ierr) |
| 146 |
if (ierr .ne. 0) go to 180 |
| 147 |
|
| 148 |
END IF |
| 149 |
C ... Read the element block variable truth table |
| 150 |
IF ((OPTION .EQ. '*') .OR. (INDEX (OPTION, 'T') .GT. 0)) THEN |
| 151 |
kmax = max(nelblk*nvarel, numnps*nvarns, numess*nvarss) |
| 152 |
|
| 153 |
CALL MDRSRV ('ITMP', KITMP, KMAX) |
| 154 |
CALL MDRSRV ('ISEVOK', KIEVOK, NELBLK * NVAREL) |
| 155 |
CALL MDRSRV ('ISNSVOK', KNSVOK, NUMNPS * NVARNS) |
| 156 |
CALL MDRSRV ('ISSSVOK', KSSVOK, NUMESS * NVARSS) |
| 157 |
CALL MDSTAT (NERR, MEM) |
| 158 |
IF (NERR .GT. 0) GOTO 210 |
| 159 |
|
| 160 |
CALL DBINM1 (NDB, 'E', OPTION, NELBLK, NVAREL, IA(KIEVOK), |
| 161 |
& IA(KIEVOK), IA(KITMP), IERR, MAX(NELBLK,1), *210) |
| 162 |
|
| 163 |
CALL DBINM1 (NDB, 'M', OPTION, NUMNPS, NVARNS, IA(KNSVOK), |
| 164 |
& IA(KNSVOK), IA(KITMP), IERR, MAX(NUMNPS,1), *210) |
| 165 |
|
| 166 |
CALL DBINM1 (NDB, 'S', OPTION, NUMESS, NVARSS, IA(KSSVOK), |
| 167 |
& IA(KSSVOK), IA(KITMP), IERR, MAX(NUMESS,1), *210) |
| 168 |
|
| 169 |
call mddel('ITMP') |
| 170 |
END IF |
| 171 |
|
| 172 |
RETURN |
| 173 |
|
| 174 |
180 CONTINUE |
| 175 |
ERRMSG = 'ELEMENT BLOCK NAMES' |
| 176 |
GOTO 220 |
| 177 |
210 CONTINUE |
| 178 |
ERRMSG = 'ELEMENT BLOCK VARIABLE TRUTH TABLE' |
| 179 |
GOTO 220 |
| 180 |
220 CONTINUE |
| 181 |
CALL DBERR (IERR, ERRMSG) |
| 182 |
RETURN 1 |
| 183 |
END |
| 184 |
|
| 185 |
subroutine rdnam2(ndb, varnam, nvar, vtype, ierr) |
| 186 |
include 'gp_namlen.blk' |
| 187 |
character*(maxnam) varnam(*) |
| 188 |
character*1 vtype |
| 189 |
|
| 190 |
ierr = 0 |
| 191 |
C ... Initialize in case there is error |
| 192 |
DO 100 I = 1, nvar |
| 193 |
varnam(i) = '-' |
| 194 |
100 CONTINUE |
| 195 |
|
| 196 |
if (nvar .gt. 0) then |
| 197 |
call exgvan (ndb, vtype, nvar, varnam, ierr) |
| 198 |
end if |
| 199 |
do 200 i = 1, nvar |
| 200 |
call exupcs(varnam(i)) |
| 201 |
200 continue |
| 202 |
call pckstr(nvar, varnam) |
| 203 |
return |
| 204 |
end |