Exodus 8.24
Loading...
Searching...
No Matches
/exodus_for/test/testwt_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 testwt
8
9c This is a test program for the Fortran binding of the EXODUS II
10c database write routines.
11
12 include 'exodusII.inc'
13
14 integer iin, iout
15 integer exoid, num_dim,num_nodes,elem_map(7),num_elem,num_elem_blk
16 integer num_elem_in_block(10), num_nodes_per_elem(10),numattr(10)
17 integer num_node_sets, num_side_sets
18 integer i, connect(37), nnpe(10)
19 integer ebids(10)
20 integer num_qa_rec, num_info
21 integer cpu_word_size, io_word_size
22
23 real x(100), y(100), z(100)
24
25 character*(MXSTLN) coord_names(3)
26 character*(MXSTLN) cname
27 character*(MXSTLN) qa_record(4,2)
28 character*(MXLNLN) inform(3)
29
30 data iin /5/, iout /6/
31
32 call exopts (exabrt, ierr)
33 write (iout,'("after exopts, error = ", i4)') ierr
34 cpu_word_size = 0
35 io_word_size = 0
36
37c create EXODUS II files
38
39 exoid = excre("test-nsided.exo",
40 1 exclob, cpu_word_size, io_word_size, ierr)
41 write (iout,'("after excre for test-nsided.exo, id: ", i8)') exoid
42 write (iout,'(" cpu word size: ",i4," io word size: ",i4)')
43 1 cpu_word_size, io_word_size
44 write (iout,'("after excre, error = ", i4)') ierr
45
46c initialize file with parameters
47
48 num_dim = 3
49 num_nodes = 33
50 num_elem = 7
51 num_elem_blk = 1
52 num_node_sets = 0
53 num_side_sets = 0
54
55 call expini (exoid, "This is a test", num_dim, num_nodes,
56 1 num_elem, num_elem_blk, num_node_sets,
57 2 num_side_sets, ierr)
58
59 write (iout, '("after expini, error = ", i4)' ) ierr
60
61 if (ierr .ne. 0) then
62 call exclos(exoid,ierr)
63 call exit (0)
64 endif
65
66c write nodal coordinates values and names to database
67
68c Quad #1
69 x(1) = 0.0
70 x(2) = 1.0
71 x(3) = 1.0
72 x(4) = 0.0
73
74 y(1) = 0.0
75 y(2) = 0.0
76 y(3) = 1.0
77 y(4) = 1.0
78
79 z(1) = 0.0
80 z(2) = 0.0
81 z(3) = 0.0
82 z(4) = 0.0
83
84c Quad #2
85 x(5) = 1.0
86 x(6) = 2.0
87 x(7) = 2.0
88 x(8) = 1.0
89
90 y(5) = 0.0
91 y(6) = 0.0
92 y(7) = 1.0
93 y(8) = 1.0
94
95 z(5) = 0.0
96 z(6) = 0.0
97 z(7) = 0.0
98 z(8) = 0.0
99
100c Hex #1
101 x(9) = 0.0
102 x(10) = 10.0
103 x(11) = 10.0
104 x(12) = 1.0
105 x(13) = 1.0
106 x(14) = 10.0
107 x(15) = 10.0
108 x(16) = 1.0
109
110 y(9) = 0.0
111 y(10) = 0.0
112 y(11) = 0.0
113 y(12) = 0.0
114 y(13) = 10.0
115 y(14) = 10.0
116 y(15) = 10.0
117 y(16) = 10.0
118
119 z(9) = 0.0
120 z(10) = 0.0
121 z(11) =-10.0
122 z(12) =-10.0
123 z(13) = 0.0
124 z(14) = 0.0
125 z(15) =-10.0
126 z(16) =-10.0
127
128c Tetra #1
129 x(17) = 0.0
130 x(18) = 1.0
131 x(19) = 10.0
132 x(20) = 7.0
133
134 y(17) = 0.0
135 y(18) = 0.0
136 y(19) = 0.0
137 y(20) = 5.0
138
139 z(17) = 0.0
140 z(18) = 5.0
141 z(19) = 2.0
142 z(20) = 3.0
143
144c Wedge #1
145 x(21) = 3.0
146 x(22) = 6.0
147 x(23) = 0.0
148 x(24) = 3.0
149 x(25) = 6.0
150 x(26) = 0.0
151
152 y(21) = 0.0
153 y(22) = 0.0
154 y(23) = 0.0
155 y(24) = 2.0
156 y(25) = 2.0
157 y(26) = 2.0
158
159 z(21) = 6.0
160 z(22) = 0.0
161 z(23) = 0.0
162 z(24) = 6.0
163 z(25) = 2.0
164 z(26) = 0.0
165
166C Tetra #2
167 x(27) = 2.7
168 x(28) = 6.0
169 x(29) = 5.7
170 x(30) = 3.7
171
172 y(27) = 1.7
173 y(28) = 1.7
174 y(29) = 1.7
175 y(30) = 0.0
176
177 z(27) = 2.7
178 z(28) = 3.3
179 z(29) = 1.7
180 z(30) = 2.3
181
182C 3d Tri
183 x(31) = 0.0
184 x(32) = 10.0
185 x(33) = 10.0
186
187 y(31) = 0.0
188 y(32) = 0.0
189 y(33) = 10.0
190
191 z(31) = 0.0
192 z(32) = 0.0
193 z(33) = 10.0
194
195 call expcor (exoid, x, y, z, ierr)
196 write (iout, '("after expcor, error = ", i4)' ) ierr
197 if (ierr .ne. 0) then
198 call exclos(exoid,ierr)
199 call exit (0)
200 endif
201
202 coord_names(1) = "xcoor"
203 coord_names(2) = "ycoor"
204 coord_names(3) = "zcoor"
205
206 call expcon (exoid, coord_names, ierr)
207 write (iout, '("after expcon, error = ", i4)' ) ierr
208 call exupda(exoid,ierr)
209 if (ierr .ne. 0) then
210 call exclos(exoid,ierr)
211 call exit (0)
212 endif
213
214c write element order map
215
216 do 10 i = 1, num_elem
217 elem_map(i) = i
21810 continue
219
220 call expmap (exoid, elem_map, ierr)
221 write (iout, '("after expmap, error = ", i4)' ) ierr
222 if (ierr .ne. 0) then
223 call exclos(exoid,ierr)
224 call exit (0)
225 endif
226
227c write element block parameters
228
229 num_elem_in_block(1) = 7
230
231 num_nodes_per_elem(1) = 37 ! This is total nodes per block
232
233 ebids(1) = 10
234
235 numattr(1) = 0
236
237 cname = "nsided"
238
239 call expelb (exoid,ebids(1),cname,num_elem_in_block(1),
240 1 num_nodes_per_elem(1),numattr(1),ierr)
241 write (iout, '("after expelb, error = ", i4)' ) ierr
242 if (ierr .ne. 0) then
243 call exclos(exoid,ierr)
244 call exit (0)
245 endif
246
247c write element connectivity
248
249 connect( 1) = 1
250 connect( 2) = 2
251 connect( 3) = 3
252 connect( 4) = 4
253 nnpe(1) = 4
254
255 connect( 5) = 5
256 connect( 6) = 6
257 connect( 7) = 7
258 connect( 8) = 8
259 nnpe(2) = 4
260
261 connect( 9) = 9
262 connect(10) = 10
263 connect(11) = 11
264 connect(12) = 12
265 connect(13) = 13
266 connect(14) = 14
267 connect(15) = 15
268 connect(16) = 16
269 nnpe(3) = 8
270
271 connect(17) = 17
272 connect(18) = 18
273 connect(19) = 19
274 connect(20) = 20
275 nnpe(4) = 4
276
277 connect(21) = 21
278 connect(22) = 22
279 connect(23) = 23
280 connect(24) = 24
281 connect(25) = 25
282 connect(26) = 26
283 nnpe(5) = 6
284
285 connect(27) = 17
286 connect(28) = 18
287 connect(29) = 19
288 connect(30) = 20
289 connect(31) = 27
290 connect(32) = 28
291 connect(33) = 30
292 connect(34) = 29
293 nnpe(6) = 8
294
295 connect(35) = 31
296 connect(36) = 32
297 connect(37) = 33;
298 nnpe(7) = 3
299
300 call expelc (exoid, ebids(1), connect, ierr)
301 write (iout, '("after expelc, error = ", i4)' ) ierr
302 if (ierr .ne. 0) then
303 call exclos(exoid,ierr)
304 call exit (0)
305 endif
306
307 call expecpp(exoid, exeblk, ebids(1), nnpe, ierr)
308 write (iout, '("after expecpp, error = ", i4)' ) ierr
309 if (ierr .ne. 0) then
310 call exclos(exoid,ierr)
311 call exit (0)
312 endif
313
314c write QA records
315
316 num_qa_rec = 2
317
318 qa_record(1,1) = "TESTWT fortran version"
319 qa_record(2,1) = "testwt"
320 qa_record(3,1) = "07/07/93"
321 qa_record(4,1) = "15:41:33"
322 qa_record(1,2) = "FASTQ"
323 qa_record(2,2) = "fastq"
324 qa_record(3,2) = "07/07/93"
325 qa_record(4,2) = "16:41:33"
326
327 call expqa (exoid, num_qa_rec, qa_record, ierr)
328 write (iout, '("after expqa, error = ", i4)' ) ierr
329 if (ierr .ne. 0) then
330 call exclos(exoid,ierr)
331 call exit (0)
332 endif
333
334c write information records
335
336 num_info = 3
337
338 inform(1) = "This is the first information record."
339 inform(2) = "This is the second information record."
340 inform(3) = "This is the third information record."
341
342 call expinf (exoid, num_info, inform, ierr)
343 write (iout, '("after expinf, error = ", i4)' ) ierr
344 if (ierr .ne. 0) then
345 call exclos(exoid,ierr)
346 call exit (0)
347 endif
348
349c ... Define and write some coordinate frames
350 call putfrm(exoid)
351
352c close the EXODUS files
353
354 call exclos (exoid, ierr)
355 write (iout, '("after exclos, error = ", i4)' ) ierr
356
357 stop
358 end
359
360 subroutine putfrm(exoid)
361 implicit none
362 include 'exodusII.inc'
363
364 integer exoid, ierr, i
365 integer numfrm; ! Assumed to be 3 for remaining dimensions
366 integer cfids(3), tags(3)
367 real coord(27)
368
369 numfrm = 3
370
371 cfids(1) = 1
372 cfids(2) = 11
373 cfids(3) = 111
374
375 tags(1) = excfrec
376 tags(2) = excfcyl
377 tags(3) = excfsph
378
379! NOTE: These values may not be sensical; just used for testing.
380 do i=0,2
381 coord(9*i+1) = i+0.1
382 coord(9*i+2) = i+0.2
383 coord(9*i+3) = i+0.3
384 coord(9*i+4) = i+0.4
385 coord(9*i+5) = i+0.5
386 coord(9*i+6) = i+0.6
387 coord(9*i+7) = i+0.7
388 coord(9*i+8) = i+0.8
389 coord(9*i+9) = i+0.9
390 end do
391
392 call expfrm(exoid, numfrm, cfids, coord, tags, ierr);
393 write (6,'("after expfrm, error = ", i4)') ierr
394
395 return
396 end
int excre(char *path, int *clobmode, int *cpu_word_size, int *io_word_size, int *ierr, int pathlen)
Definition exo_jack.c:176
void expini(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:239
void expcor(int *idexo, real *x_coor, real *y_coor, real *z_coor, int *ierr)
Definition exo_jack.c:551
void expqa(int *idexo, int *num_qa_records, char *qa_record, int *ierr, int qa_recordlen)
Definition exo_jack.c:306
void exclos(int *idexo, int *ierr)
Definition exo_jack.c:227
void expfrm(int *idexo, int *nframe, void_int *cfids, real *coord, int *tags, int *ierr)
Definition exo_jack.c:2541
void expelb(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:757
void expecpp(int *idexo, int *obj_type, entity_id *elem_blk_id, int *counts, int *ierr)
Definition exo_jack.c:874
void expmap(int *idexo, void_int *elem_map, int *ierr)
Definition exo_jack.c:688
void expelc(int *idexo, entity_id *elem_blk_id, void_int *connect, int *ierr)
Definition exo_jack.c:839
void expcon(int *idexo, char *coord_names, int *ierr, int coord_nameslen)
Definition exo_jack.c:569
void expinf(int *idexo, int *num_info, char *info, int *ierr, int infolen)
Definition exo_jack.c:442
void exopts(int *option_val, int *ierr)
Definition exo_jack.c:2613
void exupda(int *idexo, int *ierr)
Definition exo_jack.c:233