| 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, etc |
| 10 |
|
| 11 |
/*! |
| 12 |
\ingroup ResultsData |
| 13 |
\deprecated Use ex_get_var()(exoid, time_step, EX_NODAL, nodal_var_index, 1, num_nodes, |
| 14 |
nodal_var_vals) |
| 15 |
The function ex_get_nodal_var() reads the values of a single nodal |
| 16 |
variable for a single time step. Memory must be allocated for the |
| 17 |
nodal variable values array before this function is invoked. |
| 18 |
|
| 19 |
Because nodal variables are floating point values, the application |
| 20 |
code must declare the array passed to be the appropriate type |
| 21 |
(float or double) to match the compute word size passed in |
| 22 |
ex_create() or ex_open(). |
| 23 |
|
| 24 |
\return In case of an error, ex_get_nodal_var() returns a negative |
| 25 |
number; a warning will return a positive number. Possible causes of |
| 26 |
errors include: |
| 27 |
- data file not properly opened with call to ex_create() or ex_open() |
| 28 |
- specified nodal variable does not exist. |
| 29 |
- a warning value is returned if no nodal variables are stored in the file. |
| 30 |
|
| 31 |
\param[in] exoid exodus file ID returned from a previous call to |
| 32 |
ex_create() |
| 33 |
or ex_open(). |
| 34 |
|
| 35 |
\param[in] time_step The time step, as described under ex_put_time(), |
| 36 |
at which the |
| 37 |
nodal variable values are desired. This is |
| 38 |
essentially an index (in |
| 39 |
the time dimension) into the nodal variable |
| 40 |
values array stored in |
| 41 |
the database. The first time step is 1. |
| 42 |
|
| 43 |
\param[in] nodal_var_index The index of the desired nodal variable. The |
| 44 |
first variable |
| 45 |
has an index of 1. |
| 46 |
|
| 47 |
\param[in] num_nodes The number of nodal points. |
| 48 |
|
| 49 |
\param[out] nodal_var_vals Returned array of num_nodes values of the |
| 50 |
nodal_var_index-th |
| 51 |
nodal variable for the time_step-th time |
| 52 |
step. |
| 53 |
|
| 54 |
For example, the following demonstrates how this function would be |
| 55 |
used: |
| 56 |
|
| 57 |
~~~{.c} |
| 58 |
int num_nodes, time_step, var_index; |
| 59 |
float *var_values; |
| 60 |
|
| 61 |
\comment{read the second nodal variable at the first time step} |
| 62 |
time_step = 1; |
| 63 |
var_index = 2; |
| 64 |
|
| 65 |
var_values = (float *) calloc (num_nodes, sizeof(float)); |
| 66 |
error = ex_get_nodal_var(exoid, time_step, var_index, num_nodes, |
| 67 |
var_values); |
| 68 |
~~~ |
| 69 |
|
| 70 |
*/ |
| 71 |
|
| 72 |
int ex_get_nodal_var(int exoid, int time_step, int nodal_var_index, int64_t num_nodes, |
| 73 |
void *nodal_var_vals) |
| 74 |
{ |
| 75 |
return ex_get_var(exoid, time_step, EX_NODAL, nodal_var_index, 1, num_nodes, nodal_var_vals); |
| 76 |
} |