Debian Codegraph @

packages/seacas/applications/algebra/ag_dbielb.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 DBIELB (NDB, OPTION, NELBS, NELBE, IDELB, NUMELB,
8 & NUMLNK, NUMATR, BLKTYP, A, IELNK, IEATR, IOERR)
9 C=======================================================================
10
11 C --*** DBIELB *** (EXOLIB) Read database element blocks
12 C -- Written by Amy Gilkey - revised 10/14/87
13 C -- Modified to Read EXODUSIIV2
14 C --
15 C --DBIELB reads the element block information from the database.
16 C --An error message is displayed if the end of file is read.
17 C --
18 C --The dynamic memory arrays LINK and ATRIB must be reserved
19 C --if the connectivity and attributes are to be stored. These arrays
20 C --will be expanded by this routine to hold the new data.
21 C --
22 C --Parameters:
23 C -- NDB - IN - the database file
24 C -- OPTION - IN - ' ' to not store, '*' to store all, else store options:
25 C -- Element block ID's are always read in
26 C -- 'H' to store all header information
27 C -- 'C' to store connectivity (+ NUMLNK + NUMELB)
28 C -- 'A' to store attributes (+ NUMATR + NUMELB)
29 C -- NELBS - IN - the number of the first element block to read
30 C -- NELBE - IN - the number of the last element block to read
31 C -- IDELB - OUT - the element block IDs for each block
32 C -- NUMELB - OUT - the number of elements in each block (if OPTION)
33 C -- NUMLNK - OUT - the number of nodes per element in each block
34 C -- (if OPTION)
35 C -- NUMATR - OUT - the number of attributes in each block (if OPTION)
36 C -- BLKTYP - OUT - the type of elements in the each block
37 C -- A - I/O - the dynamic memory base array
38 C -- IELNK - OUT - the size of the connectivity array
39 C -- IEATR - OUT - the size of the attribute array
40 C -- IOERR - OUT - error flag
41 C --
42
43 include 'exodusII.inc'
44
45 INTEGER NDB
46 CHARACTER*(*) OPTION
47 INTEGER NELBS, NELBE
48 INTEGER IDELB(*)
49 INTEGER NUMELB(*)
50 INTEGER NUMLNK(*)
51 INTEGER NUMATR(*)
52 DIMENSION A(1)
53 INTEGER KLINK, KATRIB
54 CHARACTER*(MXSTLN) BLKTYP(*)
55 INTEGER IELNK, IEATR
56 INTEGER IOERR
57 LOGICAL ALL, HOPT, COPT, AOPT
58
59 IOERR = 0
60 IELNK = 0
61 IEATR = 0
62
63 C Set option flags
64 ALL = (OPTION .EQ. '*')
65 HOPT = ALL .OR. (INDEX (OPTION, 'H') .GT. 0)
66 COPT = ALL .OR. (INDEX (OPTION, 'C') .GT. 0)
67 AOPT = ALL .OR. (INDEX (OPTION, 'A') .GT. 0)
68 C No need to check if option = 'I' because the element block
69 C IDs are always read in this subroutine. The header, connectivity
70 C and attribute arrays need the element block IDs.
71
72 C Read the element block ID's
73 CALL EXGEBI (NDB, IDELB, IERR)
74
75 IF (ALL .OR. HOPT) THEN
76 DO 100 IELB = NELBS, NELBE
77 C Read element block parameters - returns:
78 C 1. element block ID's
79 C 2. element type in the element block
80 C 3. number of elements in the element block
81 C 4. number of nodes per element in the element block
82 C 5. number of attributes per element in the element block
83 C 6. error id
84 call exgelb(ndb, idelb(ielb), blktyp(ielb), numelb(ielb),
85 & numlnk(ielb), numatr(ielb), ierr)
86 call exupcs(blktyp(ielb))
87 call pckstr(1, blktyp(ielb))
88 100 CONTINUE
89 END IF
90
91 IF (ALL .OR. COPT) THEN
92 C Assumption: space has been reserved for 'LINK'
93 C call MxFIND(array_name, ret_index, array_size)
94 CALL MDFIND ('LINK', KLINK, IELNK)
95 CALL MDSTAT (NERR, MEM)
96 IF (NERR .GT. 0) then
97 CALL MEMERR
98 IOERR = 1
99 RETURN
100 END IF
101 DO 110 IELB = NELBS, NELBE
102 C number of elements in a block
103 NEL = NUMELB(IELB)
104 C number of nodes per element in the element block
105 NLNK = NUMLNK(IELB)
106 ISLNK = IELNK + 1
107 IELNK = IELNK + NLNK * NEL
108 CALL MDLONG ('LINK', KLINK, IELNK)
109 CALL EXGELC(NDB, IDELB(IELB), A(KLINK+ISLNK-1), IERR)
110 110 CONTINUE
111 CALL MDSTAT (NERR, MEM)
112 IF (NERR .GT. 0) then
113 CALL MEMERR
114 IOERR = 1
115 RETURN
116 END IF
117 END IF
118
119 IF (ALL .OR. AOPT) THEN
120 C Assumption: space has been reserved for 'ATRIB'
121 C call MxFIND(array_name, ret_index, array_size)
122 CALL MDFIND ('ATRIB', KATRIB, IEATR)
123 CALL MDSTAT (NERR, MEM)
124 IF (NERR .GT. 0) then
125 CALL MEMERR
126 IOERR = 1
127 RETURN
128 END IF
129 DO 120 IELB = NELBS, NELBE
130 C number of elements in a block
131 NEL = NUMELB(IELB)
132 C number of attributes in this block
133 NATR = NUMATR(IELB)
134 IF (NATR .GT. 0) THEN
135 ISATR = IEATR + 1
136 IEATR = IEATR + NATR * NEL
137 CALL MDLONG ('ATRIB', KATRIB, IEATR)
138 CALL EXGEAT(NDB, IDELB(IELB), A(KATRIB+ISATR-1), IERR)
139 END IF
140 120 CONTINUE
141 CALL MDSTAT (NERR, MEM)
142 IF (NERR .GT. 0) then
143 CALL MEMERR
144 IOERR = 1
145 END IF
146 END IF
147
148 RETURN
149 END