Forward compatibility: flex
[foam-extend-3.2.git] / applications / utilities / postProcessing / dataConversion / foamToTecplot360 / tecio / examples / simtest / simtest.c
blobfe35a33234ad2583614c0cf55337a2668598a905
1 /*
2 * Simple example c program to write a
3 * binary datafile for tecplot. This example
4 * does the following:
6 * 1. Open a datafile called "t.plt"
7 * 2. Assign values for X,Y, and P
8 * 3. Write out a zone dimensioned 4x5
9 * 4. Close the datafile.
12 #include "TECIO.h"
14 #ifndef NULL
15 #define NULL 0
16 #endif
18 enum FileType { FULL = 0, GRID = 1, SOLUTION = 2 };
20 int main(void)
22 float X[5][4], Y[5][4], P[5][4];
23 double SolTime;
24 INTEGER4 Debug, I, J, III, DIsDouble, VIsDouble, IMax, JMax, KMax, ZoneType, StrandID, ParentZn, IsBlock;
25 INTEGER4 ICellMax, JCellMax, KCellMax, NFConns, FNMode, ShrConn, FileType;
27 Debug = 1;
28 VIsDouble = 0;
29 DIsDouble = 0;
30 IMax = 4;
31 JMax = 5;
32 KMax = 1;
33 ZoneType = 0; /* Ordered */
34 SolTime = 360.0;
35 StrandID = 0; /* StaticZone */
36 ParentZn = 0; /* No Parent */
37 IsBlock = 1; /* Block */
38 ICellMax = 0;
39 JCellMax = 0;
40 KCellMax = 0;
41 NFConns = 0;
42 FNMode = 0;
43 ShrConn = 0;
44 FileType = FULL;
47 * Open the file and write the tecplot datafile
48 * header information
50 I = TECINI112((char*)"SIMPLE DATASET",
51 (char*)"X Y P",
52 (char*)"t.plt",
53 (char*)".",
54 &FileType,
55 &Debug,
56 &VIsDouble);
58 for (J = 0; J < 5; J++)
59 for (I = 0; I < 4; I++)
61 X[J][I] = (float)(I + 1);
62 Y[J][I] = (float)(J + 1);
63 P[J][I] = (float)((I + 1) * (J + 1));
66 * Write the zone header information.
68 I = TECZNE112((char*)"Simple Zone",
69 &ZoneType,
70 &IMax,
71 &JMax,
72 &KMax,
73 &ICellMax,
74 &JCellMax,
75 &KCellMax,
76 &SolTime,
77 &StrandID,
78 &ParentZn,
79 &IsBlock,
80 &NFConns,
81 &FNMode,
82 0, /* TotalNumFaceNodes */
83 0, /* NumConnectedBoundaryFaces */
84 0, /* TotalNumBoundaryConnections */
85 NULL, /* PassiveVarList */
86 NULL, /* ValueLocation = Nodal */
87 NULL, /* SharVarFromZone */
88 &ShrConn);
90 * Write out the field data.
92 III = IMax * JMax;
93 I = TECDAT112(&III, &X[0][0], &DIsDouble);
94 I = TECDAT112(&III, &Y[0][0], &DIsDouble);
95 I = TECDAT112(&III, &P[0][0], &DIsDouble);
97 I = TECEND112();
99 return 0;