pybFoam 0.1.5__tar.gz → 0.1.6__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.
Files changed (168) hide show
  1. pybfoam-0.1.6/CHANGELOG.md +36 -0
  2. {pybfoam-0.1.5 → pybfoam-0.1.6}/CMakeLists.txt +1 -1
  3. pybfoam-0.1.6/PKG-INFO +228 -0
  4. pybfoam-0.1.6/README.md +181 -0
  5. {pybfoam-0.1.5 → pybfoam-0.1.6}/cmake/FindOpenFOAM.cmake +23 -0
  6. {pybfoam-0.1.5 → pybfoam-0.1.6}/docs/conf.py +1 -1
  7. {pybfoam-0.1.5 → pybfoam-0.1.6}/pyproject.toml +1 -1
  8. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/CMakeLists.txt +1 -0
  9. pybfoam-0.1.6/src/pybFoam/_version.py +1 -0
  10. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/pybFoam_core/bind_mesh.cpp +2 -10
  11. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/pybFoam_core/bind_primitives.cpp +3 -0
  12. pybfoam-0.1.6/src/pybFoam/sampling/CMakeLists.txt +50 -0
  13. pybfoam-0.1.6/src/pybFoam/sampling/__init__.py +74 -0
  14. pybfoam-0.1.6/src/pybFoam/sampling/bind_sampling.cpp +418 -0
  15. pybfoam-0.1.6/src/pybFoam/sampling/bind_sampling.hpp +52 -0
  16. pybfoam-0.1.6/src/pybFoam/sampling/sampling.cpp +35 -0
  17. pybfoam-0.1.6/src/pybFoam/sampling/set_configs.py +289 -0
  18. pybfoam-0.1.6/src/pybFoam/sampling/surface_configs.py +194 -0
  19. pybfoam-0.1.6/src/pybFoam/sampling/utils.py +63 -0
  20. pybfoam-0.1.6/src/pybFoam/sampling.pyi +258 -0
  21. pybfoam-0.1.6/tests/pybind/test_set_sampling.py +585 -0
  22. pybfoam-0.1.6/tests/pybind/test_surface_sampling.py +675 -0
  23. pybfoam-0.1.6/tests/test_sampling_models.py +73 -0
  24. pybfoam-0.1.6/tests/test_sampling_set_configs.py +239 -0
  25. pybfoam-0.1.5/CHANGELOG.md +0 -0
  26. pybfoam-0.1.5/PKG-INFO +0 -66
  27. pybfoam-0.1.5/README.md +0 -19
  28. pybfoam-0.1.5/src/pybFoam/_version.py +0 -1
  29. {pybfoam-0.1.5 → pybfoam-0.1.6}/.github/workflows/ci.yaml +0 -0
  30. {pybfoam-0.1.5 → pybfoam-0.1.6}/.github/workflows/pages.yaml +0 -0
  31. {pybfoam-0.1.5 → pybfoam-0.1.6}/.github/workflows/release.yaml +0 -0
  32. {pybfoam-0.1.5 → pybfoam-0.1.6}/.gitignore +0 -0
  33. {pybfoam-0.1.5 → pybfoam-0.1.6}/CMakePresets.json +0 -0
  34. {pybfoam-0.1.5 → pybfoam-0.1.6}/LICENSE +0 -0
  35. {pybfoam-0.1.5 → pybfoam-0.1.6}/cmake/Dependencies.cmake +0 -0
  36. {pybfoam-0.1.5 → pybfoam-0.1.6}/conftest.py +0 -0
  37. {pybfoam-0.1.5 → pybfoam-0.1.6}/docs/Makefile +0 -0
  38. {pybfoam-0.1.5 → pybfoam-0.1.6}/docs/README.md +0 -0
  39. {pybfoam-0.1.5 → pybfoam-0.1.6}/docs/api.rst +0 -0
  40. {pybfoam-0.1.5 → pybfoam-0.1.6}/docs/changelog.rst +0 -0
  41. {pybfoam-0.1.5 → pybfoam-0.1.6}/docs/contributing.rst +0 -0
  42. {pybfoam-0.1.5 → pybfoam-0.1.6}/docs/index.rst +0 -0
  43. {pybfoam-0.1.5 → pybfoam-0.1.6}/docs/installation.rst +0 -0
  44. {pybfoam-0.1.5 → pybfoam-0.1.6}/docs/introduction.rst +0 -0
  45. {pybfoam-0.1.5 → pybfoam-0.1.6}/docs/make.bat +0 -0
  46. {pybfoam-0.1.5 → pybfoam-0.1.6}/docs/usage.rst +0 -0
  47. {pybfoam-0.1.5 → pybfoam-0.1.6}/scripts/generate_stubs.py +0 -0
  48. {pybfoam-0.1.5 → pybfoam-0.1.6}/scripts/pyInstall.sh +0 -0
  49. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/__init__.py +0 -0
  50. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/aggregation/CMakeLists.txt +0 -0
  51. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/aggregation/aggregation.cpp +0 -0
  52. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/aggregation/bind_aggregation.cpp +0 -0
  53. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/aggregation/bind_aggregation.hpp +0 -0
  54. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/fvc/CMakeLists.txt +0 -0
  55. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/fvc/bind_fvc.cpp +0 -0
  56. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/fvc/bind_fvc.hpp +0 -0
  57. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/fvc/fvc.cpp +0 -0
  58. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/fvc.pyi +0 -0
  59. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/fvm/CMakeLists.txt +0 -0
  60. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/fvm/bind_fvm.cpp +0 -0
  61. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/fvm/bind_fvm.hpp +0 -0
  62. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/fvm/fvm.cpp +0 -0
  63. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/io/__init__.py +0 -0
  64. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/io/model_base.py +0 -0
  65. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/io/system.py +0 -0
  66. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/py.typed +0 -0
  67. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/pybFoam_core/CMakeLists.txt +0 -0
  68. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/pybFoam_core/bind_cfdTools.cpp +0 -0
  69. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/pybFoam_core/bind_cfdTools.hpp +0 -0
  70. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/pybFoam_core/bind_control.cpp +0 -0
  71. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/pybFoam_core/bind_control.hpp +0 -0
  72. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/pybFoam_core/bind_dict.cpp +0 -0
  73. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/pybFoam_core/bind_dict.hpp +0 -0
  74. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/pybFoam_core/bind_dimensioned.cpp +0 -0
  75. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/pybFoam_core/bind_dimensioned.hpp +0 -0
  76. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/pybFoam_core/bind_fields.cpp +0 -0
  77. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/pybFoam_core/bind_fields.hpp +0 -0
  78. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/pybFoam_core/bind_fvMatrix.cpp +0 -0
  79. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/pybFoam_core/bind_fvMatrix.hpp +0 -0
  80. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/pybFoam_core/bind_geo_fields.cpp +0 -0
  81. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/pybFoam_core/bind_geo_fields.hpp +0 -0
  82. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/pybFoam_core/bind_io.cpp +0 -0
  83. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/pybFoam_core/bind_io.hpp +0 -0
  84. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/pybFoam_core/bind_mesh.hpp +0 -0
  85. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/pybFoam_core/bind_primitives.hpp +0 -0
  86. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/pybFoam_core/pybFoam.cpp +0 -0
  87. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/pybFoam_core.pyi +0 -0
  88. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/runTimeTables/CMakeLists.txt +0 -0
  89. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/runTimeTables/foam_runTimeTables.C +0 -0
  90. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/runTimeTables/foam_runTimeTables.H +0 -0
  91. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/runTimeTables/runTimeTables.C +0 -0
  92. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/runTimeTables.pyi +0 -0
  93. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/thermo/CMakeLists.txt +0 -0
  94. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/thermo/bind_thermo.cpp +0 -0
  95. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/thermo/bind_thermo.hpp +0 -0
  96. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/thermo/thermo.cpp +0 -0
  97. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/thermo.pyi +0 -0
  98. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/turbulence/CMakeLists.txt +0 -0
  99. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/turbulence/bind_turbulence.cpp +0 -0
  100. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/turbulence/bind_turbulence.hpp +0 -0
  101. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/turbulence/turbulence.cpp +0 -0
  102. {pybfoam-0.1.5 → pybfoam-0.1.6}/src/pybFoam/turbulence.pyi +0 -0
  103. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/cavity/0.orig/U +0 -0
  104. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/cavity/0.orig/nu +0 -0
  105. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/cavity/0.orig/p +0 -0
  106. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/cavity/Allclean +0 -0
  107. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/cavity/Allrun +0 -0
  108. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/cavity/constant/transportProperties +0 -0
  109. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/cavity/icoFoam.py +0 -0
  110. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/cavity/log2 +0 -0
  111. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/cavity/system/PDRblockMeshDict +0 -0
  112. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/cavity/system/blockMeshDict +0 -0
  113. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/cavity/system/controlDict +0 -0
  114. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/cavity/system/decomposeParDict +0 -0
  115. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/cavity/system/fvSchemes +0 -0
  116. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/cavity/system/fvSolution +0 -0
  117. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/elbow/0.orig/U +0 -0
  118. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/elbow/0.orig/nu +0 -0
  119. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/elbow/0.orig/p +0 -0
  120. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/elbow/Allclean +0 -0
  121. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/elbow/Allrun +0 -0
  122. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/elbow/constant/transportProperties +0 -0
  123. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/elbow/icoFoam.py +0 -0
  124. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/elbow/system/controlDict +0 -0
  125. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/elbow/system/foamDataToFluentDict +0 -0
  126. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/elbow/system/fvSchemes +0 -0
  127. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/elbow/system/fvSolution +0 -0
  128. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/io/TestDict +0 -0
  129. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/io/TestDict.json +0 -0
  130. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/io/TestDict.yaml +0 -0
  131. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/io/controlDict +0 -0
  132. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/io/fvSchemes +0 -0
  133. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/io/fvSolution +0 -0
  134. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/io/test_controlDict.py +0 -0
  135. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/io/test_fvSchemes.py +0 -0
  136. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/io/test_fvSolution.py +0 -0
  137. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/io/test_parse_ofdict.py +0 -0
  138. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/pybind/0/U +0 -0
  139. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/pybind/0/alpha.water +0 -0
  140. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/pybind/0/p_rgh +0 -0
  141. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/pybind/0.orig/U +0 -0
  142. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/pybind/0.orig/alpha.water +0 -0
  143. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/pybind/0.orig/p_rgh +0 -0
  144. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/pybind/Allclean +0 -0
  145. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/pybind/Allrun +0 -0
  146. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/pybind/Allrun-parallel +0 -0
  147. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/pybind/constant/dynamicMeshDict +0 -0
  148. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/pybind/constant/g +0 -0
  149. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/pybind/constant/polyMesh/boundary +0 -0
  150. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/pybind/constant/polyMesh/faces +0 -0
  151. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/pybind/constant/polyMesh/neighbour +0 -0
  152. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/pybind/constant/polyMesh/owner +0 -0
  153. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/pybind/constant/polyMesh/points +0 -0
  154. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/pybind/constant/transportProperties +0 -0
  155. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/pybind/constant/turbulenceProperties +0 -0
  156. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/pybind/system/TestDict +0 -0
  157. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/pybind/system/blockMeshDict +0 -0
  158. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/pybind/system/controlDict +0 -0
  159. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/pybind/system/decomposeParDict +0 -0
  160. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/pybind/system/fvSchemes +0 -0
  161. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/pybind/system/fvSolution +0 -0
  162. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/pybind/system/setFieldsDict +0 -0
  163. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/pybind/test_aggregation.py +0 -0
  164. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/pybind/test_dict.py +0 -0
  165. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/pybind/test_fvc.py +0 -0
  166. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/pybind/test_fvm.py +0 -0
  167. {pybfoam-0.1.5 → pybfoam-0.1.6}/tests/pybind/test_geoFields.py +0 -0
  168. {pybfoam-0.1.5 → pybfoam-0.1.6}/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
