| 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 RWNAME (NTXT, NDB, NELBLK, NVARGL, NVARNP, NVAREL, |
| 9 |
& A, C, KIEVOK, EXODUS, NAMLEN, *) |
| 10 |
C======================================================================= |
| 11 |
|
| 12 |
C --*** RDNAME *** (TXTEXO) Read database names |
| 13 |
C -- Written by Amy Gilkey - revised 02/08/88 |
| 14 |
C -- |
| 15 |
C --RDNAME reads the names of the coordinates, the element block types, |
| 16 |
C --and the database variables. The element block variable truth table |
| 17 |
C --is also read. |
| 18 |
C -- |
| 19 |
C --Note that the numbers of variables are read in this routine. |
| 20 |
C -- |
| 21 |
C --This routine calls DBVINI and uses DBVIX to get the variable name |
| 22 |
C --indices. |
| 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 -- NTXT - IN - the text file |
| 29 |
C -- NDIM - IN - the number of coordinates per node |
| 30 |
C -- NELBLK - IN - the number of element blocks |
| 31 |
C -- NVARGL - OUT - the number of global variables |
| 32 |
C -- NVARNP - OUT - the number of nodal variables |
| 33 |
C -- NVAREL - OUT - the number of element variables |
| 34 |
C -- A - In - the dynamic memory base array |
| 35 |
C -- C - IN - the dynamic character memory base array |
| 36 |
C -- KIEVOK - OUT - the dynamic memory index of the element block variable |
| 37 |
C -- truth table; variable i of block j exists iff ISEVOK(j,i) |
| 38 |
C -- EXODUS - OUT - set false if GENESIS format, true if EXODUS so far |
| 39 |
C -- * - return statement if error encountered, including end-of-file; |
| 40 |
C -- NOT used if valid GENESIS file; message is printed |
| 41 |
C -- |
| 42 |
C --Database must be positioned in front of coordinate names upon entry; |
| 43 |
C --upon exit positioned after names. |
| 44 |
|
| 45 |
include 'exodusII.inc' |
| 46 |
character*1 c(*) |
| 47 |
DIMENSION A(*) |
| 48 |
logical exodus |
| 49 |
|
| 50 |
NVARGL = -999 |
| 51 |
NVARNP = -999 |
| 52 |
NVAREL = -999 |
| 53 |
|
| 54 |
C --Read variable names |
| 55 |
READ (NTXT, *, END=130, ERR=130) |
| 56 |
READ (NTXT, *, END=130, ERR=130) NVARGL, NVARNP, NVAREL |
| 57 |
|
| 58 |
C ... Allocate array for names |
| 59 |
MAXVAR = max(nvargl, nvarnp, nvarel) |
| 60 |
if (maxvar .gt. 0) then |
| 61 |
exodus = .true. |
| 62 |
else |
| 63 |
exodus = .false. |
| 64 |
go to 100 |
| 65 |
end if |
| 66 |
|
| 67 |
call mcrsrv('NAMES', kname, namlen*maxvar) |
| 68 |
call mcstat(nerr, mem) |
| 69 |
if (nerr .gt. 0) then |
| 70 |
return 1 |
| 71 |
end if |
| 72 |
|
| 73 |
call rwnam1(ntxt, ndb, 'G', nvargl, c(kname), namlen, *180) |
| 74 |
call rwnam1(ntxt, ndb, 'N', nvarnp, c(kname), namlen, *180) |
| 75 |
call rwnam1(ntxt, ndb, 'E', nvarel, c(kname), namlen, *180) |
| 76 |
|
| 77 |
call mcdel('NAMES') |
| 78 |
call mcstat(nerr, mem) |
| 79 |
if (nerr .gt. 0) then |
| 80 |
return 1 |
| 81 |
end if |
| 82 |
|
| 83 |
C --Read the element block variable truth table |
| 84 |
CALL MDRSRV ('ISEVOK', KIEVOK, NELBLK * NVAREL) |
| 85 |
C ... Temporary logical array |
| 86 |
CALL MDRSRV ('LSEVOK', KLEVOK, NELBLK * NVAREL) |
| 87 |
CALL MDSTAT (NERR, MEM) |
| 88 |
IF (NERR .GT. 0) GOTO 100 |
| 89 |
|
| 90 |
if (nvarel .gt. 0) then |
| 91 |
CALL RDNM1 (NTXT, NDB, NELBLK, NVAREL, |
| 92 |
& A(KIEVOK), A(KLEVOK), *180) |
| 93 |
end if |
| 94 |
|
| 95 |
CALL MDDEL ('LSEVOK') |
| 96 |
CALL MDSTAT (NERR, MEM) |
| 97 |
IF (NERR .GT. 0) GOTO 100 |
| 98 |
100 CONTINUE |
| 99 |
RETURN |
| 100 |
|
| 101 |
130 CONTINUE |
| 102 |
CALL PRTERR ('FATAL', 'Reading NUMBER OF VARIABLES') |
| 103 |
GOTO 180 |
| 104 |
180 CONTINUE |
| 105 |
RETURN 1 |
| 106 |
END |
| 107 |
|
| 108 |
subroutine rwnam1(ntxt, ndb, flag, nvar, names, namlen, *) |
| 109 |
include 'exodusII.inc' |
| 110 |
character*1 flag |
| 111 |
character*(namlen) names(*) |
| 112 |
|
| 113 |
if (nvar .eq. 0) then |
| 114 |
read (ntxt,*,end=150, err=150) |
| 115 |
return |
| 116 |
else |
| 117 |
READ (NTXT, '(2 (A, 1X))', END=150, ERR=150) |
| 118 |
& (NAMES(I), I=1, nvar) |
| 119 |
|
| 120 |
call expvp(ndb, flag, nvar, ierr) |
| 121 |
call expvan(ndb, flag, nvar, names, ierr) |
| 122 |
if (ierr .ne. 0) go to 160 |
| 123 |
end if |
| 124 |
return |
| 125 |
|
| 126 |
150 CONTINUE |
| 127 |
CALL PRTERR ('FATAL', 'Reading VARIABLE NAMES') |
| 128 |
return 1 |
| 129 |
160 CONTINUE |
| 130 |
CALL PRTERR ('FATAL', 'Writing VARIABLE NAMES') |
| 131 |
return 1 |
| 132 |
end |