| 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" // for ex_set, EX_FATAL, EX_NOERR, etc |
| 10 |
#include "exodusII_int.h" // for exi_check_valid_file_id |
| 11 |
|
| 12 |
int ex_get_sets(int exoid, size_t set_count, struct ex_set *sets) |
| 13 |
{ |
| 14 |
size_t i; |
| 15 |
int status = EX_NOERR; |
| 16 |
int stat; |
| 17 |
|
| 18 |
EX_FUNC_ENTER(); |
| 19 |
if (exi_check_valid_file_id(exoid, __func__) == EX_FATAL) { |
| 20 |
EX_FUNC_LEAVE(EX_FATAL); |
| 21 |
} |
| 22 |
|
| 23 |
for (i = 0; i < set_count; i++) { |
| 24 |
if (ex_int64_status(exoid) & EX_BULK_INT64_API) { |
| 25 |
stat = ex_get_set_param(exoid, sets[i].type, sets[i].id, &sets[i].num_entry, |
| 26 |
&sets[i].num_distribution_factor); |
| 27 |
} |
| 28 |
else { |
| 29 |
/* API expecting 32-bit ints; ex_set structure has 64-bit ints. */ |
| 30 |
int num_entry; |
| 31 |
int num_dist; |
| 32 |
stat = ex_get_set_param(exoid, sets[i].type, sets[i].id, &num_entry, &num_dist); |
| 33 |
sets[i].num_entry = num_entry; |
| 34 |
sets[i].num_distribution_factor = num_dist; |
| 35 |
} |
| 36 |
if (stat != EX_NOERR) { |
| 37 |
status = (status == EX_FATAL) ? EX_FATAL : stat; |
| 38 |
} |
| 39 |
|
| 40 |
if (stat == EX_NOERR && (sets[i].entry_list != NULL || sets[i].extra_list != NULL)) { |
| 41 |
stat = ex_get_set(exoid, sets[i].type, sets[i].id, sets[i].entry_list, sets[i].extra_list); |
| 42 |
if (stat != EX_NOERR) { |
| 43 |
status = (status == EX_FATAL) ? EX_FATAL : stat; |
| 44 |
} |
| 45 |
} |
| 46 |
|
| 47 |
if (stat == EX_NOERR && sets[i].distribution_factor_list != NULL) { |
| 48 |
stat = |
| 49 |
ex_get_set_dist_fact(exoid, sets[i].type, sets[i].id, sets[i].distribution_factor_list); |
| 50 |
if (stat != EX_NOERR) { |
| 51 |
status = (status == EX_FATAL) ? EX_FATAL : stat; |
| 52 |
} |
| 53 |
} |
| 54 |
} |
| 55 |
EX_FUNC_LEAVE(status); |
| 56 |
} |