BINARY FILE FORMAT: ----------------------------------------------------------------------- The binary Datafile format (as produced by the preplot) is described below. The binary datafile has two main sections. A header section and a data section. +----------------+ | HEADER SECTION | +----------------+ +---------+ |FLOAT32 | EOHMARKER, value=357.0 +---------+ +----------------+ | DATA SECTION | +----------------+ I. HEADER SECTION The header section contains The version number of the file, a title of the file, the names of the varialles to be plotted, the descriptions of all zones to be read in and all text and geometry definitions. i. Magic number, Version number +-----------+ | "#!TDV108"| 8 Bytes, exact characters "#!TDV108". +-----------+ Version number follows the "V" and consumes the next 3 characters (for example: "V75 ", "V101"). ii. Integer value of 1. +-----------+ | INT32 | This is used to determine the byte order +-----------+ of the reader relative to the writer. iii. Title and variable names. +-----------+ | INT32*N | The TITLE. (See note 1.) +-----------+ +-----------+ | INT32 | Number of variables (NumVar) in the datafile. +-----------+ +-----------+ | INT32*N | Variable names. N = L[1] + L[2] + .... L[NumVar] +-----------+ where: L[i] = length of the ith variable name + 1 (for the terminating 0 value). (See note 1.) iv. Zones +-----------+ | FLOAT32 | Zone marker. Value = 299.0 +-----------+ +-----------+ | INT32*N | Zone name. (See note 1.) N = length of zone name + 1. +-----------+ +-----------+ | INT32 | ParentZone: Zero based zone number within this datafile +-----------+ to which this zone is a child. +-----------+ | INT32 | StrandID: -2 = pending strand ID for assignment by Tecplot, +-----------+ -1 = static strand ID 0 <= N < 32700 valid strand ID +-----------+ | FLOAT64 | Solution time. +-----------+ +-----------+ | INT32 | Zone Color (set to -1 if you want tecplot to +-----------+ determine). +-----------+ | INT32 | ZoneType 0=ORDERED,1=FELINESEG,2=FETRIANGLE, +-----------+ 3=FEQUADRILATERAL,4=FETETRAHEDRON,5=FEBRICK +-----------+ | INT32 | DataPacking 0=Block, 1=Point +-----------+ +-----------+ | INT32 | Specify Var Location. 0 = Don't specify, all data is +-----------+ located at the nodes. 1 = Specify if "specify var location" == 1 +-----------+ | INT32*NV | Variable Location (only specify if above is 1). +-----------+ 0 = Node, 1 = Cell Centered (See note 5.) +-----------+ | INT32 | Are raw local 1-to-1 face neighbors supplied? (0=FALSE 1=TRUE) +-----------+ These raw values are a compact form of the local 1-to-1 face neighbors are fully specified and therefore it will not perform auto face neighbor assignment, thereby improving Tecplot's time to first plot. See data section below for format details. ORDERED and FELINESEG zones must specify 0 for this value since raw face neighbors are not defined for these zone types. +-----------+ | INT32 | Number of miscellaneous user defined face neighbor connections +-----------+ (value >= 0) This value is in addition to the face neighbors supplied in the raw section. if "number of miscellaneous user defined face neighbor connections" != 0 +-----------+ | INT32 | User defined face neighbor mode +-----------+ (0=Local 1-to-1, 1=Local 1-to-many, 2=Global 1-to-1, 3=Global 1-to-many) if FE Zone: +-----------+ | INT32 | Indicates if the finite element face neighbors are +-----------+ completely specified by the miscellaneous face neighbors given: (0=NO, 1=YES). If yes, then Tecplot will not perform auto assignment of face neighbors otherwise all faces not specified are considered boundaries. If no, then Tecplot will perform auto-assignment of the face neighbors unless the raw face neighbor array was supplied. This option is not valid for ORDERED zones. if Ordered Zone: +-----------+ | INT32*3 | IMax,JMax,KMax +-----------+ if FE Zone: +-----------+ | INT32 | NumPts +-----------+ +-----------+ | INT32 | NumElements. +-----------+ +-----------+ | INT32*3 | ICellDim,JCellDim,KCellDim (for future use; set to zero) +-----------+ For all zone types (repeat for each Auxiliary data name/value pair): +-----------+ | INT32 | 1=Auxiliary name/value pair to follow +-----------+ 0=No more Auxiliar name/value pairs. If the above is 1, then supply the following: +-----------+ | INT32*N | name string (See note 1.) +-----------+ +-----------+ | INT32 | Auxiliary Value Format (Currently only allow 0=AuxDataType_String) +-----------+ +-----------+ | INT32*N | value string (See note 1.) +-----------+ v. Geometries +-----------+ | FLOAT32 | Geometry marker. Value = 399.0 +-----------+ +-----------+ | INT32 | Position CoordSys 0=Grid, 1=Frame, 2=FrameOffset(not used), +-----------+ 3= OldWindow(not used), 4=Grid3D(New to V10) +-----------+ | INT32 | Scope 0=Global 1=Local +-----------+ +-----------+ | INT32 | DrawOrder 0=After, 1=Before +-----------+ +-----------+ | FLOAT64*3 | (X or Theta),(Y or R),(Z or dummy) i.e. the starting location +-----------+ +-----------+ | INT32 | Zone (0=all) +-----------+ +-----------+ | INT32 | Color +-----------+ +-----------+ | INT32 | FillColor +-----------+ +-----------+ | INT32 | IsFilled (0=no 1=yes) +-----------+ +-----------+ | INT32 | GeomType 0=Line, 1=Rectangle 2=Square, +-----------+ 3=Circle, 4=ellipse +-----------+ | INT32 | LinePattern 0=Solid 1=Dashed 2=DashDot 3=Dotted... +-----------+ +-----------+ | FLOAT64 | Pattern Length +-----------+ +-----------+ | FLOAT64 | Line Thickness +-----------+ +-----------+ | INT32 | NumEllipsePts +-----------+ +-----------+ | INT32 | Arrowhead Style 0=Plain, 1=Filled, 2=Hollow +-----------+ +-----------+ | INT32 | Arrowhead Attachment 0=None, 1=Beg, 2=End, 3=Both +-----------+ +-----------+ | FLOAT64 | Arrowhead Size +-----------+ +-----------+ | FLOAT64 | Arrowhead Angle +-----------+ +-----------+ | IN32*N | Macro Function Command (string: N = Length+1) +-----------+ +-----------+ | INT32 | Polyline Field Data Type 1=Float, 2=Double (GTYPE) +-----------+ +-----------+ | INT32 | Clipping (0=ClipToAxes,1=ClipToViewport,2=ClipToFrame) +-----------+ If the geometry type is line then: +-----------+ | INT32 | Number of polylines +-----------+ +-----------+ | INT32 | Number of points, line 1. +-----------+ +-----------+ | GTYPE*N | X-block geometry points N=NumPts +-----------+ +-----------+ | GTYPE*N | Y-block geometry points N=NumPts +-----------+ +-----------+ | GTYPE*N | Z-block geometry points N=NumPts (Grid3D Only) +-----------+ . . . If the geometry type is Rectangle then +-----------+ | GTYPE*2 | X and Y offset for far corner of rectangle +-----------+ If the geometry type is Circle then +-----------+ | GTYPE | Radius +-----------+ If the geometry type is Square then +-----------+ | GTYPE | Width +-----------+ If the geometry type is Ellipse then +-----------+ | GTYPE*2 | X and Y Radii +-----------+ vi. Text +-----------+ | FLOAT32 | Text marker. Value=499.0 +-----------+ +-----------+ | INT32 | Position CoordSys 0=Grid, 1=Frame, 2=FrameOffset(not used), +-----------+ 3= OldWindow(not used), 4=Grid3D(New to V10) +-----------+ | INT32 | Scope 0=Global 1=Local +-----------+ +-----------+ | FLOAT64*3 | (X or Theta),(Y or R),(Z or dummy) Starting Location +-----------+ +-----------+ | INT32 | FontType +-----------+ +-----------+ | INT32 | Character Height Units 0=Grid, 1=Frame, 2=Point +-----------+ +-----------+ | FLOAT64 | Height of characters +-----------+ +-----------+ | INT32 | Text Box type 0=NoBox 1=Hollow 2=Filled +-----------+ +-----------+ | FLOAT64 | Text Box Margin +-----------+ +-----------+ | FLOAT64 | Text Box Margin Linewidth +-----------+ +-----------+ | INT32 | Text Box Outline Color +-----------+ +-----------+ | INT32 | Text Box Fill Color +-----------+ +-----------+ | FLOAT64 | Angle +-----------+ +-----------+ | FLOAT64 | Line Spacing +-----------+ +-----------+ | INT32 | Text Anchor. 0=left, 1=center, 2=right, +-----------+ 3=midleft 4=midcenter 5=midright, 6=headleft 7=headcenter 8=headright +-----------+ | INT32 | Zone (0=all) +-----------+ +-----------+ | INT32 | Color +-----------+ +-----------+ | INT32*N | MacroFunctionCommand (string: N = Length + 1) +-----------+ +-----------+ | INT32 | Clipping (0=ClipToAxes,1=ClipToViewport,2=ClipToFrame) +-----------+ +-----------+ | INT32*N | Text. N=Text Length+1 +-----------+ vii.CustomLabel +-----------+ | FLOAT32 | CustomLabel Marker; F=599 +-----------+ +-----------+ | INT32 | Number of labels +-----------+ +-----------+ | INT32*N | Text for label 1. (N=length of label + 1) See note 1. +-----------+ +-----------+ | INT32*N | Text for label 2. (N=length of label + 1) See note 1. +-----------+ . . . +-----------+ | INT32*N | Text for label NumLabels. (N=length of label + 1) See note 1. +-----------+ viii.UserRec +-----------+ | FLOAT32 | UserRec Marker; F=699 +-----------+ +-----------+ | INT32*N | Text for UserRec. See note 1. +-----------+ ix. Dataset Auxiliary data. +-----------+ | FLOAT32 | DataSetAux Marker; F=799.0 +-----------+ +-----------+ | INT32*N | Text for Auxiliary "Name". See note 1. +-----------+ +-----------+ | INT32 | Auxiliary Value Format (Currently only +-----------+ allow 0=AuxDataType_String) +-----------+ | INT32*N | Text for Auxiliary "Value". See note 1. +-----------+ x. Variable Auxiliary data. +-----------+ | FLOAT32 | VarAux Marker; F=899.0 +-----------+ +-----------+ | INT32*N | Variable number (zero based value) +-----------+ +-----------+ | INT32*N | Text for Auxiliary "Name". See note 1. +-----------+ +-----------+ | INT32 | Auxiliary Value Format (Currently only +-----------+ allow 0=AuxDataType_String) +-----------+ | INT32*N | Text for Auxiliary "Value". See note 1. +-----------+ II. DATA SECTION (don't forget to separate the header from the data with an EOHMARKER) The data section contains all of the data associated with the zone definitions in the header. i. For both ordered and fem zones: +-----------+ | FLOAT32 | Zone marker Value = 299.0 +-----------+ +-----------+ | INT32*N | variable data format, N=Total number of vars +-----------+ 1=Float, 2=Double, 3=LongInt, 4=ShortInt, 5=Byte, 6=Bit +-----------+ | INT32 | Has passive variables: 0 = no, 1 = yes. +-----------+ if "has passive variables" != 0 +-----------+ | INT32*NV | Is variable passive: 0 = no, 1 = yes +-----------+ (Omit entirely if "Has passive variables" is 0). +-----------+ | INT32 | Has variable sharing 0 = no, 1 = yes. +-----------+ if "has variable sharing" != 0 +-----------+ | INT32*NV | Zero based zone number to share variable with (relative to this datafile). +-----------+ (-1 = no sharing). (Omit entirely if "Has variable sharing" is 0). +-----------+ | INT32 | Zero based zone number to share connectivity list with (-1 = no sharing). +-----------+ Compressed list of min/max pairs for each non-shared and non-passive variable. For each non-shared and non-passive varaible (as specified above): +-----------+ | FLOAT64 | Min value +-----------+ +-----------+ | FLOAT64 | Max value +-----------+ +-----------+ | xxxxxxxxxx| Zone Data. Each variable is in data format as +-----------+ specified above. ii. specific to ordered zones if "zone number to share connectivity list with" == -1 && "number of miscellaneous user defined face neighbor connections" != 0 +-----------+ | INT32*N | Face neighbor connections. +-----------+ N = (number of miscellaneous user defined face neighbor connections) * P (See note 5 below). iii. specific to fem zones if "zone number to share connectivity lists with" == -1 +-----------+ | INT32*N | Zone Connectivity Data N=L*JMax (see note 3 below). +-----------+ if "zone number to share connectivity lists with" == -1 && "raw local 1-to-1 face neighbors are supplied" +-----------+ | INT32*N | Raw local 1-to-1 face neighbor array. +-----------+ N = (NumElements * NumFacesPerElement) (See note 4 below). if "zone number to share connectivity lists with" == -1 && "number of miscellaneous user defined face neighbor connections" != 0 +-----------+ | INT32*N | Face neighbor connections. +-----------+ N = (number of miscellaneous user defined face neighbor connections) * P (See note 5 below). NOTES: 1. All character data is represented by INT32 values. Example: The letter "A" has an ASCII value of 65. The WORD written to the data file for the letter "A" is then 65. In fortran this could be done by doing the following: Integer*32 I . . I = ICHAR('A'); WRITE(10) I All character strings are null terminated (i.e. terminated by a zero value) 2. In FE Data I = Number of points, J = Number of elements, and K = Element type where: 0 = Triangles; 1 = Quadrilaterals; 2 = Tetrahedrons. 3 = Bricks. 4 = LineSeg 3. This represents JMax sets of adjacency zero based indices where each set contains L values where L is 3 for TRIANGLES 4 for QUADRILATERALS 4 for TETRAHEDRONS 8 for BRICKS 4. The raw face neighbor array is dimensioned by number of elements for the zone times the number of faces per element where each member of the array holds the zero based element neighbor of that face. A boundary face is one that no neighboring element and is represented by a -1. Faces should only be neighbors if they logically share nodes and they should be reciprocal. 5. FaceNeighbor Mode # values Data --------------------------------------------------------------------- LocalOneToOne 3 cz,fz,cz LocalOneToMany nz+4 cz,fz,oz,nz,cz1,cz2,...,czn GlobalOneToOne 4 cz,fz,ZZ,CZ GlobalOneToMany 2*nz+4 cz,fz,oz,nz,ZZ1,CZ1,ZZ2,CZ2,...,ZZn,CZn Where: cz = cell in current zone (zero based) fz = face of cell in current zone (zero based) oz = face obsuration flag (only applies to one-to-many): 0 = face partially obscured 1 = face entirely obscured nz = number of cell or zone/cell associations (only applies to one-to-many) ZZ = remote Zone (zero based) CZ = cell in remote zone (zero based) cz,fz combinations must be unique and multiple entries are not allowed. Additionally, Tecplot assumes that with the one-to-one face neighbor modes a supplied cell face is entirely obscured by it's neighbor. With one-to-many, the obscuration flag must be supplied. Face neighbors that are not supplied are run through Tecplot's auto face neighbor generator (FE only). 5. Cell centered variable (DATA SECTION) To make reading of cell centered binary data efficient, Tecplot stores IMax*JMax*KMax numbers of cell centered values, where IMax, JMax, and KMax represent the number of points in the I, J, and K directions. Therefore extra zero values (ghost values) are written to the data file for the slowest moving indices. For example if your data's IJK dimensions are 2x3x2 a cell centered variable will have 1x2x1 (i.e. (I-1)x(J-1)x(K-1)) significant values however 2x3x2 values must be written out because it must include the ghost values. Assume that the two significant cell centered values are 1.5 and 12.5. The ghost values will be output with a zero value. So if the zone was dimensioned 2x3x2 it's cell centered variable would be represented as follows: 1.5 0.0 12.5 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 If the zone was dimensioned 3x2x2 it's cell centered variable would be represented as follows: 1.5 12.5 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 and if the zone was dimensioned 2x2x3 it's cell centered variable would be represented as follows: 1.5 0.0 0.0 0.0 12.5 0.0 0.0 0.0 0.0 0.0 0.0 0.0 Obviously for large variables the wasted space is less significant that it is for the small example above. ----------------------------------------------------------------------- COMPILING: ----------------------------------------------------------------------- Preplot was originally developed in PASCAL and then later converted to C. To compile preplot use one of the following commands: For UNIX, et.al.: cc preplot.cpp -DPLOT3D -DUNIXX -DCRAYT3M -o preplot (Cray T3M only) cc preplot.cpp -DPLOT3D -DUNIXX -DOLDCRAY -o preplot (Older crays like YMP's) cc preplot.cpp -DPLOT3D -DUNIXX -DOLDCRAY -DWEEDMIDBLOCKS -o preplot cc preplot.cpp -DPLOT3D -DUNIXX -DCRAYIEEE -o preplot cc preplot.cpp -DPLOT3D -DUNIXX -DIRIS -o preplot cc preplot.cpp -DPLOT3D -DUNIXX -DSUN -o preplot cc preplot.cpp -DPLOT3D -DUNIXX -DDEC -o preplot cc preplot.cpp -DPLOT3D -DUNIXX -DHITACHI -o preplot cc preplot.cpp -DPLOT3D -DUNIXX -DDECALPHA -o preplot cc preplot.cpp -DPLOT3D -DUNIXX -DCOMPAQALPHA -o preplot cc preplot.cpp -DPLOT3D -DUNIXX -DHP -o preplot cc preplot.cpp -DPLOT3D -DUNIXX -DLINUX -o preplot cc preplot.cpp -DPLOT3D -DUNIXX -DIBMRS6000 -o preplot In addition, you can modify the io buffer size used by preplot by putting the following define at the top of this file: #define TECBUFSIZE nnnn where nnnn is the size that you want the buffers to be set to. A good place to start would be somthing like 1024*16. For Windows: cl /DMSWIN preplot.cpp (Microsoft C) Including the -DPLOT3D flag adds the capability to read plot3d files. If you have some other "generic" unix system then most likely the IRIS version of the compile command should work. If you still have problems then you may have to do some customizing yourself (In which case please let us know what you came up with). MACHINE SPECIFIC NOTES: if -DCRAYIEEE is used with the CRAY version then this creates a version of preplot that can process IEEE binary files on a CRAY. The prceedure to follow is: 1. Issue the cray command to force all future writes from a FORTRAN program to a selected unit number or filename to be written in IEEE format. The command is: assign -N ieee -f f77 f:fname or assign -N ieee -f f77 u:# where fname is a file name to make the assignment to and # is a FORTRAN unit number to assign to. To list all assignments use: assign -V To remove an assignment use: assign -R 2. Run your FORTRAN application - creating an IEEE formatted PLOT3D file. 3. Run this special version of preplot on the IEEE PLOT3D file. Make sure and include -plot3d and -f flags in the preplot command line. -----------------------------------------------------------------------