| 1 |
/* |
| 2 |
* Copyright(C) 1999-2020 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 |
/***************************************************************************** |
| 9 |
* |
| 10 |
* testwt_ss - test write an ExodusII database file |
| 11 |
* |
| 12 |
* author - Sandia National Laboratories |
| 13 |
* Larry A. Schoof - Original |
| 14 |
* Vic Yarberry - Added headers and error logging |
| 15 |
* 7/7/93 Modified for use with Exodus 2.00 |
| 16 |
* |
| 17 |
* |
| 18 |
* environment - UNIX |
| 19 |
* |
| 20 |
* entry conditions - |
| 21 |
* |
| 22 |
* exit conditions - |
| 23 |
* |
| 24 |
* revision history - |
| 25 |
* |
| 26 |
* This is a test program for the C binding of the EXODUS II |
| 27 |
* database write routines. |
| 28 |
* |
| 29 |
* |
| 30 |
*****************************************************************************/ |
| 31 |
|
| 32 |
#include "exodusII.h" |
| 33 |
#include <stdio.h> |
| 34 |
#include <stdlib.h> |
| 35 |
|
| 36 |
int main(int argc, char **argv) |
| 37 |
{ |
| 38 |
int exoid, num_dim, num_nodes, num_elem, num_elem_blk; |
| 39 |
int num_elem_in_block[10], num_nodes_per_elem[10]; |
| 40 |
int num_node_sets, num_side_sets, error; |
| 41 |
int *connect; |
| 42 |
int node_list[100], elem_list[100], side_list[100]; |
| 43 |
int ebids[10], ids[10]; |
| 44 |
int num_nodes_per_set[10], num_elem_per_set[10]; |
| 45 |
int num_df_per_set[10]; |
| 46 |
int df_ind[10], node_ind[10], elem_ind[10]; |
| 47 |
int num_qa_rec, num_info; |
| 48 |
int CPU_word_size, IO_word_size; |
| 49 |
|
| 50 |
float x[100], y[100], z[100]; |
| 51 |
float attrib[1], dist_fact[100]; |
| 52 |
char *coord_names[3], *qa_record[2][4], *info[3]; |
| 53 |
|
| 54 |
ex_opts(EX_VERBOSE | EX_ABORT); |
| 55 |
|
| 56 |
/* Specify compute and i/o word size */ |
| 57 |
|
| 58 |
CPU_word_size = 0; /* sizeof(float) */ |
| 59 |
IO_word_size = 4; /* (4 bytes) */ |
| 60 |
|
| 61 |
/* create EXODUS II file */ |
| 62 |
|
| 63 |
exoid = ex_create("test.exo", /* filename path */ |
| 64 |
EX_CLOBBER, /* create mode */ |
| 65 |
&CPU_word_size, /* CPU float word size in bytes */ |
| 66 |
&IO_word_size); /* I/O float word size in bytes */ |
| 67 |
printf("after ex_create for test.exo, exoid = %d\n", exoid); |
| 68 |
printf(" cpu word size: %d io word size: %d\n", CPU_word_size, IO_word_size); |
| 69 |
|
| 70 |
/* initialize file with parameters */ |
| 71 |
|
| 72 |
num_dim = 3; |
| 73 |
num_nodes = 33; |
| 74 |
num_elem = 8; |
| 75 |
num_elem_blk = 8; |
| 76 |
num_node_sets = 2; |
| 77 |
num_side_sets = 9; |
| 78 |
|
| 79 |
error = ex_put_init(exoid, "This is a test", num_dim, num_nodes, num_elem, num_elem_blk, |
| 80 |
num_node_sets, num_side_sets); |
| 81 |
|
| 82 |
printf("after ex_put_init, error = %d\n", error); |
| 83 |
|
| 84 |
if (error) { |
| 85 |
ex_close(exoid); |
| 86 |
exit(-1); |
| 87 |
} |
| 88 |
|
| 89 |
/* write nodal coordinates values and names to database */ |
| 90 |
|
| 91 |
/* Quad #1 */ |
| 92 |
x[0] = 0.0f; |
| 93 |
y[0] = 0.0f; |
| 94 |
z[0] = 0.0f; |
| 95 |
x[1] = 1.0f; |
| 96 |
y[1] = 0.0f; |
| 97 |
z[1] = 0.0f; |
| 98 |
x[2] = 1.0f; |
| 99 |
y[2] = 1.0f; |
| 100 |
z[2] = 0.0f; |
| 101 |
x[3] = 0.0f; |
| 102 |
y[3] = 1.0f; |
| 103 |
z[3] = 0.0f; |
| 104 |
|
| 105 |
/* Quad #2 */ |
| 106 |
x[4] = 1.0f; |
| 107 |
y[4] = 0.0f; |
| 108 |
z[4] = 0.0f; |
| 109 |
x[5] = 2.0f; |
| 110 |
y[5] = 0.0f; |
| 111 |
z[5] = 0.0f; |
| 112 |
x[6] = 2.0f; |
| 113 |
y[6] = 1.0f; |
| 114 |
z[6] = 0.0f; |
| 115 |
x[7] = 1.0f; |
| 116 |
y[7] = 1.0f; |
| 117 |
z[7] = 0.0f; |
| 118 |
|
| 119 |
/* Hex #1 */ |
| 120 |
x[8] = 0.0f; |
| 121 |
y[8] = 0.0f; |
| 122 |
z[8] = 0.0f; |
| 123 |
x[9] = 10.0f; |
| 124 |
y[9] = 0.0f; |
| 125 |
z[9] = 0.0f; |
| 126 |
x[10] = 10.0f; |
| 127 |
y[10] = 0.0f; |
| 128 |
z[10] = -10.0f; |
| 129 |
x[11] = 1.0f; |
| 130 |
y[11] = 0.0f; |
| 131 |
z[11] = -10.0f; |
| 132 |
x[12] = 1.0f; |
| 133 |
y[12] = 10.0f; |
| 134 |
z[12] = 0.0f; |
| 135 |
x[13] = 10.0f; |
| 136 |
y[13] = 10.0f; |
| 137 |
z[13] = 0.0f; |
| 138 |
x[14] = 10.0f; |
| 139 |
y[14] = 10.0f; |
| 140 |
z[14] = -10.0f; |
| 141 |
x[15] = 1.0f; |
| 142 |
y[15] = 10.0f; |
| 143 |
z[15] = -10.0f; |
| 144 |
|
| 145 |
/* Tetra #1 */ |
| 146 |
x[16] = 0.0f; |
| 147 |
y[16] = 0.0f; |
| 148 |
z[16] = 0.0f; |
| 149 |
x[17] = 1.0f; |
| 150 |
y[17] = 0.0f; |
| 151 |
z[17] = 5.0f; |
| 152 |
x[18] = 10.0f; |
| 153 |
y[18] = 0.0f; |
| 154 |
z[18] = 2.0f; |
| 155 |
x[19] = 7.0f; |
| 156 |
y[19] = 5.0f; |
| 157 |
z[19] = 3.0f; |
| 158 |
|
| 159 |
/* Wedge #1 */ |
| 160 |
x[20] = 3.0f; |
| 161 |
y[20] = 0.0f; |
| 162 |
z[20] = 6.0f; |
| 163 |
x[21] = 6.0f; |
| 164 |
y[21] = 0.0f; |
| 165 |
z[21] = 0.0f; |
| 166 |
x[22] = 0.0f; |
| 167 |
y[22] = 0.0f; |
| 168 |
z[22] = 0.0f; |
| 169 |
x[23] = 3.0f; |
| 170 |
y[23] = 2.0f; |
| 171 |
z[23] = 6.0f; |
| 172 |
x[24] = 6.0f; |
| 173 |
y[24] = 2.0f; |
| 174 |
z[24] = 2.0f; |
| 175 |
x[25] = 0.0f; |
| 176 |
y[25] = 2.0f; |
| 177 |
z[25] = 0.0f; |
| 178 |
|
| 179 |
/* Tetra #2 */ |
| 180 |
x[26] = 2.7f; |
| 181 |
y[26] = 1.7f; |
| 182 |
z[26] = 2.7f; |
| 183 |
x[27] = 6.0f; |
| 184 |
y[27] = 1.7f; |
| 185 |
z[27] = 3.3f; |
| 186 |
x[28] = 5.7f; |
| 187 |
y[28] = 1.7f; |
| 188 |
z[28] = 1.7f; |
| 189 |
x[29] = 3.7f; |
| 190 |
y[29] = 0.0f; |
| 191 |
z[29] = 2.3f; |
| 192 |
|
| 193 |
/* TriShell #1 */ |
| 194 |
x[30] = 2.7f; |
| 195 |
y[30] = 1.7f; |
| 196 |
z[30] = 2.7f; |
| 197 |
x[31] = 6.0f; |
| 198 |
y[31] = 1.7f; |
| 199 |
z[31] = 3.3f; |
| 200 |
x[32] = 5.7f; |
| 201 |
y[32] = 1.7f; |
| 202 |
z[32] = 1.7f; |
| 203 |
|
| 204 |
error = ex_put_coord(exoid, x, y, z); |
| 205 |
printf("after ex_put_coord, error = %d\n", error); |
| 206 |
|
| 207 |
if (error) { |
| 208 |
ex_close(exoid); |
| 209 |
exit(-1); |
| 210 |
} |
| 211 |
|
| 212 |
coord_names[0] = "xcoor"; |
| 213 |
coord_names[1] = "ycoor"; |
| 214 |
coord_names[2] = "zcoor"; |
| 215 |
|
| 216 |
error = ex_put_coord_names(exoid, coord_names); |
| 217 |
printf("after ex_put_coord_names, error = %d\n", error); |
| 218 |
|
| 219 |
if (error) { |
| 220 |
ex_close(exoid); |
| 221 |
exit(-1); |
| 222 |
} |
| 223 |
|
| 224 |
/* write element block parameters */ |
| 225 |
|
| 226 |
num_elem_in_block[0] = 1; |
| 227 |
num_elem_in_block[1] = 1; |
| 228 |
num_elem_in_block[2] = 1; |
| 229 |
num_elem_in_block[3] = 1; |
| 230 |
num_elem_in_block[4] = 1; |
| 231 |
num_elem_in_block[5] = 1; |
| 232 |
num_elem_in_block[6] = 1; |
| 233 |
num_elem_in_block[7] = 1; |
| 234 |
|
| 235 |
num_nodes_per_elem[0] = 4; /* elements in block #1 are 4-node quads */ |
| 236 |
num_nodes_per_elem[1] = 4; /* elements in block #2 are 4-node quads */ |
| 237 |
num_nodes_per_elem[2] = 8; /* elements in block #3 are 8-node hexes */ |
| 238 |
num_nodes_per_elem[3] = 4; /* elements in block #4 are 4-node tetras */ |
| 239 |
num_nodes_per_elem[4] = 6; /* elements in block #5 are 6-node wedges */ |
| 240 |
num_nodes_per_elem[5] = 8; /* elements in block #6 are 8-node tetras */ |
| 241 |
num_nodes_per_elem[6] = 4; /* elements in block #7 are 4-node shells */ |
| 242 |
num_nodes_per_elem[7] = 3; /* elements in block #8 are 3-node shells */ |
| 243 |
|
| 244 |
ebids[0] = 10; |
| 245 |
ebids[1] = 11; |
| 246 |
ebids[2] = 12; |
| 247 |
ebids[3] = 13; |
| 248 |
ebids[4] = 14; |
| 249 |
ebids[5] = 15; |
| 250 |
ebids[6] = 16; |
| 251 |
ebids[7] = 17; |
| 252 |
|
| 253 |
error = ex_put_block(exoid, EX_ELEM_BLOCK, ebids[0], "quad", num_elem_in_block[0], |
| 254 |
num_nodes_per_elem[0], 0, 0, 1); |
| 255 |
printf("after ex_put_elem_block, error = %d\n", error); |
| 256 |
|
| 257 |
if (error) { |
| 258 |
ex_close(exoid); |
| 259 |
exit(-1); |
| 260 |
} |
| 261 |
|
| 262 |
error = ex_put_block(exoid, EX_ELEM_BLOCK, ebids[1], "quad", num_elem_in_block[1], |
| 263 |
num_nodes_per_elem[1], 0, 0, 1); |
| 264 |
printf("after ex_put_elem_block, error = %d\n", error); |
| 265 |
|
| 266 |
if (error) { |
| 267 |
ex_close(exoid); |
| 268 |
exit(-1); |
| 269 |
} |
| 270 |
|
| 271 |
error = ex_put_block(exoid, EX_ELEM_BLOCK, ebids[2], "hex", num_elem_in_block[2], |
| 272 |
num_nodes_per_elem[2], 0, 0, 1); |
| 273 |
printf("after ex_put_elem_block, error = %d\n", error); |
| 274 |
|
| 275 |
if (error) { |
| 276 |
ex_close(exoid); |
| 277 |
exit(-1); |
| 278 |
} |
| 279 |
|
| 280 |
error = ex_put_block(exoid, EX_ELEM_BLOCK, ebids[3], "tetra", num_elem_in_block[3], |
| 281 |
num_nodes_per_elem[3], 0, 0, 1); |
| 282 |
printf("after ex_put_elem_block, error = %d\n", error); |
| 283 |
|
| 284 |
if (error) { |
| 285 |
ex_close(exoid); |
| 286 |
exit(-1); |
| 287 |
} |
| 288 |
|
| 289 |
error = ex_put_block(exoid, EX_ELEM_BLOCK, ebids[4], "wedge", num_elem_in_block[4], |
| 290 |
num_nodes_per_elem[4], 0, 0, 1); |
| 291 |
printf("after ex_put_elem_block, error = %d\n", error); |
| 292 |
|
| 293 |
if (error) { |
| 294 |
ex_close(exoid); |
| 295 |
exit(-1); |
| 296 |
} |
| 297 |
|
| 298 |
error = ex_put_block(exoid, EX_ELEM_BLOCK, ebids[5], "tetra", num_elem_in_block[5], |
| 299 |
num_nodes_per_elem[5], 0, 0, 1); |
| 300 |
printf("after ex_put_elem_block, error = %d\n", error); |
| 301 |
|
| 302 |
if (error) { |
| 303 |
ex_close(exoid); |
| 304 |
exit(-1); |
| 305 |
} |
| 306 |
|
| 307 |
error = ex_put_block(exoid, EX_ELEM_BLOCK, ebids[6], "shell", num_elem_in_block[6], |
| 308 |
num_nodes_per_elem[6], 0, 0, 1); |
| 309 |
printf("after ex_put_elem_block, error = %d\n", error); |
| 310 |
|
| 311 |
if (error) { |
| 312 |
ex_close(exoid); |
| 313 |
exit(-1); |
| 314 |
} |
| 315 |
|
| 316 |
error = ex_put_block(exoid, EX_ELEM_BLOCK, ebids[7], "triangle", num_elem_in_block[7], |
| 317 |
num_nodes_per_elem[7], 0, 0, 1); |
| 318 |
printf("after ex_put_elem_block, error = %d\n", error); |
| 319 |
|
| 320 |
if (error) { |
| 321 |
ex_close(exoid); |
| 322 |
exit(-1); |
| 323 |
} |
| 324 |
|
| 325 |
/* write element connectivity */ |
| 326 |
|
| 327 |
connect = (int *)calloc(8, sizeof(int)); |
| 328 |
connect[0] = 1; |
| 329 |
connect[1] = 2; |
| 330 |
connect[2] = 3; |
| 331 |
connect[3] = 4; |
| 332 |
|
| 333 |
error = ex_put_conn(exoid, EX_ELEM_BLOCK, ebids[0], connect, NULL, NULL); |
| 334 |
printf("after ex_put_elem_conn, error = %d\n", error); |
| 335 |
if (error) { |
| 336 |
ex_close(exoid); |
| 337 |
exit(-1); |
| 338 |
} |
| 339 |
|
| 340 |
connect[0] = 5; |
| 341 |
connect[1] = 6; |
| 342 |
connect[2] = 7; |
| 343 |
connect[3] = 8; |
| 344 |
|
| 345 |
error = ex_put_conn(exoid, EX_ELEM_BLOCK, ebids[1], connect, NULL, NULL); |
| 346 |
printf("after ex_put_elem_conn, error = %d\n", error); |
| 347 |
|
| 348 |
if (error) { |
| 349 |
ex_close(exoid); |
| 350 |
exit(-1); |
| 351 |
} |
| 352 |
|
| 353 |
connect[0] = 9; |
| 354 |
connect[1] = 10; |
| 355 |
connect[2] = 11; |
| 356 |
connect[3] = 12; |
| 357 |
connect[4] = 13; |
| 358 |
connect[5] = 14; |
| 359 |
connect[6] = 15; |
| 360 |
connect[7] = 16; |
| 361 |
|
| 362 |
error = ex_put_conn(exoid, EX_ELEM_BLOCK, ebids[2], connect, NULL, NULL); |
| 363 |
printf("after ex_put_elem_conn, error = %d\n", error); |
| 364 |
|
| 365 |
if (error) { |
| 366 |
ex_close(exoid); |
| 367 |
exit(-1); |
| 368 |
} |
| 369 |
|
| 370 |
connect[0] = 17; |
| 371 |
connect[1] = 18; |
| 372 |
connect[2] = 19; |
| 373 |
connect[3] = 20; |
| 374 |
|
| 375 |
error = ex_put_conn(exoid, EX_ELEM_BLOCK, ebids[3], connect, NULL, NULL); |
| 376 |
printf("after ex_put_elem_conn, error = %d\n", error); |
| 377 |
|
| 378 |
if (error) { |
| 379 |
ex_close(exoid); |
| 380 |
exit(-1); |
| 381 |
} |
| 382 |
|
| 383 |
connect[0] = 21; |
| 384 |
connect[1] = 22; |
| 385 |
connect[2] = 23; |
| 386 |
connect[3] = 24; |
| 387 |
connect[4] = 25; |
| 388 |
connect[5] = 26; |
| 389 |
|
| 390 |
error = ex_put_conn(exoid, EX_ELEM_BLOCK, ebids[4], connect, NULL, NULL); |
| 391 |
printf("after ex_put_elem_conn, error = %d\n", error); |
| 392 |
|
| 393 |
if (error) { |
| 394 |
ex_close(exoid); |
| 395 |
exit(-1); |
| 396 |
} |
| 397 |
|
| 398 |
connect[0] = 17; |
| 399 |
connect[1] = 18; |
| 400 |
connect[2] = 19; |
| 401 |
connect[3] = 20; |
| 402 |
connect[4] = 27; |
| 403 |
connect[5] = 28; |
| 404 |
connect[6] = 30; |
| 405 |
connect[7] = 29; |
| 406 |
|
| 407 |
error = ex_put_conn(exoid, EX_ELEM_BLOCK, ebids[5], connect, NULL, NULL); |
| 408 |
printf("after ex_put_elem_conn, error = %d\n", error); |
| 409 |
|
| 410 |
if (error) { |
| 411 |
ex_close(exoid); |
| 412 |
exit(-1); |
| 413 |
} |
| 414 |
|
| 415 |
connect[0] = 1; |
| 416 |
connect[1] = 2; |
| 417 |
connect[2] = 3; |
| 418 |
connect[3] = 4; |
| 419 |
|
| 420 |
error = ex_put_conn(exoid, EX_ELEM_BLOCK, ebids[6], connect, NULL, NULL); |
| 421 |
printf("after ex_put_elem_conn, error = %d\n", error); |
| 422 |
if (error) { |
| 423 |
ex_close(exoid); |
| 424 |
exit(-1); |
| 425 |
} |
| 426 |
|
| 427 |
connect[0] = 30; |
| 428 |
connect[1] = 31; |
| 429 |
connect[2] = 32; |
| 430 |
|
| 431 |
error = ex_put_conn(exoid, EX_ELEM_BLOCK, ebids[7], connect, NULL, NULL); |
| 432 |
printf("after ex_put_elem_conn, error = %d\n", error); |
| 433 |
if (error) { |
| 434 |
ex_close(exoid); |
| 435 |
exit(-1); |
| 436 |
} |
| 437 |
|
| 438 |
free(connect); |
| 439 |
|
| 440 |
/* write element block attributes */ |
| 441 |
attrib[0] = 3.14159f; |
| 442 |
error = ex_put_attr(exoid, EX_ELEM_BLOCK, ebids[0], attrib); |
| 443 |
printf("after ex_put_elem_attr, error = %d\n", error); |
| 444 |
if (error) { |
| 445 |
ex_close(exoid); |
| 446 |
exit(-1); |
| 447 |
} |
| 448 |
|
| 449 |
error = ex_put_attr(exoid, EX_ELEM_BLOCK, ebids[0], attrib); |
| 450 |
printf("after ex_put_elem_attr, error = %d\n", error); |
| 451 |
if (error) { |
| 452 |
ex_close(exoid); |
| 453 |
exit(-1); |
| 454 |
} |
| 455 |
|
| 456 |
attrib[0] = 6.14159f; |
| 457 |
error = ex_put_attr(exoid, EX_ELEM_BLOCK, ebids[1], attrib); |
| 458 |
printf("after ex_put_elem_attr, error = %d\n", error); |
| 459 |
|
| 460 |
if (error) { |
| 461 |
ex_close(exoid); |
| 462 |
exit(-1); |
| 463 |
} |
| 464 |
|
| 465 |
error = ex_put_attr(exoid, EX_ELEM_BLOCK, ebids[2], attrib); |
| 466 |
printf("after ex_put_elem_attr, error = %d\n", error); |
| 467 |
|
| 468 |
if (error) { |
| 469 |
ex_close(exoid); |
| 470 |
exit(-1); |
| 471 |
} |
| 472 |
|
| 473 |
error = ex_put_attr(exoid, EX_ELEM_BLOCK, ebids[3], attrib); |
| 474 |
printf("after ex_put_elem_attr, error = %d\n", error); |
| 475 |
|
| 476 |
if (error) { |
| 477 |
ex_close(exoid); |
| 478 |
exit(-1); |
| 479 |
} |
| 480 |
|
| 481 |
error = ex_put_attr(exoid, EX_ELEM_BLOCK, ebids[4], attrib); |
| 482 |
printf("after ex_put_elem_attr, error = %d\n", error); |
| 483 |
|
| 484 |
if (error) { |
| 485 |
ex_close(exoid); |
| 486 |
exit(-1); |
| 487 |
} |
| 488 |
|
| 489 |
error = ex_put_attr(exoid, EX_ELEM_BLOCK, ebids[5], attrib); |
| 490 |
printf("after ex_put_elem_attr, error = %d\n", error); |
| 491 |
|
| 492 |
if (error) { |
| 493 |
ex_close(exoid); |
| 494 |
exit(-1); |
| 495 |
} |
| 496 |
|
| 497 |
error = ex_put_attr(exoid, EX_ELEM_BLOCK, ebids[6], attrib); |
| 498 |
printf("after ex_put_elem_attr, error = %d\n", error); |
| 499 |
|
| 500 |
if (error) { |
| 501 |
ex_close(exoid); |
| 502 |
exit(-1); |
| 503 |
} |
| 504 |
|
| 505 |
error = ex_put_attr(exoid, EX_ELEM_BLOCK, ebids[7], attrib); |
| 506 |
printf("after ex_put_elem_attr, error = %d\n", error); |
| 507 |
|
| 508 |
if (error) { |
| 509 |
ex_close(exoid); |
| 510 |
exit(-1); |
| 511 |
} |
| 512 |
|
| 513 |
/* write individual side sets */ |
| 514 |
|
| 515 |
/* write concatenated side sets; this produces the same information as |
| 516 |
* the above code which writes individual side sets |
| 517 |
*/ |
| 518 |
|
| 519 |
ids[0] = 30; |
| 520 |
ids[1] = 31; |
| 521 |
ids[2] = 32; |
| 522 |
ids[3] = 33; |
| 523 |
ids[4] = 34; |
| 524 |
ids[5] = 35; |
| 525 |
ids[6] = 36; |
| 526 |
ids[7] = 37; |
| 527 |
ids[8] = 38; |
| 528 |
|
| 529 |
/* side set #1 - NULL side set */ |
| 530 |
/* do nothing except set num_elem_per_set to 0 */ |
| 531 |
|
| 532 |
/* side set #2 - NULL side set */ |
| 533 |
/* do nothing except set num_elem_per_set to 0 */ |
| 534 |
|
| 535 |
/* side set #3 - quad; 2 sides */ |
| 536 |
|
| 537 |
node_list[0] = 8; |
| 538 |
node_list[1] = 5; |
| 539 |
elem_list[0] = 2; |
| 540 |
|
| 541 |
node_list[2] = 6; |
| 542 |
node_list[3] = 7; |
| 543 |
elem_list[1] = 2; |
| 544 |
|
| 545 |
/* side set #4 - quad; 2 sides spanning 2 elements */ |
| 546 |
|
| 547 |
node_list[4] = 2; |
| 548 |
node_list[5] = 3; |
| 549 |
elem_list[2] = 1; |
| 550 |
|
| 551 |
node_list[6] = 7; |
| 552 |
node_list[7] = 8; |
| 553 |
elem_list[3] = 2; |
| 554 |
|
| 555 |
/* side set #5 - hex; 7 sides */ |
| 556 |
|
| 557 |
node_list[8] = 9; |
| 558 |
node_list[9] = 12; |
| 559 |
node_list[10] = 11; |
| 560 |
node_list[11] = 10; |
| 561 |
elem_list[4] = 3; |
| 562 |
|
| 563 |
node_list[12] = 11; |
| 564 |
node_list[13] = 12; |
| 565 |
node_list[14] = 16; |
| 566 |
node_list[15] = 15; |
| 567 |
elem_list[5] = 3; |
| 568 |
|
| 569 |
node_list[16] = 16; |
| 570 |
node_list[17] = 15; |
| 571 |
node_list[18] = 11; |
| 572 |
node_list[19] = 12; |
| 573 |
elem_list[6] = 3; |
| 574 |
|
| 575 |
node_list[20] = 10; |
| 576 |
node_list[21] = 11; |
| 577 |
node_list[22] = 15; |
| 578 |
node_list[23] = 14; |
| 579 |
elem_list[7] = 3; |
| 580 |
|
| 581 |
node_list[24] = 13; |
| 582 |
node_list[25] = 16; |
| 583 |
node_list[26] = 12; |
| 584 |
node_list[27] = 9; |
| 585 |
elem_list[8] = 3; |
| 586 |
|
| 587 |
node_list[28] = 14; |
| 588 |
node_list[29] = 13; |
| 589 |
node_list[30] = 9; |
| 590 |
node_list[31] = 10; |
| 591 |
elem_list[9] = 3; |
| 592 |
|
| 593 |
node_list[32] = 16; |
| 594 |
node_list[33] = 13; |
| 595 |
node_list[34] = 14; |
| 596 |
node_list[35] = 15; |
| 597 |
elem_list[10] = 3; |
| 598 |
|
| 599 |
/* side set #6 - 4-node tetras; 4 sides */ |
| 600 |
|
| 601 |
node_list[36] = 17; |
| 602 |
node_list[37] = 18; |
| 603 |
node_list[38] = 20; |
| 604 |
elem_list[11] = 4; |
| 605 |
|
| 606 |
node_list[39] = 18; |
| 607 |
node_list[40] = 19; |
| 608 |
node_list[41] = 20; |
| 609 |
elem_list[12] = 4; |
| 610 |
|
| 611 |
node_list[42] = 17; |
| 612 |
node_list[43] = 20; |
| 613 |
node_list[44] = 19; |
| 614 |
elem_list[13] = 4; |
| 615 |
|
| 616 |
node_list[45] = 17; |
| 617 |
node_list[46] = 19; |
| 618 |
node_list[47] = 18; |
| 619 |
elem_list[14] = 4; |
| 620 |
|
| 621 |
/* side set #7 - shells; front and back faces */ |
| 622 |
|
| 623 |
node_list[48] = 1; |
| 624 |
node_list[49] = 2; |
| 625 |
node_list[50] = 3; |
| 626 |
node_list[51] = 4; |
| 627 |
elem_list[15] = 7; |
| 628 |
|
| 629 |
node_list[52] = 4; |
| 630 |
node_list[53] = 3; |
| 631 |
node_list[54] = 2; |
| 632 |
node_list[55] = 1; |
| 633 |
elem_list[16] = 7; |
| 634 |
|
| 635 |
/* side set #8 - shells; 4 edges */ |
| 636 |
|
| 637 |
node_list[56] = 1; |
| 638 |
node_list[57] = 2; |
| 639 |
elem_list[17] = 7; |
| 640 |
|
| 641 |
node_list[58] = 2; |
| 642 |
node_list[59] = 3; |
| 643 |
elem_list[18] = 7; |
| 644 |
|
| 645 |
node_list[60] = 3; |
| 646 |
node_list[61] = 4; |
| 647 |
elem_list[19] = 7; |
| 648 |
|
| 649 |
node_list[62] = 4; |
| 650 |
node_list[63] = 1; |
| 651 |
elem_list[20] = 7; |
| 652 |
|
| 653 |
/* side set #9 -- 3-node shells -- front and back */ |
| 654 |
|
| 655 |
node_list[64] = 30; |
| 656 |
node_list[65] = 31; |
| 657 |
node_list[66] = 32; |
| 658 |
elem_list[21] = 8; |
| 659 |
|
| 660 |
node_list[67] = 32; |
| 661 |
node_list[68] = 31; |
| 662 |
node_list[69] = 30; |
| 663 |
elem_list[22] = 8; |
| 664 |
|
| 665 |
/* set up indices */ |
| 666 |
node_ind[0] = 0; |
| 667 |
node_ind[1] = 0; |
| 668 |
node_ind[2] = 0; |
| 669 |
node_ind[3] = 4; |
| 670 |
node_ind[4] = 8; |
| 671 |
node_ind[5] = 36; |
| 672 |
node_ind[6] = 48; |
| 673 |
node_ind[7] = 56; |
| 674 |
node_ind[8] = 64; |
| 675 |
|
| 676 |
num_elem_per_set[0] = 0; |
| 677 |
num_elem_per_set[1] = 0; |
| 678 |
num_elem_per_set[2] = 2; |
| 679 |
num_elem_per_set[3] = 2; |
| 680 |
num_elem_per_set[4] = 7; |
| 681 |
num_elem_per_set[5] = 4; |
| 682 |
num_elem_per_set[6] = 2; |
| 683 |
num_elem_per_set[7] = 4; |
| 684 |
num_elem_per_set[8] = 2; |
| 685 |
|
| 686 |
num_nodes_per_set[0] = 0; |
| 687 |
num_nodes_per_set[1] = 0; |
| 688 |
num_nodes_per_set[2] = 4; |
| 689 |
num_nodes_per_set[3] = 4; |
| 690 |
num_nodes_per_set[4] = 28; |
| 691 |
num_nodes_per_set[5] = 12; |
| 692 |
num_nodes_per_set[6] = 8; |
| 693 |
num_nodes_per_set[7] = 8; |
| 694 |
num_nodes_per_set[8] = 6; |
| 695 |
|
| 696 |
elem_ind[0] = 0; |
| 697 |
elem_ind[1] = 0; |
| 698 |
elem_ind[2] = 0; |
| 699 |
elem_ind[3] = 2; |
| 700 |
elem_ind[4] = 4; |
| 701 |
elem_ind[5] = 11; |
| 702 |
elem_ind[6] = 15; |
| 703 |
elem_ind[7] = 17; |
| 704 |
elem_ind[8] = 21; |
| 705 |
|
| 706 |
error = ex_cvt_nodes_to_sides(exoid, num_elem_per_set, num_nodes_per_set, elem_ind, node_ind, |
| 707 |
elem_list, node_list, side_list); |
| 708 |
printf("after ex_cvt_nodes_to_sides, error = %d\n", error); |
| 709 |
|
| 710 |
if (error) { |
| 711 |
ex_close(exoid); |
| 712 |
exit(-1); |
| 713 |
} |
| 714 |
|
| 715 |
num_df_per_set[0] = 0; |
| 716 |
num_df_per_set[1] = 0; |
| 717 |
num_df_per_set[2] = 4; |
| 718 |
num_df_per_set[3] = 4; |
| 719 |
num_df_per_set[4] = 0; |
| 720 |
num_df_per_set[5] = 0; |
| 721 |
num_df_per_set[6] = 0; |
| 722 |
num_df_per_set[7] = 0; |
| 723 |
num_df_per_set[8] = 0; |
| 724 |
|
| 725 |
df_ind[0] = 0; |
| 726 |
df_ind[1] = 0; |
| 727 |
df_ind[2] = 0; |
| 728 |
df_ind[3] = 4; |
| 729 |
df_ind[4] = 0; |
| 730 |
df_ind[5] = 0; |
| 731 |
df_ind[6] = 0; |
| 732 |
df_ind[7] = 0; |
| 733 |
df_ind[8] = 0; |
| 734 |
|
| 735 |
dist_fact[0] = 30.0f; |
| 736 |
dist_fact[1] = 30.1f; |
| 737 |
dist_fact[2] = 30.2f; |
| 738 |
dist_fact[3] = 30.3f; |
| 739 |
|
| 740 |
dist_fact[4] = 31.0f; |
| 741 |
dist_fact[5] = 31.1f; |
| 742 |
dist_fact[6] = 31.2f; |
| 743 |
dist_fact[7] = 31.3f; |
| 744 |
|
| 745 |
{ |
| 746 |
struct ex_set_specs set_specs; |
| 747 |
|
| 748 |
set_specs.sets_ids = ids; |
| 749 |
set_specs.num_entries_per_set = num_elem_per_set; |
| 750 |
set_specs.num_dist_per_set = num_df_per_set; |
| 751 |
set_specs.sets_entry_index = elem_ind; |
| 752 |
set_specs.sets_dist_index = df_ind; |
| 753 |
set_specs.sets_entry_list = elem_list; |
| 754 |
set_specs.sets_extra_list = side_list; |
| 755 |
set_specs.sets_dist_fact = dist_fact; |
| 756 |
|
| 757 |
error = ex_put_concat_sets(exoid, EX_SIDE_SET, &set_specs); |
| 758 |
} |
| 759 |
printf("after ex_put_concat_side_sets, error = %d\n", error); |
| 760 |
|
| 761 |
if (error) { |
| 762 |
ex_close(exoid); |
| 763 |
exit(-1); |
| 764 |
} |
| 765 |
|
| 766 |
/* THIS SECTION IS COMMENTED OUT |
| 767 |
END COMMENTED OUT SECTION */ |
| 768 |
|
| 769 |
/* write QA records; test empty and just blank-filled records */ |
| 770 |
|
| 771 |
num_qa_rec = 2; |
| 772 |
|
| 773 |
qa_record[0][0] = "TESTWT"; |
| 774 |
qa_record[0][1] = "testwt"; |
| 775 |
qa_record[0][2] = "07/07/93"; |
| 776 |
qa_record[0][3] = "15:41:33"; |
| 777 |
qa_record[1][0] = ""; |
| 778 |
qa_record[1][1] = " "; |
| 779 |
qa_record[1][2] = ""; |
| 780 |
qa_record[1][3] = " "; |
| 781 |
|
| 782 |
error = ex_put_qa(exoid, num_qa_rec, qa_record); |
| 783 |
printf("after ex_put_qa, error = %d\n", error); |
| 784 |
|
| 785 |
if (error) { |
| 786 |
ex_close(exoid); |
| 787 |
exit(-1); |
| 788 |
} |
| 789 |
|
| 790 |
/* write information records; test empty and just blank-filled records */ |
| 791 |
|
| 792 |
num_info = 3; |
| 793 |
|
| 794 |
info[0] = "This is the first information record."; |
| 795 |
info[1] = ""; |
| 796 |
info[2] = " "; |
| 797 |
|
| 798 |
error = ex_put_info(exoid, num_info, info); |
| 799 |
printf("after ex_put_info, error = %d\n", error); |
| 800 |
|
| 801 |
if (error) { |
| 802 |
ex_close(exoid); |
| 803 |
exit(-1); |
| 804 |
} |
| 805 |
|
| 806 |
/* close the EXODUS files |
| 807 |
*/ |
| 808 |
error = ex_close(exoid); |
| 809 |
printf("after ex_close, error = %d\n", error); |
| 810 |
if (error) { |
| 811 |
ex_close(exoid); |
| 812 |
exit(-1); |
| 813 |
} |
| 814 |
return 0; |
| 815 |
} |