Debian Codegraph @

packages/seacas/libraries/exodus/src/deprecated/ex_get_elem_var_time.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 *
10 * exgevt - ex_get_elem_var_time
11 *
12 * entry conditions -
13 * input parameters:
14 * int exoid exodus file id
15 * int elem_var_index element variable index
16 * int elem_number element number
17 * int beg_time_step time step number
18 * int end_time_step time step number
19 *
20 * exit conditions -
21 * float* elem_var_vals array of element variable values
22 *
23 * revision history -
24 * 20061002 - David Thompson - Moved to ex_get_var_time.
25 *
26 *****************************************************************************/
27
28 #include "exodusII.h" // for ex_get_var_time, etc
29
30 /*!
31 \deprecated Use ex_get_var_time()(exoid, EX_ELEM_BLOCK, elem_var_index,
32 elem_number, beg_time_step, end_time_step, elem_var_vals)
33
34 The function ex_get_elem_var_time() reads the values of an element
35 variable for a single element through a specified number of time
36 steps. Memory must be allocated for the element variable values array
37 before this function is invoked.
38
39 Because element variables are floating point values, the application
40 code must declare the array passed to be the appropriate type
41 (float or double) to match the compute word size passed in
42 ex_create() or ex_open().
43
44 \return In case of an error, ex_get_elem_var_time() returns a negative
45 number; a warning will return a positive number. Possible causes of
46 errors include:
47 - data file not properly opened with call to ex_create() or ex_open()
48 - data file not initialized properly with call to ex_put_init().
49 - ex_put_elem_block() not called previously to specify
50 parameters for all element blocks.
51 - variable does not exist for the desired element or results
52 haven't been written.
53
54 \param[in] exoid exodus file ID returned from a previous call to
55 ex_create()
56 or ex_open().
57 \param[in] elem_var_index The index of the desired element variable. The
58 first variable has an
59 index of 1.
60 \param[in] elem_number The internal ID (see Section LocalElementIds) of
61 the desired
62 element. The first element is 1.
63 \param[in] beg_time_step The beginning time step for which an element
64 variable value is
65 desired. This is not a time value but rather a time
66 step number, as
67 described under ex_put_time(). The first time step
68 is 1.
69 \param[in] end_time_step The last time step for which an element variable
70 value is desired. If
71 negative, the last time step in the database will
72 be used. The first
73 time step is 1.
74 \param[out] elem_var_vals returned array of(end_time_step {-}
75 beg_time_step +
76 1) values of the elem_number-th element for the
77 elem_var_index-th element variable.
78
79 For example, the following coding will read the values of the
80 var_index-th element variable for element number 2 from the first
81 time step to the last time step:
82
83 ~~~{.c}
84
85 int error, exoid, num_time_steps, var_index, elem_num,
86 beg_time, end_time;
87
88 float *var_values;
89
90 \comment{determine how many time steps are stored}
91 num_time_steps = ex_inquire_int(exoid, EX_INQ_TIME);
92
93 \comment{read an element variable through time}
94 var_values = (float *) calloc (num_time_steps, sizeof(float));
95 var_index = 2;
96
97 elem_num = 2;
98
99 beg_time = 1;
100 end_time = -1;
101
102 error = ex_get_elem_var_time (exoid, var_index, elem_num,
103 beg_time, end_time, var_values);
104
105 \comment{Using non-deprecated function:}
106 error = ex_get_elem_var_time (exoid, EX_ELEM_BLOCK, var_index, elem_num,
107 beg_time, end_time, var_values);
108 ~~~
109
110 */
111
112 int ex_get_elem_var_time(int exoid, int elem_var_index, int64_t elem_number, int beg_time_step,
113 int end_time_step, void *elem_var_vals)
114 {
115 return ex_get_var_time(exoid, EX_ELEM_BLOCK, elem_var_index, elem_number, beg_time_step,
116 end_time_step, elem_var_vals);
117 }