tecio-python 0.4.0__py3-none-any.whl → 0.4.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. tecio/__init__.py +46 -2
  2. tecio/_constants.py +2 -2
  3. tecio/_dat_read.py +268 -17
  4. tecio/_dat_write.py +347 -10
  5. tecio/_elements.py +1311 -0
  6. tecio/_io.py +108 -31
  7. tecio/_meta.py +47 -20
  8. tecio/_plt_legacy.py +9 -1
  9. tecio/_plt_read.py +285 -89
  10. tecio/_plt_write.py +286 -9
  11. tecio/_reader.py +460 -19
  12. tecio/_szl_read.py +155 -17
  13. tecio/_szl_write.py +322 -11
  14. tecio/_utils.py +78 -15
  15. tecio/_writer.py +963 -102
  16. tecio/cli/tec2mat.py +69 -30
  17. tecio/cli/tecaux.py +24 -30
  18. tecio/cli/tecdump.py +67 -5
  19. tecio/cli/tecelretyp.py +1096 -0
  20. tecio/cli/tecextract.py +57 -14
  21. tecio/cli/tecfix.py +32 -14
  22. tecio/cli/tecmerge.py +289 -45
  23. tecio/cli/teconvert.py +29 -16
  24. tecio/cli/tecscale.py +40 -13
  25. tecio/cli/tecslice.py +158 -69
  26. tecio/cli/tecstats.py +6 -2
  27. tecio/libtecio.py +192 -67
  28. {tecio_python-0.4.0.data/data/share → tecio_python-0.4.2.data/data/share/tecio}/plugins/matlab/tecmat2struct.m +18 -18
  29. {tecio_python-0.4.0.data/data/share → tecio_python-0.4.2.data/data/share/tecio}/plugins/paraview/TecplotTecioReader.py +463 -38
  30. {tecio_python-0.4.0.data/data/share → tecio_python-0.4.2.data/data/share/tecio}/plugins/paraview/TecplotTecioWriter.py +459 -84
  31. {tecio_python-0.4.0.dist-info → tecio_python-0.4.2.dist-info}/METADATA +33 -17
  32. tecio_python-0.4.2.dist-info/RECORD +40 -0
  33. {tecio_python-0.4.0.dist-info → tecio_python-0.4.2.dist-info}/WHEEL +1 -1
  34. {tecio_python-0.4.0.dist-info → tecio_python-0.4.2.dist-info}/entry_points.txt +1 -0
  35. tecio_python-0.4.0.dist-info/RECORD +0 -38
  36. {tecio_python-0.4.0.data/data/share → tecio_python-0.4.2.data/data/share/tecio}/plugins/matlab/contourfe.m +0 -0
  37. {tecio_python-0.4.0.dist-info → tecio_python-0.4.2.dist-info}/licenses/LICENSE +0 -0
  38. {tecio_python-0.4.0.dist-info → tecio_python-0.4.2.dist-info}/licenses/NOTICE +0 -0
  39. {tecio_python-0.4.0.dist-info → tecio_python-0.4.2.dist-info}/top_level.txt +0 -0
tecio/_dat_write.py CHANGED
@@ -6,6 +6,7 @@ Supported ``DATAPACKING`` modes for writing:
6
6
  followed by a separate row-per-cell section for cell-centred variables.
7
7
  Pass ``datapacking="POINT"`` to :meth:`~TecplotDatWriter.write_ordered_zone`
8
8
  or :meth:`~TecplotDatWriter.write_fe_zone`.
9
+ * Poly zones (:meth:`~TecplotDatWriter.write_poly_zone`) are always ``BLOCK``.
9
10
  """
10
11
 
11
12
  from __future__ import annotations
@@ -26,6 +27,7 @@ from ._constants import (
26
27
  DataPacking,
27
28
  DataType,
28
29
  FaceNeighborMode,
30
+ FeCellShape,
29
31
  FileType,
30
32
  ValueLocation,
31
33
  ZoneType,
@@ -35,12 +37,14 @@ from ._writer import (
35
37
  PassiveVarsSpec,
36
38
  PreparedFEZone,
37
39
  PreparedOrderedZone,
40
+ PreparedPolyZone,
38
41
  TecplotWriter,
39
42
  VarSharingSpec,
40
43
  convert_face_connections_to_one_based,
41
44
  normalize_precision,
42
45
  prepare_fe_zone,
43
46
  prepare_ordered_zone,
47
+ prepare_poly_zone,
44
48
  )
45
49
 
46
50
  # -------------------------------------------------------------------------------------
@@ -170,12 +174,20 @@ _VALUE_SEP: str = " "
170
174
 
171
175
 
172
176
  def _quote(s: str) -> str:
173
- """Wrap *s* in double-quotes, escaping embedded double-quotes."""
177
+ """Wrap *s* in double-quotes, escaping embedded double-quotes.
178
+
179
+ Returns:
180
+ str: Stripped string.
181
+ """
174
182
  return '"' + str(s).replace('"', '\\"') + '"'
175
183
 
176
184
 
177
185
  def _unquote(s: str) -> str:
178
- r"""Remove surrounding double-quotes and unescape internal ``\\"``."""
186
+ r"""Remove surrounding double-quotes and unescape internal ``\\"``.
187
+
188
+ Returns:
189
+ str: String without the surrounding quotes.
190
+ """
179
191
  s = s.strip()
