pybFoam 0.1.5__tar.gz → 0.1.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.
- pybfoam-0.1.7/CHANGELOG.md +36 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/CMakeLists.txt +1 -1
- pybfoam-0.1.7/PKG-INFO +233 -0
- pybfoam-0.1.7/README.md +181 -0
- pybfoam-0.1.7/benchmark/bench_complex.png +0 -0
- pybfoam-0.1.7/benchmark/bench_vec_add.png +0 -0
- pybfoam-0.1.7/benchmark/bench_vec_add_4.png +0 -0
- pybfoam-0.1.7/benchmark/benchmark_expression_complex.py +142 -0
- pybfoam-0.1.7/benchmark/benchmark_expression_vec_add.py +118 -0
- pybfoam-0.1.7/benchmark/benchmark_expression_vec_add_4.py +120 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/cmake/FindOpenFOAM.cmake +23 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/docs/conf.py +1 -1
- {pybfoam-0.1.5 → pybfoam-0.1.7}/pyproject.toml +9 -3
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/CMakeLists.txt +1 -1
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/__init__.py +0 -1
- pybfoam-0.1.7/src/pybFoam/_version.py +1 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/io/model_base.py +9 -9
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/pybFoam_core/bind_dict.cpp +67 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/pybFoam_core/bind_fvMatrix.cpp +18 -3
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/pybFoam_core/bind_io.cpp +6 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/pybFoam_core/bind_mesh.cpp +5 -10
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/pybFoam_core/bind_primitives.cpp +3 -0
- pybfoam-0.1.7/src/pybFoam/sampling/CMakeLists.txt +50 -0
- pybfoam-0.1.7/src/pybFoam/sampling/__init__.py +74 -0
- pybfoam-0.1.7/src/pybFoam/sampling/bind_sampling.cpp +418 -0
- pybfoam-0.1.7/src/pybFoam/sampling/bind_sampling.hpp +52 -0
- pybfoam-0.1.5/src/pybFoam/aggregation/bind_aggregation.hpp → pybfoam-0.1.7/src/pybFoam/sampling/sampling.cpp +11 -27
- pybfoam-0.1.7/src/pybFoam/sampling/set_configs.py +289 -0
- pybfoam-0.1.7/src/pybFoam/sampling/surface_configs.py +194 -0
- pybfoam-0.1.7/src/pybFoam/sampling/utils.py +63 -0
- pybfoam-0.1.7/src/pybFoam/sampling.pyi +258 -0
- pybfoam-0.1.7/tests/pybind/test_set_sampling.py +585 -0
- pybfoam-0.1.7/tests/pybind/test_surface_sampling.py +432 -0
- pybfoam-0.1.7/tests/test_sampling_models.py +73 -0
- pybfoam-0.1.7/tests/test_sampling_set_configs.py +239 -0
- pybfoam-0.1.5/CHANGELOG.md +0 -0
- pybfoam-0.1.5/PKG-INFO +0 -66
- pybfoam-0.1.5/README.md +0 -19
- pybfoam-0.1.5/src/pybFoam/_version.py +0 -1
- pybfoam-0.1.5/src/pybFoam/aggregation/CMakeLists.txt +0 -43
- pybfoam-0.1.5/src/pybFoam/aggregation/aggregation.cpp +0 -31
- pybfoam-0.1.5/src/pybFoam/aggregation/bind_aggregation.cpp +0 -248
- pybfoam-0.1.5/tests/pybind/test_aggregation.py +0 -148
- {pybfoam-0.1.5 → pybfoam-0.1.7}/.github/workflows/ci.yaml +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/.github/workflows/pages.yaml +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/.github/workflows/release.yaml +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/.gitignore +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/CMakePresets.json +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/LICENSE +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/cmake/Dependencies.cmake +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/conftest.py +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/docs/Makefile +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/docs/README.md +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/docs/api.rst +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/docs/changelog.rst +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/docs/contributing.rst +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/docs/index.rst +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/docs/installation.rst +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/docs/introduction.rst +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/docs/make.bat +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/docs/usage.rst +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/scripts/generate_stubs.py +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/scripts/pyInstall.sh +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/fvc/CMakeLists.txt +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/fvc/bind_fvc.cpp +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/fvc/bind_fvc.hpp +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/fvc/fvc.cpp +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/fvc.pyi +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/fvm/CMakeLists.txt +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/fvm/bind_fvm.cpp +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/fvm/bind_fvm.hpp +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/fvm/fvm.cpp +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/io/__init__.py +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/io/system.py +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/py.typed +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/pybFoam_core/CMakeLists.txt +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/pybFoam_core/bind_cfdTools.cpp +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/pybFoam_core/bind_cfdTools.hpp +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/pybFoam_core/bind_control.cpp +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/pybFoam_core/bind_control.hpp +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/pybFoam_core/bind_dict.hpp +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/pybFoam_core/bind_dimensioned.cpp +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/pybFoam_core/bind_dimensioned.hpp +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/pybFoam_core/bind_fields.cpp +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/pybFoam_core/bind_fields.hpp +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/pybFoam_core/bind_fvMatrix.hpp +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/pybFoam_core/bind_geo_fields.cpp +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/pybFoam_core/bind_geo_fields.hpp +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/pybFoam_core/bind_io.hpp +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/pybFoam_core/bind_mesh.hpp +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/pybFoam_core/bind_primitives.hpp +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/pybFoam_core/pybFoam.cpp +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/pybFoam_core.pyi +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/runTimeTables/CMakeLists.txt +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/runTimeTables/foam_runTimeTables.C +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/runTimeTables/foam_runTimeTables.H +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/runTimeTables/runTimeTables.C +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/runTimeTables.pyi +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/thermo/CMakeLists.txt +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/thermo/bind_thermo.cpp +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/thermo/bind_thermo.hpp +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/thermo/thermo.cpp +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/thermo.pyi +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/turbulence/CMakeLists.txt +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/turbulence/bind_turbulence.cpp +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/turbulence/bind_turbulence.hpp +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/turbulence/turbulence.cpp +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/src/pybFoam/turbulence.pyi +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/cavity/0.orig/U +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/cavity/0.orig/nu +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/cavity/0.orig/p +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/cavity/Allclean +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/cavity/Allrun +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/cavity/constant/transportProperties +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/cavity/icoFoam.py +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/cavity/log2 +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/cavity/system/PDRblockMeshDict +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/cavity/system/blockMeshDict +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/cavity/system/controlDict +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/cavity/system/decomposeParDict +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/cavity/system/fvSchemes +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/cavity/system/fvSolution +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/elbow/0.orig/U +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/elbow/0.orig/nu +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/elbow/0.orig/p +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/elbow/Allclean +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/elbow/Allrun +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/elbow/constant/transportProperties +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/elbow/icoFoam.py +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/elbow/system/controlDict +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/elbow/system/foamDataToFluentDict +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/elbow/system/fvSchemes +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/elbow/system/fvSolution +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/io/TestDict +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/io/TestDict.json +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/io/TestDict.yaml +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/io/controlDict +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/io/fvSchemes +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/io/fvSolution +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/io/test_controlDict.py +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/io/test_fvSchemes.py +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/io/test_fvSolution.py +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/io/test_parse_ofdict.py +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/pybind/0/U +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/pybind/0/alpha.water +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/pybind/0/p_rgh +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/pybind/0.orig/U +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/pybind/0.orig/alpha.water +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/pybind/0.orig/p_rgh +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/pybind/Allclean +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/pybind/Allrun +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/pybind/Allrun-parallel +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/pybind/constant/dynamicMeshDict +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/pybind/constant/g +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/pybind/constant/polyMesh/boundary +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/pybind/constant/polyMesh/faces +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/pybind/constant/polyMesh/neighbour +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/pybind/constant/polyMesh/owner +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/pybind/constant/polyMesh/points +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/pybind/constant/transportProperties +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/pybind/constant/turbulenceProperties +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/pybind/system/TestDict +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/pybind/system/blockMeshDict +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/pybind/system/controlDict +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/pybind/system/decomposeParDict +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/pybind/system/fvSchemes +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/pybind/system/fvSolution +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/pybind/system/setFieldsDict +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/pybind/test_dict.py +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/pybind/test_fvc.py +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/pybind/test_fvm.py +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/pybind/test_geoFields.py +0 -0
- {pybfoam-0.1.5 → pybfoam-0.1.7}/tests/pybind/test_primitives.py +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
## [0.1.6]
|
|
5
|
+
|
|
6
|
+
### Added
|
|
7
|
+
- Initial implementation of sampling module with pybind11 bindings
|
|
8
|
+
- Support for sampledSurface types (plane, patch, cutting plane, iso-surface)
|
|
9
|
+
- Interpolation schemes (cell, cellPoint, cellPointFace)
|
|
10
|
+
- Line sampling functionality (uniform, cloud, polyLine, circle)
|
|
11
|
+
- Integration tests for surface and set sampling
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
- Updated build system to use scikit-build-core
|
|
15
|
+
- Improved CMake configuration for OpenFOAM library detection
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## [-0.1.5]
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
- Python bindings for OpenFOAM core functionality
|
|
23
|
+
- Field access and manipulation (volScalarField, volVectorField, volTensorField)
|
|
24
|
+
- Finite volume operators (fvc, fvm)
|
|
25
|
+
- Mesh access (fvMesh, polyMesh)
|
|
26
|
+
- Time management
|
|
27
|
+
- Dictionary I/O
|
|
28
|
+
- Basic turbulence model support
|
|
29
|
+
- NumPy buffer protocol integration for zero-copy field access
|
|
30
|
+
|
|
31
|
+
### Known Issues
|
|
32
|
+
- Memory leaks in `selectTimes` function (requires RAII fix)
|
|
33
|
+
- Incorrect return value policies in some bindings
|
|
34
|
+
- Missing negative index checks in field accessors
|
|
35
|
+
|
|
36
|
+
---
|
pybfoam-0.1.7/PKG-INFO
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pybFoam
|
|
3
|
+
Version: 0.1.7
|
|
4
|
+
Summary: python bindings for OpenFOAM
|
|
5
|
+
Keywords: OpenFOAM,simulation,CFD
|
|
6
|
+
Author-Email: Henning Scheufler <henning.scheufler@web.de>
|
|
7
|
+
License-Expression: GPL-3.0-or-later
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: Natural Language :: English
|
|
13
|
+
Classifier: Programming Language :: C++
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering
|
|
21
|
+
Project-URL: Homepage, https://github.com/HenningScheufler/pybFoam
|
|
22
|
+
Project-URL: Repository, https://github.com/HenningScheufler/pybFoam.git
|
|
23
|
+
Project-URL: Issues, https://github.com/HenningScheufler/pybFoam/issues
|
|
24
|
+
Requires-Python: >=3.8
|
|
25
|
+
Requires-Dist: numpy>=1.20
|
|
26
|
+
Requires-Dist: pybind11>=2.6.0
|
|
27
|
+
Requires-Dist: pydantic
|
|
28
|
+
Requires-Dist: pyyaml
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: pytest>=6.0; extra == "dev"
|
|
31
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
32
|
+
Requires-Dist: pytest-xdist; extra == "dev"
|
|
33
|
+
Requires-Dist: black; extra == "dev"
|
|
34
|
+
Requires-Dist: flake8; extra == "dev"
|
|
35
|
+
Requires-Dist: isort; extra == "dev"
|
|
36
|
+
Requires-Dist: mypy; extra == "dev"
|
|
37
|
+
Requires-Dist: cmake>=3.18; extra == "dev"
|
|
38
|
+
Requires-Dist: pybind11-stubgen>=2.5; extra == "dev"
|
|
39
|
+
Provides-Extra: docs
|
|
40
|
+
Requires-Dist: sphinx>=4.0; extra == "docs"
|
|
41
|
+
Requires-Dist: sphinx-sitemap; extra == "docs"
|
|
42
|
+
Requires-Dist: furo; extra == "docs"
|
|
43
|
+
Requires-Dist: sphinxcontrib-mermaid; extra == "docs"
|
|
44
|
+
Provides-Extra: benchmark
|
|
45
|
+
Requires-Dist: jax; extra == "benchmark"
|
|
46
|
+
Requires-Dist: seaborn; extra == "benchmark"
|
|
47
|
+
Requires-Dist: matplotlib; extra == "benchmark"
|
|
48
|
+
Requires-Dist: PyQt6; extra == "benchmark"
|
|
49
|
+
Provides-Extra: all
|
|
50
|
+
Requires-Dist: pybFoam[benchmark,dev,docs]; extra == "all"
|
|
51
|
+
Description-Content-Type: text/markdown
|
|
52
|
+
|
|
53
|
+
# pybFoam
|
|
54
|
+
|
|
55
|
+
Python bindings for OpenFOAM - enabling direct manipulation of OpenFOAM cases, fields, and meshes from Python.
|
|
56
|
+
|
|
57
|
+
Currently in the pre-alpha release state.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Features
|
|
62
|
+
|
|
63
|
+
- **Direct Python access to OpenFOAM data structures**: Time, fvMesh, fields
|
|
64
|
+
- **Finite volume operators**: fvc (calculus), fvm (matrix operations)
|
|
65
|
+
- **Turbulence and thermodynamic models**: Access to OpenFOAM turbulence and thermo libraries
|
|
66
|
+
- **Sampling and post-processing**: Surface sampling, line sampling, interpolation
|
|
67
|
+
- **Pydantic configuration models**: Type-safe dictionary construction for sampling surfaces
|
|
68
|
+
- **NumPy integration**: Zero-copy access to OpenFOAM field data via buffer protocol
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Requirements
|
|
73
|
+
|
|
74
|
+
- **OpenFOAM**: v2012 or higher (sourced and installed)
|
|
75
|
+
- **Python**: 3.8 or higher
|
|
76
|
+
- **CMake**: 3.18 or higher
|
|
77
|
+
- **C++ Compiler**: C++17 compatible (GCC 7+, Clang 5+)
|
|
78
|
+
- **Build tools**: pybind11, scikit-build-core
|
|
79
|
+
- **Python packages**: numpy, pydantic
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Installation
|
|
84
|
+
|
|
85
|
+
### Prerequisites
|
|
86
|
+
|
|
87
|
+
1. Source your OpenFOAM environment:
|
|
88
|
+
```bash
|
|
89
|
+
source /path/to/OpenFOAM/etc/bashrc
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
2. (Recommended) Create a virtual environment:
|
|
93
|
+
```bash
|
|
94
|
+
python -m venv .venv
|
|
95
|
+
source .venv/bin/activate
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Install from source
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
pip install .
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
For development:
|
|
105
|
+
```bash
|
|
106
|
+
pip install -e . --no-build-isolation
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Quick Start
|
|
112
|
+
|
|
113
|
+
### Basic Usage
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
import pybFoam as pf
|
|
117
|
+
|
|
118
|
+
# Create OpenFOAM time and mesh
|
|
119
|
+
time = pf.createTime()
|
|
120
|
+
mesh = pf.fvMesh(time)
|
|
121
|
+
|
|
122
|
+
# Access fields
|
|
123
|
+
p = pf.volScalarField.read_field(mesh, "p")
|
|
124
|
+
U = pf.volVectorField.read_field(mesh, "U")
|
|
125
|
+
|
|
126
|
+
# Compute gradients using finite volume calculus
|
|
127
|
+
grad_p = pf.fvc.grad(p)
|
|
128
|
+
div_U = pf.fvc.div(U)
|
|
129
|
+
|
|
130
|
+
# Convert to NumPy arrays for analysis
|
|
131
|
+
import numpy as np
|
|
132
|
+
p_array = np.asarray(p["internalField"])
|
|
133
|
+
print(f"Pressure range: {p_array.min():.3f} to {p_array.max():.3f}")
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Sampling Surfaces
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
from pybFoam.sampling import SampledPlaneConfig, sampledSurface, interpolationScalar
|
|
140
|
+
from pybFoam import Word
|
|
141
|
+
|
|
142
|
+
# Create a sampling plane using Pydantic config
|
|
143
|
+
plane_config = SampledPlaneConfig(
|
|
144
|
+
point=[0.5, 0.5, 0.0],
|
|
145
|
+
normal=[1.0, 0.0, 0.0]
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
# Create the surface
|
|
149
|
+
plane = sampledSurface.New(Word("myPlane"), mesh, plane_config.to_foam_dict())
|
|
150
|
+
plane.update()
|
|
151
|
+
|
|
152
|
+
# Interpolate field onto surface
|
|
153
|
+
interp = interpolationScalar.New(Word("cellPoint"), p)
|
|
154
|
+
sampled_values = interp.sampleOnFaces(plane)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Dictionary I/O with Pydantic
|
|
158
|
+
|
|
159
|
+
```python
|
|
160
|
+
from pybFoam.io import IOModelBase
|
|
161
|
+
from pydantic import Field
|
|
162
|
+
|
|
163
|
+
class TransportProperties(IOModelBase):
|
|
164
|
+
nu: float = Field(..., description="Kinematic viscosity")
|
|
165
|
+
|
|
166
|
+
class Config:
|
|
167
|
+
foam_file_name = "transportProperties"
|
|
168
|
+
|
|
169
|
+
# Read from OpenFOAM dictionary
|
|
170
|
+
props = TransportProperties.from_file("constant/transportProperties")
|
|
171
|
+
print(f"Viscosity: {props.nu}")
|
|
172
|
+
|
|
173
|
+
# Modify and write back
|
|
174
|
+
props.nu = 1e-5
|
|
175
|
+
props.to_file("constant/transportProperties")
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Examples
|
|
181
|
+
|
|
182
|
+
See the `tests/` directory for more examples:
|
|
183
|
+
- **Basic field operations**: `tests/pybind/test_primitives.py`
|
|
184
|
+
- **Finite volume operators**: `tests/pybind/test_fvc.py`, `tests/pybind/test_fvm.py`
|
|
185
|
+
- **Surface sampling**: `tests/pybind/test_surface_sampling.py`
|
|
186
|
+
- **Line sampling**: `tests/pybind/test_set_sampling.py`
|
|
187
|
+
- **Solver example**: `tests/cavity/icoFoam.py`
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## Testing
|
|
192
|
+
|
|
193
|
+
Run the test suite:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
pytest tests/
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Run specific test categories:
|
|
200
|
+
```bash
|
|
201
|
+
pytest tests/pybind/ # C++ binding tests
|
|
202
|
+
pytest tests/test_sampling_models.py # Pydantic config tests
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## Documentation
|
|
208
|
+
|
|
209
|
+
Full documentation is available at: [https://henningscheufler.github.io/pybFoam/](https://henningscheufler.github.io/pybFoam/index.html)
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
### Development Setup
|
|
214
|
+
|
|
215
|
+
1. Clone the repository
|
|
216
|
+
2. Install development dependencies:
|
|
217
|
+
```bash
|
|
218
|
+
pip install -e ".[dev]"
|
|
219
|
+
```
|
|
220
|
+
3. Run tests before committing:
|
|
221
|
+
```bash
|
|
222
|
+
pytest tests/
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## License
|
|
228
|
+
|
|
229
|
+
See [LICENSE](LICENSE) file for details.
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
|
pybfoam-0.1.7/README.md
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# pybFoam
|
|
2
|
+
|
|
3
|
+
Python bindings for OpenFOAM - enabling direct manipulation of OpenFOAM cases, fields, and meshes from Python.
|
|
4
|
+
|
|
5
|
+
Currently in the pre-alpha release state.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **Direct Python access to OpenFOAM data structures**: Time, fvMesh, fields
|
|
12
|
+
- **Finite volume operators**: fvc (calculus), fvm (matrix operations)
|
|
13
|
+
- **Turbulence and thermodynamic models**: Access to OpenFOAM turbulence and thermo libraries
|
|
14
|
+
- **Sampling and post-processing**: Surface sampling, line sampling, interpolation
|
|
15
|
+
- **Pydantic configuration models**: Type-safe dictionary construction for sampling surfaces
|
|
16
|
+
- **NumPy integration**: Zero-copy access to OpenFOAM field data via buffer protocol
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Requirements
|
|
21
|
+
|
|
22
|
+
- **OpenFOAM**: v2012 or higher (sourced and installed)
|
|
23
|
+
- **Python**: 3.8 or higher
|
|
24
|
+
- **CMake**: 3.18 or higher
|
|
25
|
+
- **C++ Compiler**: C++17 compatible (GCC 7+, Clang 5+)
|
|
26
|
+
- **Build tools**: pybind11, scikit-build-core
|
|
27
|
+
- **Python packages**: numpy, pydantic
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
### Prerequisites
|
|
34
|
+
|
|
35
|
+
1. Source your OpenFOAM environment:
|
|
36
|
+
```bash
|
|
37
|
+
source /path/to/OpenFOAM/etc/bashrc
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
2. (Recommended) Create a virtual environment:
|
|
41
|
+
```bash
|
|
42
|
+
python -m venv .venv
|
|
43
|
+
source .venv/bin/activate
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Install from source
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install .
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
For development:
|
|
53
|
+
```bash
|
|
54
|
+
pip install -e . --no-build-isolation
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Quick Start
|
|
60
|
+
|
|
61
|
+
### Basic Usage
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
import pybFoam as pf
|
|
65
|
+
|
|
66
|
+
# Create OpenFOAM time and mesh
|
|
67
|
+
time = pf.createTime()
|
|
68
|
+
mesh = pf.fvMesh(time)
|
|
69
|
+
|
|
70
|
+
# Access fields
|
|
71
|
+
p = pf.volScalarField.read_field(mesh, "p")
|
|
72
|
+
U = pf.volVectorField.read_field(mesh, "U")
|
|
73
|
+
|
|
74
|
+
# Compute gradients using finite volume calculus
|
|
75
|
+
grad_p = pf.fvc.grad(p)
|
|
76
|
+
div_U = pf.fvc.div(U)
|
|
77
|
+
|
|
78
|
+
# Convert to NumPy arrays for analysis
|
|
79
|
+
import numpy as np
|
|
80
|
+
p_array = np.asarray(p["internalField"])
|
|
81
|
+
print(f"Pressure range: {p_array.min():.3f} to {p_array.max():.3f}")
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Sampling Surfaces
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
from pybFoam.sampling import SampledPlaneConfig, sampledSurface, interpolationScalar
|
|
88
|
+
from pybFoam import Word
|
|
89
|
+
|
|
90
|
+
# Create a sampling plane using Pydantic config
|
|
91
|
+
plane_config = SampledPlaneConfig(
|
|
92
|
+
point=[0.5, 0.5, 0.0],
|
|
93
|
+
normal=[1.0, 0.0, 0.0]
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
# Create the surface
|
|
97
|
+
plane = sampledSurface.New(Word("myPlane"), mesh, plane_config.to_foam_dict())
|
|
98
|
+
plane.update()
|
|
99
|
+
|
|
100
|
+
# Interpolate field onto surface
|
|
101
|
+
interp = interpolationScalar.New(Word("cellPoint"), p)
|
|
102
|
+
sampled_values = interp.sampleOnFaces(plane)
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Dictionary I/O with Pydantic
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
from pybFoam.io import IOModelBase
|
|
109
|
+
from pydantic import Field
|
|
110
|
+
|
|
111
|
+
class TransportProperties(IOModelBase):
|
|
112
|
+
nu: float = Field(..., description="Kinematic viscosity")
|
|
113
|
+
|
|
114
|
+
class Config:
|
|
115
|
+
foam_file_name = "transportProperties"
|
|
116
|
+
|
|
117
|
+
# Read from OpenFOAM dictionary
|
|
118
|
+
props = TransportProperties.from_file("constant/transportProperties")
|
|
119
|
+
print(f"Viscosity: {props.nu}")
|
|
120
|
+
|
|
121
|
+
# Modify and write back
|
|
122
|
+
props.nu = 1e-5
|
|
123
|
+
props.to_file("constant/transportProperties")
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Examples
|
|
129
|
+
|
|
130
|
+
See the `tests/` directory for more examples:
|
|
131
|
+
- **Basic field operations**: `tests/pybind/test_primitives.py`
|
|
132
|
+
- **Finite volume operators**: `tests/pybind/test_fvc.py`, `tests/pybind/test_fvm.py`
|
|
133
|
+
- **Surface sampling**: `tests/pybind/test_surface_sampling.py`
|
|
134
|
+
- **Line sampling**: `tests/pybind/test_set_sampling.py`
|
|
135
|
+
- **Solver example**: `tests/cavity/icoFoam.py`
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Testing
|
|
140
|
+
|
|
141
|
+
Run the test suite:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
pytest tests/
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Run specific test categories:
|
|
148
|
+
```bash
|
|
149
|
+
pytest tests/pybind/ # C++ binding tests
|
|
150
|
+
pytest tests/test_sampling_models.py # Pydantic config tests
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Documentation
|
|
156
|
+
|
|
157
|
+
Full documentation is available at: [https://henningscheufler.github.io/pybFoam/](https://henningscheufler.github.io/pybFoam/index.html)
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
### Development Setup
|
|
162
|
+
|
|
163
|
+
1. Clone the repository
|
|
164
|
+
2. Install development dependencies:
|
|
165
|
+
```bash
|
|
166
|
+
pip install -e ".[dev]"
|
|
167
|
+
```
|
|
168
|
+
3. Run tests before committing:
|
|
169
|
+
```bash
|
|
170
|
+
pytest tests/
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## License
|
|
176
|
+
|
|
177
|
+
See [LICENSE](LICENSE) file for details.
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# import os
|
|
2
|
+
|
|
3
|
+
# N = 8
|
|
4
|
+
|
|
5
|
+
# os.environ["XLA_FLAGS"] = (
|
|
6
|
+
# f"--xla_cpu_multi_thread_eigen=true "
|
|
7
|
+
# f"intra_op_parallelism_threads={N}"
|
|
8
|
+
# )
|
|
9
|
+
import os
|
|
10
|
+
|
|
11
|
+
def configure_threads(n=1):
|
|
12
|
+
multi_thread = True if n > 1 else False
|
|
13
|
+
os.environ["XLA_FLAGS"] = (
|
|
14
|
+
f"--xla_cpu_multi_thread_eigen={multi_thread} "
|
|
15
|
+
f"intra_op_parallelism_threads={n}"
|
|
16
|
+
)
|
|
17
|
+
os.environ["NPROC"] = f"{n}"
|
|
18
|
+
os.environ["OMP_NUM_THREADS"] = str(n)
|
|
19
|
+
os.environ["MKL_NUM_THREADS"] = str(n)
|
|
20
|
+
os.environ["OPENBLAS_NUM_THREADS"] = str(n)
|
|
21
|
+
|
|
22
|
+
configure_threads(1)
|
|
23
|
+
|
|
24
|
+
from pybFoam import scalarField
|
|
25
|
+
import numpy as np
|
|
26
|
+
import timeit
|
|
27
|
+
import time
|
|
28
|
+
import pandas as pd
|
|
29
|
+
import matplotlib.pyplot as plt
|
|
30
|
+
import seaborn as sns
|
|
31
|
+
import jax
|
|
32
|
+
import jax.numpy as jnp
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def pybfoam_expression(n_elements):
|
|
36
|
+
a = scalarField([1.1] * n_elements)
|
|
37
|
+
b = scalarField([2.2] * n_elements)
|
|
38
|
+
c = scalarField([3.3] * n_elements)
|
|
39
|
+
d = scalarField([4.4] * n_elements)
|
|
40
|
+
|
|
41
|
+
def run():
|
|
42
|
+
x = a * b + c
|
|
43
|
+
y = d - a * c
|
|
44
|
+
return (x * y + b) / (a + 1.0)
|
|
45
|
+
return run
|
|
46
|
+
|
|
47
|
+
def numpy_expression(n_elements):
|
|
48
|
+
a = np.full(n_elements, 1.1)
|
|
49
|
+
b = np.full(n_elements, 2.2)
|
|
50
|
+
c = np.full(n_elements, 3.3)
|
|
51
|
+
d = np.full(n_elements, 4.4)
|
|
52
|
+
|
|
53
|
+
def run():
|
|
54
|
+
x = a * b + c
|
|
55
|
+
y = d - a * c
|
|
56
|
+
return (x * y + b) / (a + 1.0)
|
|
57
|
+
|
|
58
|
+
return run
|
|
59
|
+
|
|
60
|
+
def jax_expression(n_elements):
|
|
61
|
+
a = jnp.full(n_elements, 1.1)
|
|
62
|
+
b = jnp.full(n_elements, 2.2)
|
|
63
|
+
c = jnp.full(n_elements, 3.3)
|
|
64
|
+
d = jnp.full(n_elements, 4.4)
|
|
65
|
+
|
|
66
|
+
@jax.jit
|
|
67
|
+
def run():
|
|
68
|
+
x = a * b + c
|
|
69
|
+
y = d - a * c
|
|
70
|
+
return (x * y + b) / (a + 1.0)
|
|
71
|
+
|
|
72
|
+
return run
|
|
73
|
+
|
|
74
|
+
vector_add_data = {
|
|
75
|
+
"n_elements": [],
|
|
76
|
+
"duration": [],
|
|
77
|
+
"method": [],
|
|
78
|
+
# "jax": []
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
def add_data(n_elements, duration, method):
|
|
82
|
+
vector_add_data["n_elements"].append(n_elements)
|
|
83
|
+
vector_add_data["duration"].append(duration)
|
|
84
|
+
vector_add_data["method"].append(method)
|
|
85
|
+
|
|
86
|
+
for n_elements in [10, 100, 1000, 10_000, 100_000, 1_000_000, 10_000_000]:
|
|
87
|
+
|
|
88
|
+
bench = pybfoam_expression(n_elements)
|
|
89
|
+
# duration = timeit.timeit(bench, number=1)
|
|
90
|
+
t0 = time.perf_counter() # lower overhead than timeit
|
|
91
|
+
bench()
|
|
92
|
+
t1 = time.perf_counter()
|
|
93
|
+
duration = t1 - t0
|
|
94
|
+
add_data(n_elements, duration, "pybFoam")
|
|
95
|
+
|
|
96
|
+
bench = numpy_expression(n_elements)
|
|
97
|
+
# duration = timeit.timeit(bench, number=1)
|
|
98
|
+
t0 = time.perf_counter() # lower overhead than timeit
|
|
99
|
+
bench()
|
|
100
|
+
t1 = time.perf_counter()
|
|
101
|
+
duration = t1 - t0
|
|
102
|
+
add_data(n_elements, duration, "NumPy")
|
|
103
|
+
|
|
104
|
+
bench = jax_expression(n_elements)
|
|
105
|
+
# First call to compile
|
|
106
|
+
bench()
|
|
107
|
+
# duration = timeit.timeit(bench, number=1)
|
|
108
|
+
t0 = time.perf_counter() # lower overhead than timeit
|
|
109
|
+
bench()
|
|
110
|
+
t1 = time.perf_counter()
|
|
111
|
+
duration = t1 - t0
|
|
112
|
+
add_data(n_elements, duration, "JAX")
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
df_vector_add = pd.DataFrame(vector_add_data)
|
|
116
|
+
df_vector_add["time_per_element [ns]"] = df_vector_add["duration"] / df_vector_add["n_elements"] * 1e9 # time per element in nanoseconds
|
|
117
|
+
print("Vector Addition Benchmark:",df_vector_add)
|
|
118
|
+
|
|
119
|
+
sns.lineplot(data=df_vector_add, x="n_elements", y="time_per_element [ns]", hue="method", marker="o")
|
|
120
|
+
plt.xscale("log")
|
|
121
|
+
plt.yscale("log")
|
|
122
|
+
plt.xlabel("Number of Elements")
|
|
123
|
+
plt.ylabel("Time per Element (nanoseconds)")
|
|
124
|
+
plt.title("Expression: (x * y + b) / (a + 1.0)")
|
|
125
|
+
plt.savefig("bench_complex.png")
|
|
126
|
+
n_elements = 10_000_000
|
|
127
|
+
timings = df_vector_add[df_vector_add["n_elements"] == n_elements]
|
|
128
|
+
print(f"Timings for {n_elements} elements:")
|
|
129
|
+
for _, row in timings.iterrows():
|
|
130
|
+
print(f"{row['method']}: {row['time_per_element [ns]']:.2f} ns per element")
|
|
131
|
+
n_elements = 1_000_000
|
|
132
|
+
print("")
|
|
133
|
+
timings = df_vector_add[df_vector_add["n_elements"] == n_elements]
|
|
134
|
+
print(f"Timings for {n_elements} elements:")
|
|
135
|
+
for _, row in timings.iterrows():
|
|
136
|
+
print(f"{row['method']}: {row['time_per_element [ns]']:.2f} ns per element")
|
|
137
|
+
|
|
138
|
+
plt.show()
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
# %%
|