TecIO Read Capability
“Good things come to those who wait!”
– Guinness beer advertisement
For many years, TecIO has been a library of utility functions that allow you to output Tecplot binary files directly from your application. There are two versions of TecIO, one for serial output, and one for MPI-based parallel output.
- The serial-output version can output either classic Tecplot binary *.plt (PLT) files or the new Tecplot subzone *.szplt (SZL) files.
- The MPI-based parallel-output version can only output the new Tecplot SZL files.
Ever since we initially released the TecIO library we’ve had the intention of adding an API for reading binary data. The advantages are obvious. Reading capability would allow Tecplot binary files to be used as input for further analysis, or as a restart file for an unsteady or iterative analysis code.
Unfortunately, except for a short period several years ago, we never got around to adding read capability. TecIO was misnamed – it really should have been called TecO.
TecIO Reads SZL Binary Files
This has all changed! Starting with Tecplot 360 2017 Release 1, the TecIO library can be used to read data from Tecplot SZL binary files. For now, we don’t support reading of the classic PLT Tecplot binary format. If this is something you are interested in, please let me know (email firstname.lastname@example.org).
Our TecIO API’s are written to be compatible with C and FORTRAN, although it should work with any language that can call a C function. In all, there are more than a hundred functions in the TecIO read API. These functions allow you to read nearly any object that can be stored in a SZL file, but you can pick and choose which data you read.
How to Read Zone Data from a File
I will give a brief overview of how you would read zone data from a file, but will skip the APIs for reading geometries, text, custom label sets, strings, and auxiliary data. The APIs for reading these objects are described in chapter 5 of the Tecplot 360 Data Format Guide. The data format guide can be accessed from the Welcome screen on Tecplot 360 2017 or as a PDF file in the doc subfolder of the Tecplot home directory. This information is also available on our documentation.
There is an example application called rewriteszl in the $TEC360HOME/util/tecio/examples directory that will read a SZL file and write it back out again. Not a very useful utility, but it demonstrates the API.
If you look in the rewriteszl.cpp module, you will see the basic sequence of function calls.
- Open a SZL file using tecFileReaderOpen(…)
- Read the dataset title using tecDataSetGetTitle(…)
- Read the number of variables using tecDataSetGetNumVars(…) and tecDataSetGetNumZones(…)
That is the basic file header data. Farther down in rewriteszl.cpp are the basic functions to actually read the field data. These include tecZoneVarGetNumValues(…), tecZoneVarGetFloatValues(…), and a host of others. In each case the function name gives a fairly good description of the functions purpose.
How to Obtain TecIO Libraries
There are now separate TecIO libraries for scalar and for MPI-based parallel output. Both libraries are included in TecIO library package.