« Back to Video Tutorials

Back to Basics: TecIO


TecIO: What It Is and When to Use It

Agenda

Download TecIO from MyTecplot

TecIO source code is available in our customer portal, MyTecplot.

What is TecIO and why should I use it?

What is TecIO?

  • TecIO Library reads *.szplt file format and writes Tecplot binary *.plt and *.szplt file formats. 
  • Provides a consistent API to protect you from internal format changes.
  • Available in C & Fortran.
  • Can be used via Python.
  • Can be used via MATLAB.

Who should use TecIO?

  • Anyone who wants a fast reliable way to store data in Tecplot file format.
  • CFD code developers.
  • PIV users & hardware suppliers.
  • Users of SU2 (source code included in the SU2 repository).
  • Users of FUN3D (requires downloading TecIO from MyTecplot).
    See the blog post, Tecplot SZL File Output from FUN3D.

How do I get TecIO? Is it free?

Precompiled libraries are included in the Tecplot 360 installation. Source code is available in our customer portal MyTecplot.

Do I need to compile TecIO?

  • If you are using MPI on Linux/Mac you’ll almost certainly need compile TecIO.
  • If you need a static library (shared libraries are included in the Tecplot 360 install), you’ll need to compile TecIO.
  • For build instructions see ‘readme.txt’ in the source distribution.

Which format should I use – PLT or SZL?

SZL File Format

  • TecIO-MPI can only write SZL files.
  • You can use SZL server.
  • SZL loads into Tecplot 360 faster.
  • Smaller files when using unstructured grids.
  • Can use TecIO to read.
  • Can use TecIO-Insitu (research).

PLT

  • Polyhedral zone type.
  • Published format (can write your own reader/writer).

Where can I find documentation and example code?

Data Format Guide (PDF)

  • Chapter 3: Binary Data
  • Chapter 5: Reading SZL Data Files
  • Chapter 6: Writing SZL Data Files

Example Code

  • In the Tecplot 360 installation
    <install dir>/utils/tecio/examples
  • In the TecIO source distribution in the ‘examples’ directory

Example Code Walkthrough – Old and New APIs

Old API (TECINI, TECZNE, TECDAT, etc.)

  • Supports PLT & SZL file formats
  • Data types defined for the entire file (limited to single and double precision)
  • Long parameter lists
  • Difficult to support writing to multiple files simultaneously

New API (tecFileWriterOpen, tecZoneCreateFE, etc.)

  • Supports SZL files only (no-polyhedral cell type support)
  • Data types may be specified per variable (and allows integer types)
  • Shorter parameter lists
  • Uses file handles to more easily support writing to multiple files

IJ-Ordered Zone – Old API
ij_ordered.cpp

res = TECINI142("IJ Ordered Zone", "X Y P", "outfile.plt", ".", &FileFormat, &FileType, &Debug, &IsDouble);
res = TECZNE142("Ordered Zone", &ZoneType, &IMax, &JMax, &KMax, 0, 0, 0, &SolutionTime, &StrandID, 0, &IsBlock, 0, 0, 0, 0, 0, NULL, NULL, NULL, 0);
// Create X, Y, P array data...
III = IMax*JMax
res = TECDAT142(III,X,0);
res = TECDAT142(III,Y,0);
res = TECDAT142(III,P,0);
res = TECEND142();


IJ-Ordered Zone – New API
ijkmany.cpp

void* fileHandle = NULL;
res = tecFileWriterOpen("outfile.szplt", "IJ Ordered Dataset", "X,Y,P", fileFormat, fileType, defaultDataType, NULL, fileHandle);
// Create a IJ-Ordered Zone
int32_t zoneHandle;
int varTypes[3] = {1,1,2}; // single, single, double
res = tecZoneCreateIJK(fileHandle, "IJ Ordered Zone", IMax, JMax, KMax, &varTypes[0], NULL, NULL, NULL, 0, 0, 0, &zoneHandle);
// Create X, Y, P array data...
int64_t numPoints = IMax*JMax;
res = tecZoneVarWriteFloatValues(fileHandle, zoneHandle, xVarNum, 0, numPoints , X);
res = tecZoneVarWriteFloatValues(fileHandle, zoneHandle, yVarNum, 0, numPoints , Y);
res = tecZoneVarWriteDoubleValues(fileHandle, zoneHandle, pVarNum, 0, numPoints , P);
res = tecFileWriterClose(&fileHandle);

TecIO In-Situ Research

Research TecIO code has the ability to export SZL files with only the volume cells that meet a specific criteria (e.g. Temperature < 2100 and Temperature > 1900).  This can result in 93% reduction in file size with no “post-processing” on the solver side.

See the attached white papers for details:

Contact support@tecplot.com for access

Sign up to receive invitations to future webinars

Sign up Now!

Related Videos