Debian Codegraph @

packages/seacas/libraries/exodus/src/deprecated/ex_get_glob_vars.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 * exggv - ex_get_glob_vars
11 *
12 * entry conditions -
13 * input parameters:
14 * int exoid exodus file id
15 * int time_step time step number
16 * int num_glob_vars number of global vars in file
17 *
18 * exit conditions -
19 * float* glob_var_vals array of global variable values
20 *
21 * revision history -
22 *
23 *
24 *****************************************************************************/
25
26 #include "exodusII.h" // for ex_get_var, etc
27
28 /*!
29 \deprecated Use ex_get_var()(exoid, time_step, EX_GLOBAL, 1, 1, num_glob_vars, global_var_vals)
30 \ingroup ResultsData
31
32 The function ex_get_glob_vars() reads the values of all the
33 global variables for a single time step. Memory must be allocated for
34 the global variables values array before this function is invoked.
35
36 Because global variables are floating point values, the application
37 code must declare the array passed to be the appropriate type
38 (float or double) to match the compute word size passed in
39 ex_create() or ex_open().
40
41 In case of an error, ex_get_glob_vars() returns a negative
42 number; a warning will return a positive number. Possible causes of
43 errors include:
44
45 - data file not properly opened with call to ex_create() or ex_open()
46 - no global variables stored in the file.
47 - a warning value is returned if no global variables are stored in the file.
48
49 \param[in] exoid exodus file ID returned from a previous call to
50 ex_create() or ex_open().
51
52 \param[in] time_step The time step, as described under ex_put_time(), at
53 which the global variable values are desired. This is
54 essentially
55 an index (in the time dimension) into the global
56 variable values
57 array stored in the database. The first time step is 1.
58
59 \param[in] num_glob_vars The number of global variables stored in the database.
60 \param[out] glob_var_vals Returned array of num_glob_vars global variable values
61 for the time_step'th time step.
62
63 The following is an example code segment that reads all the global
64 variables at one time step:
65
66 ~~~{.c}
67 int num_glo_vars, error, time_step;
68 float *var_values;
69
70 error = ex_get_variable_param (idexo, EX_GLOBAL, &num_glo_vars);
71 var_values = (float *) calloc (num_glo_vars, sizeof(float));
72 error = ex_get_glob_vars (idexo, time_step, num_glo_vars,
73 var_values);
74 ~~~
75
76 */
77
78 int ex_get_glob_vars(int exoid, int time_step, int num_glob_vars, void *glob_var_vals)
79 {
80 return ex_get_var(exoid, time_step, EX_GLOBAL, 1, 1, num_glob_vars, glob_var_vals);
81 }