+ ---
@@ -5,7 +5,7 @@ if(POLICY CMP0169)
5
5
  cmake_policy(SET CMP0169 OLD)
6
6
  endif()
7
7
 
8
- project(pybFoam VERSION 0.1.5 LANGUAGES CXX)
8
+ project(pybFoam VERSION 0.1.6 LANGUAGES CXX)
9
9
 
10
10
  # Set C++ standard
11
11
  set(CMAKE_CXX_STANDARD 17)
pybfoam-0.1.6/PKG-INFO ADDED
@@ -0,0 +1,228 @@
1
+ Metadata-Version: 2.4
2
+ Name: pybFoam
3
+ Version: 0.1.6
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: all
45
+ Requires-Dist: pybFoam[dev,docs]; extra == "all"
46
+ Description-Content-Type: text/markdown
47
+
48
+ # pybFoam
49
+
50
+ Python bindings for OpenFOAM - enabling direct manipulation of OpenFOAM cases, fields, and meshes from Python.
51
+
52
+ Currently in the pre-alpha release state.
53
+
54
+ ---
55
+
56
+ ## Features
57
+
58
+ - **Direct Python access to OpenFOAM data structures**: Time, fvMesh, fields
59
+ - **Finite volume operators**: fvc (calculus), fvm (matrix operations)
60
+ - **Turbulence and thermodynamic models**: Access to OpenFOAM turbulence and thermo libraries
61
+ - **Sampling and post-processing**: Surface sampling, line sampling, interpolation
62
+ - **Pydantic configuration models**: Type-safe dictionary construction for sampling surfaces
63
+ - **NumPy integration**: Zero-copy access to OpenFOAM field data via buffer protocol
64
+
65
+ ---
66
+
67
+ ## Requirements
68
+
69
+ - **OpenFOAM**: v2012 or higher (sourced and installed)
70
+ - **Python**: 3.8 or higher
71
+ - **CMake**: 3.18 or higher
72
+ - **C++ Compiler**: C++17 compatible (GCC 7+, Clang 5+)
73
+ - **Build tools**: pybind11, scikit-build-core
74
+ - **Python packages**: numpy, pydantic
75
+
76
+ ---
77
+
78
+ ## Installation
79
+
80
+ ### Prerequisites
81
+
82
+ 1. Source your OpenFOAM environment:
83
+ ```bash
84
+ source /path/to/OpenFOAM/etc/bashrc
85
+ ```
86
+
87
+ 2. (Recommended) Create a virtual environment:
88
+ ```bash
89
+ python -m venv .venv
90
+ source .venv/bin/activate
91
+ ```
92
+
93
+ ### Install from source
94
+
95
+ ```bash
96
+ pip install .
97
+ ```
98
+
99
+ For development:
100
+ ```bash
101
+ pip install -e . --no-build-isolation
102
+ ```
103
+
104
+ ---
105
+
106
+ ## Quick Start
107
+
108
+ ### Basic Usage
109
+
110
+ ```python
111
+ import pybFoam as pf
112
+
113
+ # Create OpenFOAM time and mesh
114
+ time = pf.createTime()
115
+ mesh = pf.fvMesh(time)
116
+
117
+ # Access fields
118
+ p = pf.volScalarField.read_field(mesh, "p")
119
+ U = pf.volVectorField.read_field(mesh, "U")
120
+
121
+ # Compute gradients using finite volume calculus
122
+ grad_p = pf.fvc.grad(p)
123
+ div_U = pf.fvc.div(U)
124
+
125
+ # Convert to NumPy arrays for analysis
126
+ import numpy as np
127
+ p_array = np.asarray(p["internalField"])
128
+ print(f"Pressure range: {p_array.min():.3f} to {p_array.max():.3f}")
129
+ ```
130
+
131
+ ### Sampling Surfaces
132
+
133
+ ```python
134
+ from pybFoam.sampling import SampledPlaneConfig, sampledSurface, interpolationScalar
135
+ from pybFoam import Word
136
+
137
+ # Create a sampling plane using Pydantic config
138
+ plane_config = SampledPlaneConfig(
139
+ point=[0.5, 0.5, 0.0],
140
+ normal=[1.0, 0.0, 0.0]
141
+ )
142
+
143
+ # Create the surface
144
+ plane = sampledSurface.New(Word("myPlane"), mesh, plane_config.to_foam_dict())
145
+ plane.update()
146
+
147
+ # Interpolate field onto surface
148
+ interp = interpolationScalar.New(Word("cellPoint"), p)
149
+ sampled_values = interp.sampleOnFaces(plane)
150
+ ```
151
+
152
+ ### Dictionary I/O with Pydantic
153
+
154
+ ```python
155
+ from pybFoam.io import IOModelBase
156
+ from pydantic import Field
157
+
158
+ class TransportProperties(IOModelBase):
159
+ nu: float = Field(..., description="Kinematic viscosity")
160
+
161
+ class Config:
162
+ foam_file_name = "transportProperties"
163
+
164
+ # Read from OpenFOAM dictionary
165
+ props = TransportProperties.from_file("constant/transportProperties")
166
+ print(f"Viscosity: {props.nu}")
167
+
168
+ # Modify and write back
169
+ props.nu = 1e-5
170
+ props.to_file("constant/transportProperties")
171
+ ```
172
+
173
+ ---
174
+
175
+ ## Examples
176
+
177
+ See the `tests/` directory for more examples:
178
+ - **Basic field operations**: `tests/pybind/test_primitives.py`
179
+ - **Finite volume operators**: `tests/pybind/test_fvc.py`, `tests/pybind/test_fvm.py`
180
+ - **Surface sampling**: `tests/pybind/test_surface_sampling.py`
181
+ - **Line sampling**: `tests/pybind/test_set_sampling.py`
182
+ - **Solver example**: `tests/cavity/icoFoam.py`
183
+
184
+ ---
185
+
186
+ ## Testing
187
+
188
+ Run the test suite:
189
+
190
+ ```bash
191
+ pytest tests/
192
+ ```
193
+
194
+ Run specific test categories:
195
+ ```bash
196
+ pytest tests/pybind/ # C++ binding tests
197
+ pytest tests/test_sampling_models.py # Pydantic config tests
198
+ ```
199
+
200
+ ---
201
+
202
+ ## Documentation
203
+
204
+ Full documentation is available at: [https://henningscheufler.github.io/pybFoam/](https://henningscheufler.github.io/pybFoam/index.html)
205
+
206
+ ---
207
+
208
+ ### Development Setup
209
+
210
+ 1. Clone the repository
211
+ 2. Install development dependencies:
212
+ ```bash
213
+ pip install -e ".[dev]"
214
+ ```
215
+ 3. Run tests before committing:
216
+ ```bash
217
+ pytest tests/
218
+ ```
219
+
220
+ ---
221
+
222
+ ## License
223
+
224
+ See [LICENSE](LICENSE) file for details.
225
+
226
+ ---
227
+
228
+
@@ -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
+
@@ -228,6 +228,26 @@ if(NOT TARGET OpenFOAM::lagrangian)
228
228
  target_link_directories(OpenFOAM::lagrangian INTERFACE "${FOAM_LIBBIN}")
229
229
  endif()
230
230
 
231
+ # ============================================================================
232
+ # Create OpenFOAM::sampling target
233
+ # ============================================================================
234
+ if(NOT TARGET OpenFOAM::sampling)
235
+ add_library(OpenFOAM::sampling INTERFACE IMPORTED)
236
+
237
+ target_include_directories(OpenFOAM::sampling INTERFACE
238
+ "${FOAM_SRC}/sampling/lnInclude"
239
+ "${FOAM_SRC}/sampling/sampledSurface/sampledSurface"
240
+ )
241
+
242
+ target_link_libraries(OpenFOAM::sampling INTERFACE
243
+ sampling
244
+ OpenFOAM::finiteVolume
245
+ OpenFOAM::meshTools
246
+ OpenFOAM::core
247
+ )
248
+ target_link_directories(OpenFOAM::sampling INTERFACE "${FOAM_LIBBIN}")
249
+ endif()
250
+
231
251
  # ============================================================================
232
252
  # Create OpenFOAM::api target (combines all libraries)
233
253
  # ============================================================================
@@ -243,6 +263,7 @@ if(NOT TARGET OpenFOAM::api)
243
263
  OpenFOAM::transport
244
264
  OpenFOAM::fileFormats
245
265
  OpenFOAM::lagrangian
266
+ OpenFOAM::sampling
246
267
  )
