Although writing the element variable truth table is optional, it is encouraged because it creates at one time all the necessary
variables in which to hold the exodus element variable
values. This results in significant time savings. See
Section #Efficiency for a discussion of efficiency issues.
The function ex_put_variable_param() must be called before this
routine in order to define the number of element variables.
\return In case of an error, ex_put_elem_var_tab() returns a negative
number; a warning will return a positive number. Possible causes of
errors include:
- data file not properly opened with call to ex_create() or ex_open()
- data file opened for read only.
- data file not initialized properly with call to ex_put_init().
- the specified number of element blocks is different than the
number specified in a call to ex_put_init().
- ex_put_elem_block() not called previously to specify
element block parameters.
- ex_put_variable_param() not called previously to specify
the number of element variables or was called but with a different
number of element variables.
- ex_put_elem_var() previously called.
\param[in] exoid exodus file ID returned from a previous call to ex_create() or ex_open().
\param[in] num_elem_blk The number of element blocks.
\param[in] num_elem_var The number of element variables.
\param[in] elem_var_tab Size [num_elem_blk,num_elem_var]. A 2-dimensional array
(with the \c num_elem_var index cycling faster)
containing the element variable truth table.
The following coding will create, populate, and write an element
variable truth table to an opened exodus file (NOTE: all element
variables are valid for all element blocks in this example.):
\code
int *truth_tab, num_elem_blk, num_ele_vars, error, exoid;
\comment{write element variable truth table}
truth_tab = (int *)calloc((num_elem_blk*num_ele_vars), sizeof(int));
for (i=0, k=0; i < num_elem_blk; i++) {
for (j=0; j < num_ele_vars; j++) {
truth_tab[k++] = 1;
}
}
error = ex_put_elem_var_tab(exoid, num_elem_blk, num_ele_vars,
truth_tab);