Debian Codegraph @

packages/seacas/libraries/exodus/src/ex_put_nodal_var.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_err, etc
10 #include "exodusII_int.h" // for EX_WARN, exi_comp_ws, etc
11
12 /*!
13 \deprecated Use ex_put_var()(exoid, time_step, EX_NODAL, nodal_var_index, 1, num_nodes,
14 nodal_var_vals)
15
16 The function ex_put_nodal_var() writes the values of a single nodal
17 variable for a single time step. The function ex_put_variable_param()
18 must be invoked before this call is made.
19
20 Because nodal 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_put_nodal_var() returns a negative number; a
26 warning will return a positive number. Possible causes of errors
27 include:
28 - data file not properly opened with call to ex_create() or ex_open()
29 - data file opened for read only.
30 - data file not initialized properly with call to ex_put_init().
31 - ex_put_variable_param() not called previously specifying the number of
32 nodal variables.
33
34 \param[in] exoid exodus file ID returned from a previous call to
35 ex_create() or
36 ex_open().
37
38 \param[in] time_step The time step number, as described under
39 ex_put_time(). This
40 is essentially a counter that is incremented when
41 results variables
42 are output. The first time step is 1.
43
44 \param[in] nodal_var_index The index of the nodal variable. The first
45 variable has an index of 1.
46
47 \param[in] num_nodes The number of nodal points.
48
49 \param[in] nodal_var_vals Array of num_nodes values of the
50 nodal_var_index-th nodal
51 variable for the time_step-th time step.
52
53 As an example, the following code segment writes all the nodal
54 variables for a single time step:
55
56 ~~~{.c}
57 int num_nod_vars, num_nodes, error, exoid, time_step;
58 float *nodal_var_vals;
59
60 \comment{write nodal variables}
61 nodal_var_vals = (float *) calloc(num_nodes, sizeof(float));
62 for (k=1; k <= num_nod_vars; k++) {
63 for (j=0; j < num_nodes; j++) {
64 \comment{application code fills in this array}
65 nodal_var_vals[j] = 10.0;
66 }
67 error = ex_put_nodal_var(exoid, time_step, k, num_nodes,
68 nodal_var_vals);
69 }
70 ~~~
71
72 */
73
74 int ex_put_nodal_var(int exoid, int time_step, int nodal_var_index, int64_t num_nodes,
75 const void *nodal_var_vals)
76
77 {
78 return ex_put_var(exoid, time_step, EX_NODAL, nodal_var_index, 1, num_nodes, nodal_var_vals);
79 }