247
268
  endif()
248
269
 
@@ -267,6 +288,7 @@ set(OPENFOAM_INCLUDE_DIRS
267
288
  "${FOAM_SRC}/fileFormats/lnInclude"
268
289
  "${FOAM_SRC}/surfMesh/lnInclude"
269
290
  "${FOAM_SRC}/lagrangian/basic/lnInclude"
291
+ "${FOAM_SRC}/sampling/lnInclude"
270
292
  )
271
293
 
272
294
  set(OPENFOAM_LIBRARY_DIRS "${FOAM_LIBBIN}")
@@ -286,6 +308,7 @@ set(OPENFOAM_LIBRARIES
286
308
  fileFormats
287
309
  surfMesh
288
310
  lagrangian
311
+ sampling
289
312
  )
290
313
 
291
314
  # ============================================================================
@@ -9,7 +9,7 @@
9
9
  project = "pybFoam"
10
10
  copyright = "2025, Henning Scheufler"
11
11
  author = "Henning Scheufler"
12
- release = "0.1.5"
12
+ release = "0.1.6"
13
13
 
14
14
  # -- General configuration ---------------------------------------------------
15
15
  # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pybFoam"
3
- version = "0.1.5"
3
+ version = "0.1.6"
4
4
  authors = [
5
5
  {name = "Henning Scheufler", email = "henning.scheufler@web.de"},
6
6
  ]
