Exodus 8.24
Loading...
Searching...
No Matches
/exodus_for/test/testrd_nsid.f
1C Copyright(C) 1999-2020 National Technology & Engineering Solutions
2C of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
3C NTESS, the U.S. Government retains certain rights in this software.
4C
5C See packages/seacas/LICENSE for details
6
7 program testrd
8
9c This is a test program for the Fortran binding of the EXODUS II
10c database read routines
11
12c 09/07/93 V.R. Yarberry - Modified for API 2.00
13 implicit none
14
15 include 'exodusII.inc'
16
17 integer iin, iout, ierr, ioff
18 integer exoid, num_dim, num_nodes, num_elem, num_elem_blk
19 integer num_node_sets
20 integer num_side_sets
21 integer i, j, k, elem_map(100), connect(100), nnpe(10)
22 integer ids(10)
23 integer num_elem_in_block(10), num_nodes_per_elem(10)
24 integer num_attr(10)
25 integer cpu_ws,io_ws, mod_sz
26
27 real x(100), y(100), z(100)
28 real vers
29
30 character*(MXSTLN) coord_names(3)
31 character*(MXLNLN) titl
32 character*(MXSTLN) eltype(10)
33
34 data iin /5/, iout /6/
35
36c open EXODUS II files
37
38 cpu_ws = 0
39 io_ws = 0
40
41 exoid = exopen("test-nsided.exo", exread, cpu_ws, io_ws,
42 * vers, ierr)
43 write (iout, '(/"after exopen, error = ",i3)')
44 1 ierr
45
46 write (iout, '("test-nsided.exo is an EXODUSII file; version ",
47 1 f4.2)') vers
48 write (iout, '(" I/O word size",i2)') io_ws
49
50 mod_sz = exlgmd(exoid)
51 write (iout, '(" Model Size",i2)') mod_sz
52
53c read database parameters
54
55 call exgini (exoid, titl, num_dim, num_nodes, num_elem,
56 1 num_elem_blk, num_node_sets, num_side_sets, ierr)
57 write (iout, '(/"after exgini, error = ", i3)' ) ierr
58
59 write (iout, '("database parameters:"/
60 1 "title = ", a81 /
61 2 "num_dim = ", i3 /
62 3 "num_nodes = ", i3 /
63 4 "num_elem = ", i3 /
64 5 "num_elem_blk = ", i3 /
65 6 "num_node_sets = ", i3 /
66 7 "num_side_sets = ", i3)')
67 8 titl,num_dim, num_nodes, num_elem,
68 9 num_elem_blk,num_node_sets, num_side_sets
69
70c read nodal coordinates values and names from database
71
72 call exgcor (exoid, x, y, z, ierr)
73 write (iout, '(/"after exgcor, error = ", i3)' ) ierr
74
75 write (iout, '("x coords = ")')
76 do 10 i = 1, num_nodes
77 write (iout, '(f5.1)') x(i)
7810 continue
79
80 write (iout, '("y coords = ")')
81 do 20 i = 1, num_nodes
82 write (iout, '(f5.1)') y(i)
8320 continue
84
85 if (num_dim .gt. 2) then
86 write (iout, '("z coords = ")')
87 do 22 i = 1, num_nodes
88 write (iout, '(f5.1)') z(i)
8922 continue
90 endif
91
92 call exgcon (exoid, coord_names, ierr)
93 write (iout, '(/"after exgcon, error = ", i3)' ) ierr
94
95 write (iout, '("x coord name = ", a9)') coord_names(1)
96 write (iout, '("y coord name = ", a9)') coord_names(2)
97
98c read element order map
99
100 call exgmap (exoid, elem_map, ierr)
101 write (iout, '(/"after exgmap, error = ", i3)' ) ierr
102
103 do 30 i = 1, num_elem
104 write (iout, '("elem_map(",i1,") = ", i1)') i, elem_map(i)
10530 continue
106
107c read element block parameters
108
109 call exgebi (exoid, ids, ierr)
110 write (iout, '(/"after exgebi, error = ", i3)' ) ierr
111
112 do 40 i = 1, num_elem_blk
113
114 call exgelb (exoid, ids(i), eltype(i), num_elem_in_block(i),
115 1 num_nodes_per_elem(i), num_attr(i), ierr)
116 write (iout, '(/"after exgelb, error = ", i3)' ) ierr
117
118 write (iout, '("element block id = ", i2,/
119 1 "element type = ", a9,/
120 2 "num_elem_in_block = ", i2,/
121 3 "num_nodes_per_elem = ", i2,/
122 4 "num_attr = ", i2)')
123 5 ids(i), eltype(i), num_elem_in_block(i),
124 6 num_nodes_per_elem(i), num_attr(i)
125
12640 continue
127
128c read element connectivity
129
130 do 60 i = 1, num_elem_blk
131
132 call exgelc (exoid, ids(i), connect, ierr)
133 write (iout, '(/"after exgelc, error = ", i3)' ) ierr
134
135 if (eltype(i) .eq. 'nsided' .or. eltype(i) .eq. 'NSIDED') then
136 call exgecpp(exoid, exeblk, ids(i), nnpe, ierr)
137 write (iout, '(/"after exgecpp, error = ", i3)' ) ierr
138
139 write (iout, '("connect array for elem block ", i2)') ids(i)
140
141 ioff = 0
142 do j = 1, num_elem_in_block(i)
143 write (iout, 100) j, nnpe(j), (connect(ioff+k),k=1,nnpe(j))
144 ioff = ioff + nnpe(j)
145 end do
146
147 end if
14860 continue
149
150C ... Test coordinate frames
151 call getfrm(exoid)
152
153 call exclos (exoid, ierr)
154 write (iout, '(/"after exclos, error = ", i3)' ) ierr
155 100 format(' Element ',i3,', Nodes/Element = ',i3,' -- ',20i3)
156 stop
157 end
158
159 subroutine getfrm(exoid)
160 implicit none
161 include 'exodusII.inc'
162
163 integer iout
164
165 integer exoid, ierr, i, j
166 integer numfrm; ! Assumed to be 3 for remaining dimensions
167 integer cfids(3), tags(3)
168 character*32 ctag
169 real coord(27)
170
171 data iout /6/
172
173 numfrm = exinqi(exoid, exncf)
174 write (iout,
175 1 '(/"There are ",i2," coordinate frames")')
176 2 numfrm
177
178 numfrm = 3
179 call exgfrm(exoid, numfrm, cfids, coord, tags, ierr);
180 write (6,'("after exgfrm, error = ", i4)') ierr
181
182! NOTE: These values may not be sensical; just used for testing.
183 do i=0,2
184 if (tags(i+1) .eq. excfrec) then
185 ctag = 'RECTANGULAR'
186 else if (tags(i+1) .eq. excfcyl) then
187 ctag = 'CYLINDRICAL'
188 else if (tags(i+1) .eq. excfsph) then
189 ctag = 'SPHERICAL'
190 end if
191
192 write (iout, 100) cfids(i+1), ctag, (coord(9*i+j),j=1,9)
193 end do
194
195 100 format(i5, 3x, a, 9f10.2)
196 return
197 end
int64_t exinqi(int *idexo, int *req_info)
Definition exo_jack.c:2437
void exgebi(int *idexo, void_int *elem_blk_ids, int *ierr)
Definition exo_jack.c:837
void exgcon(int *idexo, char *coord_names, int *ierr, int coord_nameslen)
Definition exo_jack.c:634
void exgmap(int *idexo, void_int *elem_map, int *ierr)
Definition exo_jack.c:704
int exopen(char *path, int *mode, int *cpu_word_size, int *io_word_size, float *version, int *ierr, int pathlen)
Definition exo_jack.c:204
void exgelb(int *idexo, entity_id *elem_blk_id, char *elem_type, void_int *num_elem_this_blk, void_int *num_nodes_per_elem, void_int *num_attr, int *ierr, int elem_typelen)
Definition exo_jack.c:806
void exclos(int *idexo, int *ierr)
Definition exo_jack.c:230
void exgcor(int *idexo, real *x_coor, real *y_coor, real *z_coor, int *ierr)
Definition exo_jack.c:567
int exlgmd(int *idexo)
Definition exo_jack.c:2627
void exgini(int *idexo, char *title, void_int *num_dim, void_int *num_nodes, void_int *num_elem, void_int *num_elem_blk, void_int *num_node_sets, void_int *num_side_sets, int *ierr, int titlelen)
Definition exo_jack.c:286
void exgecpp(int *idexo, int *obj_type, entity_id *elem_blk_id, int *counts, int *ierr)
Definition exo_jack.c:916
void exgelc(int *idexo, entity_id *elem_blk_id, void_int *connect, int *ierr)
Definition exo_jack.c:855
void exgfrm(int *idexo, int *nframeo, void_int *cfids, real *coord, int *tags, int *ierr)
Definition exo_jack.c:2532