Debian Codegraph @

packages/seacas/applications/exodiff/test_generate_exo_files.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_GOLD_FILENAME "edge-face-gold.exo"
14 #define EX_TEST_NO_DIFF_FILENAME "edge-face-no-diff.exo"
15 #define EX_TEST_EDGE_DIFF_FILENAME "edge-diff.exo"
16 #define EX_TEST_FACE_DIFF_FILENAME "face-diff.exo"
17
18 /* ======== Coordinates and connectivity ========= */
19 double coordsX[] = {0., 0., 0., 0., 3., 3., 3., 3., -3., -3., -3., -3.};
20
21 double coordsY[] = {-1., 1., 1., -1., -3., 3., 3., -3., -3., 3., 3., -3.};
22
23 double coordsZ[] = {-1., -1., 1., 1., -3., -3., 3., 3., -3., -3., 3., 3.};
24
25 const char *coordsNames[] = {"X", "Y", "Z"};
26
27 int conn1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, 3, 4};
28
29 int conn2[] = {1, 2, 3, 5};
30
31 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};
32
33 int fconn1[] = {4, 5, 7, 6, 3, 2, 8, 9, 11, 10, 1, 3};
34
35 int ebconn1[] = {1, 2, 2, 3, 3, 4, 4, 1, 5, 6, 6, 7, 7, 8, 8, 5, 1, 5, 2, 6,
36 4, 8, 3, 7, 9, 10, 10, 11, 11, 12, 12, 9, 9, 1, 10, 2, 12, 4, 11, 3};
37
38 int fbconn1[] = {12, 11, 10, 9, 5, 6, 7, 8};
39
40 int fbconn2[] = {1, 2, 3, 4};
41
42 int fbconn3[] = {1, 5, 6, 2, 3, 7, 8, 4, 2, 6, 7, 3, 4, 8, 5, 1,
43 9, 1, 2, 10, 11, 3, 4, 12, 10, 2, 3, 11, 12, 4, 1, 9};
44
45 int nmap1[] = {12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1};
46
47 int edmap1[] = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20};
48
49 int famap1[] = {2, 1, 4, 3, 6, 5, 7, 8, 9, 10, 11};
50
51 int emap1[] = {1, 2};
52
53 const char *eblk_names[] = {"Eli_WALLACH", "Angelo_NOVI"};
54 const char *edblk_names[] = {"Aldo_GIUFFRE"};
55 const char *fablk_names[] = {"Livio_LORENZON", "Claudio_SCARCHILLI", "John_BARTHA"};
56
57 const char *nmap_names[] = {"Luigi_PISTILLI"};
58 const char *edmap_names[] = {"Antonio_CASALE"};
59 const char *famap_names[] = {"Sandro_SCARCHILLI"};
60 const char *emap_names[] = {"Benito_STEFANELLI"};
61
62 /* ======== Sets ========= */
63 int nset_nodes[] = {5, 6, 9};
64
65 int eset_edges[] = {1, 2, 4, 15, 19, 20};
66
67 int eset_orient[] = {+1, +1, +1, +1, +1, -1};
68
69 double eset_df[] = {2., 2., 0.5, 0.5, 1., 1.};
70
71 int fset_faces[] = {3, 9};
72
73 int fset_orient[] = {+1, -1};
74
75 int sset_elems[] = {1, 1, 1, 2, 2};
76
77 int sset_sides[] = {1, 3, 5, 2, 4};
78
79 int elset_elems[] = {1, 2};
80
81 const char *elset_names[] = {"Clint_EASTWOOD", "Lee_VAN_CLEEF"};
82
83 const char *nset_names[] = {"Ennio_MORRICONE"};
84 const char *eset_names[] = {"Rada_RASSIMOV"};
85 const char *fset_names[] = {"Enzo_PETITO"};
86 const char *sset_names[] = {"Luciano_VINCENZONI"};
87
88 /* ======== Attributes ========= */
89 const char *edge_attr_names1[] = {"Sergio_LEONE"};
90
91 const char *face_attr_names1[] = {"GOOD"};
92 const char *face_attr_names2[] = {"BAD"};
93 const char *face_attr_names3[] = {"UGLY"};
94
95 const char *elem_attr_names1[] = {"SPAGHETTI", "WESTERN"};
96
97 double edge_attr_values1[] = {1., 2., 3., 5., 7., 11., 13., 17., 19., 23.,
98 29., 31., 37., 41., 43., 47., 53., 59., 61., 67.};
99
100 double face_attr_values1[] = {71., 73.};
101
102 double face_attr_values2[] = {79.};
103
104 double face_attr_values3[] = {83., 89., 97., 101., 103., 107., 109., 113.};
105
106 double elem_attr_values1[] = {127., 101., 137., 139.};
107
108 /* ======== Results variables ========= */
109 /* (2 time steps) */
110
111 double vals_glo_var[2][2] = {{36., 37.}, {42., 43.}};
112
113 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},
114 {0.7, 0.5, 0.3, 0.5, 0.2, 0.7, 0.9, 0.8, 0.0, 0.2, 0.3, 0.5}};
115
116 double vals_edge_var1eb1[2][20] = {
117 {20., 19., 18., 17., 16., 15., 14., 13., 12., 11., 10., 9., 8., 7., 6., 5., 4., 3., 2., 1.},
118 {21., 20., 19., 18., 17., 16., 15., 14., 13., 12., 11., 10., 9., 8., 7., 6., 5., 4., 3., 2.}};
119
120 double diff_vals_edge_var1eb1[2][20] = {
121 {21., 20., 19., 18., 17., 16., 15., 14., 13., 12., 11., 10., 9., 8., 7., 6., 5., 4., 3., 2.},
122 {20., 19., 18., 17., 16., 15., 14., 13., 12., 11., 10., 9., 8., 7., 6., 5., 4., 3., 2., 1.}};
123
124 double vals_edge_var2eb1[2][20] = {
125 {1., 1., 0., 0., 1., 1., 2., 0., 2., 0., 1., 1., 1., 1., 0., 0., 2., 2., 2., 2.},
126 {1., 1., 0., 0., 1., 1., 2., 0., 2., 0., 1., 1., 1., 1., 0., 0., 2., 2., 2., 2.}};
127
128 double vals_face_var1fb1[2][2] = {{0, 1}, {2, 0}};
129
130 double diff_vals_face_var1fb1[2][2] = {{2, 0}, {0, 1}};
131
132 double vals_face_var1fb3[2][8] = {{1, 0, 2, 0, 3, 0, 4, 0}, {0, 1, 0, 2, 0, 3, 0, 4}};
133
134 double vals_elem_var1eb1[2][2] = {{8, 8}, {0, -8}};
135
136 double vals_fset_var1fs1[2][2] = {{1., 3.}, {9., 27.}};
137
138 #define EXCHECK(funcall, errmsg) \
139 do { \
140 if ((funcall) < 0) { \
141 fprintf(stderr, errmsg); \
142 free(varParams.edge_var_tab); \
143 free(varParams.face_var_tab); \
144 free(varParams.elem_var_tab); \
145 free(varParams.fset_var_tab); \
146 return 1; \
147 } \
148 } while (0)
149
150 int ex_have_arg(int argc, char *argv[], const char *aname)
151 {
152 int i;
153 for (i = 0; i < argc; ++i) {
154 if (!strcmp(argv[i], aname)) {
155 return 1;
156 }
157 }
158 return 0;
159 }
160
161 int create_gold_file(int argc, char *argv[])
162 {
163 int exoid;
164 int appWordSize = 8;
165 int diskWordSize = 8;
166 /* int concatBlocks = ex_have_arg( argc, argv, "-pcab" ); */
167 int concatSets = ex_have_arg(argc, argv, "-pcset");
168 int concatResult = ex_have_arg(argc, argv, "-pvpax");
169 double t;
170
171 ex_init_params modelParams = {
172 "CreateEdgeFace Test", /* title */
173 3, /* num_dim */
174 12, /* num_nodes */
175 20, /* num_edge */
176 1, /* num_edge_blk */
177 11, /* num_face */
178 3, /* num_face_blk */
179 3, /* num_elem */
180 2, /* num_elem_blk */
181 1, /* num_node_sets */
182 1, /* num_edge_sets */
183 1, /* num_face_sets */
184 1, /* num_side_sets */
185 2, /* num_elem_sets */
186 1, /* num_node_map */
187 1, /* num_edge_map */
188 1, /* num_face_map */
189 1, /* num_elem_map */
190 };
191
192 ex_block edgeBlocks[1];
193 ex_block faceBlocks[3];
194 ex_block elemBlocks[2];
195
196 ex_var_params varParams;
197
198 ex_opts(EX_VERBOSE | EX_ABORT);
199
200 exoid = ex_create(EX_TEST_GOLD_FILENAME, EX_CLOBBER, &appWordSize, &diskWordSize);
201 if (exoid <= 0) {
202 fprintf(stderr, "Unable to open \"%s\" for writing.\n", EX_TEST_GOLD_FILENAME);
203 return 1;
204 }
205
206 edgeBlocks[0].type = EX_EDGE_BLOCK;
207 edgeBlocks[0].id = 100;
208 edgeBlocks[0].num_entry = 20;
209 edgeBlocks[0].num_nodes_per_entry = 2;
210 edgeBlocks[0].num_attribute = 1;
211 ex_copy_string(edgeBlocks[0].topology, "EDGE2", MAX_STR_LENGTH + 1);
212
213 faceBlocks[0].type = EX_FACE_BLOCK;
214 faceBlocks[0].id = 500;
215 faceBlocks[0].num_entry = 2;
216 faceBlocks[0].num_nodes_per_entry = 4;
217 faceBlocks[0].num_attribute = 1;
218 ex_copy_string(faceBlocks[0].topology, "QUAD4", MAX_STR_LENGTH + 1);
219
220 faceBlocks[1].type = EX_FACE_BLOCK;
221 faceBlocks[1].id = 600;
222 faceBlocks[1].num_entry = 1;
223 faceBlocks[1].num_nodes_per_entry = 4;
224 faceBlocks[1].num_attribute = 1;
225 ex_copy_string(faceBlocks[1].topology, "QUAD4", MAX_STR_LENGTH + 1);
226
227 faceBlocks[2].type = EX_FACE_BLOCK;
228 faceBlocks[2].id = 700;
229 faceBlocks[2].num_entry = 8;
230 faceBlocks[2].num_nodes_per_entry = 4;
231 faceBlocks[2].num_attribute = 1;
232 ex_copy_string(faceBlocks[2].topology, "QUAD4", MAX_STR_LENGTH + 1);
233
234 elemBlocks[0].type = EX_ELEM_BLOCK;
235 elemBlocks[0].id = 200;
236 elemBlocks[0].num_entry = 2;
237 elemBlocks[0].num_nodes_per_entry = 8;
238 elemBlocks[0].num_edges_per_entry = 12;
239 elemBlocks[0].num_faces_per_entry = 6;
240 elemBlocks[0].num_attribute = 2;
241 ex_copy_string(elemBlocks[0].topology, "HEX8", MAX_STR_LENGTH + 1);
242
243 elemBlocks[1].type = EX_ELEM_BLOCK;
244 elemBlocks[1].id = 201;
245 elemBlocks[1].num_entry = 1;
246 elemBlocks[1].num_nodes_per_entry = 4;
247 elemBlocks[1].num_edges_per_entry = 0;
248 elemBlocks[1].num_faces_per_entry = 0;
249 elemBlocks[1].num_attribute = 0;
250 ex_copy_string(elemBlocks[1].topology, "TET4", MAX_STR_LENGTH + 1);
251
252 varParams.edge_var_tab = (int *)malloc(2 * sizeof(int));
253 varParams.face_var_tab = (int *)malloc(3 * sizeof(int));
254 varParams.elem_var_tab = (int *)malloc(2 * sizeof(int));
255 varParams.nset_var_tab = NULL;
256 varParams.eset_var_tab = NULL;
257 varParams.fset_var_tab = (int *)malloc(1 * sizeof(int));
258 varParams.sset_var_tab = NULL;
259 varParams.elset_var_tab = NULL;
260
261 varParams.num_glob = 2;
262 varParams.num_node = 1;
263 varParams.num_edge = 2;
264 varParams.edge_var_tab[0] = 1;
265 varParams.edge_var_tab[1] = 1;
266 varParams.num_face = 1;
267 varParams.face_var_tab[0] = 1;
268 varParams.face_var_tab[1] = 1;
269 varParams.face_var_tab[2] = 1;
270 varParams.num_elem = 1;
271 varParams.elem_var_tab[0] = 1;
272 varParams.elem_var_tab[1] = 0;
273 varParams.num_nset = 0;
274 varParams.num_eset = 0;
275
276 varParams.num_fset = 1;
277 varParams.fset_var_tab[0] = 1;
278 varParams.num_sset = 0;
279 varParams.num_elset = 0;
280
281 EXCHECK(ex_put_init_ext(exoid, &modelParams), "Unable to initialize database.\n");
282
283 {
284 int blk;
285 for (blk = 0; blk < modelParams.num_edge_blk; ++blk) {
286 EXCHECK(ex_put_block_param(exoid, edgeBlocks[blk]), "Unable to write edge block");
287 }
288 for (blk = 0; blk < modelParams.num_face_blk; ++blk) {
289 EXCHECK(ex_put_block_param(exoid, faceBlocks[blk]), "Unable to write face block");
290 }
291 for (blk = 0; blk < modelParams.num_elem_blk; ++blk) {
292 EXCHECK(ex_put_block_param(exoid, elemBlocks[blk]), "Unable to write elem block");
293 }
294 }
295
296 EXCHECK(ex_put_coord(exoid, (void *)coordsX, (void *)coordsY, (void *)coordsZ),
297 "Unable to write coordinates.\n");
298
299 EXCHECK(ex_put_coord_names(exoid, (char **)coordsNames), "Unable to write coordinate names.\n");
300
301 /* =============== Connectivity ================== */
302 /* *** NEW API *** */
303 EXCHECK(ex_put_conn(exoid, EX_EDGE_BLOCK, edgeBlocks[0].id, ebconn1, 0, 0),
304 "Unable to write edge block connectivity.\n");
305
306 /* *** NEW API *** */
307 EXCHECK(ex_put_conn(exoid, EX_FACE_BLOCK, faceBlocks[0].id, fbconn1, 0, 0),
308 "Unable to write face block 1 connectivity.\n");
309 EXCHECK(ex_put_conn(exoid, EX_FACE_BLOCK, faceBlocks[1].id, fbconn2, 0, 0),
310 "Unable to write face block 2 connectivity.\n");
311 EXCHECK(ex_put_conn(exoid, EX_FACE_BLOCK, faceBlocks[2].id, fbconn3, 0, 0),
312 "Unable to write face block 3 connectivity.\n");
313
314 /* *** NEW API *** */
315 EXCHECK(ex_put_conn(exoid, EX_ELEM_BLOCK, elemBlocks[0].id, conn1, econn1, fconn1),
316 "Unable to write elem block 1 connectivity.\n");
317
318 /* *** NEW API *** */
319 EXCHECK(ex_put_conn(exoid, EX_ELEM_BLOCK, elemBlocks[1].id, conn2, 0, 0),
320 "Unable to write elem block 2 connectivity.\n");
321
322 /* *** NEW API *** */
323 EXCHECK(ex_put_names(exoid, EX_EDGE_BLOCK, (char **)edblk_names),
324 "Unable to write edge block names.\n");
325 EXCHECK(ex_put_names(exoid, EX_FACE_BLOCK, (char **)fablk_names),
326 "Unable to write face block names.\n");
327 EXCHECK(ex_put_names(exoid, EX_ELEM_BLOCK, (char **)eblk_names),
328 "Unable to write element block names.\n");
329
330 /* =============== Number Maps ================== */
331 /* *** NEW API *** */
332 EXCHECK(ex_put_num_map(exoid, EX_NODE_MAP, 300, nmap1), "Unable to write node map.\n");
333 EXCHECK(ex_put_num_map(exoid, EX_EDGE_MAP, 800, edmap1), "Unable to write edge map.\n");
334 EXCHECK(ex_put_num_map(exoid, EX_FACE_MAP, 900, famap1), "Unable to write face map.\n");
335 EXCHECK(ex_put_num_map(exoid, EX_ELEM_MAP, 400, emap1), "Unable to write element map.\n");
336
337 /* *** NEW API *** */
338 EXCHECK(ex_put_names(exoid, EX_NODE_MAP, (char **)nmap_names),
339 "Unable to write node map names.\n");
340 EXCHECK(ex_put_names(exoid, EX_EDGE_MAP, (char **)edmap_names),
341 "Unable to write edge map names.\n");
342 EXCHECK(ex_put_names(exoid, EX_FACE_MAP, (char **)famap_names),
343 "Unable to write face map names.\n");
344 EXCHECK(ex_put_names(exoid, EX_ELEM_MAP, (char **)emap_names),
345 "Unable to write element map names.\n");
346
347 /* =============== Attribute names ================ */
348 /* *** NEW API *** */
349 EXCHECK(ex_put_attr_names(exoid, EX_EDGE_BLOCK, edgeBlocks[0].id, (char **)edge_attr_names1),
350 "Unable to write edge block 1 attribute names.\n");
351
352 /* *** NEW API *** */
353 EXCHECK(ex_put_attr_names(exoid, EX_FACE_BLOCK, faceBlocks[0].id, (char **)face_attr_names1),
354 "Unable to write face block 1 attribute names.\n");
355 EXCHECK(ex_put_attr_names(exoid, EX_FACE_BLOCK, faceBlocks[1].id, (char **)face_attr_names2),
356 "Unable to write face block 1 attribute names.\n");
357 EXCHECK(ex_put_attr_names(exoid, EX_FACE_BLOCK, faceBlocks[2].id, (char **)face_attr_names3),
358 "Unable to write face block 1 attribute names.\n");
359
360 /* *** NEW API *** */
361 EXCHECK(ex_put_attr_names(exoid, EX_ELEM_BLOCK, elemBlocks[0].id, (char **)elem_attr_names1),
362 "Unable to write elem block 1 attribute names.\n");
363
364 /* =============== Attribute values =============== */
365 /* *** NEW API *** */
366 EXCHECK(ex_put_attr(exoid, EX_EDGE_BLOCK, edgeBlocks[0].id, edge_attr_values1),
367 "Unable to write edge block 1 attribute values.\n");
368
369 /* *** NEW API *** */
370 EXCHECK(ex_put_attr(exoid, EX_FACE_BLOCK, faceBlocks[0].id, face_attr_values1),
371 "Unable to write face block 1 attribute values.\n");
372 EXCHECK(ex_put_attr(exoid, EX_FACE_BLOCK, faceBlocks[1].id, face_attr_values2),
373 "Unable to write face block 1 attribute values.\n");
374 EXCHECK(ex_put_attr(exoid, EX_FACE_BLOCK, faceBlocks[2].id, face_attr_values3),
375 "Unable to write face block 1 attribute values.\n");
376
377 /* *** NEW API *** */
378 EXCHECK(ex_put_attr(exoid, EX_ELEM_BLOCK, elemBlocks[0].id, elem_attr_values1),
379 "Unable to write elem block 1 attribute values.\n");
380
381 /* =============== Set parameters ================= */
382 /* *** NEW API *** */
383 EXCHECK(ex_put_names(exoid, EX_NODE_SET, (char **)nset_names),
384 "Unable to write node set names.\n");
385 EXCHECK(ex_put_names(exoid, EX_EDGE_SET, (char **)eset_names),
386 "Unable to write edge set names.\n");
387 EXCHECK(ex_put_names(exoid, EX_FACE_SET, (char **)fset_names),
388 "Unable to write face set names.\n");
389 EXCHECK(ex_put_names(exoid, EX_SIDE_SET, (char **)sset_names),
390 "Unable to write side set names.\n");
391 EXCHECK(ex_put_names(exoid, EX_ELEM_SET, (char **)elset_names),
392 "Unable to write element set names.\n");
393
394 {
395 ex_set allSets[1 + 1 + 1 + 1 + 2];
396
397 ex_set *nodeSets = &allSets[0];
398 ex_set *edgeSets = &allSets[1];
399 ex_set *faceSets = &allSets[2];
400 ex_set *sideSets = &allSets[3];
401 ex_set *elemSets = &allSets[4];
402
403 nodeSets[0].type = EX_NODE_SET;
404 nodeSets[0].id = 1000;
405 nodeSets[0].num_entry = 3;
406 nodeSets[0].num_distribution_factor = 0;
407 nodeSets[0].entry_list = nset_nodes;
408 nodeSets[0].extra_list = NULL;
409 nodeSets[0].distribution_factor_list = NULL;
410
411 edgeSets[0].type = EX_EDGE_SET;
412 edgeSets[0].id = 1200;
413 edgeSets[0].num_entry = 6;
414 edgeSets[0].num_distribution_factor = 6;
415 edgeSets[0].entry_list = eset_edges;
416 edgeSets[0].extra_list = eset_orient;
417 edgeSets[0].distribution_factor_list = eset_df;
418
419 faceSets[0].type = EX_FACE_SET;
420 faceSets[0].id = 1400;
421 faceSets[0].num_entry = 2;
422 faceSets[0].num_distribution_factor = 0;
423 faceSets[0].entry_list = fset_faces;
424 faceSets[0].extra_list = fset_orient;
425 faceSets[0].distribution_factor_list = NULL;
426
427 sideSets[0].type = EX_SIDE_SET;
428 sideSets[0].id = 1400;
429 sideSets[0].num_entry = 5;
430 sideSets[0].num_distribution_factor = 0;
431 sideSets[0].entry_list = sset_elems;
432 sideSets[0].extra_list = sset_sides;
433 sideSets[0].distribution_factor_list = NULL;
434
435 elemSets[0].type = EX_ELEM_SET;
436 elemSets[0].id = 1800;
437 elemSets[0].num_entry = 1;
438 elemSets[0].num_distribution_factor = 0;
439 elemSets[0].entry_list = &elset_elems[0];
440 elemSets[0].extra_list = NULL;
441 elemSets[0].distribution_factor_list = NULL;
442
443 elemSets[1].type = EX_ELEM_SET;
444 elemSets[1].id = 1900;
445 elemSets[1].num_entry = 1;
446 elemSets[1].num_distribution_factor = 0;
447 elemSets[1].entry_list = &elset_elems[1];
448 elemSets[1].extra_list = NULL;
449 elemSets[1].distribution_factor_list = NULL;
450
451 if (concatSets) {
452 EXCHECK(ex_put_sets(exoid, 1 + 2 + 1 + 1 + 1, allSets),
453 "Unable to output concatenated sets.\n");
454 }
455 else {
456 EXCHECK(ex_put_sets(exoid, 1, nodeSets), "Unable to write node sets.\n");
457 EXCHECK(ex_put_sets(exoid, 1, edgeSets), "Unable to write edge sets.\n");
458 EXCHECK(ex_put_sets(exoid, 1, faceSets), "Unable to write face sets.\n");
459 EXCHECK(ex_put_sets(exoid, 1, sideSets), "Unable to write side sets.\n");
460 EXCHECK(ex_put_sets(exoid, 2, elemSets), "Unable to write element sets.\n");
461 }
462 }
463
464 /* =============== Result variable params ========= */
465 /* *** NEW API *** */
466 if (concatResult) {
467 EXCHECK(ex_put_all_var_param_ext(exoid, &varParams),
468 "Unable to write result variable parameter information.\n");
469 }
470 else {
471 EXCHECK(ex_put_variable_param(exoid, EX_GLOBAL, 2),
472 "Unable to write global result variable parameters.\n");
473 EXCHECK(ex_put_variable_param(exoid, EX_NODAL, 1),
474 "Unable to write nodal result variable parameters.\n");
475 EXCHECK(ex_put_variable_param(exoid, EX_ELEM_BLOCK, 1),
476 "Unable to write element result variable parameters.\n");
477 EXCHECK(ex_put_variable_param(exoid, EX_EDGE_BLOCK, 2),
478 "Unable to write edge result variable parameters.\n");
479 // EXCHECK(ex_put_variable_param(exoid, EX_FACE_BLOCK, 2),
480 // "Unable to write face result variable parameters.\n");
481 EXCHECK(ex_put_variable_param(exoid, EX_FACE_BLOCK, 1),
482 "Unable to write face result variable parameters.\n");
483 EXCHECK(ex_put_variable_param(exoid, EX_FACE_SET, 1),
484 "Unable to write faceset result variable parameters.\n");
485 }
486
487 /* =============== Result variable names ========== */
488 /* *** NEW API *** */
489 EXCHECK(ex_put_variable_name(exoid, EX_GLOBAL, 1, "CALIBER"), "Unable to write variable name.\n");
490 EXCHECK(ex_put_variable_name(exoid, EX_GLOBAL, 2, "GUNPOWDER"),
491 "Unable to write variable name.\n");
492 EXCHECK(ex_put_variable_name(exoid, EX_NODAL, 1, "RHO"), "Unable to write variable name.\n");
493 EXCHECK(ex_put_variable_name(exoid, EX_EDGE_BLOCK, 1, "GAMMA1"),
494 "Unable to write variable name.\n");
495 EXCHECK(ex_put_variable_name(exoid, EX_EDGE_BLOCK, 2, "GAMMA2"),
496 "Unable to write variable name.\n");
497 EXCHECK(ex_put_variable_name(exoid, EX_FACE_BLOCK, 1, "PHI"), "Unable to write variable name.\n");
498 // EXCHECK(ex_put_variable_name(exoid, EX_FACE_BLOCK, 2, "PHI"), "Unable to write variable
499 // name.\n");
500 EXCHECK(ex_put_variable_name(exoid, EX_ELEM_BLOCK, 1, "EPSTRN"),
501 "Unable to write variable name.\n");
502 EXCHECK(ex_put_variable_name(exoid, EX_FACE_SET, 1, "PHI0"), "Unable to write variable name.\n");
503
504 /* =============== Result variable values ========= */
505 t = 1.;
506 /* *** NEW API *** */
507 EXCHECK(ex_put_time(exoid, 1, &t), "Unable to write time value.\n");
508 EXCHECK(ex_put_var(exoid, 1, EX_GLOBAL, 1, 0 /*N/A*/, 2, vals_glo_var[0]),
509 "Unable to write global var 1.\n");
510 EXCHECK(ex_put_var(exoid, 1, EX_EDGE_BLOCK, 1, 100, 20, vals_edge_var1eb1[0]),
511 "Unable to write edge block 1 var 1.\n");
512 EXCHECK(ex_put_var(exoid, 1, EX_EDGE_BLOCK, 2, 100, 20, vals_edge_var2eb1[0]),
513 "Unable to write edge block 1 var 2.\n");
514 EXCHECK(ex_put_var(exoid, 1, EX_FACE_BLOCK, 1, 500, 2, vals_face_var1fb1[0]),
515 "Unable to write face block 1 var 1.\n");
516 // EXCHECK(ex_put_var(exoid, 1, EX_FACE_BLOCK, 2, 700, 8, vals_face_var1fb3[0]),
517 // "Unable to write face block 3 var 1.\n");
518 EXCHECK(ex_put_var(exoid, 1, EX_FACE_BLOCK, 1, 700, 8, vals_face_var1fb3[0]),
519 "Unable to write face block 3 var 1.\n");
520 EXCHECK(ex_put_var(exoid, 1, EX_ELEM_BLOCK, 1, 200, 2, vals_elem_var1eb1[0]),
521 "Unable to write elem block 1 var 1.\n");
522 EXCHECK(ex_put_var(exoid, 1, EX_FACE_SET, 1, 1400, 2, vals_fset_var1fs1[0]),
523 "Unable to write face set 1 var 1.\n");
524
525 t = 2.;
526 EXCHECK(ex_put_time(exoid, 2, &t), "Unable to write time value.\n");
527 EXCHECK(ex_put_var(exoid, 2, EX_GLOBAL, 1, 0 /*N/A*/, 2, vals_glo_var[1]),
528 "Unable to write global var 1.\n");
529 EXCHECK(ex_put_var(exoid, 2, EX_EDGE_BLOCK, 1, 100, 20, vals_edge_var1eb1[1]),
530 "Unable to write edge block 1 var 1.\n");
531 EXCHECK(ex_put_var(exoid, 2, EX_EDGE_BLOCK, 2, 100, 20, vals_edge_var2eb1[1]),
532 "Unable to write edge block 1 var 2.\n");
533 EXCHECK(ex_put_var(exoid, 2, EX_FACE_BLOCK, 1, 500, 2, vals_face_var1fb1[1]),
534 "Unable to write face block 1 var 1.\n");
535 // EXCHECK(ex_put_var(exoid, 2, EX_FACE_BLOCK, 2, 700, 8, vals_face_var1fb3[1]),
536 // "Unable to write face block 3 var 1.\n");
537 EXCHECK(ex_put_var(exoid, 2, EX_FACE_BLOCK, 1, 700, 8, vals_face_var1fb3[1]),
538 "Unable to write face block 3 var 1.\n");
539 EXCHECK(ex_put_var(exoid, 2, EX_ELEM_BLOCK, 1, 200, 2, vals_elem_var1eb1[1]),
540 "Unable to write elem block 1 var 1.\n");
541 EXCHECK(ex_put_var(exoid, 2, EX_FACE_SET, 1, 1400, 2, vals_fset_var1fs1[1]),
542 "Unable to write face set 1 var 1.\n");
543
544 EXCHECK(ex_put_var(exoid, 1, EX_NODAL, 1, 1, 12, vals_nod_var[0]),
545 "Unable to write nodal var 1.\n");
546 EXCHECK(ex_put_var(exoid, 2, EX_NODAL, 1, 1, 12, vals_nod_var[1]),
547 "Unable to write nodal var 1.\n");
548
549 EXCHECK(ex_close(exoid), "Unable to close database.\n");
550
551 free(varParams.edge_var_tab);
552 free(varParams.face_var_tab);
553 free(varParams.elem_var_tab);
554 free(varParams.fset_var_tab);
555 return 0;
556 }
557
558 int create_no_diff_file(int argc, char *argv[])
559 {
560 int exoid;
561 int appWordSize = 8;
562 int diskWordSize = 8;
563 /* int concatBlocks = ex_have_arg( argc, argv, "-pcab" ); */
564 int concatSets = ex_have_arg(argc, argv, "-pcset");
565 int concatResult = ex_have_arg(argc, argv, "-pvpax");
566 double t;
567
568 ex_init_params modelParams = {
569 "CreateEdgeFace Test", /* title */
570 3, /* num_dim */
571 12, /* num_nodes */
572 20, /* num_edge */
573 1, /* num_edge_blk */
574 11, /* num_face */
575 3, /* num_face_blk */
576 3, /* num_elem */
577 2, /* num_elem_blk */
578 1, /* num_node_sets */
579 1, /* num_edge_sets */
580 1, /* num_face_sets */
581 1, /* num_side_sets */
582 2, /* num_elem_sets */
583 1, /* num_node_map */
584 1, /* num_edge_map */
585 1, /* num_face_map */
586 1, /* num_elem_map */
587 };
588
589 ex_block edgeBlocks[1];
590 ex_block faceBlocks[3];
591 ex_block elemBlocks[2];
592
593 ex_var_params varParams;
594
595 ex_opts(EX_VERBOSE | EX_ABORT);
596
597 exoid = ex_create(EX_TEST_NO_DIFF_FILENAME, EX_CLOBBER, &appWordSize, &diskWordSize);
598 if (exoid <= 0) {
599 fprintf(stderr, "Unable to open \"%s\" for writing.\n", EX_TEST_NO_DIFF_FILENAME);
600 return 1;
601 }
602
603 edgeBlocks[0].type = EX_EDGE_BLOCK;
604 edgeBlocks[0].id = 100;
605 edgeBlocks[0].num_entry = 20;
606 edgeBlocks[0].num_nodes_per_entry = 2;
607 edgeBlocks[0].num_attribute = 1;
608 ex_copy_string(edgeBlocks[0].topology, "EDGE2", MAX_STR_LENGTH + 1);
609
610 faceBlocks[0].type = EX_FACE_BLOCK;
611 faceBlocks[0].id = 500;
612 faceBlocks[0].num_entry = 2;
613 faceBlocks[0].num_nodes_per_entry = 4;
614 faceBlocks[0].num_attribute = 1;
615 ex_copy_string(faceBlocks[0].topology, "QUAD4", MAX_STR_LENGTH + 1);
616
617 faceBlocks[1].type = EX_FACE_BLOCK;
618 faceBlocks[1].id = 600;
619 faceBlocks[1].num_entry = 1;
620 faceBlocks[1].num_nodes_per_entry = 4;
621 faceBlocks[1].num_attribute = 1;
622 ex_copy_string(faceBlocks[1].topology, "QUAD4", MAX_STR_LENGTH + 1);
623
624 faceBlocks[2].type = EX_FACE_BLOCK;
625 faceBlocks[2].id = 700;
626 faceBlocks[2].num_entry = 8;
627 faceBlocks[2].num_nodes_per_entry = 4;
628 faceBlocks[2].num_attribute = 1;
629 ex_copy_string(faceBlocks[2].topology, "QUAD4", MAX_STR_LENGTH + 1);
630
631 elemBlocks[0].type = EX_ELEM_BLOCK;
632 elemBlocks[0].id = 200;
633 elemBlocks[0].num_entry = 2;
634 elemBlocks[0].num_nodes_per_entry = 8;
635 elemBlocks[0].num_edges_per_entry = 12;
636 elemBlocks[0].num_faces_per_entry = 6;
637 elemBlocks[0].num_attribute = 2;
638 ex_copy_string(elemBlocks[0].topology, "HEX8", MAX_STR_LENGTH + 1);
639
640 elemBlocks[1].type = EX_ELEM_BLOCK;
641 elemBlocks[1].id = 201;
642 elemBlocks[1].num_entry = 1;
643 elemBlocks[1].num_nodes_per_entry = 4;
644 elemBlocks[1].num_edges_per_entry = 0;
645 elemBlocks[1].num_faces_per_entry = 0;
646 elemBlocks[1].num_attribute = 0;
647 ex_copy_string(elemBlocks[1].topology, "TET4", MAX_STR_LENGTH + 1);
648
649 varParams.edge_var_tab = (int *)malloc(2 * sizeof(int));
650 varParams.face_var_tab = (int *)malloc(3 * sizeof(int));
651 varParams.elem_var_tab = (int *)malloc(2 * sizeof(int));
652 varParams.nset_var_tab = NULL;
653 varParams.eset_var_tab = NULL;
654 varParams.fset_var_tab = (int *)malloc(1 * sizeof(int));
655 varParams.sset_var_tab = NULL;
656 varParams.elset_var_tab = NULL;
657
658 varParams.num_glob = 2;
659 varParams.num_node = 1;
660 varParams.num_edge = 2;
661 varParams.edge_var_tab[0] = 1;
662 varParams.edge_var_tab[1] = 1;
663 varParams.num_face = 1;
664 varParams.face_var_tab[0] = 1;
665 varParams.face_var_tab[1] = 1;
666 varParams.face_var_tab[2] = 1;
667 varParams.num_elem = 1;
668 varParams.elem_var_tab[0] = 1;
669 varParams.elem_var_tab[1] = 0;
670 varParams.num_nset = 0;
671 varParams.num_eset = 0;
672
673 varParams.num_fset = 1;
674 varParams.fset_var_tab[0] = 1;
675 varParams.num_sset = 0;
676 varParams.num_elset = 0;
677
678 EXCHECK(ex_put_init_ext(exoid, &modelParams), "Unable to initialize database.\n");
679
680 {
681 int blk;
682 for (blk = 0; blk < modelParams.num_edge_blk; ++blk) {
683 EXCHECK(ex_put_block_param(exoid, edgeBlocks[blk]), "Unable to write edge block");
684 }
685 for (blk = 0; blk < modelParams.num_face_blk; ++blk) {
686 EXCHECK(ex_put_block_param(exoid, faceBlocks[blk]), "Unable to write face block");
687 }
688 for (blk = 0; blk < modelParams.num_elem_blk; ++blk) {
689 EXCHECK(ex_put_block_param(exoid, elemBlocks[blk]), "Unable to write elem block");
690 }
691 }
692
693 EXCHECK(ex_put_coord(exoid, (void *)coordsX, (void *)coordsY, (void *)coordsZ),
694 "Unable to write coordinates.\n");
695
696 EXCHECK(ex_put_coord_names(exoid, (char **)coordsNames), "Unable to write coordinate names.\n");
697
698 /* =============== Connectivity ================== */
699 /* *** NEW API *** */
700 EXCHECK(ex_put_conn(exoid, EX_EDGE_BLOCK, edgeBlocks[0].id, ebconn1, 0, 0),
701 "Unable to write edge block connectivity.\n");
702
703 /* *** NEW API *** */
704 EXCHECK(ex_put_conn(exoid, EX_FACE_BLOCK, faceBlocks[0].id, fbconn1, 0, 0),
705 "Unable to write face block 1 connectivity.\n");
706 EXCHECK(ex_put_conn(exoid, EX_FACE_BLOCK, faceBlocks[1].id, fbconn2, 0, 0),
707 "Unable to write face block 2 connectivity.\n");
708 EXCHECK(ex_put_conn(exoid, EX_FACE_BLOCK, faceBlocks[2].id, fbconn3, 0, 0),
709 "Unable to write face block 3 connectivity.\n");
710
711 /* *** NEW API *** */
712 EXCHECK(ex_put_conn(exoid, EX_ELEM_BLOCK, elemBlocks[0].id, conn1, econn1, fconn1),
713 "Unable to write elem block 1 connectivity.\n");
714
715 /* *** NEW API *** */
716 EXCHECK(ex_put_conn(exoid, EX_ELEM_BLOCK, elemBlocks[1].id, conn2, 0, 0),
717 "Unable to write elem block 2 connectivity.\n");
718
719 /* *** NEW API *** */
720 EXCHECK(ex_put_names(exoid, EX_EDGE_BLOCK, (char **)edblk_names),
721 "Unable to write edge block names.\n");
722 EXCHECK(ex_put_names(exoid, EX_FACE_BLOCK, (char **)fablk_names),
723 "Unable to write face block names.\n");
724 EXCHECK(ex_put_names(exoid, EX_ELEM_BLOCK, (char **)eblk_names),
725 "Unable to write element block names.\n");
726
727 /* =============== Number Maps ================== */
728 /* *** NEW API *** */
729 EXCHECK(ex_put_num_map(exoid, EX_NODE_MAP, 300, nmap1), "Unable to write node map.\n");
730 EXCHECK(ex_put_num_map(exoid, EX_EDGE_MAP, 800, edmap1), "Unable to write edge map.\n");
731 EXCHECK(ex_put_num_map(exoid, EX_FACE_MAP, 900, famap1), "Unable to write face map.\n");
732 EXCHECK(ex_put_num_map(exoid, EX_ELEM_MAP, 400, emap1), "Unable to write element map.\n");
733
734 /* *** NEW API *** */
735 EXCHECK(ex_put_names(exoid, EX_NODE_MAP, (char **)nmap_names),
736 "Unable to write node map names.\n");
737 EXCHECK(ex_put_names(exoid, EX_EDGE_MAP, (char **)edmap_names),
738 "Unable to write edge map names.\n");
739 EXCHECK(ex_put_names(exoid, EX_FACE_MAP, (char **)famap_names),
740 "Unable to write face map names.\n");
741 EXCHECK(ex_put_names(exoid, EX_ELEM_MAP, (char **)emap_names),
742 "Unable to write element map names.\n");
743
744 /* =============== Attribute names ================ */
745 /* *** NEW API *** */
746 EXCHECK(ex_put_attr_names(exoid, EX_EDGE_BLOCK, edgeBlocks[0].id, (char **)edge_attr_names1),
747 "Unable to write edge block 1 attribute names.\n");
748
749 /* *** NEW API *** */
750 EXCHECK(ex_put_attr_names(exoid, EX_FACE_BLOCK, faceBlocks[0].id, (char **)face_attr_names1),
751 "Unable to write face block 1 attribute names.\n");
752 EXCHECK(ex_put_attr_names(exoid, EX_FACE_BLOCK, faceBlocks[1].id, (char **)face_attr_names2),
753 "Unable to write face block 1 attribute names.\n");
754 EXCHECK(ex_put_attr_names(exoid, EX_FACE_BLOCK, faceBlocks[2].id, (char **)face_attr_names3),
755 "Unable to write face block 1 attribute names.\n");
756
757 /* *** NEW API *** */
758 EXCHECK(ex_put_attr_names(exoid, EX_ELEM_BLOCK, elemBlocks[0].id, (char **)elem_attr_names1),
759 "Unable to write elem block 1 attribute names.\n");
760
761 /* =============== Attribute values =============== */
762 /* *** NEW API *** */
763 EXCHECK(ex_put_attr(exoid, EX_EDGE_BLOCK, edgeBlocks[0].id, edge_attr_values1),
764 "Unable to write edge block 1 attribute values.\n");
765
766 /* *** NEW API *** */
767 EXCHECK(ex_put_attr(exoid, EX_FACE_BLOCK, faceBlocks[0].id, face_attr_values1),
768 "Unable to write face block 1 attribute values.\n");
769 EXCHECK(ex_put_attr(exoid, EX_FACE_BLOCK, faceBlocks[1].id, face_attr_values2),
770 "Unable to write face block 1 attribute values.\n");
771 EXCHECK(ex_put_attr(exoid, EX_FACE_BLOCK, faceBlocks[2].id, face_attr_values3),
772 "Unable to write face block 1 attribute values.\n");
773
774 /* *** NEW API *** */
775 EXCHECK(ex_put_attr(exoid, EX_ELEM_BLOCK, elemBlocks[0].id, elem_attr_values1),
776 "Unable to write elem block 1 attribute values.\n");
777
778 /* =============== Set parameters ================= */
779 /* *** NEW API *** */
780 EXCHECK(ex_put_names(exoid, EX_NODE_SET, (char **)nset_names),
781 "Unable to write node set names.\n");
782 EXCHECK(ex_put_names(exoid, EX_EDGE_SET, (char **)eset_names),
783 "Unable to write edge set names.\n");
784 EXCHECK(ex_put_names(exoid, EX_FACE_SET, (char **)fset_names),
785 "Unable to write face set names.\n");
786 EXCHECK(ex_put_names(exoid, EX_SIDE_SET, (char **)sset_names),
787 "Unable to write side set names.\n");
788 EXCHECK(ex_put_names(exoid, EX_ELEM_SET, (char **)elset_names),
789 "Unable to write element set names.\n");
790
791 {
792 ex_set allSets[1 + 1 + 1 + 1 + 2];
793
794 ex_set *nodeSets = &allSets[0];
795 ex_set *edgeSets = &allSets[1];
796 ex_set *faceSets = &allSets[2];
797 ex_set *sideSets = &allSets[3];
798 ex_set *elemSets = &allSets[4];
799
800 nodeSets[0].type = EX_NODE_SET;
801 nodeSets[0].id = 1000;
802 nodeSets[0].num_entry = 3;
803 nodeSets[0].num_distribution_factor = 0;
804 nodeSets[0].entry_list = nset_nodes;
805 nodeSets[0].extra_list = NULL;
806 nodeSets[0].distribution_factor_list = NULL;
807
808 edgeSets[0].type = EX_EDGE_SET;
809 edgeSets[0].id = 1200;
810 edgeSets[0].num_entry = 6;
811 edgeSets[0].num_distribution_factor = 6;
812 edgeSets[0].entry_list = eset_edges;
813 edgeSets[0].extra_list = eset_orient;
814 edgeSets[0].distribution_factor_list = eset_df;
815
816 faceSets[0].type = EX_FACE_SET;
817 faceSets[0].id = 1400;
818 faceSets[0].num_entry = 2;
819 faceSets[0].num_distribution_factor = 0;
820 faceSets[0].entry_list = fset_faces;
821 faceSets[0].extra_list = fset_orient;
822 faceSets[0].distribution_factor_list = NULL;
823
824 sideSets[0].type = EX_SIDE_SET;
825 sideSets[0].id = 1400;
826 sideSets[0].num_entry = 5;
827 sideSets[0].num_distribution_factor = 0;
828 sideSets[0].entry_list = sset_elems;
829 sideSets[0].extra_list = sset_sides;
830 sideSets[0].distribution_factor_list = NULL;
831
832 elemSets[0].type = EX_ELEM_SET;
833 elemSets[0].id = 1800;
834 elemSets[0].num_entry = 1;
835 elemSets[0].num_distribution_factor = 0;
836 elemSets[0].entry_list = &elset_elems[0];
837 elemSets[0].extra_list = NULL;
838 elemSets[0].distribution_factor_list = NULL;
839
840 elemSets[1].type = EX_ELEM_SET;
841 elemSets[1].id = 1900;
842 elemSets[1].num_entry = 1;
843 elemSets[1].num_distribution_factor = 0;
844 elemSets[1].entry_list = &elset_elems[1];
845 elemSets[1].extra_list = NULL;
846 elemSets[1].distribution_factor_list = NULL;
847
848 if (concatSets) {
849 EXCHECK(ex_put_sets(exoid, 1 + 2 + 1 + 1 + 1, allSets),
850 "Unable to output concatenated sets.\n");
851 }
852 else {
853 EXCHECK(ex_put_sets(exoid, 1, nodeSets), "Unable to write node sets.\n");
854 EXCHECK(ex_put_sets(exoid, 1, edgeSets), "Unable to write edge sets.\n");
855 EXCHECK(ex_put_sets(exoid, 1, faceSets), "Unable to write face sets.\n");
856 EXCHECK(ex_put_sets(exoid, 1, sideSets), "Unable to write side sets.\n");
857 EXCHECK(ex_put_sets(exoid, 2, elemSets), "Unable to write element sets.\n");
858 }
859 }
860
861 /* =============== Result variable params ========= */
862 /* *** NEW API *** */
863 if (concatResult) {
864 EXCHECK(ex_put_all_var_param_ext(exoid, &varParams),
865 "Unable to write result variable parameter information.\n");
866 }
867 else {
868 EXCHECK(ex_put_variable_param(exoid, EX_GLOBAL, 2),
869 "Unable to write global result variable parameters.\n");
870 EXCHECK(ex_put_variable_param(exoid, EX_NODAL, 1),
871 "Unable to write nodal result variable parameters.\n");
872 EXCHECK(ex_put_variable_param(exoid, EX_ELEM_BLOCK, 1),
873 "Unable to write element result variable parameters.\n");
874 EXCHECK(ex_put_variable_param(exoid, EX_EDGE_BLOCK, 2),
875 "Unable to write edge result variable parameters.\n");
876 // EXCHECK(ex_put_variable_param(exoid, EX_FACE_BLOCK, 2),
877 // "Unable to write face result variable parameters.\n");
878 EXCHECK(ex_put_variable_param(exoid, EX_FACE_BLOCK, 1),
879 "Unable to write face result variable parameters.\n");
880 EXCHECK(ex_put_variable_param(exoid, EX_FACE_SET, 1),
881 "Unable to write faceset result variable parameters.\n");
882 }
883
884 /* =============== Result variable names ========== */
885 /* *** NEW API *** */
886 EXCHECK(ex_put_variable_name(exoid, EX_GLOBAL, 1, "CALIBER"), "Unable to write variable name.\n");
887 EXCHECK(ex_put_variable_name(exoid, EX_GLOBAL, 2, "GUNPOWDER"),
888 "Unable to write variable name.\n");
889 EXCHECK(ex_put_variable_name(exoid, EX_NODAL, 1, "RHO"), "Unable to write variable name.\n");
890 EXCHECK(ex_put_variable_name(exoid, EX_EDGE_BLOCK, 1, "GAMMA1"),
891 "Unable to write variable name.\n");
892 EXCHECK(ex_put_variable_name(exoid, EX_EDGE_BLOCK, 2, "GAMMA2"),
893 "Unable to write variable name.\n");
894 EXCHECK(ex_put_variable_name(exoid, EX_FACE_BLOCK, 1, "PHI"), "Unable to write variable name.\n");
895 // EXCHECK(ex_put_variable_name(exoid, EX_FACE_BLOCK, 2, "PHI"), "Unable to write variable
896 // name.\n");
897 EXCHECK(ex_put_variable_name(exoid, EX_ELEM_BLOCK, 1, "EPSTRN"),
898 "Unable to write variable name.\n");
899 EXCHECK(ex_put_variable_name(exoid, EX_FACE_SET, 1, "PHI0"), "Unable to write variable name.\n");
900
901 /* =============== Result variable values ========= */
902 t = 1.;
903 /* *** NEW API *** */
904 EXCHECK(ex_put_time(exoid, 1, &t), "Unable to write time value.\n");
905 EXCHECK(ex_put_var(exoid, 1, EX_GLOBAL, 1, 0 /*N/A*/, 2, vals_glo_var[0]),
906 "Unable to write global var 1.\n");
907 EXCHECK(ex_put_var(exoid, 1, EX_EDGE_BLOCK, 1, 100, 20, vals_edge_var1eb1[0]),
908 "Unable to write edge block 1 var 1.\n");
909 EXCHECK(ex_put_var(exoid, 1, EX_EDGE_BLOCK, 2, 100, 20, vals_edge_var2eb1[0]),
910 "Unable to write edge block 1 var 2.\n");
911 EXCHECK(ex_put_var(exoid, 1, EX_FACE_BLOCK, 1, 500, 2, vals_face_var1fb1[0]),
912 "Unable to write face block 1 var 1.\n");
913 // EXCHECK(ex_put_var(exoid, 1, EX_FACE_BLOCK, 2, 700, 8, vals_face_var1fb3[0]),
914 // "Unable to write face block 3 var 1.\n");
915 EXCHECK(ex_put_var(exoid, 1, EX_FACE_BLOCK, 1, 700, 8, vals_face_var1fb3[0]),
916 "Unable to write face block 3 var 1.\n");
917 EXCHECK(ex_put_var(exoid, 1, EX_ELEM_BLOCK, 1, 200, 2, vals_elem_var1eb1[0]),
918 "Unable to write elem block 1 var 1.\n");
919 EXCHECK(ex_put_var(exoid, 1, EX_FACE_SET, 1, 1400, 2, vals_fset_var1fs1[0]),
920 "Unable to write face set 1 var 1.\n");
921
922 t = 2.;
923 EXCHECK(ex_put_time(exoid, 2, &t), "Unable to write time value.\n");
924 EXCHECK(ex_put_var(exoid, 2, EX_GLOBAL, 1, 0 /*N/A*/, 2, vals_glo_var[1]),
925 "Unable to write global var 1.\n");
926 EXCHECK(ex_put_var(exoid, 2, EX_EDGE_BLOCK, 1, 100, 20, vals_edge_var1eb1[1]),
927 "Unable to write edge block 1 var 1.\n");
928 EXCHECK(ex_put_var(exoid, 2, EX_EDGE_BLOCK, 2, 100, 20, vals_edge_var2eb1[1]),
929 "Unable to write edge block 1 var 2.\n");
930 EXCHECK(ex_put_var(exoid, 2, EX_FACE_BLOCK, 1, 500, 2, vals_face_var1fb1[1]),
931 "Unable to write face block 1 var 1.\n");
932 // EXCHECK(ex_put_var(exoid, 2, EX_FACE_BLOCK, 2, 700, 8, vals_face_var1fb3[1]),
933 // "Unable to write face block 3 var 1.\n");
934 EXCHECK(ex_put_var(exoid, 2, EX_FACE_BLOCK, 1, 700, 8, vals_face_var1fb3[1]),
935 "Unable to write face block 3 var 1.\n");
936 EXCHECK(ex_put_var(exoid, 2, EX_ELEM_BLOCK, 1, 200, 2, vals_elem_var1eb1[1]),
937 "Unable to write elem block 1 var 1.\n");
938 EXCHECK(ex_put_var(exoid, 2, EX_FACE_SET, 1, 1400, 2, vals_fset_var1fs1[1]),
939 "Unable to write face set 1 var 1.\n");
940
941 EXCHECK(ex_put_var(exoid, 1, EX_NODAL, 1, 1, 12, vals_nod_var[0]),
942 "Unable to write nodal var 1.\n");
943 EXCHECK(ex_put_var(exoid, 2, EX_NODAL, 1, 1, 12, vals_nod_var[1]),
944 "Unable to write nodal var 1.\n");
945
946 EXCHECK(ex_close(exoid), "Unable to close database.\n");
947
948 free(varParams.edge_var_tab);
949 free(varParams.face_var_tab);
950 free(varParams.elem_var_tab);
951 free(varParams.fset_var_tab);
952 return 0;
953 }
954
955 int create_edge_block_diff_file(int argc, char *argv[])
956 {
957 int exoid;
958 int appWordSize = 8;
959 int diskWordSize = 8;
960 /* int concatBlocks = ex_have_arg( argc, argv, "-pcab" ); */
961 int concatSets = ex_have_arg(argc, argv, "-pcset");
962 int concatResult = ex_have_arg(argc, argv, "-pvpax");
963 double t;
964
965 ex_init_params modelParams = {
966 "CreateEdgeFace Test", /* title */
967 3, /* num_dim */
968 12, /* num_nodes */
969 20, /* num_edge */
970 1, /* num_edge_blk */
971 11, /* num_face */
972 3, /* num_face_blk */
973 3, /* num_elem */
974 2, /* num_elem_blk */
975 1, /* num_node_sets */
976 1, /* num_edge_sets */
977 1, /* num_face_sets */
978 1, /* num_side_sets */
979 2, /* num_elem_sets */
980 1, /* num_node_map */
981 1, /* num_edge_map */
982 1, /* num_face_map */
983 1, /* num_elem_map */
984 };
985
986 ex_block edgeBlocks[1];
987 ex_block faceBlocks[3];
988 ex_block elemBlocks[2];
989
990 ex_var_params varParams;
991
992 ex_opts(EX_VERBOSE | EX_ABORT);
993
994 exoid = ex_create(EX_TEST_EDGE_DIFF_FILENAME, EX_CLOBBER, &appWordSize, &diskWordSize);
995 if (exoid <= 0) {
996 fprintf(stderr, "Unable to open \"%s\" for writing.\n", EX_TEST_EDGE_DIFF_FILENAME);
997 return 1;
998 }
999
1000 edgeBlocks[0].type = EX_EDGE_BLOCK;
1001 edgeBlocks[0].id = 100;
1002 edgeBlocks[0].num_entry = 20;
1003 edgeBlocks[0].num_nodes_per_entry = 2;
1004 edgeBlocks[0].num_attribute = 1;
1005 ex_copy_string(edgeBlocks[0].topology, "EDGE2", MAX_STR_LENGTH + 1);
1006
1007 faceBlocks[0].type = EX_FACE_BLOCK;
1008 faceBlocks[0].id = 500;
1009 faceBlocks[0].num_entry = 2;
1010 faceBlocks[0].num_nodes_per_entry = 4;
1011 faceBlocks[0].num_attribute = 1;
1012 ex_copy_string(faceBlocks[0].topology, "QUAD4", MAX_STR_LENGTH + 1);
1013
1014 faceBlocks[1].type = EX_FACE_BLOCK;
1015 faceBlocks[1].id = 600;
1016 faceBlocks[1].num_entry = 1;
1017 faceBlocks[1].num_nodes_per_entry = 4;
1018 faceBlocks[1].num_attribute = 1;
1019 ex_copy_string(faceBlocks[1].topology, "QUAD4", MAX_STR_LENGTH + 1);
1020
1021 faceBlocks[2].type = EX_FACE_BLOCK;
1022 faceBlocks[2].id = 700;
1023 faceBlocks[2].num_entry = 8;
1024 faceBlocks[2].num_nodes_per_entry = 4;
1025 faceBlocks[2].num_attribute = 1;
1026 ex_copy_string(faceBlocks[2].topology, "QUAD4", MAX_STR_LENGTH + 1);
1027
1028 elemBlocks[0].type = EX_ELEM_BLOCK;
1029 elemBlocks[0].id = 200;
1030 elemBlocks[0].num_entry = 2;
1031 elemBlocks[0].num_nodes_per_entry = 8;
1032 elemBlocks[0].num_edges_per_entry = 12;
1033 elemBlocks[0].num_faces_per_entry = 6;
1034 elemBlocks[0].num_attribute = 2;
1035 ex_copy_string(elemBlocks[0].topology, "HEX8", MAX_STR_LENGTH + 1);
1036
1037 elemBlocks[1].type = EX_ELEM_BLOCK;
1038 elemBlocks[1].id = 201;
1039 elemBlocks[1].num_entry = 1;
1040 elemBlocks[1].num_nodes_per_entry = 4;
1041 elemBlocks[1].num_edges_per_entry = 0;
1042 elemBlocks[1].num_faces_per_entry = 0;
1043 elemBlocks[1].num_attribute = 0;
1044 ex_copy_string(elemBlocks[1].topology, "TET4", MAX_STR_LENGTH + 1);
1045
1046 varParams.edge_var_tab = (int *)malloc(2 * sizeof(int));
1047 varParams.face_var_tab = (int *)malloc(3 * sizeof(int));
1048 varParams.elem_var_tab = (int *)malloc(2 * sizeof(int));
1049 varParams.nset_var_tab = NULL;
1050 varParams.eset_var_tab = NULL;
1051 varParams.fset_var_tab = (int *)malloc(1 * sizeof(int));
1052 varParams.sset_var_tab = NULL;
1053 varParams.elset_var_tab = NULL;
1054
1055 varParams.num_glob = 2;
1056 varParams.num_node = 1;
1057 varParams.num_edge = 2;
1058 varParams.edge_var_tab[0] = 1;
1059 varParams.edge_var_tab[1] = 1;
1060 varParams.num_face = 1;
1061 varParams.face_var_tab[0] = 1;
1062 varParams.face_var_tab[1] = 1;
1063 varParams.face_var_tab[2] = 1;
1064 varParams.num_elem = 1;
1065 varParams.elem_var_tab[0] = 1;
1066 varParams.elem_var_tab[1] = 0;
1067 varParams.num_nset = 0;
1068 varParams.num_eset = 0;
1069
1070 varParams.num_fset = 1;
1071 varParams.fset_var_tab[0] = 1;
1072 varParams.num_sset = 0;
1073 varParams.num_elset = 0;
1074
1075 EXCHECK(ex_put_init_ext(exoid, &modelParams), "Unable to initialize database.\n");
1076
1077 {
1078 int blk;
1079 for (blk = 0; blk < modelParams.num_edge_blk; ++blk) {
1080 EXCHECK(ex_put_block_param(exoid, edgeBlocks[blk]), "Unable to write edge block");
1081 }
1082 for (blk = 0; blk < modelParams.num_face_blk; ++blk) {
1083 EXCHECK(ex_put_block_param(exoid, faceBlocks[blk]), "Unable to write face block");
1084 }
1085 for (blk = 0; blk < modelParams.num_elem_blk; ++blk) {
1086 EXCHECK(ex_put_block_param(exoid, elemBlocks[blk]), "Unable to write elem block");
1087 }
1088 }
1089
1090 EXCHECK(ex_put_coord(exoid, (void *)coordsX, (void *)coordsY, (void *)coordsZ),
1091 "Unable to write coordinates.\n");
1092
1093 EXCHECK(ex_put_coord_names(exoid, (char **)coordsNames), "Unable to write coordinate names.\n");
1094
1095 /* =============== Connectivity ================== */
1096 /* *** NEW API *** */
1097 EXCHECK(ex_put_conn(exoid, EX_EDGE_BLOCK, edgeBlocks[0].id, ebconn1, 0, 0),
1098 "Unable to write edge block connectivity.\n");
1099
1100 /* *** NEW API *** */
1101 EXCHECK(ex_put_conn(exoid, EX_FACE_BLOCK, faceBlocks[0].id, fbconn1, 0, 0),
1102 "Unable to write face block 1 connectivity.\n");
1103 EXCHECK(ex_put_conn(exoid, EX_FACE_BLOCK, faceBlocks[1].id, fbconn2, 0, 0),
1104 "Unable to write face block 2 connectivity.\n");
1105 EXCHECK(ex_put_conn(exoid, EX_FACE_BLOCK, faceBlocks[2].id, fbconn3, 0, 0),
1106 "Unable to write face block 3 connectivity.\n");
1107
1108 /* *** NEW API *** */
1109 EXCHECK(ex_put_conn(exoid, EX_ELEM_BLOCK, elemBlocks[0].id, conn1, econn1, fconn1),
1110 "Unable to write elem block 1 connectivity.\n");
1111
1112 /* *** NEW API *** */
1113 EXCHECK(ex_put_conn(exoid, EX_ELEM_BLOCK, elemBlocks[1].id, conn2, 0, 0),
1114 "Unable to write elem block 2 connectivity.\n");
1115
1116 /* *** NEW API *** */
1117 EXCHECK(ex_put_names(exoid, EX_EDGE_BLOCK, (char **)edblk_names),
1118 "Unable to write edge block names.\n");
1119 EXCHECK(ex_put_names(exoid, EX_FACE_BLOCK, (char **)fablk_names),
1120 "Unable to write face block names.\n");
1121 EXCHECK(ex_put_names(exoid, EX_ELEM_BLOCK, (char **)eblk_names),
1122 "Unable to write element block names.\n");
1123
1124 /* =============== Number Maps ================== */
1125 /* *** NEW API *** */
1126 EXCHECK(ex_put_num_map(exoid, EX_NODE_MAP, 300, nmap1), "Unable to write node map.\n");
1127 EXCHECK(ex_put_num_map(exoid, EX_EDGE_MAP, 800, edmap1), "Unable to write edge map.\n");
1128 EXCHECK(ex_put_num_map(exoid, EX_FACE_MAP, 900, famap1), "Unable to write face map.\n");
1129 EXCHECK(ex_put_num_map(exoid, EX_ELEM_MAP, 400, emap1), "Unable to write element map.\n");
1130
1131 /* *** NEW API *** */
1132 EXCHECK(ex_put_names(exoid, EX_NODE_MAP, (char **)nmap_names),
1133 "Unable to write node map names.\n");
1134 EXCHECK(ex_put_names(exoid, EX_EDGE_MAP, (char **)edmap_names),
1135 "Unable to write edge map names.\n");
1136 EXCHECK(ex_put_names(exoid, EX_FACE_MAP, (char **)famap_names),
1137 "Unable to write face map names.\n");
1138 EXCHECK(ex_put_names(exoid, EX_ELEM_MAP, (char **)emap_names),
1139 "Unable to write element map names.\n");
1140
1141 /* =============== Attribute names ================ */
1142 /* *** NEW API *** */
1143 EXCHECK(ex_put_attr_names(exoid, EX_EDGE_BLOCK, edgeBlocks[0].id, (char **)edge_attr_names1),
1144 "Unable to write edge block 1 attribute names.\n");
1145
1146 /* *** NEW API *** */
1147 EXCHECK(ex_put_attr_names(exoid, EX_FACE_BLOCK, faceBlocks[0].id, (char **)face_attr_names1),
1148 "Unable to write face block 1 attribute names.\n");
1149 EXCHECK(ex_put_attr_names(exoid, EX_FACE_BLOCK, faceBlocks[1].id, (char **)face_attr_names2),
1150 "Unable to write face block 1 attribute names.\n");
1151 EXCHECK(ex_put_attr_names(exoid, EX_FACE_BLOCK, faceBlocks[2].id, (char **)face_attr_names3),
1152 "Unable to write face block 1 attribute names.\n");
1153
1154 /* *** NEW API *** */
1155 EXCHECK(ex_put_attr_names(exoid, EX_ELEM_BLOCK, elemBlocks[0].id, (char **)elem_attr_names1),
1156 "Unable to write elem block 1 attribute names.\n");
1157
1158 /* =============== Attribute values =============== */
1159 /* *** NEW API *** */
1160 EXCHECK(ex_put_attr(exoid, EX_EDGE_BLOCK, edgeBlocks[0].id, edge_attr_values1),
1161 "Unable to write edge block 1 attribute values.\n");
1162
1163 /* *** NEW API *** */
1164 EXCHECK(ex_put_attr(exoid, EX_FACE_BLOCK, faceBlocks[0].id, face_attr_values1),
1165 "Unable to write face block 1 attribute values.\n");
1166 EXCHECK(ex_put_attr(exoid, EX_FACE_BLOCK, faceBlocks[1].id, face_attr_values2),
1167 "Unable to write face block 1 attribute values.\n");
1168 EXCHECK(ex_put_attr(exoid, EX_FACE_BLOCK, faceBlocks[2].id, face_attr_values3),
1169 "Unable to write face block 1 attribute values.\n");
1170
1171 /* *** NEW API *** */
1172 EXCHECK(ex_put_attr(exoid, EX_ELEM_BLOCK, elemBlocks[0].id, elem_attr_values1),
1173 "Unable to write elem block 1 attribute values.\n");
1174
1175 /* =============== Set parameters ================= */
1176 /* *** NEW API *** */
1177 EXCHECK(ex_put_names(exoid, EX_NODE_SET, (char **)nset_names),
1178 "Unable to write node set names.\n");
1179 EXCHECK(ex_put_names(exoid, EX_EDGE_SET, (char **)eset_names),
1180 "Unable to write edge set names.\n");
1181 EXCHECK(ex_put_names(exoid, EX_FACE_SET, (char **)fset_names),
1182 "Unable to write face set names.\n");
1183 EXCHECK(ex_put_names(exoid, EX_SIDE_SET, (char **)sset_names),
1184 "Unable to write side set names.\n");
1185 EXCHECK(ex_put_names(exoid, EX_ELEM_SET, (char **)elset_names),
1186 "Unable to write element set names.\n");
1187
1188 {
1189 ex_set allSets[1 + 1 + 1 + 1 + 2];
1190
1191 ex_set *nodeSets = &allSets[0];
1192 ex_set *edgeSets = &allSets[1];
1193 ex_set *faceSets = &allSets[2];
1194 ex_set *sideSets = &allSets[3];
1195 ex_set *elemSets = &allSets[4];
1196
1197 nodeSets[0].type = EX_NODE_SET;
1198 nodeSets[0].id = 1000;
1199 nodeSets[0].num_entry = 3;
1200 nodeSets[0].num_distribution_factor = 0;
1201 nodeSets[0].entry_list = nset_nodes;
1202 nodeSets[0].extra_list = NULL;
1203 nodeSets[0].distribution_factor_list = NULL;
1204
1205 edgeSets[0].type = EX_EDGE_SET;
1206 edgeSets[0].id = 1200;
1207 edgeSets[0].num_entry = 6;
1208 edgeSets[0].num_distribution_factor = 6;
1209 edgeSets[0].entry_list = eset_edges;
1210 edgeSets[0].extra_list = eset_orient;
1211 edgeSets[0].distribution_factor_list = eset_df;
1212
1213 faceSets[0].type = EX_FACE_SET;
1214 faceSets[0].id = 1400;
1215 faceSets[0].num_entry = 2;
1216 faceSets[0].num_distribution_factor = 0;
1217 faceSets[0].entry_list = fset_faces;
1218 faceSets[0].extra_list = fset_orient;
1219 faceSets[0].distribution_factor_list = NULL;
1220
1221 sideSets[0].type = EX_SIDE_SET;
1222 sideSets[0].id = 1400;
1223 sideSets[0].num_entry = 5;
1224 sideSets[0].num_distribution_factor = 0;
1225 sideSets[0].entry_list = sset_elems;
1226 sideSets[0].extra_list = sset_sides;
1227 sideSets[0].distribution_factor_list = NULL;
1228
1229 elemSets[0].type = EX_ELEM_SET;
1230 elemSets[0].id = 1800;
1231 elemSets[0].num_entry = 1;
1232 elemSets[0].num_distribution_factor = 0;
1233 elemSets[0].entry_list = &elset_elems[0];
1234 elemSets[0].extra_list = NULL;
1235 elemSets[0].distribution_factor_list = NULL;
1236
1237 elemSets[1].type = EX_ELEM_SET;
1238 elemSets[1].id = 1900;
1239 elemSets[1].num_entry = 1;
1240 elemSets[1].num_distribution_factor = 0;
1241 elemSets[1].entry_list = &elset_elems[1];
1242 elemSets[1].extra_list = NULL;
1243 elemSets[1].distribution_factor_list = NULL;
1244
1245 if (concatSets) {
1246 EXCHECK(ex_put_sets(exoid, 1 + 2 + 1 + 1 + 1, allSets),
1247 "Unable to output concatenated sets.\n");
1248 }
1249 else {
1250 EXCHECK(ex_put_sets(exoid, 1, nodeSets), "Unable to write node sets.\n");
1251 EXCHECK(ex_put_sets(exoid, 1, edgeSets), "Unable to write edge sets.\n");
1252 EXCHECK(ex_put_sets(exoid, 1, faceSets), "Unable to write face sets.\n");
1253 EXCHECK(ex_put_sets(exoid, 1, sideSets), "Unable to write side sets.\n");
1254 EXCHECK(ex_put_sets(exoid, 2, elemSets), "Unable to write element sets.\n");
1255 }
1256 }
1257
1258 /* =============== Result variable params ========= */
1259 /* *** NEW API *** */
1260 if (concatResult) {
1261 EXCHECK(ex_put_all_var_param_ext(exoid, &varParams),
1262 "Unable to write result variable parameter information.\n");
1263 }
1264 else {
1265 EXCHECK(ex_put_variable_param(exoid, EX_GLOBAL, 2),
1266 "Unable to write global result variable parameters.\n");
1267 EXCHECK(ex_put_variable_param(exoid, EX_NODAL, 1),
1268 "Unable to write nodal result variable parameters.\n");
1269 EXCHECK(ex_put_variable_param(exoid, EX_ELEM_BLOCK, 1),
1270 "Unable to write element result variable parameters.\n");
1271 EXCHECK(ex_put_variable_param(exoid, EX_EDGE_BLOCK, 2),
1272 "Unable to write edge result variable parameters.\n");
1273 // EXCHECK(ex_put_variable_param(exoid, EX_FACE_BLOCK, 2),
1274 // "Unable to write face result variable parameters.\n");
1275 EXCHECK(ex_put_variable_param(exoid, EX_FACE_BLOCK, 1),
1276 "Unable to write face result variable parameters.\n");
1277 EXCHECK(ex_put_variable_param(exoid, EX_FACE_SET, 1),
1278 "Unable to write faceset result variable parameters.\n");
1279 }
1280
1281 /* =============== Result variable names ========== */
1282 /* *** NEW API *** */
1283 EXCHECK(ex_put_variable_name(exoid, EX_GLOBAL, 1, "CALIBER"), "Unable to write variable name.\n");
1284 EXCHECK(ex_put_variable_name(exoid, EX_GLOBAL, 2, "GUNPOWDER"),
1285 "Unable to write variable name.\n");
1286 EXCHECK(ex_put_variable_name(exoid, EX_NODAL, 1, "RHO"), "Unable to write variable name.\n");
1287 EXCHECK(ex_put_variable_name(exoid, EX_EDGE_BLOCK, 1, "GAMMA1"),
1288 "Unable to write variable name.\n");
1289 EXCHECK(ex_put_variable_name(exoid, EX_EDGE_BLOCK, 2, "GAMMA2"),
1290 "Unable to write variable name.\n");
1291 EXCHECK(ex_put_variable_name(exoid, EX_FACE_BLOCK, 1, "PHI"), "Unable to write variable name.\n");
1292 // EXCHECK(ex_put_variable_name(exoid, EX_FACE_BLOCK, 2, "PHI"), "Unable to write variable
1293 // name.\n");
1294 EXCHECK(ex_put_variable_name(exoid, EX_ELEM_BLOCK, 1, "EPSTRN"),
1295 "Unable to write variable name.\n");
1296 EXCHECK(ex_put_variable_name(exoid, EX_FACE_SET, 1, "PHI0"), "Unable to write variable name.\n");
1297
1298 /* =============== Result variable values ========= */
1299 t = 1.;
1300 /* *** NEW API *** */
1301 EXCHECK(ex_put_time(exoid, 1, &t), "Unable to write time value.\n");
1302 EXCHECK(ex_put_var(exoid, 1, EX_GLOBAL, 1, 0 /*N/A*/, 2, vals_glo_var[0]),
1303 "Unable to write global var 1.\n");
1304 EXCHECK(ex_put_var(exoid, 1, EX_EDGE_BLOCK, 1, 100, 20, diff_vals_edge_var1eb1[0]),
1305 "Unable to write edge block 1 var 1.\n");
1306 EXCHECK(ex_put_var(exoid, 1, EX_EDGE_BLOCK, 2, 100, 20, vals_edge_var2eb1[0]),
1307 "Unable to write edge block 1 var 2.\n");
1308 EXCHECK(ex_put_var(exoid, 1, EX_FACE_BLOCK, 1, 500, 2, vals_face_var1fb1[0]),
1309 "Unable to write face block 1 var 1.\n");
1310 // EXCHECK(ex_put_var(exoid, 1, EX_FACE_BLOCK, 2, 700, 8, vals_face_var1fb3[0]),
1311 // "Unable to write face block 3 var 1.\n");
1312 EXCHECK(ex_put_var(exoid, 1, EX_FACE_BLOCK, 1, 700, 8, vals_face_var1fb3[0]),
1313 "Unable to write face block 3 var 1.\n");
1314 EXCHECK(ex_put_var(exoid, 1, EX_ELEM_BLOCK, 1, 200, 2, vals_elem_var1eb1[0]),
1315 "Unable to write elem block 1 var 1.\n");
1316 EXCHECK(ex_put_var(exoid, 1, EX_FACE_SET, 1, 1400, 2, vals_fset_var1fs1[0]),
1317 "Unable to write face set 1 var 1.\n");
1318
1319 t = 2.;
1320 EXCHECK(ex_put_time(exoid, 2, &t), "Unable to write time value.\n");
1321 EXCHECK(ex_put_var(exoid, 2, EX_GLOBAL, 1, 0 /*N/A*/, 2, vals_glo_var[1]),
1322 "Unable to write global var 1.\n");
1323 EXCHECK(ex_put_var(exoid, 2, EX_EDGE_BLOCK, 1, 100, 20, diff_vals_edge_var1eb1[1]),
1324 "Unable to write edge block 1 var 1.\n");
1325 EXCHECK(ex_put_var(exoid, 2, EX_EDGE_BLOCK, 2, 100, 20, vals_edge_var2eb1[1]),
1326 "Unable to write edge block 1 var 2.\n");
1327 EXCHECK(ex_put_var(exoid, 2, EX_FACE_BLOCK, 1, 500, 2, vals_face_var1fb1[1]),
1328 "Unable to write face block 1 var 1.\n");
1329 // EXCHECK(ex_put_var(exoid, 2, EX_FACE_BLOCK, 2, 700, 8, vals_face_var1fb3[1]),
1330 // "Unable to write face block 3 var 1.\n");
1331 EXCHECK(ex_put_var(exoid, 2, EX_FACE_BLOCK, 1, 700, 8, vals_face_var1fb3[1]),
1332 "Unable to write face block 3 var 1.\n");
1333 EXCHECK(ex_put_var(exoid, 2, EX_ELEM_BLOCK, 1, 200, 2, vals_elem_var1eb1[1]),
1334 "Unable to write elem block 1 var 1.\n");
1335 EXCHECK(ex_put_var(exoid, 2, EX_FACE_SET, 1, 1400, 2, vals_fset_var1fs1[1]),
1336 "Unable to write face set 1 var 1.\n");
1337
1338 EXCHECK(ex_put_var(exoid, 1, EX_NODAL, 1, 1, 12, vals_nod_var[0]),
1339 "Unable to write nodal var 1.\n");
1340 EXCHECK(ex_put_var(exoid, 2, EX_NODAL, 1, 1, 12, vals_nod_var[1]),
1341 "Unable to write nodal var 1.\n");
1342
1343 EXCHECK(ex_close(exoid), "Unable to close database.\n");
1344
1345 free(varParams.edge_var_tab);
1346 free(varParams.face_var_tab);
1347 free(varParams.elem_var_tab);
1348 free(varParams.fset_var_tab);
1349 return 0;
1350 }
1351
1352 int create_face_block_diff_file(int argc, char *argv[])
1353 {
1354 int exoid;
1355 int appWordSize = 8;
1356 int diskWordSize = 8;
1357 /* int concatBlocks = ex_have_arg( argc, argv, "-pcab" ); */
1358 int concatSets = ex_have_arg(argc, argv, "-pcset");
1359 int concatResult = ex_have_arg(argc, argv, "-pvpax");
1360 double t;
1361
1362 ex_init_params modelParams = {
1363 "CreateEdgeFace Test", /* title */
1364 3, /* num_dim */
1365 12, /* num_nodes */
1366 20, /* num_edge */
1367 1, /* num_edge_blk */
1368 11, /* num_face */
1369 3, /* num_face_blk */
1370 3, /* num_elem */
1371 2, /* num_elem_blk */
1372 1, /* num_node_sets */
1373 1, /* num_edge_sets */
1374 1, /* num_face_sets */
1375 1, /* num_side_sets */
1376 2, /* num_elem_sets */
1377 1, /* num_node_map */
1378 1, /* num_edge_map */
1379 1, /* num_face_map */
1380 1, /* num_elem_map */
1381 };
1382
1383 ex_block edgeBlocks[1];
1384 ex_block faceBlocks[3];
1385 ex_block elemBlocks[2];
1386
1387 ex_var_params varParams;
1388
1389 ex_opts(EX_VERBOSE | EX_ABORT);
1390
1391 exoid = ex_create(EX_TEST_FACE_DIFF_FILENAME, EX_CLOBBER, &appWordSize, &diskWordSize);
1392 if (exoid <= 0) {
1393 fprintf(stderr, "Unable to open \"%s\" for writing.\n", EX_TEST_FACE_DIFF_FILENAME);
1394 return 1;
1395 }
1396
1397 edgeBlocks[0].type = EX_EDGE_BLOCK;
1398 edgeBlocks[0].id = 100;
1399 edgeBlocks[0].num_entry = 20;
1400 edgeBlocks[0].num_nodes_per_entry = 2;
1401 edgeBlocks[0].num_attribute = 1;
1402 ex_copy_string(edgeBlocks[0].topology, "EDGE2", MAX_STR_LENGTH + 1);
1403
1404 faceBlocks[0].type = EX_FACE_BLOCK;
1405 faceBlocks[0].id = 500;
1406 faceBlocks[0].num_entry = 2;
1407 faceBlocks[0].num_nodes_per_entry = 4;
1408 faceBlocks[0].num_attribute = 1;
1409 ex_copy_string(faceBlocks[0].topology, "QUAD4", MAX_STR_LENGTH + 1);
1410
1411 faceBlocks[1].type = EX_FACE_BLOCK;
1412 faceBlocks[1].id = 600;
1413 faceBlocks[1].num_entry = 1;
1414 faceBlocks[1].num_nodes_per_entry = 4;
1415 faceBlocks[1].num_attribute = 1;
1416 ex_copy_string(faceBlocks[1].topology, "QUAD4", MAX_STR_LENGTH + 1);
1417
1418 faceBlocks[2].type = EX_FACE_BLOCK;
1419 faceBlocks[2].id = 700;
1420 faceBlocks[2].num_entry = 8;
1421 faceBlocks[2].num_nodes_per_entry = 4;
1422 faceBlocks[2].num_attribute = 1;
1423 ex_copy_string(faceBlocks[2].topology, "QUAD4", MAX_STR_LENGTH + 1);
1424
1425 elemBlocks[0].type = EX_ELEM_BLOCK;
1426 elemBlocks[0].id = 200;
1427 elemBlocks[0].num_entry = 2;
1428 elemBlocks[0].num_nodes_per_entry = 8;
1429 elemBlocks[0].num_edges_per_entry = 12;
1430 elemBlocks[0].num_faces_per_entry = 6;
1431 elemBlocks[0].num_attribute = 2;
1432 ex_copy_string(elemBlocks[0].topology, "HEX8", MAX_STR_LENGTH + 1);
1433
1434 elemBlocks[1].type = EX_ELEM_BLOCK;
1435 elemBlocks[1].id = 201;
1436 elemBlocks[1].num_entry = 1;
1437 elemBlocks[1].num_nodes_per_entry = 4;
1438 elemBlocks[1].num_edges_per_entry = 0;
1439 elemBlocks[1].num_faces_per_entry = 0;
1440 elemBlocks[1].num_attribute = 0;
1441 ex_copy_string(elemBlocks[1].topology, "TET4", MAX_STR_LENGTH + 1);
1442
1443 varParams.edge_var_tab = (int *)malloc(2 * sizeof(int));
1444 varParams.face_var_tab = (int *)malloc(3 * sizeof(int));
1445 varParams.elem_var_tab = (int *)malloc(2 * sizeof(int));
1446 varParams.nset_var_tab = NULL;
1447 varParams.eset_var_tab = NULL;
1448 varParams.fset_var_tab = (int *)malloc(1 * sizeof(int));
1449 varParams.sset_var_tab = NULL;
1450 varParams.elset_var_tab = NULL;
1451
1452 varParams.num_glob = 2;
1453 varParams.num_node = 1;
1454 varParams.num_edge = 2;
1455 varParams.edge_var_tab[0] = 1;
1456 varParams.edge_var_tab[1] = 1;
1457 varParams.num_face = 1;
1458 varParams.face_var_tab[0] = 1;
1459 varParams.face_var_tab[1] = 1;
1460 varParams.face_var_tab[2] = 1;
1461 varParams.num_elem = 1;
1462 varParams.elem_var_tab[0] = 1;
1463 varParams.elem_var_tab[1] = 0;
1464 varParams.num_nset = 0;
1465 varParams.num_eset = 0;
1466
1467 varParams.num_fset = 1;
1468 varParams.fset_var_tab[0] = 1;
1469 varParams.num_sset = 0;
1470 varParams.num_elset = 0;
1471
1472 EXCHECK(ex_put_init_ext(exoid, &modelParams), "Unable to initialize database.\n");
1473
1474 {
1475 int blk;
1476 for (blk = 0; blk < modelParams.num_edge_blk; ++blk) {
1477 EXCHECK(ex_put_block_param(exoid, edgeBlocks[blk]), "Unable to write edge block");
1478 }
1479 for (blk = 0; blk < modelParams.num_face_blk; ++blk) {
1480 EXCHECK(ex_put_block_param(exoid, faceBlocks[blk]), "Unable to write face block");
1481 }
1482 for (blk = 0; blk < modelParams.num_elem_blk; ++blk) {
1483 EXCHECK(ex_put_block_param(exoid, elemBlocks[blk]), "Unable to write elem block");
1484 }
1485 }
1486
1487 EXCHECK(ex_put_coord(exoid, (void *)coordsX, (void *)coordsY, (void *)coordsZ),
1488 "Unable to write coordinates.\n");
1489
1490 EXCHECK(ex_put_coord_names(exoid, (char **)coordsNames), "Unable to write coordinate names.\n");
1491
1492 /* =============== Connectivity ================== */
1493 /* *** NEW API *** */
1494 EXCHECK(ex_put_conn(exoid, EX_EDGE_BLOCK, edgeBlocks[0].id, ebconn1, 0, 0),
1495 "Unable to write edge block connectivity.\n");
1496
1497 /* *** NEW API *** */
1498 EXCHECK(ex_put_conn(exoid, EX_FACE_BLOCK, faceBlocks[0].id, fbconn1, 0, 0),
1499 "Unable to write face block 1 connectivity.\n");
1500 EXCHECK(ex_put_conn(exoid, EX_FACE_BLOCK, faceBlocks[1].id, fbconn2, 0, 0),
1501 "Unable to write face block 2 connectivity.\n");
1502 EXCHECK(ex_put_conn(exoid, EX_FACE_BLOCK, faceBlocks[2].id, fbconn3, 0, 0),
1503 "Unable to write face block 3 connectivity.\n");
1504
1505 /* *** NEW API *** */
1506 EXCHECK(ex_put_conn(exoid, EX_ELEM_BLOCK, elemBlocks[0].id, conn1, econn1, fconn1),
1507 "Unable to write elem block 1 connectivity.\n");
1508
1509 /* *** NEW API *** */
1510 EXCHECK(ex_put_conn(exoid, EX_ELEM_BLOCK, elemBlocks[1].id, conn2, 0, 0),
1511 "Unable to write elem block 2 connectivity.\n");
1512
1513 /* *** NEW API *** */
1514 EXCHECK(ex_put_names(exoid, EX_EDGE_BLOCK, (char **)edblk_names),
1515 "Unable to write edge block names.\n");
1516 EXCHECK(ex_put_names(exoid, EX_FACE_BLOCK, (char **)fablk_names),
1517 "Unable to write face block names.\n");
1518 EXCHECK(ex_put_names(exoid, EX_ELEM_BLOCK, (char **)eblk_names),
1519 "Unable to write element block names.\n");
1520
1521 /* =============== Number Maps ================== */
1522 /* *** NEW API *** */
1523 EXCHECK(ex_put_num_map(exoid, EX_NODE_MAP, 300, nmap1), "Unable to write node map.\n");
1524 EXCHECK(ex_put_num_map(exoid, EX_EDGE_MAP, 800, edmap1), "Unable to write edge map.\n");
1525 EXCHECK(ex_put_num_map(exoid, EX_FACE_MAP, 900, famap1), "Unable to write face map.\n");
1526 EXCHECK(ex_put_num_map(exoid, EX_ELEM_MAP, 400, emap1), "Unable to write element map.\n");
1527
1528 /* *** NEW API *** */
1529 EXCHECK(ex_put_names(exoid, EX_NODE_MAP, (char **)nmap_names),
1530 "Unable to write node map names.\n");
1531 EXCHECK(ex_put_names(exoid, EX_EDGE_MAP, (char **)edmap_names),
1532 "Unable to write edge map names.\n");
1533 EXCHECK(ex_put_names(exoid, EX_FACE_MAP, (char **)famap_names),
1534 "Unable to write face map names.\n");
1535 EXCHECK(ex_put_names(exoid, EX_ELEM_MAP, (char **)emap_names),
1536 "Unable to write element map names.\n");
1537
1538 /* =============== Attribute names ================ */
1539 /* *** NEW API *** */
1540 EXCHECK(ex_put_attr_names(exoid, EX_EDGE_BLOCK, edgeBlocks[0].id, (char **)edge_attr_names1),
1541 "Unable to write edge block 1 attribute names.\n");
1542
1543 /* *** NEW API *** */
1544 EXCHECK(ex_put_attr_names(exoid, EX_FACE_BLOCK, faceBlocks[0].id, (char **)face_attr_names1),
1545 "Unable to write face block 1 attribute names.\n");
1546 EXCHECK(ex_put_attr_names(exoid, EX_FACE_BLOCK, faceBlocks[1].id, (char **)face_attr_names2),
1547 "Unable to write face block 1 attribute names.\n");
1548 EXCHECK(ex_put_attr_names(exoid, EX_FACE_BLOCK, faceBlocks[2].id, (char **)face_attr_names3),
1549 "Unable to write face block 1 attribute names.\n");
1550
1551 /* *** NEW API *** */
1552 EXCHECK(ex_put_attr_names(exoid, EX_ELEM_BLOCK, elemBlocks[0].id, (char **)elem_attr_names1),
1553 "Unable to write elem block 1 attribute names.\n");
1554
1555 /* =============== Attribute values =============== */
1556 /* *** NEW API *** */
1557 EXCHECK(ex_put_attr(exoid, EX_EDGE_BLOCK, edgeBlocks[0].id, edge_attr_values1),
1558 "Unable to write edge block 1 attribute values.\n");
1559
1560 /* *** NEW API *** */
1561 EXCHECK(ex_put_attr(exoid, EX_FACE_BLOCK, faceBlocks[0].id, face_attr_values1),
1562 "Unable to write face block 1 attribute values.\n");
1563 EXCHECK(ex_put_attr(exoid, EX_FACE_BLOCK, faceBlocks[1].id, face_attr_values2),
1564 "Unable to write face block 1 attribute values.\n");
1565 EXCHECK(ex_put_attr(exoid, EX_FACE_BLOCK, faceBlocks[2].id, face_attr_values3),
1566 "Unable to write face block 1 attribute values.\n");
1567
1568 /* *** NEW API *** */
1569 EXCHECK(ex_put_attr(exoid, EX_ELEM_BLOCK, elemBlocks[0].id, elem_attr_values1),
1570 "Unable to write elem block 1 attribute values.\n");
1571
1572 /* =============== Set parameters ================= */
1573 /* *** NEW API *** */
1574 EXCHECK(ex_put_names(exoid, EX_NODE_SET, (char **)nset_names),
1575 "Unable to write node set names.\n");
1576 EXCHECK(ex_put_names(exoid, EX_EDGE_SET, (char **)eset_names),
1577 "Unable to write edge set names.\n");
1578 EXCHECK(ex_put_names(exoid, EX_FACE_SET, (char **)fset_names),
1579 "Unable to write face set names.\n");
1580 EXCHECK(ex_put_names(exoid, EX_SIDE_SET, (char **)sset_names),
1581 "Unable to write side set names.\n");
1582 EXCHECK(ex_put_names(exoid, EX_ELEM_SET, (char **)elset_names),
1583 "Unable to write element set names.\n");
1584
1585 {
1586 ex_set allSets[1 + 1 + 1 + 1 + 2];
1587
1588 ex_set *nodeSets = &allSets[0];
1589 ex_set *edgeSets = &allSets[1];
1590 ex_set *faceSets = &allSets[2];
1591 ex_set *sideSets = &allSets[3];
1592 ex_set *elemSets = &allSets[4];
1593
1594 nodeSets[0].type = EX_NODE_SET;
1595 nodeSets[0].id = 1000;
1596 nodeSets[0].num_entry = 3;
1597 nodeSets[0].num_distribution_factor = 0;
1598 nodeSets[0].entry_list = nset_nodes;
1599 nodeSets[0].extra_list = NULL;
1600 nodeSets[0].distribution_factor_list = NULL;
1601
1602 edgeSets[0].type = EX_EDGE_SET;
1603 edgeSets[0].id = 1200;
1604 edgeSets[0].num_entry = 6;
1605 edgeSets[0].num_distribution_factor = 6;
1606 edgeSets[0].entry_list = eset_edges;
1607 edgeSets[0].extra_list = eset_orient;
1608 edgeSets[0].distribution_factor_list = eset_df;
1609
1610 faceSets[0].type = EX_FACE_SET;
1611 faceSets[0].id = 1400;
1612 faceSets[0].num_entry = 2;
1613 faceSets[0].num_distribution_factor = 0;
1614 faceSets[0].entry_list = fset_faces;
1615 faceSets[0].extra_list = fset_orient;
1616 faceSets[0].distribution_factor_list = NULL;
1617
1618 sideSets[0].type = EX_SIDE_SET;
1619 sideSets[0].id = 1400;
1620 sideSets[0].num_entry = 5;
1621 sideSets[0].num_distribution_factor = 0;
1622 sideSets[0].entry_list = sset_elems;
1623 sideSets[0].extra_list = sset_sides;
1624 sideSets[0].distribution_factor_list = NULL;
1625
1626 elemSets[0].type = EX_ELEM_SET;
1627 elemSets[0].id = 1800;
1628 elemSets[0].num_entry = 1;
1629 elemSets[0].num_distribution_factor = 0;
1630 elemSets[0].entry_list = &elset_elems[0];
1631 elemSets[0].extra_list = NULL;
1632 elemSets[0].distribution_factor_list = NULL;
1633
1634 elemSets[1].type = EX_ELEM_SET;
1635 elemSets[1].id = 1900;
1636 elemSets[1].num_entry = 1;
1637 elemSets[1].num_distribution_factor = 0;
1638 elemSets[1].entry_list = &elset_elems[1];
1639 elemSets[1].extra_list = NULL;
1640 elemSets[1].distribution_factor_list = NULL;
1641
1642 if (concatSets) {
1643 EXCHECK(ex_put_sets(exoid, 1 + 2 + 1 + 1 + 1, allSets),
1644 "Unable to output concatenated sets.\n");
1645 }
1646 else {
1647 EXCHECK(ex_put_sets(exoid, 1, nodeSets), "Unable to write node sets.\n");
1648 EXCHECK(ex_put_sets(exoid, 1, edgeSets), "Unable to write edge sets.\n");
1649 EXCHECK(ex_put_sets(exoid, 1, faceSets), "Unable to write face sets.\n");
1650 EXCHECK(ex_put_sets(exoid, 1, sideSets), "Unable to write side sets.\n");
1651 EXCHECK(ex_put_sets(exoid, 2, elemSets), "Unable to write element sets.\n");
1652 }
1653 }
1654
1655 /* =============== Result variable params ========= */
1656 /* *** NEW API *** */
1657 if (concatResult) {
1658 EXCHECK(ex_put_all_var_param_ext(exoid, &varParams),
1659 "Unable to write result variable parameter information.\n");
1660 }
1661 else {
1662 EXCHECK(ex_put_variable_param(exoid, EX_GLOBAL, 2),
1663 "Unable to write global result variable parameters.\n");
1664 EXCHECK(ex_put_variable_param(exoid, EX_NODAL, 1),
1665 "Unable to write nodal result variable parameters.\n");
1666 EXCHECK(ex_put_variable_param(exoid, EX_ELEM_BLOCK, 1),
1667 "Unable to write element result variable parameters.\n");
1668 EXCHECK(ex_put_variable_param(exoid, EX_EDGE_BLOCK, 2),
1669 "Unable to write edge result variable parameters.\n");
1670 // EXCHECK(ex_put_variable_param(exoid, EX_FACE_BLOCK, 2),
1671 // "Unable to write face result variable parameters.\n");
1672 EXCHECK(ex_put_variable_param(exoid, EX_FACE_BLOCK, 1),
1673 "Unable to write face result variable parameters.\n");
1674 EXCHECK(ex_put_variable_param(exoid, EX_FACE_SET, 1),
1675 "Unable to write faceset result variable parameters.\n");
1676 }
1677
1678 /* =============== Result variable names ========== */
1679 /* *** NEW API *** */
1680 EXCHECK(ex_put_variable_name(exoid, EX_GLOBAL, 1, "CALIBER"), "Unable to write variable name.\n");
1681 EXCHECK(ex_put_variable_name(exoid, EX_GLOBAL, 2, "GUNPOWDER"),
1682 "Unable to write variable name.\n");
1683 EXCHECK(ex_put_variable_name(exoid, EX_NODAL, 1, "RHO"), "Unable to write variable name.\n");
1684 EXCHECK(ex_put_variable_name(exoid, EX_EDGE_BLOCK, 1, "GAMMA1"),
1685 "Unable to write variable name.\n");
1686 EXCHECK(ex_put_variable_name(exoid, EX_EDGE_BLOCK, 2, "GAMMA2"),
1687 "Unable to write variable name.\n");
1688 EXCHECK(ex_put_variable_name(exoid, EX_FACE_BLOCK, 1, "PHI"), "Unable to write variable name.\n");
1689 // EXCHECK(ex_put_variable_name(exoid, EX_FACE_BLOCK, 2, "PHI"), "Unable to write variable
1690 // name.\n");
1691 EXCHECK(ex_put_variable_name(exoid, EX_ELEM_BLOCK, 1, "EPSTRN"),
1692 "Unable to write variable name.\n");
1693 EXCHECK(ex_put_variable_name(exoid, EX_FACE_SET, 1, "PHI0"), "Unable to write variable name.\n");
1694
1695 /* =============== Result variable values ========= */
1696 t = 1.;
1697 /* *** NEW API *** */
1698 EXCHECK(ex_put_time(exoid, 1, &t), "Unable to write time value.\n");
1699 EXCHECK(ex_put_var(exoid, 1, EX_GLOBAL, 1, 0 /*N/A*/, 2, vals_glo_var[0]),
1700 "Unable to write global var 1.\n");
1701 EXCHECK(ex_put_var(exoid, 1, EX_EDGE_BLOCK, 1, 100, 20, vals_edge_var1eb1[0]),
1702 "Unable to write edge block 1 var 1.\n");
1703 EXCHECK(ex_put_var(exoid, 1, EX_EDGE_BLOCK, 2, 100, 20, vals_edge_var2eb1[0]),
1704 "Unable to write edge block 1 var 2.\n");
1705 EXCHECK(ex_put_var(exoid, 1, EX_FACE_BLOCK, 1, 500, 2, diff_vals_face_var1fb1[0]),
1706 "Unable to write face block 1 var 1.\n");
1707 // EXCHECK(ex_put_var(exoid, 1, EX_FACE_BLOCK, 2, 700, 8, vals_face_var1fb3[0]),
1708 // "Unable to write face block 3 var 1.\n");
1709 EXCHECK(ex_put_var(exoid, 1, EX_FACE_BLOCK, 1, 700, 8, vals_face_var1fb3[0]),
1710 "Unable to write face block 3 var 1.\n");
1711 EXCHECK(ex_put_var(exoid, 1, EX_ELEM_BLOCK, 1, 200, 2, vals_elem_var1eb1[0]),
1712 "Unable to write elem block 1 var 1.\n");
1713 EXCHECK(ex_put_var(exoid, 1, EX_FACE_SET, 1, 1400, 2, vals_fset_var1fs1[0]),
1714 "Unable to write face set 1 var 1.\n");
1715
1716 t = 2.;
1717 EXCHECK(ex_put_time(exoid, 2, &t), "Unable to write time value.\n");
1718 EXCHECK(ex_put_var(exoid, 2, EX_GLOBAL, 1, 0 /*N/A*/, 2, vals_glo_var[1]),
1719 "Unable to write global var 1.\n");
1720 EXCHECK(ex_put_var(exoid, 2, EX_EDGE_BLOCK, 1, 100, 20, vals_edge_var1eb1[1]),
1721 "Unable to write edge block 1 var 1.\n");
1722 EXCHECK(ex_put_var(exoid, 2, EX_EDGE_BLOCK, 2, 100, 20, vals_edge_var2eb1[1]),
1723 "Unable to write edge block 1 var 2.\n");
1724 EXCHECK(ex_put_var(exoid, 2, EX_FACE_BLOCK, 1, 500, 2, diff_vals_face_var1fb1[1]),
1725 "Unable to write face block 1 var 1.\n");
1726 // EXCHECK(ex_put_var(exoid, 2, EX_FACE_BLOCK, 2, 700, 8, vals_face_var1fb3[1]),
1727 // "Unable to write face block 3 var 1.\n");
1728 EXCHECK(ex_put_var(exoid, 2, EX_FACE_BLOCK, 1, 700, 8, vals_face_var1fb3[1]),
1729 "Unable to write face block 3 var 1.\n");
1730 EXCHECK(ex_put_var(exoid, 2, EX_ELEM_BLOCK, 1, 200, 2, vals_elem_var1eb1[1]),
1731 "Unable to write elem block 1 var 1.\n");
1732 EXCHECK(ex_put_var(exoid, 2, EX_FACE_SET, 1, 1400, 2, vals_fset_var1fs1[1]),
1733 "Unable to write face set 1 var 1.\n");
1734
1735 EXCHECK(ex_put_var(exoid, 1, EX_NODAL, 1, 1, 12, vals_nod_var[0]),
1736 "Unable to write nodal var 1.\n");
1737 EXCHECK(ex_put_var(exoid, 2, EX_NODAL, 1, 1, 12, vals_nod_var[1]),
1738 "Unable to write nodal var 1.\n");
1739
1740 EXCHECK(ex_close(exoid), "Unable to close database.\n");
1741
1742 free(varParams.edge_var_tab);
1743 free(varParams.face_var_tab);
1744 free(varParams.elem_var_tab);
1745 free(varParams.fset_var_tab);
1746 return 0;
1747 }
1748
1749 #if !defined(USING_CMAKE)
1750 int main(int argc, char *argv[])
1751 {
1752 int rc = 0;
1753 rc = create_gold_file(argc, argv);
1754 if (rc != 0)
1755 return rc;
1756 rc = create_no_diff_file(argc, argv);
1757 if (rc != 0)
1758 return rc;
1759 rc = create_edge_block_diff_file(argc, argv);
1760 if (rc != 0)
1761 return rc;
1762 rc = create_face_block_diff_file(argc, argv);
1763 if (rc != 0)
1764 return rc;
1765
1766 return 0;
1767 }
1768 #endif