Debian Codegraph @

packages/seacas/applications/txtexo/rwstep.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
7 C=======================================================================
8 SUBROUTINE RWSTEP (NTXT, NDB, istep, idelb,
9 & NVARGL, NVARNP, NUMNP, NVAREL, NELBLK, NUMELB,
10 & ISEVOK, TIME, VAR, *)
11 C=======================================================================
12
13 C --*** RDSTEP *** (TXTEXO) Read database variables for one time step
14 C -- Written by Amy Gilkey - revised 03/02/88
15 C --
16 C --RDSTEP reads the database history, global, nodal, and element variables
17 C --for one time step.
18 C --
19 C --Parameters:
20 C -- NTXT - IN - the text file
21 C -- NVARGL - IN - the number of global variables
22 C -- NVARNP - IN - the number of nodal variables
23 C -- NUMNP - IN - the number of nodes
24 C -- NVAREL - IN - the number of element variables
25 C -- NELBLK - IN - the number of element blocks
26 C -- NUMELB - IN - the number of elements per block
27 C -- ISEVOK - IN - the element block variable truth table;
28 C -- variable i of block j exists iff ISEVOK(j,i)
29 C -- TIME - OUT - the time step time
30 C -- VAR - OUT - the global variables for the time step
31 C -- * - return statement if error encountered, including end-of-file;
32 C -- message is printed
33 C --
34 C --Database must be positioned in front of time step upon entry;
35 C --upon exit positioned after time step.
36
37 INTEGER NUMELB(*)
38 integer idelb(*)
39 LOGICAL ISEVOK(NVAREL, *)
40 REAL VAR(*)
41
42 CHARACTER*32 STRA
43
44 C --Read step time
45
46 READ (NTXT, *, END=180, ERR=130)
47 READ (NTXT, *, END=180, ERR=130) TIME
48 call exptim(ndb, istep, time, ierr)
49
50 C --Read global variables
51
52 IF (NVARGL .GT. 0) THEN
53 READ (NTXT, *, END=150, ERR=150)
54 READ (NTXT, *, END=150, ERR=150) (VAR(I), I=1,NVARGL)
55 call expgv(ndb, istep, nvargl, var, ierr)
56 END IF
57
58 C --Read nodal variables
59
60 IF (NVARNP .GT. 0) THEN
61 READ (NTXT, *, END=160, ERR=160)
62 DO 100 INP = 1, NUMNP
63 READ (NTXT, *, END=160, ERR=160)
64 & (VAR(inp+(i-1)*numnp), I=1,NVARNP)
65 100 CONTINUE
66
67 ioff = 1
68 do 105 i=1, nvarnp
69 call expnv(ndb, istep, i, numnp, var(ioff), ierr)
70 ioff = ioff + numnp
71 105 continue
72 END IF
73
74 C --Read element variables
75 C ... Values for all element variables are stored in text file
76 C Read an element block at a time and then write that element block
77 IF (NVAREL .GT. 0) THEN
78 C ... Skip comment line
79 READ (NTXT, *, END=170, ERR=170)
80 DO 120 IELB = 1, NELBLK
81 C ... Skip comment line
82 READ (NTXT, *, END=170, ERR=170)
83 READ (NTXT, *, END=170, ERR=170)
84 DO 110 N = 1, NUMELB(IELB)
85 READ (NTXT, *, END=170, ERR=170)
86 & (VAR(N+(I-1)*numelb(ielb)), I=1,NVAREL)
87 110 CONTINUE
88 C ... Write this blocks variables
89 ioff = 1
90 do 115 i=1, nvarel
91 if (isevok(i,ielb)) then
92 call expev(ndb, istep, i, idelb(ielb), numelb(ielb),
93 & var(ioff), ierr)
94 end if
95 ioff = ioff + numelb(ielb)
96 115 continue
97 120 CONTINUE
98 END IF
99
100 RETURN
101
102 130 CONTINUE
103 CALL PRTERR ('FATAL', 'Reading TIME STEP TIME')
104 GOTO 180
105 150 CONTINUE
106 CALL PRTERR ('FATAL', 'Reading GLOBAL VARIABLES')
107 GOTO 180
108 160 CONTINUE
109 CALL INTSTR (1, 0, INP, STRA, LSTRA)
110 CALL PRTERR ('FATAL',
111 & 'Reading NODAL VARIABLES for node ' // STRA(:LSTRA))
112 GOTO 180
113 170 CONTINUE
114 CALL INTSTR (1, 0, N, STRA, LSTRA)
115 CALL PRTERR ('FATAL',
116 & 'Reading ELEMENT VARIABLES for element ' // STRA(:LSTRA))
117 GOTO 180
118 180 CONTINUE
119 RETURN 1
120 END