Debian Codegraph @

packages/seacas/libraries/exodus/src/deprecated/ex_put_elem_var_tab.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
9 #include "exodusII.h"
10
11 /*!
12
13 \deprecated Use ex_put_truth_table()(exoid, EX_ELEM_BLOCK, num_elem_blk,
14 num_elem_var, elem_var_tab)
15
16 The function ex_put_elem_var_tab() writes the exodus element variable
17 truth table to the database. The element variable truth table
18 indicates whether a particular element result is written for the
19 elements in a particular element block. A 0 (zero) entry indicates
20 that no results will be output for that element variable for that
21 element block. A non-zero entry indicates that the appropriate results
22 will be output.
23
24 Although writing the element variable truth table is optional, it is
25 encouraged because it creates at one time all the necessary
26 `NetCDF` variables in which to hold the exodus element variable
27 values. This results in significant time savings.
28
29 The function ex_put_variable_param() must be called before this
30 routine in order to define the number of element variables.
31
32 \return In case of an error, ex_put_elem_var_tab() returns a negative
33 number; a warning will return a positive number. Possible causes of
34 errors include:
35 - data file not properly opened with call to ex_create() or ex_open()
36 - data file opened for read only.
37 - data file not initialized properly with call to ex_put_init().
38 - the specified number of element blocks is different than the
39 number specified in a call to ex_put_init().
40 - ex_put_elem_block() not called previously to specify
41 element block parameters.
42 - ex_put_variable_param() not called previously to specify
43 the number of element variables or was called but with a different
44 number of element variables.
45 - ex_put_elem_var() previously called.
46
47 \param[in] exoid exodus file ID returned from a previous call to
48 ex_create() or ex_open().
49 \param[in] num_elem_blk The number of element blocks.
50 \param[in] num_elem_var The number of element variables.
51 \param[in] elem_var_tab Size [num_elem_blk,num_elem_var]. A 2-dimensional
52 array
53 (with the num_elem_var index cycling faster)
54 containing the element variable truth table.
55
56 The following coding will create, populate, and write an element
57 variable truth table to an opened exodus file (NOTE: all element
58 variables are valid for all element blocks in this example.):
59
60 ~~~{.c}
61 int *truth_tab, num_elem_blk, num_ele_vars, error, exoid;
62
63 \comment{write element variable truth table}
64 truth_tab = (int *)calloc((num_elem_blk*num_ele_vars), sizeof(int));
65
66 for (i=0, k=0; i < num_elem_blk; i++) {
67 for (j=0; j < num_ele_vars; j++) {
68 truth_tab[k++] = 1;
69 }
70 }
71 error = ex_put_elem_var_tab(exoid, num_elem_blk, num_ele_vars,
72 truth_tab);
73 ~~~
74
75 */
76
77 int ex_put_elem_var_tab(int exoid, int num_elem_blk, int num_elem_var, int *elem_var_tab)
78 {
79 return ex_put_truth_table(exoid, EX_ELEM_BLOCK, num_elem_blk, num_elem_var, elem_var_tab);
80 }