| 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 |
#include <exodusII.h> |
| 10 |
#include <stdio.h> |
| 11 |
|
| 12 |
int main(int argc, char **argv) |
| 13 |
{ |
| 14 |
float version = 0.0; |
| 15 |
|
| 16 |
ex_opts(EX_VERBOSE | EX_ABORT); |
| 17 |
int CPU_word_size = 0; /* sizeof(float) */ |
| 18 |
int IO_word_size = 4; /* (4 bytes) */ |
| 19 |
|
| 20 |
/* ======================================== */ |
| 21 |
/* Create an empty exodus file */ |
| 22 |
/* ====================================== */ |
| 23 |
int exoid = ex_create("test.exo", EX_CLOBBER, &CPU_word_size, &IO_word_size); |
| 24 |
ex_close(exoid); |
| 25 |
|
| 26 |
/* ======================================== */ |
| 27 |
/* Now try to open and read the empty file */ |
| 28 |
/* ====================================== */ |
| 29 |
|
| 30 |
exoid = ex_open("test.exo", /* filename path */ |
| 31 |
EX_READ, /* access mode = READ */ |
| 32 |
&CPU_word_size, /* CPU word size */ |
| 33 |
&IO_word_size, /* IO word size */ |
| 34 |
&version); /* ExodusII library version */ |
| 35 |
|
| 36 |
printf("test.exo exoid = %d\n", exoid); |
| 37 |
|
| 38 |
{ |
| 39 |
char title[MAX_LINE_LENGTH + 1]; |
| 40 |
int num_dim, num_nodes, num_elem, num_elem_blk, num_node_sets, num_side_sets; |
| 41 |
int error = ex_get_init(exoid, title, &num_dim, &num_nodes, &num_elem, &num_elem_blk, |
| 42 |
&num_node_sets, &num_side_sets); |
| 43 |
printf("after ex_get_init, error = %3d\n", error); |
| 44 |
if (error) { |
| 45 |
exit(-1); |
| 46 |
} |
| 47 |
else { |
| 48 |
exit(0); |
| 49 |
} |
| 50 |
} |
| 51 |
} |