Debian Codegraph @

packages/seacas/libraries/exodus/src/deprecated/ex_get_glob_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 #include "exodusII.h" // for ex_get_var_time, etc
10
11 /*!
12 \deprecated Use ex_get_var_time()(exoid, EX_GLOBAL, global_var_index,
13 1, beg_time_step, end_time_step, glob_var_vals)
14
15 The function ex_get_glob_var_time() reads the values of a
16 single global variable through a specified number of time
17 steps. Memory must be allocated for the global variable values array
18 before this function is invoked.
19
20 Because global variables are floating point values, the application
21 code must declare the array passed to be the appropriate type
22 (float or double) to match the compute word size passed in
23 ex_create() or ex_open().
24
25 \return In case of an error, ex_get_glob_var_time() returns a
26 negative number; a warning will return a positive number. Possible
27 causes of errors include:
28 - data file not properly opened with call to ex_create() or ex_open()
29 - specified global variable does not exist.
30 - a warning value is returned if no global variables are stored in the file.
31
32 \param exoid exodus file ID returned from a previous call to
33 ex_create() or ex_open().
34
35 \param glob_var_index The index of the desired global variable. The first
36 variable has an index of 1.
37
38 \param beg_time_step The beginning time step for which a global variable
39 value is desired.
40 This is not a time value but rather a time step number,
41 as
42 described under ex_put_time(). The first time step is 1.
43
44 \param end_time_step The last time step for which a global variable value is
45 desired. If
46 negative, the last time step in the database will be
47 used. The first
48 time step is 1.
49
50 \param[out] glob_var_vals Returned array of (end_time_step - beg_time_step + 1)
51 values
52 for the glob_var_index$^{th}$ global variable.
53
54 The following is an example of using this function:
55
56 ~~~{.c}
57 int error, exoid, num_time_steps, var_index;
58 int beg_time, end_time;
59
60 float *var_values;
61
62 num_time_steps = ex_inquire_int(exoid, EX_INQ_TIME);
63
64 var_index = 1;
65 beg_time = 1;
66 end_time = -1;
67
68 var_values = (float *) calloc (num_time_steps, sizeof(float));
69
70 error = ex_get_glob_var_time(exoid, var_index, beg_time,
71 end_time, var_values);
72 ~~~
73
74 */
75
76 int ex_get_glob_var_time(int exoid, int glob_var_index, int beg_time_step, int end_time_step,
77 void *glob_var_vals)
78 {
79 return ex_get_var_time(exoid, EX_GLOBAL, glob_var_index, 1, beg_time_step, end_time_step,
80 glob_var_vals);
81 }