| 1 |
/* |
| 2 |
* Copyright(C) 1999-2020, 2024 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_err, etc |
| 10 |
#include "exodusII_int.h" // for EX_FATAL, EX_NOERR |
| 11 |
|
| 12 |
/** |
| 13 |
* \ingroup Utilities |
| 14 |
* Given a file or group 'parent' id, return the |
| 15 |
* number of child groups and the ids of the child groups below the |
| 16 |
* parent. If num_groups is NULL, do not return count; if group_ids |
| 17 |
* is NULL, do not return ids. |
| 18 |
*/ |
| 19 |
int ex_get_group_ids(int parent_id, int *num_groups, int *group_ids) |
| 20 |
{ |
| 21 |
char errmsg[MAX_ERR_LENGTH]; |
| 22 |
|
| 23 |
#if NC_HAS_HDF5 |
| 24 |
int status; |
| 25 |
|
| 26 |
EX_FUNC_ENTER(); |
| 27 |
if (exi_check_valid_file_id(parent_id, __func__) != EX_NOERR) { |
| 28 |
EX_FUNC_LEAVE(EX_FATAL); |
| 29 |
} |
| 30 |
|
| 31 |
status = nc_inq_grps(parent_id, num_groups, group_ids); |
| 32 |
if (status != NC_NOERR) { |
| 33 |
snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: Failed to get child group ids in file id %d", |
| 34 |
parent_id); |
| 35 |
ex_err_fn(parent_id, __func__, errmsg, status); |
| 36 |
EX_FUNC_LEAVE(EX_FATAL); |
| 37 |
} |
| 38 |
EX_FUNC_LEAVE(EX_NOERR); |
| 39 |
#else |
| 40 |
EX_FUNC_ENTER(); |
| 41 |
snprintf(errmsg, MAX_ERR_LENGTH, |
| 42 |
"ERROR: Group capabilities are not available in this netcdf " |
| 43 |
"version--not netcdf4"); |
| 44 |
ex_err_fn(parent_id, __func__, errmsg, NC_ENOTNC4); |
| 45 |
EX_FUNC_LEAVE(EX_FATAL); |
| 46 |
#endif |
| 47 |
} |