| 1 |
/* |
| 2 |
* Copyright(C) 1999-2020, 2022 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 |
* \undoc exgblk - read block parameters |
| 11 |
* |
| 12 |
* entry conditions - |
| 13 |
* input parameters: |
| 14 |
* int idexo exodus file id |
| 15 |
* int blk_type block type (edge,face,element) |
| 16 |
* int blk_id block id |
| 17 |
* |
| 18 |
* exit conditions - |
| 19 |
* char* elem_type element type name |
| 20 |
* int* num_entries_this_blk number of elements in this element block |
| 21 |
* int* num_nodes_per_entry number of nodes per element block |
| 22 |
* int* num_attr_per_entry number of attributes |
| 23 |
* |
| 24 |
* revision history - |
| 25 |
* |
| 26 |
* |
| 27 |
*/ |
| 28 |
|
| 29 |
#include "exodusII.h" // for ex_block, void_int, etc |
| 30 |
#include "exodusII_int.h" |
| 31 |
|
| 32 |
/* |
| 33 |
* reads the parameters used to describe an edge, face, or element block |
| 34 |
*/ |
| 35 |
|
| 36 |
int ex_get_block(int exoid, ex_entity_type blk_type, ex_entity_id blk_id, char *entity_descrip, |
| 37 |
void_int *num_entries_this_blk, void_int *num_nodes_per_entry, |
| 38 |
void_int *num_edges_per_entry, void_int *num_faces_per_entry, |
| 39 |
void_int *num_attr_per_entry) |
| 40 |
{ |
| 41 |
int err; |
| 42 |
ex_block block; |
| 43 |
|
| 44 |
EX_FUNC_ENTER(); |
| 45 |
|
| 46 |
block.id = blk_id; |
| 47 |
block.type = blk_type; |
| 48 |
|
| 49 |
err = ex_get_block_param(exoid, &block); |
| 50 |
|
| 51 |
if (ex_int64_status(exoid) & EX_BULK_INT64_API) { |
| 52 |
int64_t *n_entries_this_blk = num_entries_this_blk; |
| 53 |
int64_t *n_nodes_per_entry = num_nodes_per_entry; |
| 54 |
int64_t *n_edges_per_entry = num_edges_per_entry; |
| 55 |
int64_t *n_faces_per_entry = num_faces_per_entry; |
| 56 |
int64_t *n_attr_per_entry = num_attr_per_entry; |
| 57 |
|
| 58 |
if (num_entries_this_blk) { |
| 59 |
*n_entries_this_blk = block.num_entry; |
| 60 |
} |
| 61 |
if (num_nodes_per_entry) { |
| 62 |
*n_nodes_per_entry = block.num_nodes_per_entry; |
| 63 |
} |
| 64 |
if (num_edges_per_entry) { |
| 65 |
*n_edges_per_entry = block.num_edges_per_entry; |
| 66 |
} |
| 67 |
if (num_faces_per_entry) { |
| 68 |
*n_faces_per_entry = block.num_faces_per_entry; |
| 69 |
} |
| 70 |
if (num_attr_per_entry) { |
| 71 |
*n_attr_per_entry = block.num_attribute; |
| 72 |
} |
| 73 |
} |
| 74 |
else { |
| 75 |
int *n_entries_this_blk = (int *)num_entries_this_blk; |
| 76 |
int *n_nodes_per_entry = (int *)num_nodes_per_entry; |
| 77 |
int *n_edges_per_entry = (int *)num_edges_per_entry; |
| 78 |
int *n_faces_per_entry = (int *)num_faces_per_entry; |
| 79 |
int *n_attr_per_entry = (int *)num_attr_per_entry; |
| 80 |
|
| 81 |
if (num_entries_this_blk) { |
| 82 |
*n_entries_this_blk = (int)block.num_entry; |
| 83 |
} |
| 84 |
if (num_nodes_per_entry) { |
| 85 |
*n_nodes_per_entry = (int)block.num_nodes_per_entry; |
| 86 |
} |
| 87 |
if (num_edges_per_entry) { |
| 88 |
*n_edges_per_entry = (int)block.num_edges_per_entry; |
| 89 |
} |
| 90 |
if (num_faces_per_entry) { |
| 91 |
*n_faces_per_entry = (int)block.num_faces_per_entry; |
| 92 |
} |
| 93 |
if (num_attr_per_entry) { |
| 94 |
*n_attr_per_entry = (int)block.num_attribute; |
| 95 |
} |
| 96 |
} |
| 97 |
|
| 98 |
if (entity_descrip) { |
| 99 |
ex_copy_string(entity_descrip, block.topology, MAX_STR_LENGTH + 1); |
| 100 |
} |
| 101 |
|
| 102 |
EX_FUNC_LEAVE(err); |
| 103 |
} |