C Function Wrappers#

Python bindings for the TecIO C library.

Ctypes bindings for both the new SZL API (tec_*) and the classic PLT API (tec*142), and a Python wrapper function for each C entry point. The TecIO library often uses integers with special meanings (zone types, data types, data locations). The same values are used both for writing and for SZL reading and writing. Enum classes with descriptive names are defined in tecio._constants and imported here.

Notes

  • The ctypes bindings are defined conditionall if the symbol exists in the loaded TecIO shared object binary such that older versions not containing newer (often niche) functions such as tecznefemixed142() do not cause the entire tecio Python package to fail to load.

  • Only loading the available symbols also allows for the tecio Python package to be used without any TecIO shared object binary available as it is only needed for SZL read/write and PLT write. DAT read/write and PLT read have pure Python implementations and do not have external dependencies other than NumPy.

  • The load/bind/guard mechanism is defined in tecio._utils

  • After binding, a one-line summary is emitted via warnings (category TecioAvailabilityWarning) if anything is disabled and is available as data via LIBRARY_LOAD_ERROR and UNAVAILABLE_FUNCTIONS.

tecio.libtecio provides the direct interface with the TecIO C library functions. Each is wrapped in an equivalent Python function that also handles conversion between Python data objects and C-compatible ones, and back again for the read functions.

These are the basis of the tecio Python package; each reader and writer class provides a higher-level interface built on top of them. However, the Python wrapper functions here are kept in the public API to allow calling the TecIO library directly, if desired.

Partial or Missing TecIO Shared Library#

Importing tecio.libtecio never raises, even if the TecIO shared library can’t be found at all, or the library that is found predates a newer C entry point (e.g. tecznefemixed142, added in Tecplot 360 2024 R1). Every wrapper function is bound independently; a missing symbol disables only that one function. Calling a disabled function raises TecioUnavailableError with a message explaining why.

LIBRARY_LOAD_ERROR

LIBRARY_PATH

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

UNAVAILABLE_FUNCTIONS

set() -> new empty set object set(iterable) -> new set object

Exceptions#

TecioError

Exception for TecIO C library errors.

TecioUnavailableError

Raised when calling a function whose C symbol is unavailable.

TecioAvailabilityWarning

Emitted once at import time if any C function could not be bound.

class tecio.libtecio.TecioError[source]#

Bases: RuntimeError

Exception for TecIO C library errors.

class tecio.libtecio.TecioUnavailableError[source]#

Bases: TecioError

Raised when calling a function whose C symbol is unavailable.

Either because no TecIO shared library could be located at all, or because the library that was found doesn’t export this particular symbol (typically an older Tecplot version, predating that entry point).

class tecio.libtecio.TecioAvailabilityWarning[source]#

Bases: UserWarning

Emitted once at import time if any C function could not be bound.

SZL Read Functions#

See SZL Read Functions for full documentation.

tec_file_reader_open

Open an SZL file for reading.

tec_file_reader_close

Close an SZL file reader handle and release its resources.

tec_file_get_type

Get the file type for an opened SZL file.

tec_data_set_get_title

Read the dataset title string.

tec_data_set_get_num_vars

Query the number of variables in the dataset.

tec_data_set_get_num_zones

Query the number of zones in the dataset.

tec_zone_get_ijk

Get zone dimensions (ORDERED) or node/element counts (FE).

tec_zone_get_title

Read the title for a zone.

tec_zone_get_type

Query the zone type.

tec_zone_is_enabled

Check whether a zone is enabled.

tec_zone_get_solution_time

Read the solution time for a zone.

tec_zone_get_strand_id

Get the strand ID for a zone.

is_64bit

Check whether a zone's node-map uses 64-bit indices.

tec_zone_node_map_get_64

Read a 64-bit node map for an FE zone.

tec_zone_node_map_get

Read a 32-bit node map for an FE zone.

tec_zone_node_map_get_flat

