Debian Codegraph @

packages/seacas/applications/explore/exp_preb1.f

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