1 /* This example creates a zone with a single polyhedral cell. */
3 /* DOCSTART:pyramid.txt*/
5 #include "MASTER.h" /* for defintion of NULL */
10 INTEGER4 FileType
= 0; /* 0 for full file */
12 INTEGER4 VIsDouble
= 1;
13 INTEGER4 I
= 0; /* use to check return codes */
15 I
= TECINI112((char*)"Pyramid", /* Data Set Title */
16 (char*)"X Y Z", /* Variable List */
17 (char*)"pyramid.plt", /* File Name */
18 (char*)".", /* Scratch Directory */
25 INTEGER4 ZoneType
= 7; /* 7 for FEPolyhedron */
26 INTEGER4 NumNodes
= 5; /* number of unique nodes */
27 INTEGER4 NumElems
= 1; /* number of elements */
28 INTEGER4 NumFaces
= 5; /* number of unique faces */
30 INTEGER4 ICellMax
= 0; /* Not Used, set to zero */
31 INTEGER4 JCellMax
= 0; /* Not Used, set to zero */
32 INTEGER4 KCellMax
= 0; /* Not Used, set to zero */
34 double SolTime
= 12.65; /* solution time */
35 INTEGER4 StrandID
= 0; /* static zone */
36 INTEGER4 ParentZone
= 0; /* no parent zone */
38 INTEGER4 IsBlock
= 1; /* block format */
40 INTEGER4 NFConns
= 0; /* not used for FEPolyhedron
43 INTEGER4 FNMode
= 0; /* not used for FEPolyhedron
47 INTEGER4
*PassiveVarArray
= NULL
;
48 INTEGER4
*ValueLocArray
= NULL
;
49 INTEGER4
*VarShareArray
= NULL
;
53 /* The number of face nodes in the zone. This example creates
54 * a zone with a single pyramidal cell. This cell has four
55 * triangular faces and one rectangular face, yielding a total
58 INTEGER4 NumFaceNodes
= 16;
59 INTEGER4 NumBConns
= 0; /* No Boundary Connections */
60 INTEGER4 NumBItems
= 0; /* No Boundary Items */
62 I
= TECZNE112((char*)"Polyhedral Zone (Octahedron)",
84 /* Initialize arrays of nodal data */
85 double *X
= new double[NumNodes
];
86 double *Y
= new double[NumNodes
];
87 double *Z
= new double[NumNodes
];
109 /* Write the data (using TECDAT112) */
110 INTEGER4 DIsDouble
= 1; /* One for double precision */
111 I
= TECDAT112(&NumNodes
, X
, &DIsDouble
);
112 I
= TECDAT112(&NumNodes
, Y
, &DIsDouble
);
113 I
= TECDAT112(&NumNodes
, Z
, &DIsDouble
);
119 /* Define the Face Nodes.
121 * The FaceNodes array is used to indicate which nodes define
122 * which face. As mentioned earlier, the number of the nodes is
123 * implicitly defined by the order in which the nodal data is
124 * provided. The first value of each nodal variable describes
125 * node 1, the second value describes node 2, and so on.
127 * The face numbering is implicitly defined. Because there are
128 * two nodes in each face, the first two nodes provided define
129 * face 1, the next two define face 2 and so on. If there was
130 * a variable number of nodes used to define the faces, the
131 * array would be more complicated.
134 INTEGER4
*FaceNodeCounts
= new INTEGER4
[NumFaces
];
135 /* The first four faces are triangular, i.e. have three nodes.
136 * The fifth face is rectangular, i.e. has four nodes. */
137 FaceNodeCounts
[0] = 3;
138 FaceNodeCounts
[1] = 3;
139 FaceNodeCounts
[2] = 3;
140 FaceNodeCounts
[3] = 3;
141 FaceNodeCounts
[4] = 4;
143 INTEGER4
*FaceNodes
= new INTEGER4
[NumFaceNodes
];
144 /* Face Nodes for Face 1 */
149 /* Face Nodes for Face 2 */
154 /* Face Nodes for Face 3 */
159 /* Face Nodes for Face 4 */
164 /* Face Nodes for Face 5 */
170 /* Define the right and left elements of each face.
172 * The last step for writing out the polyhedral data is to
173 * define the right and left neighboring elements for each
174 * face. The neighboring elements can be determined using the
175 * right-hand rule. For each face, place your right-hand along
176 * the face which your fingers pointing the direction of
177 * incrementing node numbers (i.e. from node 1 to node 2).
178 * Your right thumb will point towards the right element; the
179 * element on the other side of your hand is the left element.
181 * The number zero is used to indicate that there isn't an
182 * element on that side of the face.
184 * Because of the way we numbered the nodes and faces, the
185 * right element for every face is the element itself
186 * (element 1) and the left element is "no-neighboring element"
190 INTEGER4
*FaceLeftElems
= new INTEGER4
[NumFaces
];
191 FaceLeftElems
[0] = 1;
192 FaceLeftElems
[1] = 1;
193 FaceLeftElems
[2] = 0;
194 FaceLeftElems
[3] = 0;
195 FaceLeftElems
[4] = 0;
197 INTEGER4
*FaceRightElems
= new INTEGER4
[NumFaces
];
198 FaceRightElems
[0] = 0;
199 FaceRightElems
[1] = 0;
200 FaceRightElems
[2] = 1;
201 FaceRightElems
[3] = 1;
202 FaceRightElems
[4] = 1;
204 /* Write the face map (created above) using TECPOLY112. */
205 I
= TECPOLY112(FaceNodeCounts
, /* The face node counts array */
206 FaceNodes
, /* The face nodes array */
207 FaceLeftElems
, /* The left elements array */
208 FaceRightElems
, /* The right elements array */
209 NULL
, /* No boundary connection counts */
210 NULL
, /* No boundary connection elements */
211 NULL
); /* No boundary connection zones */
213 delete FaceNodeCounts
;
215 delete FaceLeftElems
;
216 delete FaceRightElems
;