plot3d 1.7.5__tar.gz → 1.7.7__tar.gz
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.
- {plot3d-1.7.5 → plot3d-1.7.7}/PKG-INFO +3 -2
- {plot3d-1.7.5 → plot3d-1.7.7}/plot3d/graph.py +25 -3
- {plot3d-1.7.5 → plot3d-1.7.7}/plot3d/gridpro/import_functions.py +60 -22
- {plot3d-1.7.5 → plot3d-1.7.7}/plot3d/periodicity.py +2 -1
- {plot3d-1.7.5 → plot3d-1.7.7}/pyproject.toml +11 -2
- {plot3d-1.7.5 → plot3d-1.7.7}/plot3d/__init__.py +0 -0
- {plot3d-1.7.5 → plot3d-1.7.7}/plot3d/block.py +0 -0
- {plot3d-1.7.5 → plot3d-1.7.7}/plot3d/block_merging_mixed_facepairs.py +0 -0
- {plot3d-1.7.5 → plot3d-1.7.7}/plot3d/blockfunctions.py +0 -0
- {plot3d-1.7.5 → plot3d-1.7.7}/plot3d/connectivity.py +0 -0
- {plot3d-1.7.5 → plot3d-1.7.7}/plot3d/differencing.py +0 -0
- {plot3d-1.7.5 → plot3d-1.7.7}/plot3d/face.py +0 -0
- {plot3d-1.7.5 → plot3d-1.7.7}/plot3d/facefunctions.py +0 -0
- {plot3d-1.7.5 → plot3d-1.7.7}/plot3d/glennht/__init__.py +0 -0
- {plot3d-1.7.5 → plot3d-1.7.7}/plot3d/glennht/class_definitions.py +0 -0
- {plot3d-1.7.5 → plot3d-1.7.7}/plot3d/glennht/export_functions.py +0 -0
- {plot3d-1.7.5 → plot3d-1.7.7}/plot3d/glennht/import_functions.py +0 -0
- {plot3d-1.7.5 → plot3d-1.7.7}/plot3d/gridpro/__init__.py +0 -0
- {plot3d-1.7.5 → plot3d-1.7.7}/plot3d/listfunctions.py +0 -0
- {plot3d-1.7.5 → plot3d-1.7.7}/plot3d/point_match.py +0 -0
- {plot3d-1.7.5 → plot3d-1.7.7}/plot3d/read.py +0 -0
- {plot3d-1.7.5 → plot3d-1.7.7}/plot3d/split_block.py +0 -0
- {plot3d-1.7.5 → plot3d-1.7.7}/plot3d/write.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: plot3d
|
|
3
|
-
Version: 1.7.
|
|
3
|
+
Version: 1.7.7
|
|
4
4
|
Summary: Plot3D python utilities for reading and writing and also finding connectivity between blocks
|
|
5
5
|
Author: Paht Juangphanich
|
|
6
6
|
Author-email: paht.juangphanich@nasa.gov
|
|
@@ -8,9 +8,10 @@ Requires-Python: >=3.10.12,<4.0.0
|
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
9
9
|
Classifier: Programming Language :: Python :: 3.11
|
|
10
10
|
Classifier: Programming Language :: Python :: 3.12
|
|
11
|
+
Requires-Dist: matplotlib
|
|
11
12
|
Requires-Dist: networkx
|
|
12
13
|
Requires-Dist: numpy
|
|
13
14
|
Requires-Dist: pandas
|
|
14
|
-
Requires-Dist: pymetis
|
|
15
|
+
Requires-Dist: pymetis ; platform_system != "Windows"
|
|
15
16
|
Requires-Dist: scipy
|
|
16
17
|
Requires-Dist: tqdm
|
|
@@ -4,8 +4,18 @@ from __future__ import annotations
|
|
|
4
4
|
from pathlib import Path
|
|
5
5
|
from typing import Dict, List, Sequence, Tuple, Optional
|
|
6
6
|
import inspect
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
import sys
|
|
8
|
+
|
|
9
|
+
if sys.platform != "win32":
|
|
10
|
+
try:
|
|
11
|
+
import pymetis # type: ignore
|
|
12
|
+
HAS_PYMETIS = True
|
|
13
|
+
except Exception: # pragma: no cover - optional dependency
|
|
14
|
+
pymetis = None # type: ignore
|
|
15
|
+
HAS_PYMETIS = False
|
|
16
|
+
else:
|
|
17
|
+
pymetis = None # type: ignore
|
|
18
|
+
HAS_PYMETIS = False
|
|
9
19
|
from .block import Block # <-- use your existing Block
|
|
10
20
|
|
|
11
21
|
|
|
@@ -139,7 +149,13 @@ def _metis_part_graph_compat(
|
|
|
139
149
|
Returns:
|
|
140
150
|
(edgecut, parts)
|
|
141
151
|
"""
|
|
142
|
-
|
|
152
|
+
if not HAS_PYMETIS:
|
|
153
|
+
raise RuntimeError(
|
|
154
|
+
"pymetis is not available. On Windows it is skipped during install; "
|
|
155
|
+
"use Linux/macOS to enable METIS-based partitioning."
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
sig_params = set(inspect.signature(pymetis.part_graph).parameters.keys()) # type: ignore[attr-defined]
|
|
143
159
|
|
|
144
160
|
# Prefer keyword args when supported
|
|
145
161
|
if {"xadj", "adjncy"}.issubset(sig_params):
|
|
@@ -194,6 +210,12 @@ def partition_from_face_matches(
|
|
|
194
210
|
edge_w : Dict[int, Dict[int, int]]
|
|
195
211
|
Edge weights.
|
|
196
212
|
"""
|
|
213
|
+
if not HAS_PYMETIS:
|
|
214
|
+
raise RuntimeError(
|
|
215
|
+
"METIS partitioning is disabled because pymetis is unavailable. "
|
|
216
|
+
"Install pymetis (Linux/macOS) or run on a platform where it is supported."
|
|
217
|
+
)
|
|
218
|
+
|
|
197
219
|
n_blocks = len(blocks)
|
|
198
220
|
adj_list, edge_w = build_weighted_graph_from_face_matches(
|
|
199
221
|
face_matches, n_blocks,
|
|
@@ -82,23 +82,54 @@ def read_gridpro_connectivity(
|
|
|
82
82
|
file_path: str,
|
|
83
83
|
sb_zero_based_in_file: bool = True, # False if sb1/sb2 are 1-based in file
|
|
84
84
|
index_zero_based_in_file: bool = True, # False if IMIN..KMAX are 1-based in file
|
|
85
|
+
inlet_ids: Optional[List[int]] = None,
|
|
86
|
+
outlet_ids: Optional[List[int]] = None,
|
|
87
|
+
wall_ids: Optional[List[int]] = None,
|
|
88
|
+
symm_slip_ids: Optional[List[int]] = None,
|
|
89
|
+
custom_bc_ids: Optional[Dict[str, List[int]]] = None,
|
|
85
90
|
) -> Dict[str, object]:
|
|
86
|
-
"""
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
91
|
+
"""Parse a GridPro connectivity file into plot3d.connectivity_fast-like structures.
|
|
92
|
+
|
|
93
|
+
Expected P-line layout (as provided):
|
|
94
|
+
``P pid sb1 sf1 sb2 sf2 fmap L1i L1j L1k H1i H1j H1k L2i L2j L2k H2i H2j H2k pty lbid``
|
|
95
|
+
|
|
96
|
+
Boundary-condition IDs default to GridPro's PTY values but can be overridden
|
|
97
|
+
via the provided *_ids lists or extended via ``custom_bc_ids={"name": [ids]}``.
|
|
98
|
+
|
|
99
|
+
Args:
|
|
100
|
+
file_path: Path to the GridPro connectivity file.
|
|
101
|
+
sb_zero_based_in_file: Set False if ``sb1/sb2`` are 1-based in the file.
|
|
102
|
+
index_zero_based_in_file: Set False if IMIN..KMAX are 1-based in the file.
|
|
103
|
+
inlet_ids: PTY ids to treat as inlet; defaults to ``[5]``.
|
|
104
|
+
outlet_ids: PTY ids to treat as outlet; defaults to ``[6]``.
|
|
105
|
+
wall_ids: PTY ids to treat as wall; defaults to ``[2]``.
|
|
106
|
+
symm_slip_ids: PTY ids to treat as symmetry/slip; defaults to ``[4]``.
|
|
107
|
+
custom_bc_ids: Optional mapping of ``group_name -> [pty ids]`` for any
|
|
108
|
+
additional boundary-condition groupings (e.g., ``{"cooling": [500]}``).
|
|
109
|
+
|
|
110
|
+
Returns:
|
|
111
|
+
Dict[str, object]: A dictionary with keys:
|
|
112
|
+
- ``face_matches``: list of face-pair dictionaries for connected blocks.
|
|
113
|
+
- ``outer_faces``: list of faces on the exterior (no neighbor).
|
|
114
|
+
- ``bc_group``: mapping of bc name to list of faces (inlet/outlet/etc.).
|
|
115
|
+
- ``gif_faces``: list of faces tagged as GIF (pty 12..21 or 1000).
|
|
116
|
+
- ``periodic_faces``: list of paired periodic faces (pty 3).
|
|
117
|
+
- ``volume_zones``: list describing volume zone type per superblock.
|
|
118
|
+
|
|
119
|
+
Examples:
|
|
120
|
+
Basic usage with defaults::
|
|
121
|
+
|
|
122
|
+
data = read_gridpro_connectivity("connectivity.dat")
|
|
123
|
+
inlet_faces = data["bc_group"]["inlet"]
|
|
124
|
+
|
|
125
|
+
Override built-in BC ids and add a custom group::
|
|
126
|
+
|
|
127
|
+
data = read_gridpro_connectivity(
|
|
128
|
+
"connectivity.dat",
|
|
129
|
+
inlet_ids=[5, 105],
|
|
130
|
+
custom_bc_ids={"cooling_hole1": [500]},
|
|
131
|
+
)
|
|
132
|
+
cooling_faces = data["bc_group"]["cooling_hole1"]
|
|
102
133
|
"""
|
|
103
134
|
# ---------------------------- parsing ----------------------------
|
|
104
135
|
superblock_ptys: List[int] = []
|
|
@@ -207,18 +238,25 @@ def read_gridpro_connectivity(
|
|
|
207
238
|
)
|
|
208
239
|
|
|
209
240
|
# Boundary-condition groups (by pty)
|
|
210
|
-
def bc_faces_for(
|
|
241
|
+
def bc_faces_for(pty_vals: List[int]) -> List[Dict[str, int]]:
|
|
242
|
+
targets = set(pty_vals)
|
|
211
243
|
return [
|
|
212
244
|
face_dict(p["sb1"], p["L1i"], p["L1j"], p["L1k"], p["H1i"], p["H1j"], p["H1k"], p["pty"]) # type: ignore
|
|
213
|
-
for p in patches if p["pty"]
|
|
245
|
+
for p in patches if p["pty"] in targets
|
|
214
246
|
]
|
|
215
247
|
|
|
216
248
|
bc_group = {
|
|
217
|
-
"inlet": bc_faces_for(5),
|
|
218
|
-
"outlet": bc_faces_for(6),
|
|
219
|
-
"symm_slip": bc_faces_for(4),
|
|
220
|
-
"wall": bc_faces_for(2),
|
|
249
|
+
"inlet": bc_faces_for(inlet_ids or [5]),
|
|
250
|
+
"outlet": bc_faces_for(outlet_ids or [6]),
|
|
251
|
+
"symm_slip": bc_faces_for(symm_slip_ids or [4]),
|
|
252
|
+
"wall": bc_faces_for(wall_ids or [2]),
|
|
221
253
|
}
|
|
254
|
+
|
|
255
|
+
# add any user-defined boundary groups keyed by name -> list of pty ids
|
|
256
|
+
if custom_bc_ids:
|
|
257
|
+
for name, ids in custom_bc_ids.items():
|
|
258
|
+
if ids:
|
|
259
|
+
bc_group[name] = bc_faces_for(ids)
|
|
222
260
|
|
|
223
261
|
# Periodic faces: pty == 3 (explicit pairs)
|
|
224
262
|
periodic_faces: List[Dict[str, Dict[str, int]]] = []
|
|
@@ -365,7 +365,7 @@ def rotated_periodicity(blocks:List[Block], matched_faces:List[Dict[str,int]], o
|
|
|
365
365
|
"""
|
|
366
366
|
gcd_array = list()
|
|
367
367
|
# Find the gcd of all the blocks
|
|
368
|
-
if ReduceMesh
|
|
368
|
+
if ReduceMesh:
|
|
369
369
|
for block_indx in range(len(blocks)):
|
|
370
370
|
block = blocks[block_indx]
|
|
371
371
|
gcd_array.append(math.gcd(block.IMAX-1, math.gcd(block.JMAX-1, block.KMAX-1)))
|
|
@@ -410,6 +410,7 @@ def rotated_periodicity(blocks:List[Block], matched_faces:List[Dict[str,int]], o
|
|
|
410
410
|
# Rotate Block 1
|
|
411
411
|
block1_rotated = blocks_rotated[face1.blockIndex]
|
|
412
412
|
block2 = blocks[face2.blockIndex]
|
|
413
|
+
print(f'evaluating working blocks: a={face1.blockIndex} b={face2.blockIndex}')
|
|
413
414
|
# Check periodicity
|
|
414
415
|
df, periodic_faces_temp, split_faces_temp = __periodicity_check__(face1,face2,block1_rotated, block2)
|
|
415
416
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "plot3d"
|
|
3
|
-
version = "1.7.
|
|
3
|
+
version = "1.7.7"
|
|
4
4
|
description = "Plot3D python utilities for reading and writing and also finding connectivity between blocks"
|
|
5
5
|
authors = ["Paht Juangphanich <paht.juangphanich@nasa.gov>"]
|
|
6
6
|
|
|
@@ -11,10 +11,19 @@ scipy = "*"
|
|
|
11
11
|
pandas = "*"
|
|
12
12
|
tqdm = "*"
|
|
13
13
|
networkx = "*"
|
|
14
|
-
pymetis = "*"
|
|
14
|
+
pymetis = { version = "*", markers = "platform_system != 'Windows'" }
|
|
15
|
+
matplotlib = "*"
|
|
15
16
|
|
|
16
17
|
[tool.poetry.group.deve.dependencies]
|
|
17
18
|
|
|
19
|
+
[tool.poetry.group.docs]
|
|
20
|
+
optional = true
|
|
21
|
+
|
|
22
|
+
[tool.poetry.group.docs.dependencies]
|
|
23
|
+
sphinx = "^7.4"
|
|
24
|
+
sphinx-rtd-theme = "^2.0"
|
|
25
|
+
sphinx-autobuild = "^2024.4"
|
|
26
|
+
|
|
18
27
|
[build-system]
|
|
19
28
|
requires = ["poetry>=1.1.2"]
|
|
20
29
|
build-backend = "poetry.masonry.api"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|