Debian Codegraph @

packages/seacas/applications/ex2ex1v2/ex2ex1v2.f

raw
1 C Copyright(C) 1999-2021 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 PROGRAM EX2EX1V2
8 C=======================================================================
9
10 C --*** EX2EX1V2 *** EXODUS II to EXODUS I translator
11 C --
12 C --EX2EX1V2 reads the EXODUS II V2.02 and V2.03
13 C --regular and history files and writes an EXODUS I database file.
14 C --
15 C --Expects the output database on unit 11.
16
17 include 'exodusII.inc'
18 INCLUDE 'argparse.inc'
19
20 CHARACTER*8 QAINFO(6)
21 PARAMETER (MAXQA = 100, MAXINF = 100)
22 c CHARACTER*32 QAREC(4,MAXQA)
23 c CHARACTER*80 INFO(MAXINF)
24
25 C ... Names read in are 32-characters long
26 CHARACTER*(mxstln) MAMECO(6)
27 CHARACTER*(mxstln) MAMES(256)
28 C ... Names written out are 8-characters long, truncate with no warning
29 CHARACTER*8 NAMECO(6)
30 CHARACTER*8 NAMELB(256)
31 CHARACTER*8 NAMES(256)
32
33 CHARACTER*80 TITLE
34
35 DIMENSION A(1), ia(1)
36 C --A - the dynamic memory base array
37 equivalence (a(1), ia(1))
38 CHARACTER*1 c(1)
39 CHARACTER*8 cdummy
40
41 CHARACTER*5 STRA, STRB
42 CHARACTER*8 STR8
43 character*2048 netfil, ndbfil, errmsg
44 character*(mxstln) name
45 LOGICAL WHOTIM
46 real wtime, htime
47 integer cpuws, iows
48 LOGICAL MDEBUG
49
50 data (qainfo(i), i=1,3) / 'ex2ex1v2', '20210128', 'v 2.10 ' /
51 data cpuws, iows /0,0/
52
53 CALL STRTUP (QAINFO)
54
55 CALL BANNER (0, QAINFO,
56 & 'EXODUS II TO EXODUS I DATABASE'//
57 & ' TRANSLATOR',' ', ' ')
58
59 CALL MDINIT (A)
60 CALL MCINIT (C)
61 CALL MDSTAT (NERR, MEM)
62 IF (NERR .GT. 0) GOTO 130
63
64 MDEBUG = .false.
65 if (MDEBUG) then
66 call mlist()
67 end if
68
69 c make netCDF and exodus errors not show up
70
71 c call ncpopt (0)
72 call exopts (0,ierr)
73
74 C .. Get filename from command line. If not specified, emit error message
75 NARG = argument_count()
76 if (narg .lt. 2) then
77 CALL PRTERR ('FATAL', 'Filenames not specified.')
78 CALL PRTERR ('FATAL',
79 * 'Syntax is: "ex2ex1v2 exo2_file exo1_file"')
80 GOTO 140
81 else if (narg .gt. 2) then
82 CALL PRTERR ('FATAL', 'Too many arguments specified.')
83 CALL PRTERR ('FATAL',
84 * 'Syntax is: "ex2ex1v2 exo2_file exo1_file"')
85 GOTO 140
86 end if
87
88 c open the netcdf file
89
90 net = 11
91 CALL get_argument(1,netfil, lnam)
92
93 netid = EXOPEN(netfil(1:lnam), EXREAD, cpuws, iows, vers, nerr)
94 if (nerr .lt. 0) then
95 errmsg = 'Database "'//netfil(:lnam)//'" does not exist.'
96 CALL PRTERR ('FATAL', errmsg(:lenstr(errmsg)))
97 call exerr('ex2ex1v2', errmsg, exlmsg)
98 goto 140
99 endif
100
101 write(*,*) 'Input file name: ',netfil(1:lnam)
102 call exinq (netid, EXVERS, idummy, exversion, name, nerr)
103 write(*,'(A,F6.3)')
104 & 'This database was created by ExodusII version ', exversion
105
106 C open the output database and write the initial variables
107
108 NDB = 20
109 CALL get_argument(2,ndbfil, lnam)
110 open(unit=ndb, file=ndbfil(:lnam), form='unformatted',
111 * status='unknown', iostat=ierr)
112 IF (IERR .NE. 0) THEN
113 errmsg = 'Error opening output file "'//ndbfil(:lnam)//'".'
114 CALL PRTERR ('FATAL', errmsg(:LENSTR(errmsg)))
115 GOTO 140
116 END IF
117 write(*,*) 'Output file name: ',ndbfil(1:lnam)
118
119 c get initialization parameters from regular netcdf file
120
121 CALL EXGINI (netid, title, ndim, numnp, numel,
122 & nelblk, numnps, numess, nerr)
123 if (nerr .lt. 0) then
124 call exerr('ex2ex1v2', 'Error from exgini', exlmsg)
125 goto 140
126 endif
127
128 c get the length of the node sets node list
129
130 if (numnps .gt. 0) then
131 CALL EXINQ (netid, EXNSNL, lnpsnl, dummy, cdummy, nerr)
132 if (nerr .lt. 0) then
133 call exerr('ex2ex1v2', 'Error from exqini', exlmsg)
134 goto 140
135 endif
136 else
137 lnpsnl = 0
138 endif
139
140 if (numess .gt. 0) then
141
142 c get the length of the side sets node list
143
144 CALL EXINQ (netid, EXSSNL, lessnl, dummy, cdummy, nerr)
145 if (nerr .lt. 0) then
146 call exerr('ex2ex1v2', 'Error from exqini', exlmsg)
147 goto 140
148 endif
149
150 c get the length of the side sets distribution factor list
151
152 CALL EXINQ (netid, EXSSDF, lessdl, dummy, cdummy, nerr)
153 if (nerr .lt. 0) then
154 call exerr('ex2ex1v2', 'Error from exqini', exlmsg)
155 goto 140
156 endif
157
158 c get the length of the side sets element list
159
160 CALL EXINQ (netid, EXSSEL, lessel, dummy, cdummy, nerr)
161 if (nerr .lt. 0) then
162 call exerr('ex2ex1v2', 'Error from exqini', exlmsg)
163 goto 140
164 endif
165 else
166 lessnl = 0
167 lessel = 0
168 lessdl = 0
169 endif
170
171 c write the initialization information to the EXODUS 1.0 database
172
173 CALL DBOINI (NDB, TITLE, NDIM, NUMNP, NUMEL, NELBLK,
174 & NUMNPS, LNPSNL, NUMESS, LESSEL, LESSNL)
175
176 CALL DBPINI ('TIS', NDB, TITLE, NDIM, NUMNP, NUMEL, NELBLK,
177 & NUMNPS, LNPSNL, NUMESS, LESSEL, LESSNL,
178 & IDUM, IDUM, IDUM, IDUM)
179
180 C --Read the coordinates
181
182 CALL MDRSRV ('XN', KXN, NUMNP)
183 CALL MDRSRV ('YN', KYN, NUMNP)
184 IF (NDIM .GE. 3) THEN
185 CALL MDRSRV ('ZN', KZN, NUMNP)
186 CALL MDSTAT (NERR, MEM)
187 IF (NERR .GT. 0) GOTO 130
188 c write(*,*)' ************************* NDIM: ',ndim
189 CALL EXGCOR(netid, a(kxn), a(kyn), a(kzn), nerr)
190 if (nerr .lt. 0) then
191 call exerr('ex2ex1v2', 'Error from exgcor', exlmsg)
192 goto 140
193 endif
194
195 CALL DBOXYZ (NDB, NDIM, NUMNP, A(KXN), A(KYN), A(KZN))
196
197 CALL MDDEL ('XN')
198 CALL MDDEL ('YN')
199 CALL MDDEL ('ZN')
200 ELSE
201 CALL EXGCOR(netid, a(kxn), a(kyn), dummy, nerr)
202 if (nerr .lt. 0) then
203 call exerr('ex2ex1v2', 'Error from exgcor', exlmsg)
204 goto 140
205 endif
206
207 CALL DBOXYZ (NDB, NDIM, NUMNP, A(KXN), A(KYN), dummy)
208
209 CALL MDDEL ('XN')
210 CALL MDDEL ('YN')
211 ENDIF
212
213 C --Read the element order map
214
215 CALL MDRSRV ('MAPEL', KMAPEL, NUMEL)
216 CALL MDSTAT (NERR, MEM)
217 IF (NERR .GT. 0) GOTO 130
218
219 CALL EXGMAP (netid, a(KMAPEL), nerr)
220 if (nerr .ne. 0) then
221 if (nerr .eq. 17) then
222
223 C -- no element order map in the EXODUS II file; create a dummy one
224 do 30 i=1,numel
225 ia(kmapel+i-1) = i
226 30 continue
227 else
228 goto 140
229 endif
230 endif
231
232 CALL DBOMAP (NDB, NUMEL, A(KMAPEL))
233
234 CALL MDDEL ('MAPEL')
235
236 c Read in the element block ID array
237
238 call MDRSRV ('IDELB', kidelb, nelblk)
239 call exgebi (netid, a(kidelb), nerr)
240 if (nerr .lt. 0) then
241 call exerr('ex2ex1v2', 'Error from exgebi', exlmsg)
242 goto 140
243 endif
244
245 C --Read the element blocks
246
247 CALL MDRSRV ('NUMELB', KNELB, NELBLK)
248 CALL MDRSRV ('LINK', KLINK, 0)
249 CALL MDRSRV ('ATRIB', KATRIB, 0)
250 CALL MDSTAT (NERR, MEM)
251 IF (NERR .GT. 0) GOTO 130
252
253 nel = 0
254 DO 50 IELB = 1, NELBLK
255
256 CALL EXGELB (netid, a(kidelb+ielb-1), name,
257 & a(knelb+ielb-1), numlnk, numatr, nerr)
258 if (nerr .lt. 0) then
259 call exerr('ex2ex1v2', 'Error from exgelb', exlmsg)
260 goto 140
261 endif
262 namelb(ielb) = name(:8)
263
264 call getin (ia(knelb+ielb-1),num)
265 if (numlnk .gt. 0) then
266 CALL MDLONG ('LINK', KLINK, num*numlnk)
267 CALL EXGELC (netid, a(kidelb+ielb-1),
268 & a(klink), nerr)
269 if (nerr .lt. 0) then
270 call exerr('ex2ex1v2', 'Error from exgelc', exlmsg)
271 goto 140
272 endif
273 end if
274
275 if (numatr .gt. 0) then
276 CALL MDLONG ('ATRIB', KATRIB, num*numatr)
277 CALL EXGEAT (netid, a(kidelb+ielb-1), a(katrib), nerr)
278 if (nerr .lt. 0) then
279 call exerr('ex2ex1v2', 'Error from exgeat', exlmsg)
280 goto 140
281 endif
282 end if
283
284 CALL MDSTAT (NERR, MEM)
285 IF (NERR .GT. 0) GOTO 130
286
287 CALL DBOELB (NDB, IELB, IELB,
288 & a(kidelb+ielb-1), A(KNELB+IELB-1), NUMLNK, NUMATR,
289 & A(KLINK), A(KATRIB))
290
291 nel=nel+num
292 CALL MDLONG ('LINK', klink, 0)
293 CALL MDLONG ('ATRIB', katrib, 0)
294
295 50 CONTINUE
296
297 CALL MDDEL ('LINK')
298 CALL MDDEL ('ATRIB')
299
300 IF (NEL .NE. NUMEL) THEN
301 CALL INTSTR (1, 0, NEL, STRA, LSTRA)
302 CALL INTSTR (1, 0, NUMEL, STRB, LSTRB)
303 CALL PRTERR ('WARNING',
304 & 'NUMBER OF ELEMENTS IN BLOCK = ' // STRA(:LSTRA)
305 & // ' does not match TOTAL = ' // STRB(:LSTRB))
306 END IF
307
308 C --Read the node sets
309
310 CALL MDRSRV ('IDNPS', KIDNS, NUMNPS) ! Node set ids array
311 CALL MDRSRV ('NNNPS', KNNNS, NUMNPS) ! Node set node count array
312 CALL MDRSRV ('NDNPS', KNDNS, NUMNPS) ! Node set df count array
313 CALL MDRSRV ('IXNNPS', KIXNNS, NUMNPS) ! Node set nodes index array
314 CALL MDRSRV ('IXDNPS', KIXDNS, NUMNPS) ! Node set df index array
315 CALL MDRSRV ('LSTNPS', KLSTNS, LNPSNL) ! Node set node list array
316 CALL MDRSRV ('FACNPS', KFACNS, LNPSNL) ! Node set df list array
317 CALL MDRSRV ('XFACNP', KXFACN, LNPSNL) ! Expanded df list array
318 CALL MDSTAT (NERR, MEM)
319
320 if (numnps .gt. 0) then
321 call exgcns (netid, a(kidns), a(knnns), a(kndns), a(kixnns),
322 & a(kixdns), a(klstns), a(kfacns), nerr)
323 if (nerr .lt. 0) then
324 call exerr('ex2ex1v2', 'Error from exgcns', exlmsg)
325 goto 140
326 endif
327 endif
328
329 C Massage node sets distribution factors to include '1' for node sets
330 C without Dfs by walking KNDNS array, checking for 0, and filling where
331 C necessary.
332
333 do 64 i=0, numnps-1
334 if (ia(kndns+i) .eq. 0) then
335 do 60 ii=0, ia(knnns+i)-1
336 a(kxfacn+ia(kixnns+i)-1+ii) = 1.0! Force unity distribution factor
337 60 continue
338 else
339 do 62 ii=0, ia(kndns+i)-1
340 a(kxfacn+ia(kixnns+i)-1+ii) = a(kfacns+ia(kixdns+i)-1+ii)
341 62 continue
342 endif
343 64 continue
344
345 CALL DBONPS (NDB, NUMNPS, LNPSNL,
346 & A(KIDNS), A(KNNNS), A(KIXNNS), A(KLSTNS), A(KXFACN))
347
348 CALL MDDEL ('IDNPS')
349 CALL MDDEL ('NNNPS')
350 CALL MDDEL ('NDNPS')
351 CALL MDDEL ('IXNNPS')
352 CALL MDDEL ('IXDNPS')
353 CALL MDDEL ('LSTNPS')
354 CALL MDDEL ('FACNPS')
355 CALL MDDEL ('XFACNP')
356 CALL MDSTAT (NERR, MEM)
357 IF (NERR .GT. 0) GOTO 130
358
359 C --Read the side sets
360
361 CALL MDRSRV ('IDESS', KIDSS, NUMESS) ! side set id array
362 c write(*,*)'side set id array size: ',numess
363 CALL MDRSRV ('NEESS', KNESS, NUMESS) ! number of ss elems array
364 c write(*,*)'number of side set elements array size: ',numess
365 CALL MDRSRV ('NDESS', KNDSS, NUMESS) ! number of dist factors array
366 c write(*,*)'number of dist factors array size: ',numess
367 CALL MDRSRV ('NNESS', KNNSS, NUMESS) ! number of nodes array
368 c write(*,*)'number of side set nodes array size: ',numess
369 CALL MDRSRV ('IXEESS', KIXESS, NUMESS) ! index into elements array
370 c write(*,*)'index into side set elements array size: ',numess
371 CALL MDRSRV ('IXDESS', KIXDSS, NUMESS) ! index into dist factors array
372 c write(*,*)'index into side set dist factors array size: ',numess
373 CALL MDRSRV ('IXNESS', KIXNSS, NUMESS) ! index into nodes array
374 c write(*,*)'index into side set nodes array size: ',numess
375 CALL MDRSRV ('LTEESS', KLTESS, LESSEL) ! element list
376 c write(*,*)'side set element list array size: ',lessel
377 CALL MDRSRV ('LTNESS', KLTNSS, LESSNL) ! node list (21 is max possible)
378 c write(*,*)'side set node list array size: ',lessnl
379 CALL MDRSRV ('LTNNSS', KLTNNS, LESSEL) ! node count array
380 c write(*,*)'side set node count array size: ',lessel
381 CALL MDRSRV ('LTSESS', KLTSSS, LESSEL) ! side list
382 c write(*,*)'side set side list array size: ',lessel
383 CALL MDRSRV ('FACESS', KFACSS, LESSDL) ! dist factors list
384 c write(*,*)'side set dist factors list array size: ',lessdl
385 CALL MDRSRV ('XFACES', KXFACS, LESSNL) ! dist factors list(w/all DF)
386 CALL MDSTAT (NERR, MEM)
387 IF (NERR .GT. 0) GOTO 130
388
389 if (numess .gt. 0) then
390 call exgcss (netid, a(kidss), a(kness), a(kndss),
391 & a(kixess), a(kixdss),
392 & a(kltess), a(kltsss), a(kfacss), nerr)
393 if (nerr .lt. 0) then
394 call exerr('ex2ex1v2', 'Error from exgcss', exlmsg)
395 goto 140
396 endif
397
398 C Convert sides to nodes
399
400 isoff = 0 ! offset into element list for current side set
401 nodcnt = 0 ! node count for current side set
402 do 104 i=0,numess-1 ! loop through ss elem blks
403
404 ia(kixnss+i)=nodcnt+1 ! update index array
405
406 call exgsp(netid,ia(kidss+i),nsess,ndess,nerr)! get num of sides & df
407 if (nerr .lt. 0) then
408 call exerr('ex2ex1v2', 'Error from exgsp', exlmsg)
409 goto 140
410 endif
411 c write(*,*)'SS ID: ',ia(kidss+i)
412 c write(*,*)' # of sides: ',nsess
413 c write(*,*)' # of dist factors: ',ndess
414
415 call exgssn(netid,ia(kidss+i),a(kltnns+isoff),
416 & a(kltnss+nodcnt),nerr) ! get side set nodes
417 if (nerr .lt. 0) then
418 call exerr('ex2ex1v2', 'Error from exgssn', exlmsg)
419 goto 140
420 endif
421 nness = 0
422 do 102 ii=0,nsess-1 ! sum node counts to
423 nness=nness+ia(kltnns+isoff+ii) ! calculate next index
424 102 continue
425 c write(*,*)' # of nodes: ',nness
426 ia(knnss+i)=nness
427 nodcnt=nodcnt+nness
428 isoff=isoff+nsess
429 104 continue
430 endif
431
432 C Massage side sets distribution factors to include '1' for side sets
433 C without Dfs by walking KNDSS array, checking for 0, and filling where
434 C necessary.
435
436 do 110 i=0, numess-1
437 if (ia(kndss+i) .eq. 0) then
438 do 106 ii=0, ia(knnss+i)-1
439 a(kxfacs+ia(kixnss+i)-1+ii) = 1.0! Force unity distribution factor
440 106 continue
441 else
442 do 108 ii=0, ia(knnss+i)-1
443 a(kxfacs+ia(kixnss+i)-1+ii) = a(kfacss+ia(kixdss+i)-1+ii)
444 108 continue
445 endif
446 110 continue
447
448 CALL DBOESS (NDB, NUMESS, LESSEL, LESSNL,
449 & A(KIDSS), A(KNESS), A(KNNSS), A(KIXESS), A(KIXNSS),
450 & A(KLTESS), A(KLTNSS), A(KXFACS))
451
452 CALL MDDEL ('IDESS')
453 CALL MDDEL ('NEESS')
454 CALL MDDEL ('NDESS')
455 CALL MDDEL ('NNESS')
456 CALL MDDEL ('IXEESS')
457 CALL MDDEL ('IXDESS')
458 CALL MDDEL ('IXNESS')
459 CALL MDDEL ('LTEESS')
460 CALL MDDEL ('LTNESS')
461 CALL MDDEL ('LTNNSS')
462 CALL MDDEL ('LTSESS')
463 CALL MDDEL ('FACESS')
464 CALL MDDEL ('XFACES')
465
466 C --Read the QA records
467
468 nqarec = 0
469 call exinq (netid, EXQA, nqarec, r, name, nerr)
470 if (nerr .lt. 0) then
471 call exerr('ex2ex1v2', 'Error from exinq', exlmsg)
472 goto 140
473 endif
474
475 if (nqarec .gt. 0 .and. nqarec .le. MAXQA) then
476 call mcrsrv('QARECS', kqarec, 4*nqarec*8)
477 call mcrsrv('QATMP', kqatmp, 4*nqarec*mxstln)
478 call mcstat(nerr, mem)
479 if (nerr .ne. 0) goto 130
480 else
481 kqarec = 1
482 end if
483 if (nqarec .gt. MAXQA) nqarec = 0
484
485 ninfo = 0
486 call exinq (netid, EXINFO, ninfo, r, name, nerr)
487 if (nerr .lt. 0) then
488 call exerr('ex2ex1v2', 'Error from exinq', exlmsg)
489 goto 140
490 endif
491
492 if (ninfo .gt. 0 .and. ninfo .le. MAXINF) then
493 call mcrsrv('INFO', kinfo, ninfo*mxlnln)
494 call mcstat(nerr, mem)
495 if (nerr .ne. 0) goto 130
496 else
497 kinfo = 1
498 end if
499 if (ninfo .gt. MAXINF) ninfo = 0
500
501 call rdqain (netid, nqarec, c(kqatmp), ninfo, c(kinfo))
502
503 if (nqarec .gt. 0)
504 & call resize (nqarec, c(kqarec), c(kqatmp))
505
506 IF (NQAREC .GE. 0) THEN
507 CALL DBOQA (NDB, NQAREC, c(kqarec), NINFO, c(kinfo))
508 END IF
509
510 C --Read in the number of element variable names
511
512 call exgvp (netid, 'e', nvarel, nerr)
513 if (nerr .lt. 0) then
514 call exerr('ex2ex1v2', 'Error from exgvp', exlmsg)
515 goto 140
516 endif
517
518 C --Read in the number of global variable names
519
520 call exgvp (netid, 'g', nvargl, nerr)
521 if (nerr .lt. 0) then
522 call exerr('ex2ex1v2', 'Error from exgvp', exlmsg)
523 goto 140
524 endif
525
526 C --Read in the number of nodal variable names
527
528 call exgvp (netid, 'n', nvarnp, nerr)
529 if (nerr .lt. 0) then
530 call exerr('ex2ex1v2', 'Error from exgvp', exlmsg)
531 goto 140
532 endif
533
534 nvarhi = 0
535
536 call mdrsrv ('ISEVOK', kievok, nvarel*nelblk)
537 CALL MDSTAT (NERR, MEM)
538 IF (NERR .GT. 0) GOTO 130
539
540 c read in the element variable truth table
541
542 if (nvarel .gt. 0) then
543 call exgvtt (netid, nelblk, nvarel, a(kievok), nerr)
544 if (nerr .gt. 0) then
545 if (nvarel .gt. 0) then
546 write (*,'(4x,"must have element variable truth table")')
547 goto 140
548 endif
549 endif
550 if (nerr .lt. 0) then
551 call exerr('ex2ex1v2', 'Error from exgvtt', exlmsg)
552 goto 140
553 endif
554 end if
555
556 c read in the element variable names
557
558 ixev = 1
559 if (nvarel .gt. 0) then
560 call exgvan (netid, 'e', nvarel,mames(ixev), nerr)
561 if (nerr .lt. 0) then
562 call exerr('ex2ex1v2', 'Error from exgvan', exlmsg)
563 goto 140
564 endif
565 end if
566
567 c read in the global variable names
568
569 ixgv = ixev + nvarel
570 if (nvargl .gt. 0) then
571 call exgvan (netid, 'g', nvargl,mames(ixgv), nerr)
572 if (nerr .lt. 0) then
573 call exerr('ex2ex1v2', 'Error from exgvan', exlmsg)
574 goto 140
575 endif
576 end if
577
578 c read in the nodal variable names
579
580 ixnv = ixgv + nvargl
581 if (nvarnp .gt. 0) then
582 call exgvan (netid, 'n', nvarnp, mames(ixnv), nerr)
583 if (nerr .lt. 0) then
584 call exerr('ex2ex1v2', 'Error from exgvan', exlmsg)
585 goto 140
586 endif
587 end if
588
589 c read in the history variable names
590
591 ixhv = ixnv + nvarnp
592
593 c read coordinate names
594
595 call exgcon (netid, mameco, nerr)
596 if (nerr .lt. 0) then
597 call exerr('ex2ex1v2', 'Error from exgcon', exlmsg)
598 goto 140
599 endif
600
601 CALL DBPINI ('V', NTXT, TITLE, NDIM, NUMNP, NUMEL, NELBLK,
602 & NUMNPS, LNPSNL, NUMESS, LESSEL, LESSNL,
603 & NVARHI, NVARGL, NVARNP, NVAREL)
604
605 do 111 i=1, ndim
606 nameco(i) = mameco(i)(:8)
607 111 continue
608 do 112 i=1, (nvarhi+nvargl+nvarnp+nvarel)
609 names(i) = mames(i)(:8)
610 112 continue
611
612 CALL DBONAM (NDB, NDIM, NELBLK, NVARHI, NVARGL, NVARNP, NVAREL,
613 & nameco, namelb,
614 & names(ixhv), names(ixgv), names(ixnv), names(ixev),
615 & A(KIEVOK))
616
617 CALL MDRSRV ('VARHI', KVARHI, NVARHI)
618 CALL MDRSRV ('VARGL', KVARGL, NVARGL)
619 CALL MDRSRV ('VARNP', KVARNP, NVARNP * NUMNP)
620 CALL MDRSRV ('VAREL', KVAREL, NVAREL * NUMEL)
621 CALL MDSTAT (NERR, MEM)
622 IF (NERR .GT. 0) GOTO 130
623
624 c read in the number of history time steps and the number of
625 C whole time steps
626
627 call exinq (netid, EXTIMS, ntime, s, name, nerr)
628 if (nerr .lt. 0) then
629 call exerr('ex2ex1v2', 'Error from exqini', exlmsg)
630 goto 140
631 endif
632 if (ntime .eq. 0) then
633 write(errmsg,'("GENISIS file - no time steps written")')
634 call exerr('ex2ex1v2', errmsg, EXPMSG)
635 goto 140
636 endif
637 numstp = ntime
638
639 c read the time step information
640
641 istep = 0
642 call exgtim(netid, istep+1, wtime, nerr)
643 if (nerr .lt. 0) then
644 call exerr('ex2ex1v2', 'Error from exgtim', exlmsg)
645 goto 140
646 endif
647
648 do 300 ihstep=1,numstp
649
650 write (*,'(4x,"processing time step ", i4)') ihstep
651
652 c get history information
653
654 whotim = .true.
655 call exgtim(netid, ihstep, wtime, nerr)
656 if (nerr .lt. 0) then
657 call exerr('ex2ex1v2', 'Error from exgtim', exlmsg)
658 goto 140
659 endif
660 htime = wtime
661
662 c If a whole time step, do global, nodal, and element
663 c variables for the time step.
664
665 if ((whotim) .or. (wtime .eq. htime)) then
666
667 whotim =.true.
668 istep = istep + 1
669
670 c get the global variable values
671
672 if( nvargl .gt. 0) then
673 call exggv (netid, istep, nvargl, a(kvargl), nerr)
674 if (nerr .lt. 0) then
675 call exerr('ex2ex1v2', 'Error from exggv', exlmsg)
676 goto 140
677 endif
678 end if
679
680 c get the nodal variable values
681
682 do 210 j=1, nvarnp
683 call exgnv (netid, istep, j, numnp,
684 & a(kvarnp+(j-1)*numnp), nerr)
685 if (nerr .lt. 0) then
686 call exerr('ex2ex1v2', 'Error from exgnv', exlmsg)
687 goto 140
688 endif
689 210 continue
690
691 c get element variable values
692
693 if (nvarel .gt. 0) then
694 ielo=0
695 do 250 k = 1,nelblk
696 l=(k-1)*nvarel
697 do 240 j=1, nvarel
698
699 c If truth table indicates element values are available
700 c for the element variable, get the values for the
701 c element variable.
702
703 if(a(kievok+l +j-1) .ne. 0) then
704 call exgev (netid, istep, j, a(kidelb+k-1),
705 & a(knelb+k-1), a(kvarel+ielo), nerr)
706 if (nerr .lt. 0) then
707 call exerr('ex2ex1v2', 'Error from exgev', exlmsg)
708 goto 140
709 endif
710 call getin (ia(knelb+k-1),num)
711 ielo = ielo+num
712 end if
713 240 continue
714 250 continue
715 end if
716 else
717 whotim=.false.
718 end if
719 CALL DBOSTE (NDB, ihstep, NVARHI, NVARGL, NVARNP, NUMNP,
720 & NVAREL, NELBLK, a(knelb), a(kievok),
721 & HTIME, WHOTIM, A(KVARHI), A(KVARGL), A(KVARNP),
722 & A(KVAREL))
723
724 300 continue
725
726 call MDDEL ('IDELB')
727 CALL MDDEL ('VARHI')
728 CALL MDDEL ('VARGL')
729 CALL MDDEL ('VARNP')
730 CALL MDDEL ('VAREL')
731 CALL MDDEL ('NUMELB')
732
733 CALL INTSTR (1, 0, IHSTEP-1, STR8, LSTR)
734 WRITE (*, 10010) STR8(:LSTR)
735 10010 FORMAT (/, 4X, A,
736 & ' time steps have been written to the database')
737
738 GOTO 140
739
740 130 CONTINUE
741 CALL MEMERR
742 GOTO 140
743
744 140 CONTINUE
745
746 c close all files
747
748 CLOSE (NDB, IOSTAT=IDUM)
749
750 if (netid .gt. 0 ) call exclos (netid, ierr)
751
752 call addlog (QAINFO(1)(:lenstr(QAINFO(1))))
753 CALL WRAPUP (QAINFO(1))
754
755 END
756
757 subroutine mlist()
758 call mdlist(6)
759 return
760 end
761
762 subroutine rdqain (ndb, nqarec, qarec, ninfo, info)
763 include 'exodusII.inc'
764 integer ndb
765 character*(32) qarec(4,nqarec)
766 character*(80) info(ninfo)
767
768 if (nqarec .gt. 0) then
769 call exgqa (ndb, qarec, nerr)
770 if (nerr .lt. 0) then
771 call exerr('ex2ex1v2', 'Error from exgqa', exlmsg)
772 endif
773 endif
774 if (ninfo .gt. 0) then
775 call exginf (ndb, info, nerr)
776 if (nerr .lt. 0) then
777 call exerr('ex2ex1v2', 'Error from exginf', exlmsg)
778 endif
779 endif
780
781 return
782 end
783
784 C=======================================================================
785 SUBROUTINE RESIZE (NQAREC, QAREC, QATMP)
786 C=======================================================================
787 C --
788 C --RESIZE - resizes the qa records from length 32 to 8
789 C --
790 C --Parameters:
791 C -- NQAREC - IN - the number of QA records
792 C -- QAREC - IN - the QA records containing size = 8
793 C -- QATMP - IN - the QA records containing size = 32
794
795 INTEGER NQAREC
796 CHARACTER*8 QAREC(4,NQAREC)
797 CHARACTER*32 QATMP(4,NQAREC)
798
799 IF (NQAREC .GT. 0) THEN
800 DO 50 I = 1, NQAREC
801 DO 75 J = 1, 4
802 QAREC(J,I) = QATMP(J,I)(:8)
803 75 CONTINUE
804 50 CONTINUE
805 END IF
806
807 RETURN
808 END
809
810 subroutine getin (num1,num2)
811 integer num1(*)
812 num2=num1(1)
813 return
814 end