| 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_put_set_param, etc |
| 10 |
|
| 11 |
/*! |
| 12 |
\deprecated Use ex_put_set_param()(exoid, EX_NODE_SET, node_set_id, |
| 13 |
num_nodes_in_set, num_dist_in_set) |
| 14 |
|
| 15 |
The function ex_put_node_set_param() writes the node set ID, the |
| 16 |
number of nodes which describe a single node set, and the number of |
| 17 |
node set distribution factors for the node set. |
| 18 |
|
| 19 |
\return In case of an error, ex_put_node_set_param() returns a |
| 20 |
negative number; a warning will return a positive number. Possible |
| 21 |
causes of errors include: |
| 22 |
- data file not properly opened with call to ex_create() or ex_open() |
| 23 |
- data file opened for read only. |
| 24 |
- data file not initialized properly with call to ex_put_init(). |
| 25 |
- the number of node sets specified in the call to ex_put_init() was zero or |
| 26 |
has been exceeded. |
| 27 |
- a node set with the same ID has already been stored. |
| 28 |
- the specified number of distribution factors is not zero and is not equal |
| 29 |
to the number of nodes. |
| 30 |
|
| 31 |
\param[in] exoid exodus file ID returned from a previous call to |
| 32 |
ex_create() or ex_open(). |
| 33 |
\param[in] node_set_id The node set ID. |
| 34 |
\param[in] num_nodes_in_set The number of nodes in the node set. |
| 35 |
\param[in] num_dist_in_set The number of distribution factors in the node |
| 36 |
set. This should be |
| 37 |
either 0 (zero) for no factors, or should equal num_nodes_in_set. |
| 38 |
|
| 39 |
The following code segment will write out a node set to an open exodus |
| 40 |
file : |
| 41 |
|
| 42 |
~~~{.c} |
| 43 |
int id, num_nodes_in_set, num_dist_in_set, error, exoid, *node_list; |
| 44 |
float *dist_fact; |
| 45 |
|
| 46 |
\comment{write node set parameters} |
| 47 |
id = 20; num_nodes_in_set = 5; num_dist_in_set = 5; |
| 48 |
error = ex_put_node_set_param(exoid, id, num_nodes_in_set, |
| 49 |
num_dist_in_set); |
| 50 |
|
| 51 |
\comment{write node set node list} |
| 52 |
node_list = (int *) calloc (num_nodes_in_set, sizeof(int)); |
| 53 |
node_list[0] = 100; node_list[1] = 101; node_list[2] = 102; |
| 54 |
node_list[3] = 103; node_list[4] = 104; |
| 55 |
|
| 56 |
error = ex_put_node_set(exoid, id, node_list); |
| 57 |
|
| 58 |
\comment{write node set distribution factors} |
| 59 |
dist_fact = (float *) calloc (num_dist_in_set, sizeof(float)); |
| 60 |
dist_fact[0] = 1.0; dist_fact[1] = 2.0; dist_fact[2] = 3.0; |
| 61 |
dist_fact[3] = 4.0; dist_fact[4] = 5.0; |
| 62 |
|
| 63 |
error = ex_put_node_set_dist_fact(exoid, id, dist_fact); |
| 64 |
|
| 65 |
\comment{Same result using non-deprecated functions} |
| 66 |
error = ex_put_set_param(exoid, EX_NODE_SET, id, num_nodes_in_set, |
| 67 |
num_dist_in_set); |
| 68 |
error = ex_put_set(exoid, EX_NODE_SET, id, node_list, NULL); |
| 69 |
error = ex_put_set_dist_fact(exoid, EX_NODE_SET, id, dist_fact); |
| 70 |
~~~ |
| 71 |
*/ |
| 72 |
|
| 73 |
int ex_put_node_set_param(int exoid, ex_entity_id node_set_id, int64_t num_nodes_in_set, |
| 74 |
int64_t num_dist_in_set) |
| 75 |
{ |
| 76 |
return ex_put_set_param(exoid, EX_NODE_SET, node_set_id, num_nodes_in_set, num_dist_in_set); |
| 77 |
} |