@@ -8,6 +8,7 @@ add_subdirectory(fvm)
8
8
  add_subdirectory(thermo)
9
9
  add_subdirectory(turbulence)
10
10
  add_subdirectory(aggregation)
11
+ add_subdirectory(sampling)
11
12
 
12
13
  # Create a Python module that includes all components
13
14
  set(PYBFOAM_PYTHON_FILES
@@ -0,0 +1 @@
1
+ __version__ = "0.1.6"
@@ -89,19 +89,11 @@ void bindMesh(pybind11::module &m)
89
89
  namespace py = pybind11;
90
90
 
91
91
  m.def("selectTimes", &Foam::selectTimes);
92
+ m.def("createMesh", &Foam::createMesh, py::return_value_policy::take_ownership,
93
+ "Create a mesh from a Time object");
92
94
 
93
95
  py::class_<Foam::argList>(m, "argList")
94
96
  .def(py::init(&Foam::makeArgList), py::return_value_policy::take_ownership)
95
- // .def(py::init<const Foam::argList&, const Foam::HashTable<Foam::string>&, bool, bool, bool>())
96
- // .def("check", &Foam::argList::check)
97
- // .def("checkRootCase", &Foam::argList::checkRootCase)
98
- // .def("printCompat", &Foam::argList::printCompat)
99
- // .def("printNotes", &Foam::argList::printNotes)
100
- // .def("printUsage", &Foam::argList::printUsage)
101
- // .def("printMan", &Foam::argList::printMan)
102
- // .def("displayDoc", &Foam::argList::displayDoc)
103
- // .def("checkArgs", &Foam::argList::argsMandatory)
104
- // .def("setCheckArgs", &Foam::argList::argsMandatory, py::arg("check"))
105
97
  ;
106
98
 
107
99
  py::class_<Foam::Time>(m, "Time")
@@ -104,6 +104,9 @@ void bindPrimitives(pybind11::module& m)
104
104
  .def("__str__",[](const Foam::word& self){
105
105
  return std::string(self);
106
106
  })
107
+ .def("__repr__",[](const Foam::word& self){
108
+ return std::string(self);
109
+ })
107
110
  ;
108
111
 
109
112
 
@@ -0,0 +1,50 @@
1
+ # sampling module CMakeLists.txt
2
+
3
+ set(SAMPLING_SOURCES
4
+ bind_sampling.cpp
5
+ sampling.cpp
6
+ )
7
+
8
+ set(SAMPLING_HEADERS
9
+ bind_sampling.hpp
10
+ )
11
+
12
+ # Create the pybind11 module
13
+ pybind11_add_module(_sampling ${SAMPLING_SOURCES})
14
+
15
+ # Set target properties
16
+ set_target_properties(_sampling PROPERTIES
17
+ CXX_VISIBILITY_PRESET "hidden"
18
+ VISIBILITY_INLINES_HIDDEN ON
19
+ )
20
+
21
+ # Link OpenFOAM libraries - order matters!
22
+ target_link_libraries(_sampling PRIVATE
23
+ OpenFOAM::finiteVolume
24
+ OpenFOAM::meshTools
25
+ OpenFOAM::core
26
+ )
27
+
28
+ # Explicitly link the sampling library
29
+ target_link_directories(_sampling PRIVATE "${FOAM_LIBBIN}")
30
+ target_link_libraries(_sampling PRIVATE -lsampling)
31
+
32
+ # Add include directories specific to this module
33
+ target_include_directories(_sampling PRIVATE
34
+ ${CMAKE_CURRENT_SOURCE_DIR}
35
+ "${FOAM_SRC}/sampling/lnInclude"
36
+ )
37
+
38
+ # Install the module
39
+ if(DEFINED SKBUILD)
40
+ # scikit-build-core manages the installation
41
+ install(TARGETS _sampling
42
+ LIBRARY DESTINATION pybFoam
43
+ COMPONENT python
44
+ )
45
+ else()
46
+ # Standalone build - install to Python site-packages
47
+ install(TARGETS _sampling
48
+ LIBRARY DESTINATION "${Python_SITELIB}/pybFoam"
49
+ )
50
+ endif()
@@ -0,0 +1,74 @@
1
+ """pybFoam.sampling package exports for convenience.
2
+
3
+ Keep the public API small: import configs in the package namespace so
4
+ `from pybFoam.sampling import SampledPlaneConfig, UniformSetConfig` works in examples/tests.
5
+ """
6
+ from __future__ import annotations
7
+
8
+
9
+ from pybFoam._sampling import * # noqa: F403
10
+
11
+ from .surface_configs import (
12
+ SampledSurfaceBaseConfig,
13
+ SampledPlaneConfig,
14
+ SampledPatchConfig,
15
+ SampledCuttingPlaneConfig,
16
+ SampledCuttingSurfaceConfig,
17
+ SampledIsoSurfaceConfig,
18
+ SampledMeshedSurfaceConfig,
19
+ SampledFaceZoneConfig,
20
+ SampledPatchInternalFieldConfig,
21
+ SampledThresholdCellFacesConfig,
22
+ SampledDistanceSurfaceConfig,
23
+ sampled_surface_from,
24
+ )
25
+
26
+ from .set_configs import (
27
+ SampledSetBaseConfig,
28
+ UniformSetConfig,
29
+ CloudSetConfig,
30
+ PolyLineSetConfig,
31
+ CircleSetConfig,
32
+ ArraySetConfig,
33
+ FaceOnlySetConfig,
34
+ MidPointSetConfig,
35
+ MidPointAndFaceSetConfig,
36
+ CellCentreSetConfig,
37
+ PatchCloudSetConfig,
38
+ PatchSeedSetConfig,
39
+ sampled_set_from,
40
+ )
41
+
42
+ from .utils import dict_to_foam
43
+
44
+ __all__ = [
45
+ # SampledSurface configs
46
+ "SampledSurfaceBaseConfig",
47
+ "SampledPlaneConfig",
48
+ "SampledPatchConfig",
49
+ "SampledCuttingPlaneConfig",
50
+ "SampledCuttingSurfaceConfig",
51
+ "SampledIsoSurfaceConfig",
52
+ "SampledMeshedSurfaceConfig",
53
+ "SampledFaceZoneConfig",
54
+ "SampledPatchInternalFieldConfig",
55
+ "SampledThresholdCellFacesConfig",
56
+ "SampledDistanceSurfaceConfig",
57
+ # SampledSet configs
58
+ "SampledSetBaseConfig",
59
+ "UniformSetConfig",
60
+ "CloudSetConfig",
61
+ "PolyLineSetConfig",
62
+ "CircleSetConfig",
63
+ "ArraySetConfig",
64
+ "FaceOnlySetConfig",
65
+ "MidPointSetConfig",
66
+ "MidPointAndFaceSetConfig",
67
+ "CellCentreSetConfig",
68
+ "PatchCloudSetConfig",
69
+ "PatchSeedSetConfig",
70
+ # Helper functions
71
+ "sampled_surface_from",
72
+ "sampled_set_from",
73
+ "dict_to_foam",
74
+ ]