Skip to content

Commit

Permalink
EXODUS: Fix varid query for assembly and blob
Browse files Browse the repository at this point in the history
  • Loading branch information
gsjaardema committed Oct 27, 2023
1 parent d9c176f commit 7df7cf1
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions packages/seacas/libraries/exodus/src/ex_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -2321,6 +2321,30 @@ int ex__get_varid(int exoid, ex_entity_type obj_type, ex_entity_id id)
return varid;
}

if (obj_type == EX_ASSEMBLY) {
int varid = 0;
if ((status = nc_inq_varid(exoid, VAR_ENTITY_ASSEMBLY(id), &varid)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH,
"ERROR: failed to locate %s id %" PRId64 " in id array in file id %d",
ex_name_of_object(obj_type), id, exoid);
ex_err_fn(exoid, __func__, errmsg, status);
return EX_FATAL;
}
return varid;
}

if (obj_type == EX_BLOB) {
int varid = 0;
if ((status = nc_inq_varid(exoid, VAR_ENTITY_BLOB(id), &varid)) != NC_NOERR) {
snprintf(errmsg, MAX_ERR_LENGTH,
"ERROR: failed to locate %s id %" PRId64 " in id array in file id %d",
ex_name_of_object(obj_type), id, exoid);
ex_err_fn(exoid, __func__, errmsg, status);
return EX_FATAL;
}
return varid;
}

/* Everything else ... */
/* First, locate index of this objects id `obj_type` id array */
/* First, locate index of this objects id `obj_type` id array */
Expand All @@ -2341,8 +2365,6 @@ int ex__get_varid(int exoid, ex_entity_type obj_type, ex_entity_id id)

const char *entryptr = NULL;
switch (obj_type) {
case EX_ASSEMBLY: entryptr = VAR_ENTITY_ASSEMBLY(id_ndx); break;
case EX_BLOB: entryptr = VAR_ENTITY_BLOB(id_ndx); break;
case EX_NODE_SET: entryptr = VAR_NODE_NS(id_ndx); break;
case EX_EDGE_SET: entryptr = VAR_EDGE_ES(id_ndx); break;
case EX_FACE_SET: entryptr = VAR_FACE_FS(id_ndx); break;
Expand Down

0 comments on commit 7df7cf1

Please sign in to comment.