Debian Codegraph @

packages/seacas/libraries/exodus/src/deprecated/ex_get_concat_node_sets.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_set_specs, void_int, etc
10
11 /*!
12 \deprecated Use ex_get_concat_sets()(exoid, EX_NODE_SET, set_specs) instead
13
14 The function ex_get_concat_node_sets() reads the node set ID's, node
15 set node count array, node set distribution factors count array, node
16 set node pointers array, node set distribution factors pointer array,
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.
22
23 Because the distribution factors are floating point values, the
24 application code must declare the array passed to be the appropriate
25 type (float or double) to match the compute word size passed in
26 ex_create() or ex_open().
27
28 The length of each of the returned arrays can be determined by
29 invoking ex_inquire() or ex_inquire_int().
30
31 \return In case of an error, ex_get_concat_node_sets() returns a
32 negative number; a warning will return a positive number. Possible
33 causes of errors include:
34 - data file not properly opened with call to ex_create() or ex_open()
35 - a warning value is returned if no node sets are stored in the file.
36
37 \param[in] exoid exodus file ID returned from a previous call
38 to ex_create()
39 or ex_open().
40
41 \param[out] node_set_ids Returned array containing the node set ID for
42 each set.
43
44 \param[out] num_nodes_per_set Returned array containing the number of nodes
45 for each set.
46
47 \param[out] num_df_per_set Returned array containing the number of
48 distribution factors for each
49 set.
50
51 \param[out] node_sets_node_index Returned array containing the indices into the
52 node_set_node_list
53 which are the locations of the first node for
54 each set. These indices
55 are 0-based.
56
57 \param[out] node_sets_df_index Returned array containing the indices into the
58 node_set_dist_fact
59 which are the locations of the first
60 distribution factor for each
61 set. These indices are 0-based.
62
63 \param[out] node_sets_node_list Returned array containing the nodes for all
64 sets. Internal node IDs
65 are used in this list (see Section
66 LocalNodeIds).
67
68 \param[out] node_sets_dist_fact Returned array containing the distribution
69 factors for all sets.
70
71 As an example, the following code segment will read concatenated node
72 sets:
73
74 ~~~{.c}
75
76 int error, exoid, num_node_sets, list_len, *ids,
77 *num_nodes_per_set, *num_df_per_set, *node_ind,
78 *df_ind, *node_list;
79
80 float *dist_fact
81
82 \comment{read concatenated node sets}
83 num_node_sets = ex_inquire_int(exoid, EX_INQ_NODE_SETS);
84
85 ids = (int *) calloc(num_node_sets, sizeof(int));
86 num_nodes_per_set = (int *) calloc(num_node_sets, sizeof(int));
87 num_df_per_set = (int *) calloc(num_node_sets, sizeof(int));
88 node_ind = (int *) calloc(num_node_sets, sizeof(int));
89 df_ind = (int *) calloc(num_node_sets, sizeof(int));
90
91 list_len = ex_inquire_int(exoid, EX_INQ_NS_NODE_LEN);
92 node_list = (int *) calloc(list_len, sizeof(int));
93
94 list_len = ex_inquire_int(exoid, EX_INQ_NS_DF_LEN);
95 dist_fact = (float *) calloc(list_len, sizeof(float));
96
97 error = ex_get_concat_node_sets (exoid, ids, num_nodes_per_set,
98 num_df_per_set, node_ind, df_ind,
99 node_list, dist_fact);
100 ~~~
101 */
102
103 int ex_get_concat_node_sets(int exoid, void_int *node_set_ids, void_int *num_nodes_per_set,
104 void_int *num_df_per_set, void_int *node_sets_node_index,
105 void_int *node_sets_df_index, void_int *node_sets_node_list,
106 void *node_sets_dist_fact)
107 {
108 struct ex_set_specs set_specs;
109
110 set_specs.sets_ids = node_set_ids;
111 set_specs.num_entries_per_set = num_nodes_per_set;
112 set_specs.num_dist_per_set = num_df_per_set;
113 set_specs.sets_entry_index = node_sets_node_index;
114 set_specs.sets_dist_index = node_sets_df_index;
115 set_specs.sets_entry_list = node_sets_node_list;
116 set_specs.sets_extra_list = NULL;
117 set_specs.sets_dist_fact = node_sets_dist_fact;
118
119 return ex_get_concat_sets(exoid, EX_NODE_SET, &set_specs);
120 }