Debian Codegraph @

packages/seacas/libraries/exodus/include/polyhedra.md

raw
1 \page polyhedra Polyhedral Element Support
2 \section poly Storage of 3D arbitrary polyhedra elements in Exodus.
3
4 The 3D polyhedra elements are represented as elements with a variable
5 number of faces in their connectivity. The faces can either be
6 regular faces such as quadrilateral or triangles; or they can be
7 topologically two-dimensional arbitrary polyhedra themselves.
8
9 An arbitrary polyhedra 3D element block will have an element type of
10 "nfaced" or "NFACED".
11
12 The faces that are used in the connectivity of this block should be
13 defined in one or more face blocks. If the faces are arbitrary
14 polyhedra, then they will have a face type of "nsided" or "NSIDED".
15
16 An annotated example of defining an arbitrary polyhedral element block
17 consisting of 3 elements is shown below.
18
19 The three elements have the following geometry:
20
21 * Element 1: 5 faces.
22 * Face 1: triangle with nodes 5, 6, 8
23 * Face 2: triangle with nodes 2, 1, 4
24 * Face 3: quadrilateral with nodes 6, 2, 4, 8
25 * Face 4: quadrilateral with nodes 8, 4, 1, 5
26 * Face 5: quadrilateral with nodes 1, 2, 6, 5
27 * Element 2: 5 faces.
28 * Face 6: triangle with nodes 5, 8, 7
29 * Face 7: triangle with nodes 1, 3, 4
30 * Face 8: quadrilateral with nodes 7, 8, 4, 3
31 * Face 9: quadrilateral with nodes 7, 3, 1, 5
32 * Face 4: quadrilateral with nodes 8, 4, 1, 5 (shared with element 1)
33 * Element 3: 7 faces.
34 * Face 8: quadrilateral with nodes 7, 8, 4, 3 (shared with element 2)
35 * Face 10: pentagonal with nodes 8, 4, 14, 10, 12
36 * Face 11: pentagonal with nodes 7, 11, 9, 13, 3
37 * Face 12: quadrilateral with nodes 7, 8, 12, 11
38 * Face 13: quadrilateral with nodes 11, 12, 10, 9
39 * Face 14: quadrilateral with nodes 9, 10, 14, 13
40 * Face 15: quadrilateral with nodes 12, 14, 4, 3
41
42 The Exodus model is created via the following calls:
43
44 * Output the initial information. Since the model contains faces and
45 a face block, the "extended" version of the `ex_put_init_ext()` call must be used:
46 ~~~~C
47 ex_init_params par;
48 ex_copy_string(par.title, "This is the title", MAX_LINE_LENGTH + 1);
49 par.num_dim = 3;
50 par.num_nodes = 14;
51 par.num_edge = 0;
52 par.num_edge_blk = 0;
53 par.num_face = 15;
54 par.num_face_blk = 1;
55 par.num_elem = 3;
56 par.num_elem_blk = 1;
57 par.num_node_sets = 0;
58 par.num_edge_sets = 0;
59 par.num_face_sets = 0;
60 par.num_side_sets = 0;
61 par.num_elem_sets = 0;
62 par.num_node_maps = 0;
63 par.num_edge_maps = 0;
64 par.num_face_maps = 0;
65 par.num_elem_maps = 0;
66
67 ex_put_init_ext (exoid, &par);
68 ~~~~
69
70 * Coordinate output is normal...
71 * Define the face block.
72 ~~~~C
73 block_name = "face_block_1";
74 num_face_in_block[0] = 15;
75 num_total_nodes_per_blk[0] = 58;
76 block_id = 10;
77
78 ex_put_block (exoid, EX_FACE_BLOCK, block_id, "nsided",
79 num_face_in_block[0],
80 num_total_nodes_per_blk[0],
81 0, 0, 0);
82 ex_put_name(exoid, EX_FACE_BLOCK, block_id, block_name);
83 ~~~~
84
85 * Output the face connectivity for "face_block_1".
86 The data for the face connectivity is listed above; a portion is shown below...
87 ~~~~C
88 connect = (int *) calloc(num_total_nodes_per_blk[0], sizeof(int));
89 i = 0
90 connect[i++] = 5;
91 connect[i++] = 6;
92 connect[i++] = 8; /* connectivity of face 1 of element 1 */
93
94 connect[i++] = 2;
95 connect[i++] = 1;
96 connect[i++] = 4; /* face 2 of element 1 */
97
98 connect[i++] = 6;
99 connect[i++] = 2;
100 connect[i++] = 4;
101 connect[i++] = 8; /* face 3 of element 1 */
102
103 connect[i++] = 8;
104 connect[i++] = 4;
105 connect[i++] = 1;
106 connect[i++] = 5; /* face 4 of element 1 */
107
108 connect[i++] = 1;
109 connect[i++] = 2;
110 connect[i++] = 6;
111 connect[i++] = 5; /* face 5 of element 1 */
112
113 connect[i++] = 5;
114 connect[i++] = 8;
115 connect[i++] = 7; /* connectivity of face 1 of element 2 */
116
117 ... and so on....
118 assert(i == num_total_nodes_per_blk[0]);
119
120 ex_put_conn (exoid, EX_FACE_BLOCK, block_id, connect, NULL, NULL);
121 ~~~~
122
123 * Output the number of nodes per face count for "face_block_1":
124 ~~~~C
125 j = 0;
126 nnpe[ 1] = 3; /* Face 1 */
127 nnpe[ 2] = 3;
128 nnpe[ 3] = 4;
129 nnpe[ 4] = 4;
130 nnpe[ 5] = 4;
131 nnpe[ 6] = 3;
132 nnpe[ 7] = 3;
133 nnpe[ 8] = 4;
134 nnpe[ 9] = 4;
135 nnpe[10] = 5;
136 nnpe[11] = 5;
137 nnpe[12] = 4;
138 nnpe[13] = 4;
139 nnpe[14] = 4;
140 nnpe[15] = 4;
141
142 ex_put_entity_count_per_polyhedra(exoid, EX_FACE_BLOCK, block_id, nnpe);
143 ~~~~
144
145 * The face block is now fully defined; now define the nfaced element
146 block which uses these faces.
147 ~~~~C
148 block_name = "nfaced_1";
149
150 num_elem_in_block = 3;
151 num_total_faces_per_blk = 5 + 5 + 7;
152 block_id = 10;
153
154 ex_put_block (exoid, EX_ELEM_BLOCK, block_id, "nfaced",
155 num_elem_in_block,
156 0, /* nodes */
157 0, /* edges */
158 num_total_faces_per_blk,
159 0); /* attribute count */
160 ex_put_name(exoid, EX_ELEM_BLOCK, block_id, block_name);
161 ~~~~
162
163 In the `ex_put_block()` function, the element type is "nfaced". The
164 connectivity is defined in terms of the faces, so the node and edge
165 arguments are passed zeros. The nodal connectivity can be defined,
166 but it isn't required. The face connectivity argument for an
167 nfaced block is the total number of faces in the connectivity for all
168 elements in the nfaced block.
169
170 * Write the face connectivity:
171 ~~~~C
172 /* write element-face connectivity */
173 connect = (int *) calloc(num_total_faces_per_blk, sizeof(int));
174
175 i = 0;
176 connect[i++] = 1;
177 connect[i++] = 2;
178 connect[i++] = 3;
179 connect[i++] = 4;
180 connect[i++] = 5;
181
182 connect[i++] = 4;
183 connect[i++] = 6;
184 connect[i++] = 7;
185 connect[i++] = 8;
186 connect[i++] = 9;
187
188 connect[i++] = 8;
189 connect[i++] = 10;
190 connect[i++] = 11;
191 connect[i++] = 12;
192 connect[i++] = 13;
193 connect[i++] = 14;
194 connect[i++] = 15;
195
196 assert(i == num_total_faces_per_blk);
197 ex_put_conn (exoid, EX_ELEM_BLOCK, block_id, NULL, NULL, connect);
198 ~~~~
199
200 * Output the number of faces per element count for "nfaced_1":
201 ~~~~C
202 nnpe[1] = 5; /* Number of faces per element 1 */
203 nnpe[2] = 5; /* Number of faces per element 2 */
204 nnpe[3] = 7; /* Number of faces per element 3 */
205
206 ex_put_entity_count_per_polyhedra(exoid, EX_ELEM_BLOCK, block_id, nnpe);
207 ~~~~
208
209 * That's all; the rest of the calls are the same as normal Exodus except:
210
211 * There is a similar `ex_get_entity_count_per_polyhedra()` function for read.
212
213 * The `ex_get_block()` functions return the total number of nodes or
214 faces for all faces or element for "nfaced" and "nsided" blocks
215 and not the number per element
216
217 * An example read/write usage is shown in the
218 [testwt-nfaced.c](../test/testwt-nfaced.c) and [testrd-nfaced](../test/testrd-nfaced.c) files.
219
220 * These changes are in Exodus version v4.93 and later.