Debian Codegraph @

packages/seacas/applications/explore/exp_prebn.f

raw
1 C Copyright(C) 1999-2020, 2023 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 PREBN (OPTION, NOUT, IELB, NUME, IDELB,
8 * IEL0, NLISEL, LISEL,
9 * NATR, LINK, ATRIB, natrdm,
10 * MAPN, DOMAPN, MAPE, DOMAPE)
11 C=======================================================================
12
13 C --*** PREB1 *** (BLOT) Display database element block information
14 C --
15 C --PREB1 displays the element block internal information (either the
16 C --connectivity or the attributes.
17 C --
18 C --Parameters:
19 C -- OPTION - IN - '*' to print all, else print options:
20 C -- 'C' to print connectivity
21 C -- 'A' to print attributes
22 C -- NOUT - IN - the output file, <=0 for standard
23 C -- IEL0 - IN - the element offset of the elements in the block
24 C -- NLISEL - IN - the number of selected elements
25 C -- LISEL - IN - the indices of the selected elements
26 C -- NATR - IN - the number of attributes per element
27 C -- LINK - IN - the connectivity array for this block
28 C -- ATRIB - IN - the attribute array for this block
29
30 include 'exodusII.inc'
31 include 'exp_dbase.blk'
32 CHARACTER*(*) OPTION
33 INTEGER LISEL(*)
34 INTEGER LINK(*)
35 REAL ATRIB(natrdm,*)
36 INTEGER MAPN(*), MAPE(*)
37 LOGICAL DOMAPN, DOMAPE
38
39 C ... Automatic Array...
40 INTEGER NNPE(0:NUME)
41
42 LOGICAL ALLSAM
43 LOGICAL DOCONN, DOATR
44
45 IF (NLISEL .LE. 0) RETURN
46
47 DOCONN = ((OPTION .EQ. '*') .OR. (INDEX (OPTION, 'C') .GT. 0))
48 DOATR = ((OPTION .EQ. '*') .OR. (INDEX (OPTION, 'A') .GT. 0))
49 & .AND. (NATR .GT. 0)
50 IF (.NOT. (DOCONN .OR. DOATR)) RETURN
51
52 IF (NOUT .GT. 0) THEN
53 IF (DOCONN .AND. DOATR) THEN
54 WRITE (NOUT, 10000) 'Connectivity and Attributes'
55 ELSE IF (DOCONN) THEN
56 WRITE (NOUT, 10000) 'Connectivity'
57 ELSE IF (DOATR) THEN
58 WRITE (NOUT, 10000) 'Attributes'
59 END IF
60 if (domape) then
61 write (nout, 10030)
62 end if
63 ELSE
64 IF (DOCONN .AND. DOATR) THEN
65 WRITE (*, 10000) 'Connectivity and Attributes'
66 ELSE IF (DOCONN) THEN
67 WRITE (*, 10000) 'Connectivity'
68 ELSE IF (DOATR) THEN
69 WRITE (*, 10000) 'Attributes'
70 END IF
71 if (domape) then
72 write (*, 10030)
73 end if
74 END IF
75
76 if (doconn) then
77 C ... Need to read the nodes/element array for this element block...
78 CALL EXGECPP(NDB, EXEBLK, IDELB, NNPE(1), IERR)
79 nnpe(0) = 0
80 do i=1, nume
81 nnpe(i) = nnpe(i) + nnpe(i-1)
82 end do
83
84 nprnt = 0
85 do ix=1, numel - iel0
86 IEL = LISEL(IX)
87 if (iel .eq. 0) cycle
88 NE = IEL - IEL0
89 NLINKS = NNPE(NE-1)
90 NLINK = NNPE(NE) - NLINKS
91 if (domape) then
92 ID = MAPE(IEL)
93 else
94 id = iel
95 end if
96 IF (NOUT .GT. 0) THEN
97 if (domapn) then
98 WRITE (NOUT, 10010, IOSTAT=IDUM)
99 & NE, ID, (MAPN(LINK(NLINKS+I)), I=1,NLINK)
100 else
101 WRITE (NOUT, 10010, IOSTAT=IDUM)
102 & NE, ID, (LINK(NLINKS+I), I=1,NLINK)
103 end if
104 ELSE
105 if (domapn) then
106 WRITE (*, 10010, IOSTAT=IDUM)
107 & NE, ID, (MAPN(LINK(NLINKS+I)), I=1,NLINK)
108 else
109 WRITE (*, 10010, IOSTAT=IDUM)
110 & NE, ID, (LINK(NLINKS+I), I=1,NLINK)
111 end if
112 END IF
113 nprnt = nprnt + 1
114 if (nprnt .ge. nlisel) exit
115 end do
116 END IF
117
118 if (doatr) then
119 C ... See if all attributes are the same
120 allsam = .true.
121 ifrst = 0
122 do i=1, numel
123 if (lisel(i) .gt. 0) then
124 ifrst = i
125 exit
126 end if
127 end do
128
129 if (ifrst .eq. 0) return
130
131 do ia = 1, natr
132 iel = lisel(ifrst)-iel0
133 aval = atrib(ia, iel)
134 do ix = ifrst+1, numel - iel0
135 iel = lisel(ix)
136 if (iel .eq. 0) cycle
137 ne = iel - iel0
138 if (aval .ne. atrib(ia, ne)) then
139 allsam = .false.
140 go to 190
141 end if
142 end do
143 end do
144
145 C ... Print either all values (if not all same), or the common values
146 190 continue
147 if (allsam) then
148 ne = lisel(ifrst) - iel0
149 IF (NOUT .GT. 0) THEN
150 WRITE (NOUT, 10025, IOSTAT=IDUM)
151 & (ATRIB(I,NE), I=1,NATR)
152 ELSE
153 WRITE (*, 10025, IOSTAT=IDUM)
154 & (ATRIB(I,NE), I=1,NATR)
155 END IF
156 else
157 DO IX = ifrst, numel - iel0
158 IEL = LISEL(IX)
159 if (iel .eq. 0) cycle
160 NE = IEL - IEL0
161 IF (NOUT .GT. 0) THEN
162 WRITE (NOUT, 10020, IOSTAT=IDUM)
163 & NE, IEL, (ATRIB(I,NE), I=1,NATR)
164 ELSE
165 WRITE (*, 10020, IOSTAT=IDUM)
166 & NE, IEL, (ATRIB(I,NE), I=1,NATR)
167 END IF
168 end do
169 end if
170 end if
171
172 RETURN
173
174 10000 FORMAT (1X, ' # elem ', A)
175 10010 FORMAT (1X, I12, I12, 5X, 8I12, :, /,
176 & (26X, 8I12))
177 10020 FORMAT (1X, I12, I12, 3X, 4 (1X, 1pE11.4), :, /,
178 & (24X, 4 (1X, 1pE11.4)))
179 10025 FORMAT (1X, 'All attributes are equal. Values are: ',
180 & (3 (1x, 1pE11.4)), :, /,
181 & (3X, 6 (1X, 1pE11.4)))
182 10030 FORMAT (1x, 'Ids are global')
183 END