Classic API Functions#
The classic tec*142 API uses a single implicit global file context.
Only one file may be active at a time; call :func:tecini142 to open it
and tecend142() to close it. Both PLT and SZL formats are supported.
Initialise a Tecplot data file (classic API). |
|
Finalise and close the active Tecplot data file. |
|
Flush data to disk, optionally retaining zones in memory (SZL only). |
|
Get the file handle for the current output file. |
|
Set foreign byte order for output. |
|
Create a new zone in the active file (classic API). |
|
Create a polygonal or polyhedral zone (classic API). |
|
Create a mixed finite-element zone (classic API). |
|
Write field data to the current zone (classic API). |
|
Write node connectivity for an FE zone (classic API). |
|
Write face-neighbor connections (classic API). |
|
Write face data for polygonal/polyhedral zones (classic API). |
|
Write boundary connections for poly zones (classic API). |
|
Add dataset-level auxiliary data (classic API). |
|
Add variable-level auxiliary data (classic API). |
|
Add zone-level auxiliary data (classic API). |
|
Write a user-defined data record (classic API). |
- tecio.libtecio.tecini142(filename, variables, title='Untitled', scratch_dir='.', file_format=FileFormat.PLT, file_type=FileType.FULL, debug=Debug.FALSE, vis_double=DataType.DOUBLE)[source]#
Initialise a Tecplot data file (classic API).
- Parameters:
filename (str) – Output file path. Supports PLT and SZPLT extensions.
variables (Sequence[str]) – Variable name list.
title (str) – Dataset title.
scratch_dir (str) – Scratch directory for temporary files.
file_format (int | FileFormat) – FileFormat.PLT (0) or FileFormat.SZPLT (1)
file_type (int | FileType) – FileType.FULL (0), GRID (1), or SOLUTION (2)
debug (int | Debug) – Debug.FALSE (0) or Debug.TRUE (1)
vis_double (int | DataType) – DataType.DOUBLE (1) or DataType.FLOAT (0). PLT files do not suport integer zone variables. Use the new API functions to create integer zone variables for SZPLT files.
- Raises:
TecioError – On C library error.
Note
Must be called before any zone or data operations
Note
Call
tecend142()to finalize the file
- tecio.libtecio.tecend142()[source]#
Finalise and close the active Tecplot data file.
- Raises:
TecioError – On C library error.
Note
Must be called after all data has been written
Note
Flushes all pending data and closes the file
- tecio.libtecio.tecflush142(num_zones_to_retain=0, zones_to_retain=None)[source]#
Flush data to disk, optionally retaining zones in memory (SZL only).
- Parameters:
num_zones_to_retain (int) – Number of zones to keep in memory.
zones_to_retain (Sequence[int] | None) – 1-based zone indices to retain.
- Raises:
TecioError – On C library error.
Important
SZL Only!
Note
Used to reduce memory usage for large files.
Note
Retained zones can still be modified.
- tecio.libtecio.tecfil142()[source]#
Get the file handle for the current output file.
- Returns:
File handle integer.
- Raises:
TecioError – On C library error.
Note
Used for advanced file operations.
- tecio.libtecio.tecforeign142(output_foreign_byte_order)[source]#
Set foreign byte order for output.
- Parameters:
output_foreign_byte_order (int) – 0 = native, 1 = foreign.
- Raises:
TecioError – On C library error.
- tecio.libtecio.teczne142(zone_title, zone_type, imax, jmax, kmax, var_sharing=None, value_locations=None, pas_vars=None, con_sharing=0, strand=0, solution_time=0.0, num_face_connections=0, face_nbr_mode=FaceNeighborMode.LOCAL_ONE_TO_ONE, total_num_face_nodes=0, num_connected_boundary_faces=0, total_num_boundary_connections=0)[source]#
Create a new zone in the active file (classic API).
- Parameters:
zone_title (str) – Zone title.
zone_type (int | ZoneType) – Zone type enum or integer (0=ORDERED, 1=FELINESEG, etc.).
imax (int) – I dimension (or num nodes for FE).
jmax (int) – J dimension (or num elements for FE).
kmax (int) – K dimension or NumFaces for FEPOLYGON and FEPOLYHEDRON. Not used for all other finite element zone types.
var_sharing (Sequence[int] | None) – List of zone indices to share variables from (0: No sharing, Null: no variables are shared from other zones)
value_locations (Sequence[int | ValueLocation] | None) – Per-variable data locations.
pas_vars (Sequence[int | VarStatus] | None) – List of VarStatus enums or 0/1 for passive variables. Must be same length as var_sharing if provided. None/null means all variables are active.
con_sharing (int) – Connectivity sharing source zone number.
strand (int) – Strand ID for transient data (0 for static data, positive integer for transient data).
solution_time (float) – Solution time.
num_face_connections (int) – Number of face connections (for cell-based FE zones only. The number of face connections that will be passed to
tecface142).face_nbr_mode (int | FaceNeighborMode) – FaceNeighborMode enum. Used for cell-based FE and ordered zones only. Type of face connection that will be passed in routine
tecface142.total_num_face_nodes (int) – Total face nodes (poly zones).
num_connected_boundary_faces (int) – Boundary faces (poly zones).
total_num_boundary_connections (int) – Boundary connections (poly zones).
- Raises:
TecioError – On C library error.
Hint
For ORDERED zones: imx, jmx, kmx are dimensions.
Note
For FE zones: imax=NumNodes, jmax=NumElements, kmax=0 (unless higher order element)
- tecio.libtecio.tecpolyzne142(zone_title, zone_type, num_nodes, num_faces, num_elements, var_sharing=None, value_locations=None, pas_vars=None, con_sharing=0, strand=0, solution_time=0.0, total_num_face_nodes=0, num_connected_boundary_faces=0, total_num_boundary_connections=0)[source]#
Create a polygonal or polyhedral zone (classic API).
- Parameters:
zone_title (str) – Zone title.
zone_type (int | ZoneType) –
ZoneType.FEPOLYGONorZoneType.FEPOLYHEDRON.num_nodes (int) – Number of nodes.
num_faces (int) – Number of faces.
num_elements (int) – Number of elements.
var_sharing (Sequence[int] | None) – List of zone indices to share variables from (0: No sharing, Null: no variables are shared from other zones). Must be same length as value_locations and pas_vars if provided.
value_locations (Sequence[int | ValueLocation] | None) – Per-variable data locations.
pas_vars (Sequence[int | VarStatus] | None) – ist of VarStatus enums or 0/1 for passive variables. Must be same length as value_locations and var_sharing if provided. None/null means all variables are active.
con_sharing (int) – Connectivity sharing source zone.
strand (int) – Strand ID for transient data (0 for static data, positive integer for transient data).
solution_time (float) – Solution time for transient data.
total_num_face_nodes (int) – Total face nodes.
num_connected_boundary_faces (int) – Boundary faces.
total_num_boundary_connections (int) – Boundary connections.
- Raises:
TecioError – On C library error.
- tecio.libtecio.tecznefemixed142(zone_title, num_nodes, num_elements, num_nodes_per_element, solution_time=0.0, strand_id=0, parent_zone=0, datapacking=DataPacking.BLOCK, num_face_connections=0, face_neighbor_mode=FaceNeighborMode.LOCAL_ONE_TO_ONE, passive_var_list=None, value_location=None, share_var_from_zone=None, share_connectivity_from_zone=0)[source]#
Create a mixed finite-element zone (classic API).
- Parameters:
zone_title (str) – Zone title.
num_nodes (int) – Number of nodes.
num_elements (int) – Number of elements.
num_nodes_per_element (int) – Nodes per element.
solution_time (float) – Solution time.
strand_id (int) – Strand ID for transient data (0 for static data, positive integer for transient data).
parent_zone (int) – Parent zone index (0 = none).
datapacking (int | DataPacking) – DataPacking.BLOCK (1) or DataPacking.POINT (0)
num_face_connections (int) – Number of face connections.
face_neighbor_mode (int | FaceNeighborMode) – Face-neighbor mode.
passive_var_list (Sequence[int | VarStatus] | None) – PList of VarStatus enums or 0/1 for passive variables. None/null means all variables are active. Must be same length as value_location if provided.
value_location (Sequence[int | ValueLocation] | None) – List of ValueLocation enums or 0/1 for nodal/cell-centered. Must be same length as passive_var_list if provided.
share_var_from_zone (Sequence[int] | None) – List of zone indices to share variables from.
share_connectivity_from_zone (int) – Zone index to share connectivity from.
- Raises:
TecioError – On C library error.
- tecio.libtecio.tecdat142(field_data, is_double=True)[source]#
Write field data to the current zone (classic API).
- Parameters:
field_data (npt.ArrayLike) – Array of field values.
is_double (bool) – True for double precision, False for single.
- Raises:
TecioError – On C library error.
Important
Data must be written in the order specified by dataset variables and zone definition
Hint
If variable is shared or passive, skip writing data for that variable
Note
For ORDERED zones: data should be ordered with the I dimension varying fastest, then J, then K
Note
For FE zones: data should be ordered by node index for nodal variables, and by element index for cell-centered variables
- tecio.libtecio.tecnode142(nodes)[source]#
Write node connectivity for an FE zone (classic API).
- Parameters:
nodes (npt.ArrayLike) – Array of 1-based node indices.
- Raises:
TecioError – On C library error.
Important
Node indices are 1-based (Fortran convention)
Hint
For FEBRICK elements: 8 nodes per element.
For FETETRAHEDRON elements: 4 nodes per element.
- tecio.libtecio.tecface142(face_connections)[source]#
Write face-neighbor connections (classic API).
- Parameters:
face_connections (npt.ArrayLike) – Array of face connection data.
- Raises:
TecioError – On C library error.
Note
Used to specify face-to-face connectivity between zones.
- tecio.libtecio.tecpolyface142(face_node_counts, face_nodes, face_left_elems, face_right_elems)[source]#
Write face data for polygonal/polyhedral zones (classic API).
- Parameters:
face_node_counts (npt.ArrayLike) – Number of nodes per face.
face_nodes (npt.ArrayLike) – Concatenated face node indices.
face_left_elems (npt.ArrayLike) – Left element per face.
face_right_elems (npt.ArrayLike) – Right element per face.
- Raises:
TecioError – On C library error.
Note
face_node_countshas one entry per face.Note
face_nodesis a concatenated list of all face node indices.Hint
Element indices are 1-based; 0 indicates boundary.
- tecio.libtecio.tecpolybconn142(boundary_connection_counts, boundary_connection_elems, boundary_connection_zones=None)[source]#
Write boundary connections for poly zones (classic API).
- Parameters:
boundary_connection_counts (npt.ArrayLike) – Connections per boundary face.
boundary_connection_elems (npt.ArrayLike) – Element indices.
boundary_connection_zones (npt.ArrayLike | None) – Zone indices.
- Raises:
TecioError – On C library error.
Note
Used to specify connectivity to neighboring zones at boundaries.
- tecio.libtecio.tecauxstr142(name, value)[source]#
Add dataset-level auxiliary data (classic API).
- Parameters:
name (str) – Auxiliary data name.
value (str) – Auxiliary data value.
- Raises:
TecioError – On C library error.
Note
Must be called after
tecini142but before firstteczne142.
- tecio.libtecio.tecvauxstr142(var, name, value)[source]#
Add variable-level auxiliary data (classic API).
- Parameters:
var (int) – 1-based variable index.
name (str) – Auxiliary data name.
value (str) – Auxiliary data value.
- Raises:
TecioError – On C library error.
Note
Must be called after
tecini142but before firstteczne142.
- tecio.libtecio.teczauxstr142(name, value)[source]#
Add zone-level auxiliary data (classic API).
- Parameters:
name (str) – Auxiliary data name.
value (str) – Auxiliary data value.
- Raises:
TecioError – On C library error.
Note
Must be called after
teczne142for the current zone.
- tecio.libtecio.tecusr142(user_rec)[source]#
Write a user-defined data record (classic API).
- Parameters:
user_rec (str) – User-defined data string.
- Raises:
TecioError – On C library error.
Note
Used to write custom data records into the file. Data is preserved but not interpreted by Tecplot