foamlib 0.3.7__tar.gz → 0.3.8__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.
- {foamlib-0.3.7 → foamlib-0.3.8}/PKG-INFO +4 -3
- {foamlib-0.3.7 → foamlib-0.3.8}/README.md +3 -2
- {foamlib-0.3.7 → foamlib-0.3.8}/foamlib/__init__.py +1 -1
- {foamlib-0.3.7 → foamlib-0.3.8}/foamlib/_cases.py +31 -7
- {foamlib-0.3.7 → foamlib-0.3.8}/foamlib/_files/_files.py +1 -1
- {foamlib-0.3.7 → foamlib-0.3.8}/foamlib/_files/_io.py +0 -4
- {foamlib-0.3.7 → foamlib-0.3.8}/foamlib/_files/_parsing.py +1 -1
- {foamlib-0.3.7 → foamlib-0.3.8}/foamlib.egg-info/PKG-INFO +4 -3
- {foamlib-0.3.7 → foamlib-0.3.8}/LICENSE.txt +0 -0
- {foamlib-0.3.7 → foamlib-0.3.8}/foamlib/_files/__init__.py +0 -0
- {foamlib-0.3.7 → foamlib-0.3.8}/foamlib/_files/_base.py +0 -0
- {foamlib-0.3.7 → foamlib-0.3.8}/foamlib/_files/_serialization.py +0 -0
- {foamlib-0.3.7 → foamlib-0.3.8}/foamlib/_util.py +0 -0
- {foamlib-0.3.7 → foamlib-0.3.8}/foamlib/py.typed +0 -0
- {foamlib-0.3.7 → foamlib-0.3.8}/foamlib.egg-info/SOURCES.txt +0 -0
- {foamlib-0.3.7 → foamlib-0.3.8}/foamlib.egg-info/dependency_links.txt +0 -0
- {foamlib-0.3.7 → foamlib-0.3.8}/foamlib.egg-info/requires.txt +0 -0
- {foamlib-0.3.7 → foamlib-0.3.8}/foamlib.egg-info/top_level.txt +0 -0
- {foamlib-0.3.7 → foamlib-0.3.8}/pyproject.toml +0 -0
- {foamlib-0.3.7 → foamlib-0.3.8}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: foamlib
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.8
|
4
4
|
Summary: A Python interface for interacting with OpenFOAM
|
5
5
|
Author-email: "Gabriel S. Gerlero" <ggerlero@cimec.unl.edu.ar>
|
6
6
|
Project-URL: Homepage, https://github.com/gerlero/foamlib
|
@@ -45,7 +45,7 @@ Requires-Dist: sphinx<8,>=7; extra == "docs"
|
|
45
45
|
Requires-Dist: sphinx_rtd_theme; extra == "docs"
|
46
46
|
Requires-Dist: numpy<2,>=1; extra == "docs"
|
47
47
|
|
48
|
-
|
48
|
+
[<img alt="foamlib" src="https://github.com/gerlero/foamlib/raw/main/logo.png" height="50">](https://github.com/gerlero/foamlib)
|
49
49
|
|
50
50
|
[](https://foamlib.readthedocs.io/)
|
51
51
|
[](https://github.com/gerlero/foamlib/actions/workflows/ci.yml)
|
@@ -54,7 +54,8 @@ Requires-Dist: numpy<2,>=1; extra == "docs"
|
|
54
54
|
[](https://github.com/astral-sh/ruff)
|
55
55
|
[](https://pypi.org/project/foamlib/)
|
56
56
|
[](https://pypi.org/project/foamlib/)
|
57
|
-
|
57
|
+

|
58
|
+
[](https://hub.docker.com/r/microfluidica/foamlib/)
|
58
59
|
|
59
60
|
**foamlib** provides a simple, modern and ergonomic Python interface for interacting with [OpenFOAM](https://www.openfoam.com).
|
60
61
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
[<img alt="foamlib" src="https://github.com/gerlero/foamlib/raw/main/logo.png" height="50">](https://github.com/gerlero/foamlib)
|
2
2
|
|
3
3
|
[](https://foamlib.readthedocs.io/)
|
4
4
|
[](https://github.com/gerlero/foamlib/actions/workflows/ci.yml)
|
@@ -7,7 +7,8 @@
|
|
7
7
|
[](https://github.com/astral-sh/ruff)
|
8
8
|
[](https://pypi.org/project/foamlib/)
|
9
9
|
[](https://pypi.org/project/foamlib/)
|
10
|
-
|
10
|
+

|
11
|
+
[](https://hub.docker.com/r/microfluidica/foamlib/)
|
11
12
|
|
12
13
|
**foamlib** provides a simple, modern and ergonomic Python interface for interacting with [OpenFOAM](https://www.openfoam.com).
|
13
14
|
|
@@ -32,8 +32,6 @@ from ._util import is_sequence, run_process, run_process_async
|
|
32
32
|
class FoamCaseBase(Sequence["FoamCaseBase.TimeDirectory"]):
|
33
33
|
def __init__(self, path: Union[Path, str] = Path()):
|
34
34
|
self.path = Path(path).absolute()
|
35
|
-
if not self.path.is_dir():
|
36
|
-
raise NotADirectoryError(f"{self.path} is not a directory")
|
37
35
|
|
38
36
|
class TimeDirectory(Set[FoamFieldFile]):
|
39
37
|
"""
|
@@ -46,8 +44,6 @@ class FoamCaseBase(Sequence["FoamCaseBase.TimeDirectory"]):
|
|
46
44
|
|
47
45
|
def __init__(self, path: Union[Path, str]):
|
48
46
|
self.path = Path(path).absolute()
|
49
|
-
if not self.path.is_dir():
|
50
|
-
raise NotADirectoryError(f"{self.path} is not a directory")
|
51
47
|
|
52
48
|
@property
|
53
49
|
def time(self) -> float:
|
@@ -148,9 +144,15 @@ class FoamCaseBase(Sequence["FoamCaseBase.TimeDirectory"]):
|
|
148
144
|
if has_decompose_par_dict and p.name.startswith("processor"):
|
149
145
|
paths.add(p)
|
150
146
|
|
147
|
+
if (self.path / "0.orig").is_dir() and (self.path / "0").is_dir():
|
148
|
+
paths.add(self.path / "0")
|
149
|
+
|
151
150
|
if has_block_mesh_dict and (self.path / "constant" / "polyMesh").exists():
|
152
151
|
paths.add(self.path / "constant" / "polyMesh")
|
153
152
|
|
153
|
+
if self._run_script() is not None:
|
154
|
+
paths.update(self.path.glob("log.*"))
|
155
|
+
|
154
156
|
return paths
|
155
157
|
|
156
158
|
def _clone_ignore(
|
@@ -176,7 +178,7 @@ class FoamCaseBase(Sequence["FoamCaseBase.TimeDirectory"]):
|
|
176
178
|
else:
|
177
179
|
return None
|
178
180
|
|
179
|
-
def _run_script(self, *, parallel: Optional[bool]) -> Optional[Path]:
|
181
|
+
def _run_script(self, *, parallel: Optional[bool] = None) -> Optional[Path]:
|
180
182
|
"""Return the path to the (All)run script, or None if no run script is found."""
|
181
183
|
run = self.path / "run"
|
182
184
|
run_parallel = self.path / "run-parallel"
|
@@ -325,7 +327,10 @@ class FoamCase(FoamCaseBase):
|
|
325
327
|
self.run([script_path], check=check)
|
326
328
|
else:
|
327
329
|
for p in self._clean_paths():
|
328
|
-
|
330
|
+
if p.is_dir():
|
331
|
+
shutil.rmtree(p)
|
332
|
+
else:
|
333
|
+
p.unlink()
|
329
334
|
|
330
335
|
def run(
|
331
336
|
self,
|
@@ -359,6 +364,9 @@ class FoamCase(FoamCaseBase):
|
|
359
364
|
return self.run([script_path], check=check)
|
360
365
|
|
361
366
|
else:
|
367
|
+
if not self and (self.path / "0.orig").is_dir():
|
368
|
+
self.restore_0_dir()
|
369
|
+
|
362
370
|
if (self.path / "system" / "blockMeshDict").is_file():
|
363
371
|
self.block_mesh()
|
364
372
|
|
@@ -393,6 +401,11 @@ class FoamCase(FoamCaseBase):
|
|
393
401
|
"""Reconstruct this case after parallel running."""
|
394
402
|
self.run(["reconstructPar"], check=check)
|
395
403
|
|
404
|
+
def restore_0_dir(self) -> None:
|
405
|
+
"""Restore the 0 directory from the 0.orig directory."""
|
406
|
+
shutil.rmtree(self.path / "0", ignore_errors=True)
|
407
|
+
shutil.copytree(self.path / "0.orig", self.path / "0")
|
408
|
+
|
396
409
|
def copy(self, dest: Union[Path, str]) -> "FoamCase":
|
397
410
|
"""
|
398
411
|
Make a copy of this case.
|
@@ -478,7 +491,10 @@ class AsyncFoamCase(FoamCaseBase):
|
|
478
491
|
await self.run([script_path], check=check)
|
479
492
|
else:
|
480
493
|
for p in self._clean_paths():
|
481
|
-
|
494
|
+
if p.is_dir():
|
495
|
+
await aioshutil.rmtree(p)
|
496
|
+
else:
|
497
|
+
p.unlink()
|
482
498
|
|
483
499
|
async def run(
|
484
500
|
self,
|
@@ -531,6 +547,9 @@ class AsyncFoamCase(FoamCaseBase):
|
|
531
547
|
await self.run([script_path], check=check, cpus=cpus)
|
532
548
|
|
533
549
|
else:
|
550
|
+
if not self and (self.path / "0.orig").is_dir():
|
551
|
+
await self.restore_0_dir()
|
552
|
+
|
534
553
|
if (self.path / "system" / "blockMeshDict").is_file():
|
535
554
|
await self.block_mesh()
|
536
555
|
|
@@ -572,6 +591,11 @@ class AsyncFoamCase(FoamCaseBase):
|
|
572
591
|
"""Reconstruct this case after parallel running."""
|
573
592
|
await self.run(["reconstructPar"], check=check)
|
574
593
|
|
594
|
+
async def restore_0_dir(self) -> None:
|
595
|
+
"""Restore the 0 directory from the 0.orig directory."""
|
596
|
+
await aioshutil.rmtree(self.path / "0", ignore_errors=True)
|
597
|
+
await aioshutil.copytree(self.path / "0.orig", self.path / "0")
|
598
|
+
|
575
599
|
async def copy(self, dest: Union[Path, str]) -> "AsyncFoamCase":
|
576
600
|
"""
|
577
601
|
Make a copy of this case.
|
@@ -20,10 +20,6 @@ from ._parsing import Parsed
|
|
20
20
|
class FoamFileIO:
|
21
21
|
def __init__(self, path: Union[str, Path]) -> None:
|
22
22
|
self.path = Path(path).absolute()
|
23
|
-
if self.path.is_dir():
|
24
|
-
raise IsADirectoryError(self.path)
|
25
|
-
elif not self.path.is_file():
|
26
|
-
raise FileNotFoundError(self.path)
|
27
23
|
|
28
24
|
self.__contents: Optional[bytes] = None
|
29
25
|
self.__parsed: Optional[Parsed] = None
|
@@ -247,6 +247,6 @@ class Parsed(Mapping[Tuple[str, ...], Union[FoamDict.Data, EllipsisType]]):
|
|
247
247
|
r = v
|
248
248
|
|
249
249
|
assert isinstance(r, dict)
|
250
|
-
r[keywords[-1]] = {} if data is ... else data
|
250
|
+
r[keywords[-1]] = {} if data is ... else data
|
251
251
|
|
252
252
|
return ret
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: foamlib
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.8
|
4
4
|
Summary: A Python interface for interacting with OpenFOAM
|
5
5
|
Author-email: "Gabriel S. Gerlero" <ggerlero@cimec.unl.edu.ar>
|
6
6
|
Project-URL: Homepage, https://github.com/gerlero/foamlib
|
@@ -45,7 +45,7 @@ Requires-Dist: sphinx<8,>=7; extra == "docs"
|
|
45
45
|
Requires-Dist: sphinx_rtd_theme; extra == "docs"
|
46
46
|
Requires-Dist: numpy<2,>=1; extra == "docs"
|
47
47
|
|
48
|
-
|
48
|
+
[<img alt="foamlib" src="https://github.com/gerlero/foamlib/raw/main/logo.png" height="50">](https://github.com/gerlero/foamlib)
|
49
49
|
|
50
50
|
[](https://foamlib.readthedocs.io/)
|
51
51
|
[](https://github.com/gerlero/foamlib/actions/workflows/ci.yml)
|
@@ -54,7 +54,8 @@ Requires-Dist: numpy<2,>=1; extra == "docs"
|
|
54
54
|
[](https://github.com/astral-sh/ruff)
|
55
55
|
[](https://pypi.org/project/foamlib/)
|
56
56
|
[](https://pypi.org/project/foamlib/)
|
57
|
-
|
57
|
+

|
58
|
+
[](https://hub.docker.com/r/microfluidica/foamlib/)
|
58
59
|
|
59
60
|
**foamlib** provides a simple, modern and ergonomic Python interface for interacting with [OpenFOAM](https://www.openfoam.com).
|
60
61
|
|
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
|