Debian Codegraph @

packages/seacas/applications/explore/exp_rdname.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 C=======================================================================
7 SUBROUTINE RDNAME (A, C, NDB, KVNAMI, KVNAMO,
8 & IXGV, IXNV, IXEV, IXNS, IXSS, KIEVOK, KNSVOK, KSSVOK)
9 C=======================================================================
10
11 C --*** RDNAME *** (EXPLORE) Read database names
12 C --
13 C --RDNAME reads the names of the coordinates, the element block types,
14 C --and the database variables. The element block variable truth table
15 C --is also read. An error message is displayed if the end of file is read.
16 C --
17 C --Dynamic memory is reserved in this routine. If there is a problem,
18 C --the routine returns normally without printing an error message.
19 C --
20 C --Parameters:
21 C -- A - OUT - the dynamic memory base array
22 C -- NDB - IN - the database number
23 C -- NDIM - IN - the number of coordinates per node
24 C -- NELBLK - IN - the number of element blocks
25 C -- MAXELB - IN - the maximum number of element block type names to store
26 C -- MAXVAR - IN - the maximum number of variable names to store
27 C -- NAMECO - OUT - the names of the coordinates
28 C -- EBTYPE - OUT - the names of the element block types
29 C -- VNAMEI - OUT - the names of the global, nodal, and element variables
30 C -- exactly as input (including blanks and lowercase)
31 C -- VNAMEO - OUT - the names of the global, nodal, and element variables
32 C -- with blanks deleted and converted to uppercase
33 C -- NVARGL - OUT - the number of global variables
34 C -- IXGV - OUT - the VNAME index of the global variable names
35 C -- NVARNP - OUT - the number of nodal variables
36 C -- IXNV - OUT - the VNAME index of the nodal variable names
37 C -- NVAREL - OUT - the number of element variables
38 C -- IXEV - OUT - the VNAME index of the element variable names
39 C -- KIEVOK - OUT - the dynamic memory index of the element block variable
40 C -- truth table;
41 C -- variable i of block j exists iff ISEVOK(i,j) is NOT 0
42
43 include 'exodusII.inc'
44 include 'exp_dbnums.blk'
45
46 DIMENSION A(*)
47 CHARACTER*1 C(*)
48
49 CHARACTER*80 ERRMSG
50
51 NVARGL = 0
52 NVARNP = 0
53 NVAREL = 0
54 NVARNS = 0
55 NVARSS = 0
56
57 IXGV = 1
58 IXNV = 1
59 IXEV = 1
60 IXNS = 1
61 IXSS = 1
62
63 KIEVOK = 1
64 KNSVOK = 1
65 KSSVOK = 1
66
67 C ... Read number of variables of each type
68 call exgvp (ndb, 'g', nvargl, ierr)
69 if (ierr .ne. 0) go to 210
70 call exgvp (ndb, 'n', nvarnp, ierr)
71 if (ierr .ne. 0) go to 211
72 call exgvp (ndb, 'e', nvarel, ierr)
73 if (ierr .ne. 0) go to 212
74 call exgvp (ndb, 'm', nvarns, ierr)
75 if (ierr .ne. 0) go to 212
76 call exgvp (ndb, 's', nvarss, ierr)
77 if (ierr .ne. 0) go to 212
78
79 C --Get the name indices
80 IXGV = 1
81 IXGVE = IXGV + NVARGL - 1
82 IXNV = IXGVE + 1
83 IXNVE = IXNV + NVARNP - 1
84 IXEV = IXNVE + 1
85 IXEVE = IXEV + NVAREL - 1
86 IXNS = IXEVE + 1
87 IXNSE = IXNS + NVARNS - 1
88 IXSS = IXNSE + 1
89 IXSSE = IXSS + NVARSS - 1
90
91 C ... Allocate space for variable names
92 nname = nvargl + nvarnp + nvarel + nvarns + nvarss
93 call mcrsrv('VNAMEI', kvnami, nname*namlen)
94 call mcrsrv('VNAMEO', kvnamo, nname*namlen)
95 call mcstat(nerr, nused)
96 if (nerr .gt. 0) go to 240
97
98 C ... Read variable names (wrapper used to get character length correct)
99 ioff = 0
100 call rdnam2(ndb, c(kvnami+ioff), nvargl, 'g', ierr, namlen)
101 if (ierr .ne. 0) go to 220
102 call fixnam(c(kvnami+ioff), c(kvnamo+ioff), nvargl, namlen)
103
104 ioff = ioff + (nvargl * namlen)
105 call rdnam2(ndb, c(kvnami+ioff), nvarnp, 'n', ierr, namlen)
106 if (ierr .ne. 0) go to 220
107 call fixnam(c(kvnami+ioff), c(kvnamo+ioff), nvarnp, namlen)
108
109 ioff = ioff + (nvarnp * namlen)
110 call rdnam2(ndb, c(kvnami+ioff), nvarel, 'e', ierr, namlen)
111 if (ierr .ne. 0) go to 220
112 call fixnam(c(kvnami+ioff), c(kvnamo+ioff), nvarel, namlen)
113
114 ioff = ioff + (nvarel * namlen)
115 call rdnam2(ndb, c(kvnami+ioff), nvarns, 'm', ierr, namlen)
116 if (ierr .ne. 0) go to 220
117 call fixnam(c(kvnami+ioff), c(kvnamo+ioff), nvarns, namlen)
118
119 ioff = ioff + (nvarns * namlen)
120 call rdnam2(ndb, c(kvnami+ioff), nvarss, 's', ierr, namlen)
121 if (ierr .ne. 0) go to 220
122 call fixnam(c(kvnami+ioff), c(kvnamo+ioff), nvarss, namlen)
123
124 C ... Read the element block variable truth table
125 CALL MDRSRV ('ISEVOK', KIEVOK, NELBLK * NVAREL)
126 CALL MDRSRV ('ISNSVOK', KNSVOK, NUMNPS * NVARNS)
127 CALL MDRSRV ('ISSSVOK', KSSVOK, NUMESS * NVARSS)
128 CALL MDSTAT (NERR, MEM)
129 IF (NERR .GT. 0) GOTO 240
130
131 CALL RDNAM1 (NDB, 'E', NELBLK, NVAREL, A(KIEVOK))
132 CALL RDNAM1 (NDB, 'M', NUMNPS, NVARNS, A(KNSVOK))
133 CALL RDNAM1 (NDB, 'S', NUMESS, NVARSS, A(KSSVOK))
134 RETURN
135
136 210 CONTINUE
137 WRITE (ERRMSG, 10000) 'NUMBER OF GLOBAL VARIABLES'
138 GOTO 230
139 211 CONTINUE
140 WRITE (ERRMSG, 10000) 'NUMBER OF NODAL VARIABLES'
141 GOTO 230
142 212 CONTINUE
143 WRITE (ERRMSG, 10000) 'NUMBER OF ELEMENT VARIABLES'
144 GOTO 230
145 220 CONTINUE
146 WRITE (ERRMSG, 10000) 'GLOBAL VARIABLE NAMES'
147 GOTO 230
148 230 CONTINUE
149 CALL WDBERR (IERR, ERRMSG)
150 240 CONTINUE
151 RETURN
152
153 10000 FORMAT (A)
154 END
155
156 subroutine rdnam2(ndb, varnam, nvar, vtype, ierr, namlen)
157 character*(namlen) varnam(*)
158 character*1 vtype
159
160 ierr = 0
161 C ... Initialize in case there is error
162 DO 100 I = 1, nvar
163 varnam(i) = '--------------------------------'
164 100 CONTINUE
165
166 if (nvar .gt. 0) then
167 call exgvan (ndb, vtype, nvar, varnam, ierr)
168 end if
169 return
170 end
171
172 subroutine fixnam(namin, namout, nvar, namlen)
173 C ... Convert the variable names to uppercase and compress blanks
174 character*(namlen) namin(*), namout(*)
175
176 do 100 i = 1, nvar
177 namout(i) = namin(i)
178 call exupcs(namout(i))
179 100 continue
180 call pckstr(nvar, namout)
181
182 return
183 end