1 /* This example creates two simple polyhedral zones in the shape
2 * of a three-dimensional arrow. Obscured boundary faces are used.
10 /* DOCSTART:arrow_tecini.txt*/
12 INTEGER4 VIsDouble
= 1;
13 INTEGER4 FileType
= 0;
16 /* Open the file and write the Tecplot datafile
19 I
= TECINI112((char*)"Multiple polyhedral zones", /* Name of the entire
22 (char*)"X Y Z P", /* Defines the variables for the data
23 * file. Each zone must contain each of
24 * the variables listed here. The order
25 * of the variables in the list is used
26 * to define the variable number (e.g.
30 (char*)".", /* Scratch Directory */
38 /* After TECINI is called, call TECZNE to create one or more
39 * zones for your data file. In this example, Zone 1 contains a
40 * single rectangular solid created as a face-based finite-element
41 * (i.e. polyhedral zone). The zone has eight points (or nodes),
42 * six faces and one element.
44 /* DOCSTART:arrow_teczne_rect.txt*/
45 /* TECZNE Parameters */
46 INTEGER4 ZoneType
= 7; /* sets the zone type
48 INTEGER4 NumPts_Rect
= 8;
49 INTEGER4 NumElems_Rect
= 1;
50 INTEGER4 NumFaces_Rect
= 6;
51 INTEGER4 ICellMax
= 0; /* not used */
52 INTEGER4 JCellMax
= 0; /* not used */
53 INTEGER4 KCellMax
= 0; /* not used */
54 double SolutionTime
= 0.0;
55 INTEGER4 StrandID
= 0;
56 INTEGER4 ParentZone
= 0;
58 INTEGER4 NumFaceConnections
= 0; /* not used */
59 INTEGER4 FaceNeighborMode
= 1; /* not used */
60 INTEGER4 SharConn
= 0;
62 /* In a rectangular solid, each face is composed of four nodes.
63 * As such, the total number of face nodes is twenty-four (four
64 * nodes for each of the six faces).
66 INTEGER4 TotalNumFaceNodes_Rect
= 24;
68 /* There is one connected boundary face in this zone (the face on
69 * the rectangle adjacent to the arrowhead). Refer to the Data
70 * Format Guide for additional information. */
71 INTEGER4 NumConnBndryFaces_Rect
= 1;
73 /* The connected boundary face has one connection, the face on
74 * the bottom of the arrowhead. A connection is an element-zone
75 * tuple that indicates a neighboring element (and its zone) when
76 * the neighboring element is in a different zone. Generally,
77 * there will be one boundary connection for each boundary face.
79 INTEGER4 TotalNumBndryConns_Rect
= 1;
81 /* For illustrative purposes, the grid variables (X, Y, and Z)
82 * are nodal variables (i.e. ValueLocation = 1), and the pressure
83 * variable (P) is a cell-centered variable (i.e.
86 INTEGER4 ValueLocation
[4] = { 1, 1, 1, 0 };
88 I
= TECZNE112((char*)"Zone 1: Rectangular Solid",
102 &TotalNumFaceNodes_Rect
,
103 &NumConnBndryFaces_Rect
,
104 &TotalNumBndryConns_Rect
,
112 /* DOCSTART:arrow_tecdat_rect.txt*/
113 //set variable values (X_Rect, Y_Rect, Z_Rect & P_Rect)
114 double *X_Rect
= new double[NumPts_Rect
];
115 double *Y_Rect
= new double[NumPts_Rect
];
116 double *Z_Rect
= new double[NumPts_Rect
];
117 double *P_Rect
= new double[NumElems_Rect
];
119 for (INTEGER4 ii
= 0; ii
<= NumPts_Rect
/ 2; ii
+= 4)
132 for (INTEGER4 ii
= 0; ii
< 4; ii
++)
135 for (INTEGER4 ii
= 4; ii
< NumPts_Rect
; ii
++)
141 INTEGER4 IsDouble
= 1;
142 I
= TECDAT112(&NumPts_Rect
, X_Rect
, &IsDouble
);
143 I
= TECDAT112(&NumPts_Rect
, Y_Rect
, &IsDouble
);
144 I
= TECDAT112(&NumPts_Rect
, Z_Rect
, &IsDouble
);
145 I
= TECDAT112(&NumElems_Rect
, P_Rect
, &IsDouble
);
148 /* DOCSTART:arrow_facenodes_rect.txt*/
150 /* The FaceNodeCounts array is used to describe the number of
151 * nodes in each face of the zone. The first value in the array
152 * is the number of nodes in Face 1, the second value is the
153 * number of nodes in Face 2 and so forth. In this example, each
154 * face of the zone has four nodes.
157 INTEGER4
*FaceNodeCounts_Rect
= new INTEGER4
[NumFaces_Rect
];
158 //For this particular zone, each face has the 4 nodes
159 for (INTEGER4 ii
= 0; ii
< NumFaces_Rect
; ii
++)
160 FaceNodeCounts_Rect
[ii
] = 4;
162 /* The FaceNodes array is used to specify the nodes that compose
163 * each face. For each face (n of N), the number of nodes used
164 * to define the face is specified by the nth value in the
165 * FaceNodeCounts array. For example, if the first value in the
166 * FaceNodeCounts array is 4 (indicating Face 1 is composed of
167 * four nodes), the first four values in the FaceNodes array are
168 * the node numbers of the nodes in Face 1.
172 * When providing the node numbers for each face, you must
173 * provide the node numbers in a consistent order (either
174 * clockwise or counter-clockwise. Providing the node numbers
175 * out of order results in contorted faces.
179 INTEGER4
*FaceNodes_Rect
= new INTEGER4
[TotalNumFaceNodes_Rect
];
182 FaceNodes_Rect
[0] = 1;
183 FaceNodes_Rect
[1] = 2;
184 FaceNodes_Rect
[2] = 3;
185 FaceNodes_Rect
[3] = 4;
188 FaceNodes_Rect
[4] = 1;
189 FaceNodes_Rect
[5] = 4;
190 FaceNodes_Rect
[6] = 8;
191 FaceNodes_Rect
[7] = 5;
194 FaceNodes_Rect
[8] = 5;
195 FaceNodes_Rect
[9] = 8;
196 FaceNodes_Rect
[10] = 7;
197 FaceNodes_Rect
[11] = 6;
200 FaceNodes_Rect
[12] = 2;
201 FaceNodes_Rect
[13] = 6;
202 FaceNodes_Rect
[14] = 7;
203 FaceNodes_Rect
[15] = 3;
206 FaceNodes_Rect
[16] = 6;
207 FaceNodes_Rect
[17] = 2;
208 FaceNodes_Rect
[18] = 1;
209 FaceNodes_Rect
[19] = 5;
212 FaceNodes_Rect
[20] = 3;
213 FaceNodes_Rect
[21] = 7;
214 FaceNodes_Rect
[22] = 8;
215 FaceNodes_Rect
[23] = 4;
218 /* DOCSTART:arrow_neighbors_rect.txt*/
219 INTEGER4
*FaceLeftElems_Rect
= new INTEGER4
[NumFaces_Rect
];
220 INTEGER4
*FaceRightElems_Rect
= new INTEGER4
[NumFaces_Rect
];
222 /* Since this zone has just one element, all leftelems are
223 * NoNeighboring Element and all right elems are itself
225 for (INTEGER4 ii
= 0; ii
< NumFaces_Rect
; ii
++)
227 FaceRightElems_Rect
[ii
] = 1;
228 FaceLeftElems_Rect
[ii
] = 0;
231 /* The negative value in the FaceLeftElems array indicates that
232 * the face is connected to an element in another zone. In this
233 * case, Face 4 is connected to a face in Zone 2 (to be defined
234 * later in the example). The FaceBoundaryConnectionElems array
235 * lists all of the element numbers in other zones that the
236 * current zone shares boundary connections with. Similarly, the
237 * FaceBoundaryConnectionZones array lists all of the zone numbers
238 * with which the current zone shares boundaries. A negative
239 * value in the FaceLeftElems or FaceRightElems array indicates
240 * the position within these arrays that defines the neighboring
241 * element and zone for a face.
243 * For example, if the FaceBoundaryConnectionElems array is:
244 * [1 8 2] and the FaceBoundaryConnectionZones array is: [2 5 3],
245 * a FaceLeftElems or FaceRightElems value of -2 indicates that
246 * the face in question has a boundary connection with Element 8
249 FaceLeftElems_Rect
[3] = -1;
252 /* DOCSTART:arrow_tecpoly_rect.txt*/
253 /* The FaceBndryConnectionCounts array is used to define the
254 * number of boundary connections for each face that has a
255 * boundary connection. For example, if a zone has three boundary
256 * connections in total (NumConnectedBoundaryFaces), two of those
257 * boundary connections are in one face, and the remaining
258 * boundary connection is in a second face, the
259 * FaceBndryConnectionCounts array would be: [2 1].
260 * In this example, the total number of connected boundary faces
261 * (specified via TECZNE) is equal to one, so the
262 * FaceBoundaryConnectionCounts array contains a single value (1).
264 INTEGER4
*FaceBndryConnCounts_Rect
= new INTEGER4
[NumConnBndryFaces_Rect
];
265 FaceBndryConnCounts_Rect
[0] = 1;
267 /* The value(s) in the FaceBndryConnectionElems and
268 * FaceBndryConnectionZones arrays specify the element number and
269 * zone number, respectively, that a given boundary connection is
270 * connected to. In this case, the boundary connection face is
271 * connected to Element 1 in Zone 2.
273 INTEGER4
*FaceBndryConnElems_Rect
= new INTEGER4
[TotalNumBndryConns_Rect
];
274 INTEGER4
*FaceBndryConnZones_Rect
= new INTEGER4
[TotalNumBndryConns_Rect
];
276 FaceBndryConnElems_Rect
[0] = 1;
277 FaceBndryConnZones_Rect
[0] = 2;
279 I
= TECPOLY112(FaceNodeCounts_Rect
,
283 FaceBndryConnCounts_Rect
,
284 FaceBndryConnElems_Rect
,
285 FaceBndryConnZones_Rect
);
292 delete FaceNodeCounts_Rect
;
293 delete FaceNodes_Rect
;
294 delete FaceLeftElems_Rect
;
295 delete FaceRightElems_Rect
;
296 delete FaceBndryConnCounts_Rect
;
297 delete FaceBndryConnElems_Rect
;
298 delete FaceBndryConnZones_Rect
;
301 /* The data for Zone 1 has been written to the data file, so we
302 * are ready to create Zone 2. For simplicity, we will reuse many
303 * of the variables created for the rectangular zone that are not
304 * relevant to this tutorial. */
306 /* Zone 2 (the arrowhead or prism) has a single element composed
307 * of six nodes and five faces.
310 /* DOCSTART:arrow_teczne_prism.txt*/
312 INTEGER4 NumPts_Prism
= 6;
313 INTEGER4 NumElems_Prism
= 1;
314 INTEGER4 NumFaces_Prism
= 5;
316 /* The prism is composed of two triangular faces and three
317 * rectangular faces. The total number of face nodes is the sum
318 * of the nodes in each triangular face (2 times 3) and the nodes
319 * in each rectangular face (3 times 4).
321 INTEGER4 TotalNumFaceNodes_Prism
= 18;
323 /* As with Zone 1, Zone 2 has one connected boundary face, the
324 * face that is connected to Zone 1.
326 INTEGER4 NumConnBndryFaces_Prism
= 1;
328 /* In this case, we have set the total number of boundary
329 * connections for the connected face to two. The first boundary
330 * connection is the connection to Zone 1. The second boundary
331 * connection is used to indicate that the face is only partially
332 * obscured by the face from Zone 1. If we omitted the second
333 * boundary connection, the connected face of the prism would
334 * disappear if the rectangular zone was deactivated.
336 INTEGER4 TotalNumBndryConns_Prism
= 2;
338 I
= TECZNE112((char*)"Zone 2: Prism",
352 &TotalNumFaceNodes_Prism
,
353 &NumConnBndryFaces_Prism
,
354 &TotalNumBndryConns_Prism
,
361 /* DOCSTART:arrow_tecdat_prism.txt*/
364 double *X_Prism
= new double[NumPts_Prism
];
365 double *Y_Prism
= new double[NumPts_Prism
];
366 double *Z_Prism
= new double[NumPts_Prism
];
369 /* Set the X and Y variable values, one z-plane at a time */
371 for (INTEGER4 ii
= 0; ii
< 2; ii
++)
373 // triangle in Z=ZVal plane
376 Z_Prism
[3*ii
] = ZVal
;
380 Z_Prism
[3*ii
+1] = ZVal
;
384 Z_Prism
[3*ii
+2] = ZVal
;
389 /* When we called TecZne, we specified that the variable 4
390 * (pressure) is cell-centered. As such, only NumElements number
391 * of values needs to be written to the data file for the pressure
394 double *P_Prism
= new double[NumElems_Prism
];
397 I
= TECDAT112(&NumPts_Prism
, X_Prism
, &IsDouble
);
398 I
= TECDAT112(&NumPts_Prism
, Y_Prism
, &IsDouble
);
399 I
= TECDAT112(&NumPts_Prism
, Z_Prism
, &IsDouble
);
400 I
= TECDAT112(&NumElems_Prism
, P_Prism
, &IsDouble
);
403 /* DOCSTART:arrow_facemap_prism.txt*/
404 INTEGER4
*FaceNodeCounts_Prism
= new INTEGER4
[NumFaces_Prism
];
405 INTEGER4
*FaceNodes_Prism
= new INTEGER4
[TotalNumFaceNodes_Prism
];
407 /* Because of the way we chose to number our faces, the first
408 * three faces are rectangular and the last two are triangular.
409 * The numbering of the faces is arbitrary, but the faces must
410 * be referred to consistently.
412 for (INTEGER4 ii
= 0; ii
< 3; ii
++)
413 FaceNodeCounts_Prism
[ii
] = 4;
415 for (INTEGER4 ii
= 3; ii
< NumFaces_Prism
; ii
++)
416 FaceNodeCounts_Prism
[ii
] = 3;
419 FaceNodes_Prism
[0] = 1;
420 FaceNodes_Prism
[1] = 3;
421 FaceNodes_Prism
[2] = 6;
422 FaceNodes_Prism
[3] = 4;
425 FaceNodes_Prism
[4] = 1;
426 FaceNodes_Prism
[5] = 4;
427 FaceNodes_Prism
[6] = 5;
428 FaceNodes_Prism
[7] = 2;
431 FaceNodes_Prism
[8] = 3;
432 FaceNodes_Prism
[9] = 2;
433 FaceNodes_Prism
[10] = 5;
434 FaceNodes_Prism
[11] = 6;
437 FaceNodes_Prism
[12] = 5;
438 FaceNodes_Prism
[13] = 4;
439 FaceNodes_Prism
[14] = 6;
442 FaceNodes_Prism
[15] = 1;
443 FaceNodes_Prism
[16] = 2;
444 FaceNodes_Prism
[17] = 3;
447 /* DOCSTART:arrow_neighbors_prism.txt*/
448 /* Since this zone has just one element, all leftelems are
449 * NoNeighboring Element and all right elems are itself.
451 INTEGER4
*FaceLeftElems_Prism
= new INTEGER4
[NumFaces_Prism
];
452 INTEGER4
*FaceRightElems_Prism
= new INTEGER4
[NumFaces_Prism
];
454 for (INTEGER4 ii
= 0; ii
< NumFaces_Prism
; ii
++)
456 FaceRightElems_Prism
[ii
] = 1;
457 FaceLeftElems_Prism
[ii
] = 0;
460 /* The negative value in the FaceLeftElems array indicates that
461 * the face is connected to an element in another zone. In this
462 * case, Face 1 is connected to a face in Zone 1 (as indicated in
463 * Line 6). The FaceBoundaryConnectionElems array lists all of
464 * the element numbers in other zones that the current zone shares
465 * boundary connections with. Similarly, the
466 * FaceBoundaryConnectionZones array lists all of the zone numbers
467 * with which the current zone shares boundaries. A negative
468 * value in the FaceLeftElems or FaceRightElems array indicates
469 * the position within these arrays that defines the neighboring
470 * element and zone for a face.
472 FaceLeftElems_Prism
[0] = -1;
475 /* DOCSTART:arrow_tecpoly_prism.txt*/
477 INTEGER4
*FaceBndryConnCounts_Prism
= new INTEGER4
[NumConnBndryFaces_Prism
];
478 FaceBndryConnCounts_Prism
[0] = 2;
480 INTEGER4
*FaceBndryConnElems_Prism
= new INTEGER4
[TotalNumBndryConns_Prism
];
481 INTEGER4
*FaceBndryConnZones_Prism
= new INTEGER4
[TotalNumBndryConns_Prism
];
483 /* As previously mentioned, a connected boundary face is a face
484 * that has either multiple neighboring faces or neighbor(s) that
485 * belong to another zone. Those cases are sufficient when the
486 * combination of all of the face’s neighbors completely cover the
487 * face. However, there are some cases (such as the bottom of the
488 * arrowhead) where the face is not completely covered by its
489 * neighbors. In those cases the face is referred to as “partially
490 * obscured”. A partially obscured face is indicated by
491 * incrementing the value in TotalNumConnectedBoundaryFaces and
492 * entering a value of 0 in both the FaceBndryConnectionElems and
493 * FaceBoundaryConnectionZones arrays for the boundary connection
494 * for the partially obscured face.
496 FaceBndryConnElems_Prism
[0] = 0;
497 FaceBndryConnZones_Prism
[0] = 0;
499 /* Indicates that Face 1 is connected to Element 1 in Zone 1. */
500 FaceBndryConnElems_Prism
[1] = 1;
501 FaceBndryConnZones_Prism
[1] = 1;
503 I
= TECPOLY112(FaceNodeCounts_Prism
,
506 FaceRightElems_Prism
,
507 FaceBndryConnCounts_Prism
,
508 FaceBndryConnElems_Prism
,
509 FaceBndryConnZones_Prism
);
516 delete FaceNodeCounts_Prism
;
517 delete FaceNodes_Prism
;
518 delete FaceLeftElems_Prism
;
519 delete FaceRightElems_Prism
;
520 delete FaceBndryConnCounts_Prism
;
521 delete FaceBndryConnElems_Prism
;
522 delete FaceBndryConnZones_Prism
;
525 /* DOCSTART:arrow_tecend.txt*/