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