cffview 0.1.1__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.
cffview-0.1.1/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026, preamer
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1 @@
1
+ recursive-include src/cffview *.h
cffview-0.1.1/PKG-INFO ADDED
@@ -0,0 +1,136 @@
1
+ Metadata-Version: 2.4
2
+ Name: cffview
3
+ Version: 0.1.1
4
+ Summary: A Python CLI tool to inspect Ansys Fluent .cas.h5/.msh.h5 files without opening Fluent
5
+ Author-email: preamer <1524477126@qq.com>
6
+ License-Expression: BSD-3-Clause
7
+ Project-URL: Repository, https://github.com/preamer/cffview
8
+ Keywords: fluent,cfd,ansys,hdf5,mesh
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: Programming Language :: Python :: 3.14
14
+ Classifier: Programming Language :: C++
15
+ Classifier: Topic :: Scientific/Engineering
16
+ Classifier: Environment :: Console
17
+ Requires-Python: >=3.11
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: h5py>=3.16.0
21
+ Requires-Dist: pyvista>=0.48.4
22
+ Requires-Dist: sexpdata>=1.0.2
23
+ Requires-Dist: tqdm>=4.68.3
24
+ Dynamic: license-file
25
+
26
+ [中文](README.zh.md)
27
+
28
+ # fv
29
+
30
+ A command-line tool for inspecting Ansys Fluent `.cas.h5` / `.msh.h5` files **without opening Fluent**.
31
+
32
+ - Read solver settings, materials, boundary conditions, discretisation schemes, and more directly from the HDF5 file.
33
+ - Visualise the mesh with [PyVista](https://pyvista.org).
34
+ - Mesh reader based on a modified version of VTK's [`vtkFLUENTCFFReader`](https://github.com/Kitware/VTK/tree/master/IO/FLUENTCFF), with the VTK dependency removed. Supports all VTK cell types including polyhedra, for both `.cas.h5` and `.msh.h5`.
35
+
36
+ ---
37
+
38
+ ## Installation
39
+
40
+ ```bash
41
+ pip install fv
42
+ ```
43
+
44
+ ### Build from source
45
+
46
+ HDF5 development headers and libraries are required. The build script detects them automatically in the following order: `HDF5_DIR` environment variable → local `include/lib` → `pkg-config` → conda → Homebrew (macOS) → common system paths.
47
+
48
+ ```bash
49
+ git clone https://github.com/preamer/fv.git
50
+ cd fv
51
+ pip install .
52
+ ```
53
+
54
+ If auto-detection fails, set `HDF5_DIR` explicitly before installing.
55
+
56
+ ---
57
+
58
+ ## Usage
59
+
60
+ ```
61
+ fv <file> [options]
62
+ ```
63
+
64
+ ### Options
65
+
66
+ | Option | Description |
67
+ |---|---|
68
+ | `-v`, `--version` | Print the Fluent version stored in the file |
69
+ | `--extract` | Dump raw Scheme settings to `general.scm` and `boundary.scm` |
70
+ | `--showmesh` | Visualise the mesh interactively with PyVista |
71
+ | `--solver` | Solver type, time, dimension, precision, turbulence model, energy, radiation, gravity |
72
+ | `--mat` | Material properties |
73
+ | `--bd` | Boundary condition settings |
74
+ | `--ne` | Named expressions |
75
+ | `--disc` | Discretisation schemes and relaxation factors |
76
+ | `--rd` | Report definitions |
77
+ | `--plotsets` | Plot sets |
78
+ | `--monitorsets` | Monitor sets |
79
+ | `--iter` | Iteration / time-step settings |
80
+ | `--save` | Save the output to `<file>.json` |
81
+
82
+ Multiple flags can be combined freely. Case settings flags (`--solver`, `--mat`, etc.) apply to `.cas.h5` files only.
83
+
84
+ ### Examples
85
+
86
+ ```bash
87
+ # Show solver configuration and boundary conditions
88
+ fv case.cas.h5 --solver --bd
89
+
90
+ # Show all settings and save to JSON
91
+ fv case.cas.h5 --solver --mat --bd --ne --disc --rd --iter --save
92
+
93
+ # Visualise the mesh (.cas.h5 and .msh.h5 both supported)
94
+ fv case.cas.h5 --showmesh
95
+ fv mesh.msh.h5 --showmesh
96
+
97
+ # Check the Fluent version embedded in the file
98
+ fv case.cas.h5 --version
99
+
100
+ # Extract raw Scheme strings for manual inspection
101
+ fv case.cas.h5 --extract
102
+ ```
103
+
104
+ ---
105
+
106
+ ## File Format Support
107
+
108
+ | Feature | `.cas.h5` | `.msh.h5` |
109
+ |---|---|---|
110
+ | Case settings (`--solver`, `--mat`, `--bd`, …) | ✅ | — |
111
+ | Mesh visualisation (3D) | ✅ | ✅ |
112
+ | Mesh visualisation (2D) | ✅ | ⚠️ partial |
113
+
114
+ > **Note:** 2D `.msh.h5` face connectivity (C0/C1) parsing is not yet fully implemented.
115
+
116
+ ---
117
+
118
+ ## Supported Settings
119
+
120
+ | Flag | Contents |
121
+ |---|---|
122
+ | `--solver` | Algorithm (PBNS/DBNS), steady/transient, 2D/3D, single/double precision, turbulence model, energy, radiation, gravity |
123
+ | `--mat` | Fluid/solid materials with properties and evaluation methods |
124
+ | `--bd` | Velocity-inlet, pressure-outlet, mass-flow-inlet/outlet, wall (thermal & motion BC), porous-jump, interior, symmetry, … |
125
+ | `--ne` | Named expressions defined in the case |
126
+ | `--disc` | Per-equation scheme (Second Order Upwind, QUICK, …) and under-relaxation / pseudo-transient factors |
127
+ | `--rd` | Report definitions (volume, surface, flux) with field, zones, and per-zone flag |
128
+ | `--plotsets` | Plot set configurations |
129
+ | `--monitorsets` | Monitor set configurations |
130
+ | `--iter` | Iteration count (steady) or time-step size, number of steps, max inner iterations (transient) |
131
+
132
+ ---
133
+
134
+ ## License
135
+
136
+ [BSD-3-Clause](LICENSE)
@@ -0,0 +1,111 @@
1
+ [中文](README.zh.md)
2
+
3
+ # fv
4
+
5
+ A command-line tool for inspecting Ansys Fluent `.cas.h5` / `.msh.h5` files **without opening Fluent**.
6
+
7
+ - Read solver settings, materials, boundary conditions, discretisation schemes, and more directly from the HDF5 file.
8
+ - Visualise the mesh with [PyVista](https://pyvista.org).
9
+ - Mesh reader based on a modified version of VTK's [`vtkFLUENTCFFReader`](https://github.com/Kitware/VTK/tree/master/IO/FLUENTCFF), with the VTK dependency removed. Supports all VTK cell types including polyhedra, for both `.cas.h5` and `.msh.h5`.
10
+
11
+ ---
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ pip install fv
17
+ ```
18
+
19
+ ### Build from source
20
+
21
+ HDF5 development headers and libraries are required. The build script detects them automatically in the following order: `HDF5_DIR` environment variable → local `include/lib` → `pkg-config` → conda → Homebrew (macOS) → common system paths.
22
+
23
+ ```bash
24
+ git clone https://github.com/preamer/fv.git
25
+ cd fv
26
+ pip install .
27
+ ```
28
+
29
+ If auto-detection fails, set `HDF5_DIR` explicitly before installing.
30
+
31
+ ---
32
+
33
+ ## Usage
34
+
35
+ ```
36
+ fv <file> [options]
37
+ ```
38
+
39
+ ### Options
40
+
41
+ | Option | Description |
42
+ |---|---|
43
+ | `-v`, `--version` | Print the Fluent version stored in the file |
44
+ | `--extract` | Dump raw Scheme settings to `general.scm` and `boundary.scm` |
45
+ | `--showmesh` | Visualise the mesh interactively with PyVista |
46
+ | `--solver` | Solver type, time, dimension, precision, turbulence model, energy, radiation, gravity |
47
+ | `--mat` | Material properties |
48
+ | `--bd` | Boundary condition settings |
49
+ | `--ne` | Named expressions |
50
+ | `--disc` | Discretisation schemes and relaxation factors |
51
+ | `--rd` | Report definitions |
52
+ | `--plotsets` | Plot sets |
53
+ | `--monitorsets` | Monitor sets |
54
+ | `--iter` | Iteration / time-step settings |
55
+ | `--save` | Save the output to `<file>.json` |
56
+
57
+ Multiple flags can be combined freely. Case settings flags (`--solver`, `--mat`, etc.) apply to `.cas.h5` files only.
58
+
59
+ ### Examples
60
+
61
+ ```bash
62
+ # Show solver configuration and boundary conditions
63
+ fv case.cas.h5 --solver --bd
64
+
65
+ # Show all settings and save to JSON
66
+ fv case.cas.h5 --solver --mat --bd --ne --disc --rd --iter --save
67
+
68
+ # Visualise the mesh (.cas.h5 and .msh.h5 both supported)
69
+ fv case.cas.h5 --showmesh
70
+ fv mesh.msh.h5 --showmesh
71
+
72
+ # Check the Fluent version embedded in the file
73
+ fv case.cas.h5 --version
74
+
75
+ # Extract raw Scheme strings for manual inspection
76
+ fv case.cas.h5 --extract
77
+ ```
78
+
79
+ ---
80
+
81
+ ## File Format Support
82
+
83
+ | Feature | `.cas.h5` | `.msh.h5` |
84
+ |---|---|---|
85
+ | Case settings (`--solver`, `--mat`, `--bd`, …) | ✅ | — |
86
+ | Mesh visualisation (3D) | ✅ | ✅ |
87
+ | Mesh visualisation (2D) | ✅ | ⚠️ partial |
88
+
89
+ > **Note:** 2D `.msh.h5` face connectivity (C0/C1) parsing is not yet fully implemented.
90
+
91
+ ---
92
+
93
+ ## Supported Settings
94
+
95
+ | Flag | Contents |
96
+ |---|---|
97
+ | `--solver` | Algorithm (PBNS/DBNS), steady/transient, 2D/3D, single/double precision, turbulence model, energy, radiation, gravity |
98
+ | `--mat` | Fluid/solid materials with properties and evaluation methods |
99
+ | `--bd` | Velocity-inlet, pressure-outlet, mass-flow-inlet/outlet, wall (thermal & motion BC), porous-jump, interior, symmetry, … |
100
+ | `--ne` | Named expressions defined in the case |
101
+ | `--disc` | Per-equation scheme (Second Order Upwind, QUICK, …) and under-relaxation / pseudo-transient factors |
102
+ | `--rd` | Report definitions (volume, surface, flux) with field, zones, and per-zone flag |
103
+ | `--plotsets` | Plot set configurations |
104
+ | `--monitorsets` | Monitor set configurations |
105
+ | `--iter` | Iteration count (steady) or time-step size, number of steps, max inner iterations (transient) |
106
+
107
+ ---
108
+
109
+ ## License
110
+
111
+ [BSD-3-Clause](LICENSE)
@@ -0,0 +1,55 @@
1
+ [build-system]
2
+ requires = ["setuptools>=83.0.0", "wheel", "pybind11>=3.0.4", "numpy>=1.20.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "cffview"
7
+ version = "0.1.1"
8
+ description = "A Python CLI tool to inspect Ansys Fluent .cas.h5/.msh.h5 files without opening Fluent"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ authors = [{ name = "preamer", email = "1524477126@qq.com" }]
12
+ keywords = ["fluent", "cfd", "ansys", "hdf5", "mesh"]
13
+ license = "BSD-3-Clause"
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "Programming Language :: Python :: 3.11",
17
+ "Programming Language :: Python :: 3.12",
18
+ "Programming Language :: Python :: 3.13",
19
+ "Programming Language :: Python :: 3.14",
20
+ "Programming Language :: C++",
21
+ "Topic :: Scientific/Engineering",
22
+ "Environment :: Console",
23
+ ]
24
+ dependencies = [
25
+ "h5py>=3.16.0",
26
+ "pyvista>=0.48.4",
27
+ "sexpdata>=1.0.2",
28
+ "tqdm>=4.68.3",
29
+ ]
30
+
31
+ [project.scripts]
32
+ cffview = "cffview.main:main"
33
+
34
+ [project.urls]
35
+ Repository = "https://github.com/preamer/cffview"
36
+
37
+ [tool.setuptools.packages.find]
38
+ where = ["src"]
39
+
40
+ [tool.cibuildwheel]
41
+ build = "cp311-* cp312-* cp313-* cp314-*"
42
+ skip = ["*-win32", "*-musllinux*", "*-manylinux_i686"]
43
+
44
+ [tool.cibuildwheel.linux]
45
+ before-all = "bash tools/build_hdf5_linux.sh"
46
+ environment = { HDF5_DIR = "/opt/hdf5", PIP_ONLY_BINARY = ":all:" }
47
+
48
+ [tool.cibuildwheel.macos]
49
+ environment = { HDF5_DIR = "/tmp/hdf5", MACOSX_DEPLOYMENT_TARGET = "11.0", DYLD_LIBRARY_PATH = "/tmp/hdf5/lib", CC = "clang", CXX = "clang++" }
50
+ before-all = "bash tools/build_hdf5_macos.sh"
51
+
52
+ [tool.cibuildwheel.windows]
53
+ before-all = "powershell tools/build_hdf5_windows.ps1"
54
+ environment = { HDF5_DIR = "C:/Users/runneradmin/hdf5" }
55
+ repair-wheel-command = "delvewheel repair --add-path C:\\Users\\runneradmin\\hdf5\\bin -w {dest_dir} {wheel}"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
cffview-0.1.1/setup.py ADDED
@@ -0,0 +1,120 @@
1
+ import os
2
+ import sys
3
+ import warnings
4
+ from pathlib import Path
5
+
6
+ import pybind11
7
+ import numpy as np
8
+ from setuptools import setup
9
+ from pybind11.setup_helpers import Pybind11Extension, build_ext
10
+
11
+
12
+ def _has_hdf5_header(d: Path) -> bool:
13
+ return (d / "hdf5.h").exists()
14
+
15
+
16
+ def find_hdf5() -> tuple[list, list, list, list, list]:
17
+ """Returns (include_dirs, library_dirs, libraries, define_macros, extra_link_args)."""
18
+ include_dirs: list[str] = []
19
+ library_dirs: list[str] = []
20
+ libraries: list[str] = ["hdf5"]
21
+ define_macros: list = []
22
+ extra_link_args: list = []
23
+
24
+ hdf5_dir = os.environ.get("HDF5_DIR", "").strip()
25
+ if hdf5_dir:
26
+ p = Path(hdf5_dir)
27
+ if (p / "include").is_dir():
28
+ include_dirs.append(str(p / "include"))
29
+ if (p / "lib").is_dir():
30
+ library_dirs.append(str(p / "lib"))
31
+
32
+ if not include_dirs:
33
+ local_inc, local_lib = Path("include"), Path("lib")
34
+ if _has_hdf5_header(local_inc):
35
+ include_dirs.append(str(local_inc))
36
+ if local_lib.is_dir() and any(local_lib.iterdir()):
37
+ library_dirs.append(str(local_lib))
38
+
39
+ if sys.platform == "win32":
40
+ define_macros.append(("H5_BUILT_AS_DYNAMIC_LIB", None))
41
+ conda_base = Path(sys.prefix) / "Library"
42
+ if _has_hdf5_header(conda_base / "include"):
43
+ include_dirs.append(str(conda_base / "include"))
44
+ library_dirs.append(str(conda_base / "lib"))
45
+ elif sys.platform.startswith("linux"):
46
+ for candidate in [Path("/usr/include/hdf5/serial"), Path("/usr/include")]:
47
+ if _has_hdf5_header(candidate):
48
+ include_dirs.append(str(candidate))
49
+ break
50
+ for candidate in [Path("/usr/lib/x86_64-linux-gnu/hdf5/serial"), Path("/usr/lib64")]:
51
+ if candidate.is_dir():
52
+ library_dirs.append(str(candidate))
53
+ break
54
+
55
+ if sys.platform == "win32":
56
+ define_macros.append(("H5_BUILT_AS_DYNAMIC_LIB", None))
57
+ found_lib = False
58
+ for ldir in library_dirs:
59
+ lib_path = Path(ldir)
60
+ if (lib_path / "hdf5.lib").exists():
61
+ libraries = ["hdf5"]
62
+ found_lib = True
63
+ break
64
+ elif (lib_path / "libhdf5.lib").exists():
65
+ libraries = ["libhdf5"]
66
+ found_lib = True
67
+ break
68
+ if not found_lib:
69
+ libraries = ["hdf5"]
70
+ else:
71
+ for ldir in library_dirs:
72
+ extra_link_args.append(f"-Wl,-rpath,{ldir}")
73
+
74
+ if not any(_has_hdf5_header(Path(d)) for d in include_dirs):
75
+ warnings.warn(
76
+ f"\n\n*** Could not locate hdf5.h inside {include_dirs} — build will likely fail. ***\n"
77
+ "Please check if HDF5_DIR is set correctly.\n",
78
+ stacklevel=2
79
+ )
80
+
81
+ return include_dirs, library_dirs, libraries, define_macros, extra_link_args
82
+
83
+
84
+ def get_compile_args() -> list[str]:
85
+ if sys.platform == "win32":
86
+ return ["/utf-8", "/EHsc", "/bigobj", "/O2"]
87
+ return ["-O2", "-fvisibility=hidden"]
88
+
89
+
90
+ # ---------------------------------------------------------------------------
91
+ # Extension module
92
+ # ---------------------------------------------------------------------------
93
+ hdf5_inc, hdf5_lib, hdf5_libs, macros, link_args = find_hdf5()
94
+
95
+ ext_modules = [
96
+ Pybind11Extension(
97
+ "cffview.mesh_reader",
98
+ sources=[
99
+ "src/cffview/main.cxx",
100
+ "src/cffview/vtkFLUENTCFFReader.cxx",
101
+ ],
102
+ include_dirs=[
103
+ *hdf5_inc,
104
+ str(Path("include")),
105
+ np.get_include(),
106
+ pybind11.get_include(),
107
+ ],
108
+ library_dirs=[*hdf5_lib, str(Path("lib"))],
109
+ libraries=hdf5_libs,
110
+ define_macros=macros,
111
+ extra_compile_args=get_compile_args(),
112
+ extra_link_args=link_args,
113
+ cxx_std=17,
114
+ ),
115
+ ]
116
+
117
+ setup(
118
+ ext_modules=ext_modules,
119
+ cmdclass={"build_ext": build_ext},
120
+ )