180
192
  if len(s) >= 2 and s[0] == '"' and s[-1] == '"':
181
193
  return s[1:-1].replace('\\"', '"')
@@ -183,7 +195,11 @@ def _unquote(s: str) -> str:
183
195
 
184
196
 
185
197
  def _strip_comment(line: str) -> str:
186
- """Remove a Tecplot ``#`` comment and trailing whitespace."""
198
+ """Remove a Tecplot ``#`` comment and trailing whitespace.
199
+
200
+ Returns:
201
+ str: The line without the comment and trailing whitespace.
202
+ """
187
203
  idx = line.find("#")
188
204
  return line[:idx].rstrip() if idx >= 0 else line.rstrip()
189
205
 
@@ -266,6 +282,21 @@ def _stage_connectivity_row(buf: io.StringIO, row: npt.NDArray) -> None:
266
282
  buf.write(_DATA_INDENT + " ".join(str(int(n)) for n in row) + "\n")
267
283
 
268
284
 
285
+ def _stage_int_block(
286
+ buf: io.StringIO, label: str, arr: npt.NDArray, per_line: int = 10
287
+ ) -> None:
288
+ """Write a flat integer array to *buf* under a ``# label`` comment line.
289
+
290
+ Tecplot writes the face-map sections of poly zones this way, ``per_line`` values
291
+ per line, and the reader skips the comment.
292
+ """
293
+ buf.write(f"# {label}\n")
294
+ flat = arr.ravel()
295
+ for start in range(0, flat.size, per_line):
296
+ chunk = flat[start : start + per_line].tolist()
297
+ buf.write(_DATA_INDENT + " ".join(map(str, chunk)) + "\n")
298
+
299
+
269
300
  # ======================================================================================
270
301
  # TecplotDatWriter
271
302
  # ======================================================================================
@@ -347,7 +378,11 @@ class TecplotDatWriter(TecplotWriter):
347
378
  # -- Validation checks and errror handling -----------------------------------------
348
379
 
349
380
  def _check_handle(self) -> io.TextIOWrapper:
350
- """Return the file handle, raising if the file has been closed."""
381
+ """Return the file handle, raising if the file has been closed.
382
+
383
+ Raises:
384
+ ValueError: If the file has been closed.
385
+ """
351
386
  if self._fp is None:
352
387
  raise ValueError(f"I/O operation on closed file: '{self.path}'")
353
388
  return self._fp
@@ -615,7 +650,8 @@ class TecplotDatWriter(TecplotWriter):
615
650
  from the zone referenced by *con_sharing*.
616
651
 
617
652
  Warning:
618
- ``FEPOLYGON`` and ``FEPOLYHEDRON`` raise :exc:`NotImplementedError`.
653
+ ``FEPOLYGON`` and ``FEPOLYHEDRON`` are face-based and raise
654
+ :exc:`ValueError`, write them with :meth:`write_poly_zone`.
619
655
 
620
656
  Args:
621
657
  data (Sequence[npt.ArrayLike]):
@@ -697,13 +733,12 @@ class TecplotDatWriter(TecplotWriter):
697
733
  accepted. Defaults to :attr:`~tecio.DataPacking.BLOCK`.
698
734
 
699
735
  Raises:
700
- NotImplementedError:
701
- For FEPOLYGON or FEPOLYHEDRON.
702
736
  TypeError:
703
737
  If *passive_vars*/*var_sharing* isn't a list/tuple/set/mapping as
704
738
  appropriate, or mixes variable names and indices.
705
739
  ValueError:
706
- On variable count or array length mismatch; if ``node_map`` is omitted
740
+ For FEPOLYGON or FEPOLYHEDRON (use :meth:`write_poly_zone`); on
741
+ variable count or array length mismatch; if ``node_map`` is omitted
707
742
  without ``con_sharing``; if ``var_sharing``/``con_sharing`` reference a
708
743
  zone with no recorded node/cell count, or one whose count disagrees with
709
744
  this zone's; or a variable named in both *passive_vars* and
@@ -727,8 +762,8 @@ class TecplotDatWriter(TecplotWriter):
727
762
  "string equivalents."
728
763
  ) from None
729
764
  if zone_type in _FE_POLY:
730
- raise NotImplementedError(
731
- f"Zone type {zone_type.name!r} is not supported by write_fe_zone."
765
+ raise ValueError(
766
+ f"{zone_type.name} zones are face-based, use write_poly_zone."
732
767
  )
733
768
  if zone_type not in _FE_SIMPLE:
734
769
  raise NotImplementedError(
@@ -904,6 +939,286 @@ class TecplotDatWriter(TecplotWriter):
904
939
  )
905
940
  )
906
941
 
942
+ def write_femixed_zone(
943
+ self,
944
+ data: Sequence[npt.ArrayLike],
945
+ cell_shapes: Sequence[FeCellShape | int | str] | None = None,
946
+ node_maps: Sequence[npt.ArrayLike] | None = None,
947
+ *,
948
+ title: str | None = None,
949
+ variables: list[str] | None = None,
950
+ value_locations: Sequence[ValueLocation] | None = None,
951
+ passive_vars: PassiveVarsSpec | None = None,
952
+ var_sharing: VarSharingSpec | None = None,
953
+ con_sharing: int | None = None,
954
+ solution_time: float = 0.0,
955
+ strand_id: int = 0,
956
+ aux: dict[str, Any] | None = None,
957
+ datapacking: DataPacking | str = DataPacking.BLOCK,
958
+ ) -> None:
959
+ """Not supported: DAT files cannot hold FEMIXED zones.
960
+
961
+ The signature matches :meth:`TecplotSzlWriter.write_femixed_zone` so every
962
+ writer exposes the same interface.
963
+
964
+ Raises:
965
+ NotImplementedError: Always. Write a ``.szplt`` file instead, see
966
+ :meth:`TecplotSzlWriter.write_femixed_zone`.
967
+ """
968
+ raise NotImplementedError(
969
+ "The DAT file format does not support FEMIXED (mixed finite-element) "
970
+ "zones. Write a .szplt file instead."
971
+ )
972
+
973
+ def write_poly_zone(
974
+ self,
975
+ data: Sequence[npt.ArrayLike],
976
+ zone_type: ZoneType,
977
+ *,
978
+ face_nodes: npt.ArrayLike | None = None,
979
+ face_node_counts: npt.ArrayLike | None = None,
980
+ face_left_elements: npt.ArrayLike | None = None,
981
+ face_right_elements: npt.ArrayLike | None = None,
982
+ boundary_connection_counts: npt.ArrayLike | None = None,
983
+ boundary_connection_elements: npt.ArrayLike | None = None,
984
+ boundary_connection_zones: npt.ArrayLike | None = None,
985
+ title: str | None = None,
986
+ variables: list[str] | None = None,
987
+ value_locations: Sequence[ValueLocation] | None = None,
988
+ passive_vars: PassiveVarsSpec | None = None,
989
+ var_sharing: VarSharingSpec | None = None,
990
+ con_sharing: int | None = None,
991
+ solution_time: float = 0.0,
992
+ strand_id: int = 0,
993
+ aux: dict[str, Any] | None = None,
994
+ datapacking: DataPacking | str = DataPacking.BLOCK,
995
+ ) -> None:
996
+ """Write a complete FEPOLYGON or FEPOLYHEDRON (face-based) zone.
997
+
998
+ Node and element counts are inferred from the face map, or from the
999
+ *con_sharing* source zone when it is omitted. Every index is 0-based in
1000
+ Python and shifted to the 1-based ASCII convention here (0 for no element,
1001
+ ``-k`` for the k-th boundary face).
1002
+
1003
+ The face map follows the variable blocks as integer sections introduced by the
1004
+ same ``#`` comment lines Tecplot writes: ``# node count per face`` (polyhedra
1005
+ only), ``# face nodes``, ``# left elements``, ``# right elements``, and with
1006
+ boundary connections ``# boundary connection counts``, ``# boundary connection
1007
+ elements``, and ``# boundary connection zones``. Nothing is written for a zone
1008
+ that shares connectivity.
1009
+
1010
+ Args:
1011
+ data (Sequence[npt.ArrayLike]):
1012
+ Sequence of 1-D arrays, one per active (non-passive, non-shared) dataset
1013
+ variable, in dataset order. NODAL arrays need ``num_nodes`` values,
1014
+ CELL_CENTERED arrays ``num_elements``, both inferred from the face map.
1015
+ zone_type (ZoneType):
1016
+ :attr:`~tecio.ZoneType.FEPOLYGON` or
1017
+ :attr:`~tecio.ZoneType.FEPOLYHEDRON`.
1018
+ face_nodes (npt.ArrayLike):
1019
+ Flat 0-based node indices of all faces, in face order. Two per face
1020
+ for a polygon zone. Required unless ``con_sharing`` is set.
1021
+ face_node_counts (npt.ArrayLike):
1022
+ Number of nodes of each face. Required for FEPOLYHEDRON. Optional for
1023
+ FEPOLYGON, where every face has 2 nodes.
1024
+ face_left_elements (npt.ArrayLike):
1025
+ Element on the left of each face: a 0-based element index, ``-1`` for
1026
+ no element, or ``-(b + 2)`` for boundary face ``b`` (0-based).
1027
+ face_right_elements (npt.ArrayLike):
1028
+ Element on the right of each face, same convention as
1029
+ ``face_left_elements``.
1030
+ boundary_connection_counts (npt.ArrayLike):
1031
+ Number of connections of each boundary face. Boundary faces describe
1032
+ neighbors in other zones, or faces with more than one neighbor.
1033
+ boundary_connection_elements (npt.ArrayLike):
1034
+ Flat 0-based neighbor element of every boundary connection.
1035
+ boundary_connection_zones (npt.ArrayLike):
1036
+ Flat 0-based zone of every neighbor element. May only reference a zone
1037
+ already written or this zone.
1038
+ title (str):
1039
+ Zone title string. Defaults to ``"Poly_Zone_{index}"``, with this
1040
+ zone's 0-based index.
1041
+ variables (list[str]):
1042
+ Variable name list, only used when the file has not been opened yet
1043
+ (lazy-open path). Defaults to ``[V1, V2, V3, ...]``.
1044
+ value_locations (Sequence[ValueLocation]):
1045
+ Per-active-variable :class:`~tecio.ValueLocation`. Defaults to all
1046
+ ``NODAL``.
1047
+ passive_vars (list | tuple | set | None):
1048
+ Variables to mark passive: a list, tuple, or set of variable names, or
1049
+ of 0-based indices. Defaults to all active.
1050
+ var_sharing (Mapping[int | str, int]):
1051
+ Variables to share from another zone: a ``{variable: source zone}``
1052
+ mapping, name or 0-based index to 0-based zone index.
1053
+ con_sharing (int):
1054
+ Zone index to share the face map from, which must be a zone of the
1055
+ same type without boundary faces (TecIO does not allow sharing those).
1056
+ ``None`` means this zone owns its connectivity.
1057
+ solution_time (float):
1058
+ Solution time for transient data. Defaults to ``0.0``.
1059
+ strand_id (int):
1060
+ Strand ID for transient data, ``0`` for static zones.
1061
+ aux (dict[str, str | float | int]):
1062
+ Zone-level auxiliary data as ``{name: value}`` pairs.
1063
+ datapacking (DataPacking | str):
1064
+ Must be :attr:`~tecio.DataPacking.BLOCK`. Tecplot refuses ``POINT``
1065
+ for poly zones, whether or not they have cell-centered variables.
1066
+
1067
+ Raises:
1068
+ TypeError:
1069
+ If *passive_vars*/*var_sharing* isn't a list/tuple/set/mapping as
1070
+ appropriate, or mixes variable names and indices.
1071
+ ValueError:
1072
+ If *datapacking* is :attr:`~tecio.DataPacking.POINT`. For a
1073
+ *zone_type* other than FEPOLYGON or FEPOLYHEDRON (use
1074
+ :meth:`write_fe_zone`); on a missing, inconsistent, or out of range
1075
+ face map, boundary connection, or variable array.
1076
+ KeyError:
1077
+ A *passive_vars*/*var_sharing* name doesn't match any dataset variable.
1078
+ IndexError:
1079
+ A *passive_vars*/*var_sharing* index is out of range.
1080
+ """
1081
+ if isinstance(datapacking, str):
1082
+ try:
1083
+ datapacking = DataPacking[datapacking.upper()]
1084
+ except KeyError:
1085
+ raise ValueError(
1086
+ f"datapacking={datapacking!r} is not supported; "
1087
+ "use DataPacking.BLOCK or its string equivalent."
1088
+ ) from None
1089
+ if datapacking != DataPacking.BLOCK:
1090
+ raise ValueError(
1091
+ "Polygon and polyhedron zones must use BLOCK data packing."
1092
+ )
1093
+
1094
+ new_zone_index = self.current_zone + 1
1095
+ if title is None:
1096
+ title = f"Poly_Zone_{new_zone_index}"
1097
+ if variables is None:
1098
+ variables = [f"V{i}" for i in range(1, len(data) + 1)]
1099
+
1100
+ # Open the file if lazily loaded and flush buffered aux data
1101
+ if not self._opened:
1102
+ self._open(variables)
1103
+ if self.current_zone == -1:
1104
+ self.flush_aux()
1105
+
1106
+ arrays: list[npt.NDArray] = [np.asarray(arr) for arr in data]
1107
+ variable_types = [
1108
+ _resolve_written_type(_infer_data_type(arr), self.precision)
1109
+ for arr in arrays
1110
+ ]
1111
+
1112
+ prepared: PreparedPolyZone | None = prepare_poly_zone(
1113
+ arrays,
1114
+ variable_types,
1115
+ zone_type,
1116
+ face_nodes=face_nodes,
1117
+ face_node_counts=face_node_counts,
1118
+ face_left_elements=face_left_elements,
1119
+ face_right_elements=face_right_elements,
1120
+ boundary_connection_counts=boundary_connection_counts,
1121
+ boundary_connection_elements=boundary_connection_elements,
1122
+ boundary_connection_zones=boundary_connection_zones,
1123
+ value_locations=value_locations,
1124
+ passive_vars=passive_vars,
1125
+ var_sharing=var_sharing,
1126
+ con_sharing=con_sharing,
1127
+ dataset_variables=self._check_variables(),
1128
+ meta=self._meta,
1129
+ on_error=self._handle_zone_error,
1130
+ )
1131
+ if prepared is None:
1132
+ return
1133
+ conn = prepared.connectivity
1134
+
1135
+ buf = io.StringIO()
1136
+ self._stage_zone_header(
1137
+ buf,
1138
+ title,
1139
+ zone_type,
1140
+ num_nodes=conn.num_nodes,
1141
+ num_elements=conn.num_cells,
1142
+ solution_time=solution_time,
1143
+ strand_id=strand_id,
1144
+ passive_vars=prepared.passive_vars,
1145
+ var_sharing=prepared.var_sharing,
1146
+ value_locations_global=prepared.value_locations_global,
1147
+ variable_types_global=prepared.variable_types_global,
1148
+ con_sharing=prepared.con_sharing,
1149
+ aux=aux,
1150
+ datapacking=datapacking,
1151
+ num_faces=conn.num_faces,
1152
+ total_face_nodes=conn.total_face_nodes,
1153
+ num_boundary_faces=conn.num_boundary_faces,
1154
+ num_boundary_connections=conn.num_boundary_connections,
1155
+ )
1156
+
1157
+ for arr, dt in zip(arrays, variable_types, strict=True):
1158
+ _stage_float_array(
1159
+ buf, arr.astype(_DT_TO_DTYPE[dt], copy=False), self._float_fmt
1160
+ )
1161
+
1162
+ # Face map (if not shared). ASCII is the 0-based API convention plus one for
1163
+ # every array: 0 for no element and -k for the k-th boundary face.
1164
+ if prepared.con_sharing is None:
1165
+ assert conn.face_nodes is not None
1166
+ assert (
1167
+ conn.face_left_elements is not None
1168
+ and conn.face_right_elements is not None
1169
+ )
1170
+ if zone_type is ZoneType.FEPOLYHEDRON:
1171
+ assert conn.face_node_counts is not None
1172
+ _stage_int_block(buf, "node count per face", conn.face_node_counts)
1173
+ _stage_int_block(buf, "face nodes", conn.face_nodes.astype(np.int64) + 1)
1174
+ _stage_int_block(
1175
+ buf, "left elements", conn.face_left_elements.astype(np.int64) + 1
1176
+ )
1177
+ _stage_int_block(
1178
+ buf, "right elements", conn.face_right_elements.astype(np.int64) + 1
1179
+ )
1180
+ if conn.num_boundary_faces:
1181
+ assert conn.boundary_connection_counts is not None
1182
+ assert conn.boundary_connection_elements is not None
1183
+ assert conn.boundary_connection_zones is not None
1184
+ _stage_int_block(
1185
+ buf, "boundary connection counts", conn.boundary_connection_counts
1186
+ )
1187
+ _stage_int_block(
1188
+ buf,
1189
+ "boundary connection elements",
1190
+ conn.boundary_connection_elements.astype(np.int64) + 1,
1191
+ )
1192
+ _stage_int_block(
1193
+ buf,
1194
+ "boundary connection zones",
1195
+ conn.boundary_connection_zones.astype(np.int64) + 1,
1196
+ )
1197
+
1198
+ self._check_handle().write(buf.getvalue())
1199
+ self.current_zone = new_zone_index
1200
+
1201
+ self._meta.record_zone(
1202
+ ZoneMeta(
1203
+ index=self.current_zone,
1204
+ title=title,
1205
+ zone_type=zone_type,
1206
+ solution_time=solution_time,
1207
+ strand_id=strand_id,
1208
+ num_aux_items=len(aux) if aux else 0,
1209
+ num_nodes=conn.num_nodes,
1210
+ num_elements=conn.num_cells,
1211
+ num_faces=conn.num_faces,
1212
+ total_face_nodes=conn.total_face_nodes,
1213
+ num_boundary_faces=conn.num_boundary_faces,
1214
+ num_boundary_connections=conn.num_boundary_connections,
1215
+ value_locations=tuple(prepared.value_locations_global),
1216
+ passive_vars=tuple(prepared.passive_vars),
1217
+ shared_vars=tuple(prepared.var_sharing),
1218
+ data_types=tuple(prepared.variable_types_global),
1219
+ )
1220
+ )
1221
+
907
1222
  # -- Private helpers --------------------------------------------------------------
908
1223
 
909
1224
  def _handle_zone_error(self) -> None:
@@ -947,6 +1262,10 @@ class TecplotDatWriter(TecplotWriter):
947
1262
  num_face_connections: int = 0,
948
1263
  face_neighbor_mode: FaceNeighborMode = FaceNeighborMode.LOCAL_ONE_TO_ONE,
949
1264
  face_neighbors_complete: bool | None = None,
1265
+ num_faces: int = 0,
1266
+ total_face_nodes: int = 0,
1267
+ num_boundary_faces: int = 0,
1268
+ num_boundary_connections: int = 0,
950
1269
  ) -> None:
951
1270
  """Write a ``ZONE`` header block into the staging buffer *buf*."""
952
1271
  zt_str = _ZONETYPE_STR[zone_type]
@@ -959,6 +1278,11 @@ class TecplotDatWriter(TecplotWriter):
959
1278
 
960
1279
  if zone_type == ZoneType.ORDERED:
961
1280
  buf.write(f"{_INDENT}I={imax}, J={jmax}, K={kmax}, ZONETYPE={zt_str}\n")
1281
+ elif zone_type in _FE_POLY:
1282
+ buf.write(
1283
+ f"{_INDENT}Nodes={num_nodes}, Faces={num_faces}, "
1284
+ f"Elements={num_elements}, ZONETYPE={zt_str}\n"
1285
+ )
962
1286
  else:
963
1287
  buf.write(
964
1288
  f"{_INDENT}Nodes={num_nodes}, Elements={num_elements}, "
@@ -967,6 +1291,19 @@ class TecplotDatWriter(TecplotWriter):
967
1291
 
968
1292
  buf.write(f"{_INDENT}DATAPACKING={datapacking.name}\n")
969
1293
 
1294
+ if zone_type in _FE_POLY:
1295
+ # A polygon face always has 2 nodes, so only polyhedra record the total.
1296
+ face_nodes_str = (
1297
+ f"TotalNumFaceNodes={total_face_nodes}, "
1298
+ if zone_type is ZoneType.FEPOLYHEDRON
1299
+ else ""
1300
+ )
1301
+ buf.write(
1302
+ f"{_INDENT}{face_nodes_str}"
1303
+ f"NumConnectedBoundaryFaces={num_boundary_faces}, "
1304
+ f"TotalNumBoundaryConnections={num_boundary_connections}\n"
1305
+ )
1306
+
970
1307
  if num_face_connections > 0:
971
1308
  buf.write(f"{_INDENT}FACENEIGHBORCONNECTIONS={num_face_connections}\n")
972
1309
  buf.write(