Read a whole FE zone node map as one flat array.

tec_var_get_name

Get a variable name by index.

tec_var_is_enabled

Check whether a variable is enabled.

tec_zone_var_get_type

Get the data type for a variable in a zone.

tec_zone_var_get_value_location

Get the value location for a zone variable.

tec_zone_var_is_passive

Check whether a zone variable is passive.

tec_zone_var_get_shared_zone

Get the shared zone index for a variable.

tec_zone_var_get_num_values

Query the number of values for a zone variable.

tec_zone_var_get_float_values

Read float32 values for a zone variable.

tec_zone_var_get_double_values

Read float64 values for a zone variable.

tec_zone_var_get_int32_values

Read int32 values for a zone variable.

tec_zone_var_get_int16_values

Read int16 values for a zone variable.

tec_zone_var_get_uint8_values

Read uint8 values for a zone variable.

tec_data_set_aux_data_get_num_items

Get the number of dataset-level auxiliary data items.

tec_data_set_aux_data_get_item

Read a dataset-level auxiliary data item.

tec_var_aux_data_get_num_items

Get the number of auxiliary data items for a variable.

tec_var_aux_data_get_item

Read a variable-level auxiliary data item.

tec_zone_aux_data_get_num_items

Get the number of auxiliary data items for a zone.

tec_zone_aux_data_get_item

Read a zone-level auxiliary data item.

SZL Write Functions#

See SZL Write Functions for full documentation.

tec_file_writer_open

Open a writer handle for creating SZL files.

tec_file_writer_close

Close a writer handle and finalise the output file.

tec_file_writer_flush

Flush written zone data to a temporary intermediate file.

tec_zone_create_ijk

Create an ordered IJK zone for writing.

tec_zone_create_fe

Create a finite-element zone for writing.

tec_zone_set_unsteady_options

Set time/strand metadata for a zone.

tec_zone_var_write_double_values

Write float64 values for a zone variable.

tec_zone_var_write_float_values

Write float32 values for a zone variable.

tec_zone_var_write_int32_values

Write int32 values for a zone variable.

tec_zone_var_write_int16_values

Write int16 values for a zone variable.

tec_zone_var_write_uint8_values

Write uint8 values for a zone variable.

tec_zone_node_map_write32

Write 32-bit node map entries for an FE zone.

tec_zone_node_map_write64

Write 64-bit node map entries for an FE zone.

tec_zone_face_nbr_write_connections32

Write 32-bit face-neighbor connections for an FE zone.

tec_zone_face_nbr_write_connections64

Write 64-bit face-neighbor connections for an FE zone.

tec_data_set_add_aux_data

Add a dataset-level auxiliary data record.

tec_var_add_aux_data

Add a variable-level auxiliary data record.

tec_zone_add_aux_data

Add a zone-level auxiliary data record.

Classic API Functions#

See Classic API Functions for full documentation.

tecini142

Initialise a Tecplot data file (classic API).

tecend142

Finalise and close the active Tecplot data file.

tecflush142

Flush data to disk, optionally retaining zones in memory (SZL only).

tecfil142

Get the file handle for the current output file.

tecforeign142

Set foreign byte order for output.

teczne142

Create a new zone in the active file (classic API).

tecpolyzne142

Create a polygonal or polyhedral zone (classic API).

tecznefemixed142

Create a FEMIXED zone (classic API).

tecdat142

Write field data to the current zone (classic API).

tecnode142

Write node connectivity for an FE zone (classic API).

tecface142

Write face-neighbor connections (classic API).

tecpolyface142

Write face data for polygonal/polyhedral zones (classic API).

tecpolybconn142

Write boundary connections for poly zones (classic API).

tecauxstr142

Add dataset-level auxiliary data (classic API).

tecvauxstr142

Add variable-level auxiliary data (classic API).

teczauxstr142

Add zone-level auxiliary data (classic API).

tecusr142

Write a user-defined data record (classic API).