Debian Codegraph @

packages/seacas/libraries/exodus/test/CreateEdgeFace.c

raw
1 /*
2 * Copyright(C) 1999-2020, 2022, 2023 National Technology & Engineering Solutions
3 * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
4 * NTESS, the U.S. Government retains certain rights in this software.
5 *
6 * See packages/seacas/LICENSE for details
7 */
8 #include "exodusII.h"
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include <string.h>
12
13 #define EX_TEST_FILENAME "edgeFace.exo"
14
15 /* ======== Coordinates and connectivity ========= */
16 double coordsX[] = {0., 0., 0., 0., 3., 3., 3., 3., -3., -3., -3., -3.};
17
18 double coordsY[] = {-1., 1., 1., -1., -3., 3., 3., -3., -3., 3., 3., -3.};
19
20 double coordsZ[] = {-1., -1., 1., 1., -3., -3., 3., 3., -3., -3., 3., 3.};
21
22 const char *coordsNames[] = {"X", "Y", "Z"};
23
24 int conn1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4};
25
26 int conn2[] = {1, 2, 3, 5};
27
28 int econn1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 17, 18, 19, 20};
29
30 int fconn1[] = {4, 5, 7, 6, 3, 2, 8, 9, 11, 10, 1, 3};
31
32 int ebconn1[] = {1, 2, 2, 3, 3, 4, 4, 1, 5, 6, 6, 7, 7, 8, 8, 5, 1, 5, 2, 6,
33 4, 8, 3, 7, 9, 10, 10, 11, 11, 12, 12, 9, 9, 1, 10, 2, 12, 4, 11, 3};
34
35 int fbconn1[] = {12, 11, 10, 9, 5, 6, 7, 8};
36
37 int fbconn2[] = {1, 2, 3, 4};
38
39 int fbconn3[] = {1, 5, 6, 2, 3, 7, 8, 4, 2, 6, 7, 3, 4, 8, 5, 1,
40 9, 1, 2, 10, 11, 3, 4, 12, 10, 2, 3, 11, 12, 4, 1, 9};
41
42 int nmap1[] = {12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
43
44 int edmap1[] = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20};
45
46 int famap1[] = {2, 1, 4, 3, 6, 5, 7, 8, 9, 10, 11};
47
48 int emap1[] = {1, 2};
49
50 const char *eblk_names[] = {"Eli_WALLACH", "Angelo_NOVI"};
51 const char *edblk_names[] = {"Aldo_GIUFFRE"};
52 const char *fablk_names[] = {"Livio_LORENZON", "Claudio_SCARCHILLI", "John_BARTHA"};
53
54 const char *nmap_names[] = {"Luigi_PISTILLI"};
55 const char *edmap_names[] = {"Antonio_CASALE"};
56 const char *famap_names[] = {"Sandro_SCARCHILLI"};
57 const char *emap_names[] = {"Benito_STEFANELLI"};
58
59 /* ======== Sets ========= */
60 int nset_nodes[] = {5, 6, 9};
61
62 int eset_edges[] = {1, 2, 4, 15, 19, 20};
63
64 int eset_orient[] = {+1, +1, +1, +1, +1, -1};
65
66 double eset_df[] = {2., 2., 0.5, 0.5, 1., 1.};
67
68 int fset_faces[] = {3, 9};
69
70 int fset_orient[] = {+1, -1};
71
72 int sset_elems[] = {1, 1, 1, 2, 2};
73
74 int sset_sides[] = {1, 3, 5, 2, 4};
75
76 int elset_elems[] = {1, 2};
77
78 const char *elset_names[] = {"Clint_EASTWOOD", "Lee_VAN_CLEEF"};
79
80 const char *nset_names[] = {"Ennio_MORRICONE"};
81 const char *eset_names[] = {"Rada_RASSIMOV"};
82 const char *fset_names[] = {"Enzo_PETITO"};
83 const char *sset_names[] = {"Luciano_VINCENZONI"};
84
85 /* ======== Attributes ========= */
86 const char *edge_attr_names1[] = {"Sergio_LEONE"};
87
88 const char *face_attr_names1[] = {"GOOD"};
89 const char *face_attr_names2[] = {"BAD"};
90 const char *face_attr_names3[] = {"UGLY"};
91
92 const char *elem_attr_names1[] = {"SPAGHETTI", "WESTERN"};
93
94 double edge_attr_values1[] = {1., 2., 3., 5., 7., 11., 13., 17., 19., 23.,
95 29., 31., 37., 41., 43., 47., 53., 59., 61., 67.};
96
97 double face_attr_values1[] = {71., 73.};
98
99 double face_attr_values2[] = {79.};
100
101 double face_attr_values3[] = {83., 89., 97., 101., 103., 107., 109., 113.};
102
103 double elem_attr_values1[] = {127., 101., 137., 139.};
104
105 /* ======== Results variables ========= */
106 /* (2 time steps) */
107
108 double vals_glo_var[2][2] = {{36., 37.}, {42., 43.}};
109
110 double vals_nod_var[2][12] = {{0.1, 0.8, 0.0, 0.4, 0.3, 0.9, 0.8, 0.5, 0.3, 0.7, 0.4, 0.6},
111 {0.7, 0.5, 0.3, 0.5, 0.2, 0.7, 0.9, 0.8, 0.0, 0.2, 0.3, 0.5}};
112
113 double vals_edge_var1eb1[2][20] = {
114 {20., 19., 18., 17., 16., 15., 14., 13., 12., 11., 10., 9., 8., 7., 6., 5., 4., 3., 2., 1.},
115 {21., 20., 19., 18., 17., 16., 15., 14., 13., 12., 11., 10., 9., 8., 7., 6., 5., 4., 3., 2.}};
116
117 double vals_edge_var2eb1[2][20] = {
118 {1., 1., 0., 0., 1., 1., 2., 0., 2., 0., 1., 1., 1., 1., 0., 0., 2., 2., 2., 2.},
119 {1., 1., 0., 0., 1., 1., 2., 0., 2., 0., 1., 1., 1., 1., 0., 0., 2., 2., 2., 2.}};
120
121 double vals_face_var1fb1[2][2] = {{0, 1}, {2, 0}};
122
123 double vals_face_var1fb3[2][8] = {{1, 0, 2, 0, 3, 0, 4, 0}, {0, 1, 0, 2, 0, 3, 0, 4}};
124
125 double vals_elem_var1eb1[2][2] = {{8, 8}, {0, -8}};
126
127 double vals_fset_var1fs1[2][2] = {{1., 3.}, {9., 27.}};
128
129 #define EXCHECK(funcall, errmsg) \
130 do { \
131 if ((funcall) < 0) { \
132 fprintf(stderr, errmsg); \
133 free(varParams.edge_var_tab); \
134 free(varParams.face_var_tab); \
135 free(varParams.elem_var_tab); \
136 free(varParams.fset_var_tab); \
137 return 1; \
138 } \
139 } while (0)
140
141 int ex_have_arg(int argc, char *argv[], const char *aname)
142 {
143 int i;
144 for (i = 0; i < argc; ++i) {
145 if (!strcmp(argv[i], aname)) {
146 return 1;
147 }
148 }
149 return 0;
150 }
151
152 int cCreateEdgeFace(int argc, char *argv[])
153 {
154 int exoid;
155 int appWordSize = 8;
156 int diskWordSize = 8;
157 /* int concatBlocks = ex_have_arg( argc, argv, "-pcab" ); */
158 int concatSets = ex_have_arg(argc, argv, "-pcset");
159 int concatResult = ex_have_arg(argc, argv, "-pvpax");
160 double t;
161
162 ex_init_params modelParams = {
163 "CreateEdgeFace Test", /* title */
164 3, /* num_dim */
165 12, /* num_nodes */
166 20, /* num_edge */
167 1, /* num_edge_blk */
168 11, /* num_face */
169 3, /* num_face_blk */
170 3, /* num_elem */
171 2, /* num_elem_blk */
172 1, /* num_node_sets */
173 1, /* num_edge_sets */
174 1, /* num_face_sets */
175 1, /* num_side_sets */
176 2, /* num_elem_sets */
177 1, /* num_node_map */
178 1, /* num_edge_map */
179 1, /* num_face_map */
180 1, /* num_elem_map */
181 };
182
183 ex_block edgeBlocks[1];
184 ex_block faceBlocks[3];
185 ex_block elemBlocks[2];
186
187 ex_var_params varParams;
188
189 ex_opts(EX_VERBOSE | EX_ABORT);
190
191 exoid = ex_create(EX_TEST_FILENAME, EX_CLOBBER, &appWordSize, &diskWordSize);
192 if (exoid <= 0) {
193 fprintf(stderr, "Unable to open \"%s\" for writing.\n", EX_TEST_FILENAME);
194 return 1;
195 }
196
197 edgeBlocks[0].type = EX_EDGE_BLOCK;
198 edgeBlocks[0].id = 100;
199 edgeBlocks[0].num_entry = 20;
200 edgeBlocks[0].num_nodes_per_entry = 2;
201 edgeBlocks[0].num_attribute = 1;
202 ex_copy_string(edgeBlocks[0].topology, "EDGE2", MAX_STR_LENGTH + 1);
203
204 faceBlocks[0].type = EX_FACE_BLOCK;
205 faceBlocks[0].id = 500;
206 faceBlocks[0].num_entry = 2;
207 faceBlocks[0].num_nodes_per_entry = 4;
208 faceBlocks[0].num_attribute = 1;
209 ex_copy_string(faceBlocks[0].topology, "QUAD4", MAX_STR_LENGTH + 1);
210
211 faceBlocks[1].type = EX_FACE_BLOCK;
212 faceBlocks[1].id = 600;
213 faceBlocks[1].num_entry = 1;
214 faceBlocks[1].num_nodes_per_entry = 4;
215 faceBlocks[1].num_attribute = 1;
216 ex_copy_string(faceBlocks[1].topology, "QUAD4", MAX_STR_LENGTH + 1);
217
218 faceBlocks[2].type = EX_FACE_BLOCK;
219 faceBlocks[2].id = 700;
220 faceBlocks[2].num_entry = 8;
221 faceBlocks[2].num_nodes_per_entry = 4;
222 faceBlocks[2].num_attribute = 1;
223 ex_copy_string(faceBlocks[2].topology, "QUAD4", MAX_STR_LENGTH + 1);
224
225 elemBlocks[0].type = EX_ELEM_BLOCK;
226 elemBlocks[0].id = 200;
227 elemBlocks[0].num_entry = 2;
228 elemBlocks[0].num_nodes_per_entry = 8;
229 elemBlocks[0].num_edges_per_entry = 12;
230 elemBlocks[0].num_faces_per_entry = 6;
231 elemBlocks[0].num_attribute = 2;
232 ex_copy_string(elemBlocks[0].topology, "HEX8", MAX_STR_LENGTH + 1);
233
234 elemBlocks[1].type = EX_ELEM_BLOCK;
235 elemBlocks[1].id = 201;
236 elemBlocks[1].num_entry = 1;
237 elemBlocks[1].num_nodes_per_entry = 4;
238 elemBlocks[1].num_edges_per_entry = 0;
239 elemBlocks[1].num_faces_per_entry = 0;
240 elemBlocks[1].num_attribute = 0;
241 ex_copy_string(elemBlocks[1].topology, "TET4", MAX_STR_LENGTH + 1);
242
243 varParams.edge_var_tab = (int *)malloc(2 * sizeof(int));
244 varParams.face_var_tab = (int *)malloc(3 * sizeof(int));
245 varParams.elem_var_tab = (int *)malloc(2 * sizeof(int));
246 varParams.nset_var_tab = NULL;
247 varParams.eset_var_tab = NULL;
248 varParams.fset_var_tab = (int *)malloc(1 * sizeof(int));
249 varParams.sset_var_tab = NULL;
250 varParams.elset_var_tab = NULL;
251
252 varParams.num_glob = 2;
253 varParams.num_node = 1;
254 varParams.num_edge = 2;
255 varParams.edge_var_tab[0] = 1;
256 varParams.edge_var_tab[1] = 1;
257 varParams.num_face = 1;
258 varParams.face_var_tab[0] = 1;
259 varParams.face_var_tab[1] = 1;
260 varParams.face_var_tab[2] = 1;
261 varParams.num_elem = 1;
262 varParams.elem_var_tab[0] = 1;
263 varParams.elem_var_tab[1] = 0;
264 varParams.num_nset = 0;
265 varParams.num_eset = 0;
266 ;
267 varParams.num_fset = 1;
268 varParams.fset_var_tab[0] = 1;
269 varParams.num_sset = 0;
270 varParams.num_elset = 0;
271
272 EXCHECK(ex_put_init_ext(exoid, &modelParams), "Unable to initialize database.\n");
273
274 {
275 int blk;
276 for (blk = 0; blk < modelParams.num_edge_blk; ++blk) {
277 EXCHECK(ex_put_block_param(exoid, edgeBlocks[blk]), "Unable to write edge block");
278 }
279 for (blk = 0; blk < modelParams.num_face_blk; ++blk) {
280 EXCHECK(ex_put_block_param(exoid, faceBlocks[blk]), "Unable to write face block");
281 }
282 for (blk = 0; blk < modelParams.num_elem_blk; ++blk) {
283 EXCHECK(ex_put_block_param(exoid, elemBlocks[blk]), "Unable to write elem block");
284 }
285 }
286
287 EXCHECK(ex_put_coord(exoid, (void *)coordsX, (void *)coordsY, (void *)coordsZ),
288 "Unable to write coordinates.\n");
289
290 EXCHECK(ex_put_coord_names(exoid, (char **)coordsNames), "Unable to write coordinate names.\n");
291
292 /* =============== Connectivity ================== */
293 /* *** NEW API *** */
294 EXCHECK(ex_put_conn(exoid, EX_EDGE_BLOCK, edgeBlocks[0].id, ebconn1, 0, 0),
295 "Unable to write edge block connectivity.\n");
296
297 /* *** NEW API *** */
298 EXCHECK(ex_put_conn(exoid, EX_FACE_BLOCK, faceBlocks[0].id, fbconn1, 0, 0),
299 "Unable to write face block 1 connectivity.\n");
300 EXCHECK(ex_put_conn(exoid, EX_FACE_BLOCK, faceBlocks[1].id, fbconn2, 0, 0),
301 "Unable to write face block 2 connectivity.\n");
302 EXCHECK(ex_put_conn(exoid, EX_FACE_BLOCK, faceBlocks[2].id, fbconn3, 0, 0),
303 "Unable to write face block 3 connectivity.\n");
304
305 /* *** NEW API *** */
306 EXCHECK(ex_put_conn(exoid, EX_ELEM_BLOCK, elemBlocks[0].id, conn1, econn1, fconn1),
307 "Unable to write elem block 1 connectivity.\n");
308
309 /* *** NEW API *** */
310 EXCHECK(ex_put_conn(exoid, EX_ELEM_BLOCK, elemBlocks[1].id, conn2, 0, 0),
311 "Unable to write elem block 2 connectivity.\n");
312
313 /* *** NEW API *** */
314 EXCHECK(ex_put_names(exoid, EX_EDGE_BLOCK, (char **)edblk_names),
315 "Unable to write edge block names.\n");
316 EXCHECK(ex_put_names(exoid, EX_FACE_BLOCK, (char **)fablk_names),
317 "Unable to write face block names.\n");
318 EXCHECK(ex_put_names(exoid, EX_ELEM_BLOCK, (char **)eblk_names),
319 "Unable to write element block names.\n");
320
321 /* =============== Number Maps ================== */
322 /* *** NEW API *** */
323 EXCHECK(ex_put_num_map(exoid, EX_NODE_MAP, 300, nmap1), "Unable to write node map.\n");
324 EXCHECK(ex_put_num_map(exoid, EX_EDGE_MAP, 800, edmap1), "Unable to write edge map.\n");
325 EXCHECK(ex_put_num_map(exoid, EX_FACE_MAP, 900, famap1), "Unable to write face map.\n");
326 EXCHECK(ex_put_num_map(exoid, EX_ELEM_MAP, 400, emap1), "Unable to write element map.\n");
327
328 /* *** NEW API *** */
329 EXCHECK(ex_put_names(exoid, EX_NODE_MAP, (char **)nmap_names),
330 "Unable to write node map names.\n");
331 EXCHECK(ex_put_names(exoid, EX_EDGE_MAP, (char **)edmap_names),
332 "Unable to write edge map names.\n");
333 EXCHECK(ex_put_names(exoid, EX_FACE_MAP, (char **)famap_names),
334 "Unable to write face map names.\n");
335 EXCHECK(ex_put_names(exoid, EX_ELEM_MAP, (char **)emap_names),
336 "Unable to write element map names.\n");
337
338 /* =============== Attribute names ================ */
339 /* *** NEW API *** */
340 EXCHECK(ex_put_attr_names(exoid, EX_EDGE_BLOCK, edgeBlocks[0].id, (char **)edge_attr_names1),
341 "Unable to write edge block 1 attribute names.\n");
342
343 /* *** NEW API *** */
344 EXCHECK(ex_put_attr_names(exoid, EX_FACE_BLOCK, faceBlocks[0].id, (char **)face_attr_names1),
345 "Unable to write face block 1 attribute names.\n");
346 EXCHECK(ex_put_attr_names(exoid, EX_FACE_BLOCK, faceBlocks[1].id, (char **)face_attr_names2),
347 "Unable to write face block 1 attribute names.\n");
348 EXCHECK(ex_put_attr_names(exoid, EX_FACE_BLOCK, faceBlocks[2].id, (char **)face_attr_names3),
349 "Unable to write face block 1 attribute names.\n");
350
351 /* *** NEW API *** */
352 EXCHECK(ex_put_attr_names(exoid, EX_ELEM_BLOCK, elemBlocks[0].id, (char **)elem_attr_names1),
353 "Unable to write elem block 1 attribute names.\n");
354
355 /* =============== Attribute values =============== */
356 /* *** NEW API *** */
357 EXCHECK(ex_put_attr(exoid, EX_EDGE_BLOCK, edgeBlocks[0].id, edge_attr_values1),
358 "Unable to write edge block 1 attribute values.\n");
359
360 /* *** NEW API *** */
361 EXCHECK(ex_put_attr(exoid, EX_FACE_BLOCK, faceBlocks[0].id, face_attr_values1),
362 "Unable to write face block 1 attribute values.\n");
363 EXCHECK(ex_put_attr(exoid, EX_FACE_BLOCK, faceBlocks[1].id, face_attr_values2),
364 "Unable to write face block 1 attribute values.\n");
365 EXCHECK(ex_put_attr(exoid, EX_FACE_BLOCK, faceBlocks[2].id, face_attr_values3),
366 "Unable to write face block 1 attribute values.\n");
367
368 /* *** NEW API *** */
369 EXCHECK(ex_put_attr(exoid, EX_ELEM_BLOCK, elemBlocks[0].id, elem_attr_values1),
370 "Unable to write elem block 1 attribute values.\n");
371
372 /* =============== Set parameters ================= */
373 /* *** NEW API *** */
374 EXCHECK(ex_put_names(exoid, EX_NODE_SET, (char **)nset_names),
375 "Unable to write node set names.\n");
376 EXCHECK(ex_put_names(exoid, EX_EDGE_SET, (char **)eset_names),
377 "Unable to write edge set names.\n");
378 EXCHECK(ex_put_names(exoid, EX_FACE_SET, (char **)fset_names),
379 "Unable to write face set names.\n");
380 EXCHECK(ex_put_names(exoid, EX_SIDE_SET, (char **)sset_names),
381 "Unable to write side set names.\n");
382 EXCHECK(ex_put_names(exoid, EX_ELEM_SET, (char **)elset_names),
383 "Unable to write element set names.\n");
384
385 {
386 ex_set allSets[1 + 1 + 1 + 1 + 2];
387
388 ex_set *nodeSets = &allSets[0];
389 ex_set *edgeSets = &allSets[1];
390 ex_set *faceSets = &allSets[2];
391 ex_set *sideSets = &allSets[3];
392 ex_set *elemSets = &allSets[4];
393
394 nodeSets[0].type = EX_NODE_SET;
395 nodeSets[0].id = 1000;
396 nodeSets[0].num_entry = 3;
397 nodeSets[0].num_distribution_factor = 0;
398 nodeSets[0].entry_list = nset_nodes;
399 nodeSets[0].extra_list = NULL;
400 nodeSets[0].distribution_factor_list = NULL;
401
402 edgeSets[0].type = EX_EDGE_SET;
403 edgeSets[0].id = 1200;
404 edgeSets[0].num_entry = 6;
405 edgeSets[0].num_distribution_factor = 6;
406 edgeSets[0].entry_list = eset_edges;
407 edgeSets[0].extra_list = eset_orient;
408 edgeSets[0].distribution_factor_list = eset_df;
409
410 faceSets[0].type = EX_FACE_SET;
411 faceSets[0].id = 1400;
412 faceSets[0].num_entry = 2;
413 faceSets[0].num_distribution_factor = 0;
414 faceSets[0].entry_list = fset_faces;
415 faceSets[0].extra_list = fset_orient;
416 faceSets[0].distribution_factor_list = NULL;
417
418 sideSets[0].type = EX_SIDE_SET;
419 sideSets[0].id = 1400;
420 sideSets[0].num_entry = 5;
421 sideSets[0].num_distribution_factor = 0;
422 sideSets[0].entry_list = sset_elems;
423 sideSets[0].extra_list = sset_sides;
424 sideSets[0].distribution_factor_list = NULL;
425
426 elemSets[0].type = EX_ELEM_SET;
427 elemSets[0].id = 1800;
428 elemSets[0].num_entry = 1;
429 elemSets[0].num_distribution_factor = 0;
430 elemSets[0].entry_list = &elset_elems[0];
431 elemSets[0].extra_list = NULL;
432 elemSets[0].distribution_factor_list = NULL;
433
434 elemSets[1].type = EX_ELEM_SET;
435 elemSets[1].id = 1900;
436 elemSets[1].num_entry = 1;
437 elemSets[1].num_distribution_factor = 0;
438 elemSets[1].entry_list = &elset_elems[1];
439 elemSets[1].extra_list = NULL;
440 elemSets[1].distribution_factor_list = NULL;
441
442 if (concatSets) {
443 EXCHECK(ex_put_sets(exoid, 1 + 2 + 1 + 1 + 1, allSets),
444 "Unable to output concatenated sets.\n");
445 }
446 else {
447 EXCHECK(ex_put_sets(exoid, 1, nodeSets), "Unable to write node sets.\n");
448 EXCHECK(ex_put_sets(exoid, 1, edgeSets), "Unable to write edge sets.\n");
449 EXCHECK(ex_put_sets(exoid, 1, faceSets), "Unable to write face sets.\n");
450 EXCHECK(ex_put_sets(exoid, 1, sideSets), "Unable to write side sets.\n");
451 EXCHECK(ex_put_sets(exoid, 2, elemSets), "Unable to write element sets.\n");
452 }
453 }
454
455 /* =============== Result variable params ========= */
456 /* *** NEW API *** */
457 if (concatResult) {
458 EXCHECK(ex_put_all_var_param_ext(exoid, &varParams),
459 "Unable to write result variable parameter information.\n");
460 }
461 else {
462 EXCHECK(ex_put_variable_param(exoid, EX_GLOBAL, 2),
463 "Unable to write global result variable parameters.\n");
464 EXCHECK(ex_put_variable_param(exoid, EX_NODAL, 1),
465 "Unable to write nodal result variable parameters.\n");
466 EXCHECK(ex_put_variable_param(exoid, EX_ELEM_BLOCK, 1),
467 "Unable to write element result variable parameters.\n");
468 EXCHECK(ex_put_variable_param(exoid, EX_EDGE_BLOCK, 2),
469 "Unable to write edge result variable parameters.\n");
470 EXCHECK(ex_put_variable_param(exoid, EX_FACE_BLOCK, 1),
471 "Unable to write face result variable parameters.\n");
472 EXCHECK(ex_put_variable_param(exoid, EX_FACE_SET, 1),
473 "Unable to write faceset result variable parameters.\n");
474 }
475
476 /* =============== Result variable names ========== */
477 /* *** NEW API *** */
478 EXCHECK(ex_put_variable_name(exoid, EX_GLOBAL, 1, "CALIBER"), "Unable to write variable name.\n");
479 EXCHECK(ex_put_variable_name(exoid, EX_GLOBAL, 2, "GUNPOWDER"),
480 "Unable to write variable name.\n");
481 EXCHECK(ex_put_variable_name(exoid, EX_NODAL, 1, "RHO"), "Unable to write variable name.\n");
482 EXCHECK(ex_put_variable_name(exoid, EX_EDGE_BLOCK, 1, "GAMMA1"),
483 "Unable to write variable name.\n");
484 EXCHECK(ex_put_variable_name(exoid, EX_EDGE_BLOCK, 2, "GAMMA2"),
485 "Unable to write variable name.\n");
486 EXCHECK(ex_put_variable_name(exoid, EX_FACE_BLOCK, 1, "PHI"), "Unable to write variable name.\n");
487 EXCHECK(ex_put_variable_name(exoid, EX_ELEM_BLOCK, 1, "EPSTRN"),
488 "Unable to write variable name.\n");
489 EXCHECK(ex_put_variable_name(exoid, EX_FACE_SET, 1, "PHI0"), "Unable to write variable name.\n");
490
491 /* =============== Result variable values ========= */
492 t = 1.;
493 /* *** NEW API *** */
494 EXCHECK(ex_put_time(exoid, 1, &t), "Unable to write time value.\n");
495 EXCHECK(ex_put_var(exoid, 1, EX_GLOBAL, 1, 0 /*N/A*/, 2, vals_glo_var[0]),
496 "Unable to write global var 1.\n");
497 EXCHECK(ex_put_var(exoid, 1, EX_EDGE_BLOCK, 1, 100, 20, vals_edge_var1eb1[0]),
498 "Unable to write edge block 1 var 1.\n");
499 EXCHECK(ex_put_var(exoid, 1, EX_EDGE_BLOCK, 2, 100, 20, vals_edge_var2eb1[0]),
500 "Unable to write edge block 1 var 2.\n");
501 EXCHECK(ex_put_var(exoid, 1, EX_FACE_BLOCK, 1, 500, 2, vals_face_var1fb1[0]),
502 "Unable to write face block 1 var 1.\n");
503 EXCHECK(ex_put_var(exoid, 1, EX_FACE_BLOCK, 1, 700, 8, vals_face_var1fb3[0]),
504 "Unable to write face block 3 var 1.\n");
505 EXCHECK(ex_put_var(exoid, 1, EX_ELEM_BLOCK, 1, 200, 2, vals_elem_var1eb1[0]),
506 "Unable to write elem block 1 var 1.\n");
507 EXCHECK(ex_put_var(exoid, 1, EX_FACE_SET, 1, 1400, 2, vals_fset_var1fs1[0]),
508 "Unable to write face set 1 var 1.\n");
509
510 t = 2.;
511 EXCHECK(ex_put_time(exoid, 2, &t), "Unable to write time value.\n");
512 EXCHECK(ex_put_var(exoid, 2, EX_GLOBAL, 1, 0 /*N/A*/, 2, vals_glo_var[1]),
513 "Unable to write global var 1.\n");
514 EXCHECK(ex_put_var(exoid, 2, EX_EDGE_BLOCK, 1, 100, 20, vals_edge_var1eb1[1]),
515 "Unable to write edge block 1 var 1.\n");
516 EXCHECK(ex_put_var(exoid, 2, EX_EDGE_BLOCK, 2, 100, 20, vals_edge_var2eb1[1]),
517 "Unable to write edge block 1 var 2.\n");
518 EXCHECK(ex_put_var(exoid, 2, EX_FACE_BLOCK, 1, 500, 2, vals_face_var1fb1[1]),
519 "Unable to write face block 1 var 1.\n");
520 EXCHECK(ex_put_var(exoid, 2, EX_FACE_BLOCK, 1, 700, 8, vals_face_var1fb3[1]),
521 "Unable to write face block 3 var 1.\n");
522 EXCHECK(ex_put_var(exoid, 2, EX_ELEM_BLOCK, 1, 200, 2, vals_elem_var1eb1[1]),
523 "Unable to write elem block 1 var 1.\n");
524 EXCHECK(ex_put_var(exoid, 2, EX_FACE_SET, 1, 1400, 2, vals_fset_var1fs1[1]),
525 "Unable to write face set 1 var 1.\n");
526
527 EXCHECK(ex_put_var(exoid, 1, EX_NODAL, 1, 1, 12, vals_nod_var[0]),
528 "Unable to write nodal var 1.\n");
529 EXCHECK(ex_put_var(exoid, 2, EX_NODAL, 1, 1, 12, vals_nod_var[1]),
530 "Unable to write nodal var 1.\n");
531
532 EXCHECK(ex_close(exoid), "Unable to close database.\n");
533
534 free(varParams.edge_var_tab);
535 free(varParams.face_var_tab);
536 free(varParams.elem_var_tab);
537 free(varParams.fset_var_tab);
538 return 0;
539 }
540
541 #if !defined(USING_CMAKE)
542 int main(int argc, char *argv[]) { return cCreateEdgeFace(argc, argv); }
543 #endif