1 /* This example illustrates using separate grid
6 #include "MASTER.h" /* for defintion of NULL */
10 /* DOCSTART:gridsolution_grid_tecini.txt*/
11 INTEGER4 I
; /* use to check return values */
14 INTEGER4 VIsDouble
= 0;
15 INTEGER4 FileType
= 1; /* 1 = grid file. */
17 I
= TECINI112((char*)"Example: Separate grid and solution files",
18 (char*)"X Y Z", /* Defines the variables for the data file.
19 * Each zone must contain each of the vars
20 * listed here. The order of the variables
21 * in the list is used to define the
22 * variable number (e.g. X is Variable 1).
23 * When referring to variables in other
24 * TecIO functions, you will refer to the
25 * variable by its number.
28 (char*)".", /* scratch directory */
34 /* DOCSTART:gridsolution_grid_teczne.txt*/
35 /* TECZNE Parameters */
36 INTEGER4 ZoneType
= 7; /* FE Polyhedron */
37 INTEGER4 NumPts
= 20; /* the number of unique
40 INTEGER4 NumElems
= 1;
41 INTEGER4 NumFaces
= 12; /* the number of unique
44 INTEGER4 ICellMax
= 0; /* not used */
45 INTEGER4 JCellMax
= 0; /* not used */
46 INTEGER4 KCellMax
= 0; /* not used */
47 double SolutionTime
= 0.0;
48 INTEGER4 StrandID
= 1; /* time strand for
51 INTEGER4 ParentZone
= 0;
53 INTEGER4 NumFaceConnections
= 0;
54 INTEGER4 FaceNeighborMode
= 1;
55 INTEGER4 SharConn
= 0;
57 /* For this zone, the total number of face nodes is
58 * five times number of faces, because each face
61 INTEGER4 TotalNumFaceNodes
= 5 * NumFaces
;
63 /* This zone has no connected boundary faces.
65 INTEGER4 TotalNumBndryFaces
= 0;
66 INTEGER4 TotalNumBndryConns
= 0;
68 I
= TECZNE112((char*)"Dodecahedron", /* Name of the zone. */
86 NULL
, /* All nodal variables */
91 /* DOCSTART:gridsolution_grid_tecdat.txt*/
93 /* TECDAT Parameters */
94 double Phi
= 0.5 * (1.0 + sqrt(5.0));
95 double Pi
= 3.141592653578;
96 double *X
= new double[NumPts
];
97 double *Y
= new double[NumPts
];
98 double *Z
= new double[NumPts
];
101 for(int J
= 0; J
<= 4; J
++)
103 X
[Count
] = 2.0 * cos(2.0 / 5.0 * Pi
* J
);
104 Y
[Count
] = 2.0 * sin(2.0 / 5.0 * Pi
* J
);
105 Z
[Count
] = Phi
+ 1.0;
108 X
[Count
] = -X
[Count
- 1];
109 Y
[Count
] = -Y
[Count
- 1];
110 Z
[Count
] = -Z
[Count
- 1];
113 X
[Count
] = 2.0 * Phi
* cos(2.0 / 5.0 * Pi
* J
);
114 Y
[Count
] = 2.0 * Phi
* sin(2.0 / 5.0 * Pi
* J
);
115 Z
[Count
] = Phi
- 1.0;
118 X
[Count
] = -X
[Count
- 1];
119 Y
[Count
] = -Y
[Count
- 1];
120 Z
[Count
] = -Z
[Count
- 1];
124 INTEGER4 IsDouble
= 1;
126 I
= TECDAT112(&NumPts
, X
, &IsDouble
);
127 I
= TECDAT112(&NumPts
, Y
, &IsDouble
);
128 I
= TECDAT112(&NumPts
, Z
, &IsDouble
);
136 /* DOCSTART:gridsolution_grid_facenodes.txt*/
137 /* TecPoly Parameters */
139 /* Create a FaceNodes array, dimensioned by the total number
140 * of face nodes in the zone.
142 INTEGER4
*FaceNodes
= new INTEGER4
[TotalNumFaceNodes
];
145 /* Face Nodes for face 1 of the dodecahedron */
152 /* Face Nodes for face 2 */
159 /* Face Nodes for face 3 */
166 /* Face Nodes for face 4 */
173 /* Face Nodes for face 5 */
180 /* Face Nodes for face 6 */
187 /* Face Nodes for face 7 */
194 /* Face Nodes for face 8 */
201 /* Face Nodes for face 9 */
208 /* Face Nodes for face 10 */
215 /* Face Nodes for face 11 */
222 /* Face Nodes for face 12 */
231 /* Specify the number of nodes for each face, and the right and
232 * left neighboring elements. The neighboring elements can be
233 * determined using the right-hand rule. For each face, curl
234 * the fingers of your right hand in the direction of
235 * incrementing node numbers (i.e. from Node 1 to Node 2 and
236 * so on). Your thumb will point toward the right element.
237 * A value of zero indicates that there is no
238 * neighboring element on that side. A negative value
239 * indicates that the neighboring element is in another zone.
240 * In that case, the number is a pointer into the
241 * FaceBndryConnectionElems and FaceBndryConnectionZones arrays.
244 /* DOCSTART:gridsolution_grid_tecpoly.txt*/
245 INTEGER4
*FaceNodeCounts
= new INTEGER4
[NumFaces
];
246 INTEGER4
*FaceLeftElems
= new INTEGER4
[NumFaces
];
247 INTEGER4
*FaceRightElems
= new INTEGER4
[NumFaces
];
249 /* For this particular zone, each face has the 5 nodes. */
250 for(int J
= 0; J
< NumFaces
; J
++)
251 FaceNodeCounts
[J
] = 5;
253 /* Set the right and left elements for each face. */
254 FaceRightElems
[0] = 1;
255 FaceRightElems
[1] = 1;
256 FaceRightElems
[2] = 0;
257 FaceRightElems
[3] = 0;
258 FaceRightElems
[4] = 0;
259 FaceRightElems
[5] = 1;
260 FaceRightElems
[6] = 1;
261 FaceRightElems
[7] = 0;
262 FaceRightElems
[8] = 0;
263 FaceRightElems
[9] = 1;
264 FaceRightElems
[10] = 1;
265 FaceRightElems
[11] = 0;
267 FaceLeftElems
[0] = 0;
268 FaceLeftElems
[1] = 0;
269 FaceLeftElems
[2] = 1;
270 FaceLeftElems
[3] = 1;
271 FaceLeftElems
[4] = 1;
272 FaceLeftElems
[5] = 0;
273 FaceLeftElems
[6] = 0;
274 FaceLeftElems
[7] = 1;
275 FaceLeftElems
[8] = 1;
276 FaceLeftElems
[9] = 0;
277 FaceLeftElems
[10] = 0;
278 FaceLeftElems
[11] = 1;
280 I
= TECPOLY112(FaceNodeCounts
,
284 NULL
, /* No boundary connections. */
289 delete FaceLeftElems
;
290 delete FaceRightElems
;
295 /* DOCSTART:gridsolution_grid_tecend.txt*/
299 /* DOCSTART:gridsolution_solution_tecini.txt*/
300 for(int J
= 0; J
< 5; J
++)
302 char SolutionFileName
[128];
303 sprintf(SolutionFileName
, "solution%d.plt", J
);
305 /* DOCSTART:gridsolution_solution_tecini.txt*/
306 FileType
= 2; /* 1 = solution file. */
308 I
= TECINI112((char*)"Example: Separate grid and solution files",
309 (char*)"P T", /* Defines the variables for the solution file.
310 * Note that these are different variables from
314 (char*)".", /* scratch directory */
320 /* DOCSTART:gridsolution_solution_teczne.txt*/
321 /* TECZNE Parameters are mostly unchanged from creation of the grid file. */
322 TotalNumFaceNodes
= 0;
326 sprintf(ZoneName
, "Dodecahedron Time=%g", SolutionTime
);
327 I
= TECZNE112(ZoneName
,
345 NULL
, /* All nodal variables */
350 /* DOCSTART:gridsolution_solution_tecdat.txt*/
352 /* TECDAT Parameters */
353 double *P
= new double[NumPts
];
354 double *T
= new double[NumPts
];
356 for(int K
= 0; K
< NumPts
; K
++)
358 P
[K
] = (double)(K
+ J
);
362 I
= TECDAT112(&NumPts
, P
, &IsDouble
);
363 I
= TECDAT112(&NumPts
, T
, &IsDouble
);
370 /* DOCSTART:gridsolution_solution_tecend.txt*/