toughanimator 0.1.8__py3-none-any.whl → 0.1.9__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.
toughanimator/run.py CHANGED
@@ -10,7 +10,7 @@ test_case_dir = os.path.join(os.path.dirname(os.path.dirname(__file__)), dir_nam
10
10
 
11
11
  case_dir = os.path.join(test_case_dir, case_name)
12
12
 
13
-
13
+ case_dir = r"D:\Projects\202511\dip_left\TRv4"
14
14
  #case_dir = r"D:\Projects\202504\polygonal\poly_test"
15
15
  #case_dir = r"D:\Projects\202507\tough系列output\tough output format\TR_MINC_exe"
16
16
  #case_dir = r"D:\Projects\202508\tough_cases\WW\7_TR_MINC_petrasim2025__5spot"
@@ -1028,6 +1028,9 @@ class vis_reader:
1028
1028
  if os.path.isfile(self.tec_scalar_path):
1029
1029
  firstFile = False
1030
1030
  file = open(self.tec_scalar_path, "a")
1031
+ if len(self.setting.selected_variables_scalar) == 0:
1032
+ self.setting.selected_variables_scalar = headers
1033
+
1031
1034
  if firstFile:
1032
1035
  file.write('TITLE = TECPLOT PLOT \n')
1033
1036
  selected_header_string = '"'+'", "'.join(self.setting.selected_variables_scalar) + '"'
@@ -1038,37 +1041,42 @@ class vis_reader:
1038
1041
 
1039
1042
  #time_statement = f'ZONE T ="{vis_time_step.time_step}, Time = {vis_time_step.time}", N = {vtu_cell_to_points.GetNumberOfPoints()}, E = {vtu_cell_to_points.GetNumberOfCells()}, F = FEPOINT, ET = {tecplot_cell_type}, SOLUTIONTIME = {vis_time_step.time}\n'
1040
1043
 
1041
- time_statement = f'ZONE T="{vis_time_step.time_step}, Time = {vis_time_step.time}", I={self.xyz_elem[0] + 1}, J={self.xyz_elem[1] + 1}, K={self.xyz_elem[2] + 1}, SOLUTIONTIME={vis_time_step.time}, DATAPACKING=BLOCK, VARLOCATION=({self.__get_varlocarion_string(headers)})'
1044
+ time_statement = f'ZONE T="{vis_time_step.time_step}, Time = {vis_time_step.time}", I={self.xyz_elem[0] + 1}, J={self.xyz_elem[1] + 1}, K={self.xyz_elem[2] + 1}, SOLUTIONTIME={vis_time_step.time}, DATAPACKING=BLOCK, VARLOCATION=({self.__get_varlocarion_string(self.setting.selected_variables_scalar)})'
1042
1045
  if not firstFile:
1043
1046
  time_statement = f'{time_statement}, D=(1,2,3,FECONNECT)'
1044
1047
  #if self.setting.debug:
1045
1048
  #time_statement = f'ZONE T ="{vis_time_step.time_step}, Time = {vis_time_step.time}", N = {vtu_cell_to_points.GetNumberOfPoints()}, E = {vtu_cell_to_points.GetNumberOfCells()}, F = FEPOINT, ET = {tecplot_cell_type}\n'
1046
1049
  file.write(f'{time_statement}\n')
1047
-
1050
+ max_line_length = 20000
1048
1051
  # X, Y, Z
1049
1052
  if firstFile:
1050
- for i in range(0, vtr.GetNumberOfPoints()):
1051
- point = vtr.GetPoint(i)
1052
- file.write(str(point[0]) + " ")
1053
- file.write(" \n")
1054
-
1055
- for i in range(0, vtr.GetNumberOfPoints()):
1056
- point = vtr.GetPoint(i)
1057
- file.write(str(point[1]) + " ")
1058
- file.write(" \n")
1059
-
1060
- for i in range(0, vtr.GetNumberOfPoints()):
1061
- point = vtr.GetPoint(i)
1062
- file.write(str(point[2]) + " ")
1063
- file.write(" \n")
1053
+ for point_idx in range(0, 3):
1054
+ line_string = ''
1055
+ for i in range(0, vtr.GetNumberOfPoints()):
1056
+ point = vtr.GetPoint(i)
1057
+ #file.write(str(point[0]) + " ")
1058
+ if len(line_string) + len(str(point[point_idx])) + 1 > max_line_length:
1059
+ # write the current line to file
1060
+ file.write(f'{line_string}\n')
1061
+ # reset the line string
1062
+ line_string = ''
1063
+ line_string = f'{line_string}{str(point[point_idx])} '
1064
+
1065
+ file.write(f'{line_string}\n')
1064
1066
 
1065
1067
  # Other data
1066
1068
  for header in self.setting.selected_variables_scalar:
1067
1069
  array = vtr.GetCellData().GetArray(header)
1068
-
1070
+ line_string = ''
1069
1071
  for e in range(0, vtr.GetNumberOfCells()):
1070
- file.write(str(array.GetValue(e)) + " ")
1071
- file.write(" \n")
1072
+ #file.write(f'{str(array.GetComponent(e, 0))} ')
1073
+ if len(line_string) + len(str(array.GetValue(e))) + 1 > max_line_length:
1074
+ # write the current line to file
1075
+ file.write(f'{line_string}\n')
1076
+ # reset the line string
1077
+ line_string = ''
1078
+ line_string = f'{line_string}{str(array.GetValue(e))} '
1079
+ file.write(f'{line_string}\n')
1072
1080
 
1073
1081
  file.close()
1074
1082
 
@@ -1203,6 +1211,11 @@ class vis_reader:
1203
1211
 
1204
1212
  if VisType.Tecplot not in self.setting.vis_types:
1205
1213
  return
1214
+
1215
+
1216
+ if self.setting.mesh_type == MeshType.PolygonalMesh:
1217
+ print(f' Tecplot output for polygonal mesh is not supported yet.')
1218
+ return
1206
1219
 
1207
1220
  # Start Tecplot generating
1208
1221
  tec_name = pathlib.Path(self.setting.input_file_paths[0]).stem
@@ -1212,11 +1225,16 @@ class vis_reader:
1212
1225
  firstFile = False
1213
1226
  file = open(self.tec_vector_path, "a")
1214
1227
 
1215
- vector_headers = self.__get_tec_vector_headers(headers)
1228
+ #selected_header_string = '"'+'", "'.join(self.setting.selected_variables_scalar) + '"'
1229
+ if len(self.setting.selected_variables_vector) == 0:
1230
+ self.setting.selected_variables_vector = headers
1231
+ vector_headers = self.__get_tec_vector_headers(self.setting.selected_variables_vector)
1232
+
1216
1233
  # add header
1217
1234
  if firstFile:
1218
1235
  file.write('TITLE = TECPLOT PLOT \n')
1219
1236
  header_string = '"'+'", "'.join(vector_headers) + '"'
1237
+
1220
1238
  file.write(f'VARIABLES = "X", "Y", "Z", {header_string}\n')
1221
1239
 
1222
1240
  time_statement = f'ZONE T="{vis_time_step.time_step}, Time = {vis_time_step.time}", I={self.xyz_elem[0] + 1}, J={self.xyz_elem[1] + 1}, K={self.xyz_elem[2] + 1}, SOLUTIONTIME={vis_time_step.time}, DATAPACKING=BLOCK, VARLOCATION=({self.__get_varlocarion_string(vector_headers)})'
@@ -1226,38 +1244,40 @@ class vis_reader:
1226
1244
  #time_statement = f'ZONE T ="{vis_time_step.time_step}, Time = {vis_time_step.time}", N = {vtu_cell_to_points.GetNumberOfPoints()}, E = {vtu_cell_to_points.GetNumberOfCells()}, F = FEPOINT, ET = {tecplot_cell_type}\n'
1227
1245
  file.write(f'{time_statement}\n')
1228
1246
 
1247
+ max_line_length = 20000
1229
1248
  # X, Y, Z
1230
- if firstFile:
1231
- for i in range(0, vector_vtr.GetNumberOfPoints()):
1232
- point = vector_vtr.GetPoint(i)
1233
- file.write(str(point[0]) + " ")
1234
- file.write(" \n")
1249
+ if firstFile:
1250
+ for point_idx in range(0, 3):
1251
+ line_string = ''
1252
+ for i in range(0, vector_vtr.GetNumberOfPoints()):
1253
+ point = vector_vtr.GetPoint(i)
1254
+ #file.write(str(point[0]) + " ")
1255
+ if len(line_string) + len(str(point[point_idx])) + 1 > max_line_length:
1256
+ # write the current line to file
1257
+ file.write(f'{line_string}\n')
1258
+ # reset the line string
1259
+ line_string = ''
1260
+ line_string = f'{line_string}{str(point[point_idx])} '
1261
+ file.write(f'{line_string}\n')
1235
1262
 
1236
- for i in range(0, vector_vtr.GetNumberOfPoints()):
1237
- point = vector_vtr.GetPoint(i)
1238
- file.write(str(point[1]) + " ")
1239
- file.write(" \n")
1240
1263
 
1241
- for i in range(0, vector_vtr.GetNumberOfPoints()):
1242
- point = vector_vtr.GetPoint(i)
1243
- file.write(str(point[2]) + " ")
1244
- file.write(" \n")
1245
1264
 
1246
1265
  # Other data
1247
- for header in headers:
1248
- array = vector_vtr.GetCellData().GetArray(header)
1266
+ for header in self.setting.selected_variables_vector:
1249
1267
 
1250
- for e in range(0, vector_vtr.GetNumberOfCells()):
1251
- file.write(f'{str(array.GetComponent(e, 0))} ')
1252
- file.write(" \n")
1253
-
1254
- for e in range(0, vector_vtr.GetNumberOfCells()):
1255
- file.write(f'{str(array.GetComponent(e, 1))} ')
1256
- file.write(" \n")
1268
+ array = vector_vtr.GetCellData().GetArray(header)
1257
1269
 
1258
- for e in range(0, vector_vtr.GetNumberOfCells()):
1259
- file.write(f'{str(array.GetComponent(e, 2))} ')
1260
- file.write(" \n")
1270
+ for dim_idx in range(0, 3):
1271
+ line_string = ''
1272
+ for e in range(0, vector_vtr.GetNumberOfCells()):
1273
+ #file.write(f'{str(array.GetComponent(e, 0))} ')
1274
+ if len(line_string) + len(str(array.GetComponent(e, dim_idx))) + 1 > max_line_length:
1275
+ # write the current line to file
1276
+ file.write(f'{line_string}\n')
1277
+ # reset the line string
1278
+ line_string = ''
1279
+ line_string = f'{line_string}{str(array.GetComponent(e, dim_idx))} '
1280
+ file.write(f'{line_string}\n')
1261
1281
 
1262
1282
  file.close()
1263
1283
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: toughanimator
3
- Version: 0.1.8
3
+ Version: 0.1.9
4
4
  Summary: A tool for visualizing TOUGH simulation outputs.
5
5
  Home-page: https://github.com/scarletref/toughanimator
6
6
  Author: scarletref
@@ -8,7 +8,7 @@ Author-email: scarletreflection@gmail.com
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Classifier: License :: OSI Approved :: MIT License
10
10
  Classifier: Operating System :: OS Independent
11
- Requires-Python: >=3.7
11
+ Requires-Python: >=3.11,<3.14
12
12
  Description-Content-Type: text/markdown
13
13
  Requires-Dist: numpy
14
14
  Requires-Dist: pandas
@@ -0,0 +1,7 @@
1
+ toughanimator/__init__.py,sha256=m1f3fJ1SNGLNKxHlS0pLNHwaHlN6UUTh5GpS_8hC8kw,30
2
+ toughanimator/run.py,sha256=LplSjwo8it2cLGZM3GAwah1UvJ5FGrpsloF6A3z2gsU,817
3
+ toughanimator/tough_classes.py,sha256=jjxuG59vo6uqGYHIsKMp2dIeBnyPFyYCqCRGyj3N5V0,113089
4
+ toughanimator-0.1.9.dist-info/METADATA,sha256=l-JeJLpgOdo_-nqpTq0TAgbRWt6FHGgGrZ2e3Nw8gJE,4570
5
+ toughanimator-0.1.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
+ toughanimator-0.1.9.dist-info/top_level.txt,sha256=pAT-UflvbjT4lTmBdzHqApZGWbywkSM3Y_qsHyLi4pU,14
7
+ toughanimator-0.1.9.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- toughanimator/__init__.py,sha256=m1f3fJ1SNGLNKxHlS0pLNHwaHlN6UUTh5GpS_8hC8kw,30
2
- toughanimator/run.py,sha256=YmoiVElHRCo9BzMmBuB53zGy_h8AEQddllQJsqN3tV4,771
3
- toughanimator/tough_classes.py,sha256=c_EUwDstIVv-GdoarIDI6IMOL1m0pHHYV1ep2l9Nw7I,111590
4
- toughanimator-0.1.8.dist-info/METADATA,sha256=QyIJQViNITA9ygInPnLzaF105ywS5D7ZXcU9eCW8hTc,4563
5
- toughanimator-0.1.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
- toughanimator-0.1.8.dist-info/top_level.txt,sha256=pAT-UflvbjT4lTmBdzHqApZGWbywkSM3Y_qsHyLi4pU,14
7
- toughanimator-0.1.8.dist-info/RECORD,,