| 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_set_specs, void_int, etc |
| 10 |
|
| 11 |
/*! |
| 12 |
\deprecated Use ex_put_concat_sets()(exoid, EX_NODE_SET, &set_specs) |
| 13 |
|
| 14 |
The function ex_put_concat_node_sets() writes the node set ID's, node |
| 15 |
sets node count array, node sets distribution factor count array, node |
| 16 |
sets node list pointers array, node sets distribution factor pointer, |
| 17 |
node set node list, and node set distribution factors for all of the |
| 18 |
node sets. ``Concatenated node sets'' refers to the arrays required to |
| 19 |
define all of the node sets (ID array, counts arrays, pointers arrays, |
| 20 |
node list array, and distribution factors array) as described in |
| 21 |
Section 3.10 on page 11. Writing concatenated node sets is more |
| 22 |
efficient than writing individual node sets. |
| 23 |
|
| 24 |
Because the distribution factors are floating point values, the |
| 25 |
application code must declare the array passed to be the appropriate |
| 26 |
type (float or double) to match the compute word size passed in |
| 27 |
ex_create() or ex_open(). |
| 28 |
|
| 29 |
\return In case of an error, ex_put_concat_node_sets() returns a |
| 30 |
negative number; a warning will return a positive number. Possible |
| 31 |
causes of errors include: |
| 32 |
- data file not properly opened with call to ex_create() or ex_open() |
| 33 |
- data file opened for read only. |
| 34 |
- data file not initialized properly with call to ex_put_init(). |
| 35 |
- the number of node sets specified in a call to ex_put_init() was zero or |
| 36 |
has been exceeded. |
| 37 |
- a node set with the same ID has already been stored. |
| 38 |
- the number of distribution factors specified for one of the |
| 39 |
node sets is not zero and is not equal to the number of nodes in the |
| 40 |
same node set. |
| 41 |
|
| 42 |
\param[in] exoid exodus file ID returned from a previous call to |
| 43 |
ex_create() |
| 44 |
or ex_open(). |
| 45 |
|
| 46 |
\param[in] node_set_ids Array containing the node set ID for each set. |
| 47 |
|
| 48 |
\param[in] num_nodes_per_set Array containing the number of nodes for each |
| 49 |
set. |
| 50 |
|
| 51 |
\param[in] num_dist_per_set Array containing the number of distribution |
| 52 |
factors for each set. |
| 53 |
|
| 54 |
\param[in] node_sets_node_index Array containing the indices into the |
| 55 |
node_set_node_list which |
| 56 |
are the locations of the first node for each |
| 57 |
set. These indices are |
| 58 |
0-based. Pass NULL for remaining parameters |
| 59 |
to just set the |
| 60 |
nodeset parameters and not output nodeset data. |
| 61 |
|
| 62 |
\param[in] node_sets_df_index Array containing the indices into the |
| 63 |
node_set_dist_list which |
| 64 |
are the locations of the first distribution |
| 65 |
factor for each set. These |
| 66 |
indices are 0-based. |
| 67 |
|
| 68 |
\param[in] node_sets_node_list Array containing the nodes for all sets. |
| 69 |
Internal node IDs are used in |
| 70 |
this list (See Section LocalNodeIds). |
| 71 |
\param[in] node_sets_dist_fact Array containing the distribution factors for |
| 72 |
all sets. |
| 73 |
|
| 74 |
For example, the following code will write out two node sets |
| 75 |
in a concatenated format: |
| 76 |
|
| 77 |
~~~{.c} |
| 78 |
int ids[2], num_nodes_per_set[2], node_ind[2], node_list[8], |
| 79 |
num_df_per_set[2], df_ind[2], error, exoid; |
| 80 |
|
| 81 |
float dist_fact[8]; |
| 82 |
|
| 83 |
ids[0] = 20; ids[1] = 21; |
| 84 |
num_nodes_per_set[0] = 5; num_nodes_per_set[1] = 3; |
| 85 |
|
| 86 |
node_ind[0] = 0; node_ind[1] = 5; |
| 87 |
|
| 88 |
node_list[0] = 100; node_list[1] = 101; node_list[2] = 102; |
| 89 |
node_list[3] = 103; node_list[4] = 104; |
| 90 |
node_list[5] = 200; node_list[6] = 201; node_list[7] = 202; |
| 91 |
|
| 92 |
num_df_per_set[0] = 5; num_df_per_set[1] = 3; |
| 93 |
|
| 94 |
df_ind[0] = 0; df_ind[1] = 5; |
| 95 |
|
| 96 |
dist_fact[0] = 1.0; dist_fact[1] = 2.0; dist_fact[2] = 3.0; |
| 97 |
dist_fact[3] = 4.0; dist_fact[4] = 5.0; |
| 98 |
dist_fact[5] = 1.1; dist_fact[6] = 2.1; |
| 99 |
dist_fact[7] = 3.1; |
| 100 |
|
| 101 |
error = ex_put_concat_node_sets (exoid, ids, num_nodes_per_set, |
| 102 |
num_df_per_set, node_ind, df_ind, |
| 103 |
node_list, dist_fact); |
| 104 |
~~~ |
| 105 |
|
| 106 |
*/ |
| 107 |
|
| 108 |
int ex_put_concat_node_sets(int exoid, void_int *node_set_ids, void_int *num_nodes_per_set, |
| 109 |
void_int *num_dist_per_set, void_int *node_sets_node_index, |
| 110 |
void_int *node_sets_df_index, void_int *node_sets_node_list, |
| 111 |
void *node_sets_dist_fact) |
| 112 |
{ |
| 113 |
struct ex_set_specs set_specs; |
| 114 |
|
| 115 |
set_specs.sets_ids = node_set_ids; |
| 116 |
set_specs.num_entries_per_set = num_nodes_per_set; |
| 117 |
set_specs.num_dist_per_set = num_dist_per_set; |
| 118 |
set_specs.sets_entry_index = node_sets_node_index; |
| 119 |
set_specs.sets_dist_index = node_sets_df_index; |
| 120 |
set_specs.sets_entry_list = node_sets_node_list; |
| 121 |
set_specs.sets_extra_list = NULL; |
| 122 |
set_specs.sets_dist_fact = node_sets_dist_fact; |
| 123 |
|
| 124 |
return ex_put_concat_sets(exoid, EX_NODE_SET, &set_specs); |
| 125 |
} |