For example, the following code segment will initialize an element block with an ID of 10, write out the connectivity array, and write out the element attributes array:
int id, error, exoid, num_elem_in_blk, num_nodes_per_elem, *connect, num_attr;
float *attrib;
\comment{write element block parameters}
id = 10;
num_elem_in_blk = 2;
num_nodes_per_elem = 4; \comment{elements are 4-node shells}
num_attr = 1; \comment{one attribute per element}
num_nodes_per_elem, num_attr);
\comment{write element connectivity}
connect = (int *)calloc(num_elem_in_blk*num_nodes_per_elem, sizeof(int));
\comment{fill connect with node numbers; nodes for first element}
connect[0] = 1; connect[1] = 2; connect[2] = 3; connect[3] = 4;
\comment{nodes for second element}
connect[4] = 5; connect[5] = 6; connect[6] = 7; connect[7] = 8;
\comment{write element block attributes}
attrib = (float *) calloc (num_attr*num_elem_in_blk, sizeof(float));
for (i=0, cnt=0; i < num_elem_in_blk; i++) {
for (j=0; j < num_attr; j++, cnt++) {
attrib[cnt] = 1.0;
}
}
\comment{Same result using non-deprecated code}
num_nodes_per_elem, 0, 0, num_attr);
@ EX_ELEM_BLOCK
Definition exodusII.h:275
SEACAS_DEPRECATED int ex_put_elem_conn(int exoid, ex_entity_id elem_blk_id, const void_int *connect)
Definition ex_put_elem_conn.c:41
SEACAS_DEPRECATED int ex_put_elem_block(int exoid, ex_entity_id elem_blk_id, const char *elem_type, int64_t num_elem_this_blk, int64_t num_nodes_per_elem, int64_t num_attr_per_elem)
Definition ex_put_elem_block.c:106
SEACAS_DEPRECATED int ex_put_elem_attr(int exoid, ex_entity_id elem_blk_id, const void *attrib)
Definition ex_put_elem_attr.c:48
int ex_put_conn(int exoid, ex_entity_type blk_type, ex_entity_id blk_id, const void_int *node_conn, const void_int *elem_edge_conn, const void_int *elem_face_conn)
Definition ex_put_conn.c:44
int ex_put_attr(int exoid, ex_entity_type blk_type, ex_entity_id blk_id, const void *attrib)
Definition ex_put_attr.c:37
int ex_put_block(int exoid, ex_entity_type blk_type, ex_entity_id blk_id, const char *entry_descrip, int64_t num_entries_this_blk, int64_t num_nodes_per_entry, int64_t num_edges_per_entry, int64_t num_faces_per_entry, int64_t num_attr_per_entry)
Definition ex_put_block.c:47