Debian Codegraph @

packages/seacas/libraries/exodus/src/deprecated/ex_get_elem_block.c

raw
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 #include "exodusII.h"
9
10 /**
11 \deprecated Use ex_get_block()(exoid, EX_ELEM_BLOCK, elem_blk_id, elem_type,
12 num_elem_this_blk, num_nodes_per_elem, NULL, NULL, num_attr) instead
13
14 The function ex_get_elem_block() reads the parameters used to describe
15 an element block. IDs of all element blocks stored can be determined
16 by calling ex_get_elem_blk_ids().
17
18 \return In case of an error, ex_get_elem_block() returns a negative
19 number; a warning will return a positive number. Possible causes of
20 errors include:
21 - data file not properly opened with call to ex_create() or ex_open()
22 - element block with specified ID is not stored in the data file.
23
24 \param[in] exoid exodus file ID returned from a previous call to
25 ex_create() or ex_open().
26 \param[in] elem_blk_id The element block ID.
27 \param[out] elem_type Returned element typetype of elements in the
28 element block.
29 The maximum length of this string is \p
30 MAX_STR_LENGTH .
31 \param[out] num_elem_this_blk Returned number of elements in the element block.
32 \param[out] num_nodes_per_elem Returned number of nodes per element in the
33 element block.
34 \param[out] num_attr Returned number of attributes per element in the
35 element block.
36
37 As an example, the following code segment will read the parameters for
38 the element block with an ID of 10 and read the connectivity and
39 element attributes arrays from an open exodus file :
40
41 ~~~{.c}
42 #include "exodusII.h"
43 int id, error, exoid, num_el_in_blk, num_nod_per_el, num_attr,
44 *connect;
45 float *attrib;
46 char elem_type[MAX_STR_LENGTH+1];
47
48 \comment{read element block parameters}
49 id = 10;
50
51 error = ex_get_elem_block(exoid, id, elem_type, &num_el_in_blk,
52 &num_nod_per_elem, &num_attr);
53
54 \comment{read element connectivity}
55 connect = (int *) calloc(num_nod_per_el*num_el_in_blk,
56 sizeof(int));
57
58 error = ex_get_elem_conn(exoid, id, connect);
59
60 \comment{read element block attributes}
61 attrib = (float *) calloc (num_attr * num_el_in_blk, sizeof(float));
62 error = ex_get_elem_attr (exoid, id, attrib);
63
64 \comment{Same result using non-deprecated functions}
65 error = ex_get_block(exoid, EX_ELEM_BLOCK, id, elem_type, &num_el_in_blk,
66 &num_nod_per_elem, 0, 0, &num_attr);
67 error = ex_get_conn (exoid, EX_ELEM_BLOCK, id, connect);
68 error = ex_get_attr (exoid, EX_ELEM_BLOCK, id, attrib);
69
70 ~~~
71
72 */
73
74 int ex_get_elem_block(int exoid, ex_entity_id elem_blk_id, char *elem_type,
75 void_int *num_elem_this_blk, void_int *num_nodes_per_elem, void_int *num_attr)
76
77 {
78 return ex_get_block(exoid, EX_ELEM_BLOCK, elem_blk_id, elem_type, num_elem_this_blk,
79 num_nodes_per_elem, 0, 0, num_attr);
80 }