openinterfaces 0.5.4__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 (58) hide show
  1. openinterfaces-0.5.4/.pytest_cache/README.md +8 -0
  2. openinterfaces-0.5.4/CMakeLists.txt +60 -0
  3. openinterfaces-0.5.4/LICENSE +24 -0
  4. openinterfaces-0.5.4/PKG-INFO +98 -0
  5. openinterfaces-0.5.4/README.md +69 -0
  6. openinterfaces-0.5.4/common/CMakeLists.txt +22 -0
  7. openinterfaces-0.5.4/common/oif_config_dict.c +474 -0
  8. openinterfaces-0.5.4/common/util.c +55 -0
  9. openinterfaces-0.5.4/dispatch/CMakeLists.txt +8 -0
  10. openinterfaces-0.5.4/dispatch/dispatch.c +342 -0
  11. openinterfaces-0.5.4/examples/call_ivp_from_python.py +50 -0
  12. openinterfaces-0.5.4/examples/call_ivp_from_python_burgers_eq.py +103 -0
  13. openinterfaces-0.5.4/examples/call_ivp_from_python_vdp.py +114 -0
  14. openinterfaces-0.5.4/examples/call_linsolve_from_python.py +45 -0
  15. openinterfaces-0.5.4/examples/call_qeq_from_python.py +38 -0
  16. openinterfaces-0.5.4/examples/compare_performance_ivp_burgers_eq.py +241 -0
  17. openinterfaces-0.5.4/examples/compare_performance_ivp_burgers_eq_pure_comparison.py +294 -0
  18. openinterfaces-0.5.4/examples/compare_performance_ivp_cvode_gray_scott.py +455 -0
  19. openinterfaces-0.5.4/include/oif/_platform.h +14 -0
  20. openinterfaces-0.5.4/include/oif/api.h +77 -0
  21. openinterfaces-0.5.4/include/oif/c_bindings.h +42 -0
  22. openinterfaces-0.5.4/include/oif/config_dict.h +52 -0
  23. openinterfaces-0.5.4/include/oif/internal/bridge_api.h +40 -0
  24. openinterfaces-0.5.4/include/oif/internal/dispatch.h +50 -0
  25. openinterfaces-0.5.4/include/oif/util.h +43 -0
  26. openinterfaces-0.5.4/lang_python/CMakeLists.txt +2 -0
  27. openinterfaces-0.5.4/lang_python/oif/CMakeLists.txt +4 -0
  28. openinterfaces-0.5.4/lang_python/oif/_convert.c +224 -0
  29. openinterfaces-0.5.4/lang_python/oif/openinterfaces/CMakeLists.txt +23 -0
  30. openinterfaces-0.5.4/lang_python/oif/openinterfaces/_conversion.c +75 -0
  31. openinterfaces-0.5.4/lang_python/oif/openinterfaces/core.py +396 -0
  32. openinterfaces-0.5.4/lang_python/oif/openinterfaces/util.py +112 -0
  33. openinterfaces-0.5.4/lang_python/oif/openinterfaces/version.py +1 -0
  34. openinterfaces-0.5.4/lang_python/oif_impl/CMakeLists.txt +32 -0
  35. openinterfaces-0.5.4/lang_python/oif_impl/_callback.c +374 -0
  36. openinterfaces-0.5.4/lang_python/oif_impl/_serialization.py +28 -0
  37. openinterfaces-0.5.4/lang_python/oif_impl/dispatch_python.c +471 -0
  38. openinterfaces-0.5.4/lang_python/oif_impl/openinterfaces/_impl/interfaces/ivp.py +36 -0
  39. openinterfaces-0.5.4/lang_python/oif_impl/openinterfaces/_impl/interfaces/linsolve.py +9 -0
  40. openinterfaces-0.5.4/lang_python/oif_impl/openinterfaces/_impl/interfaces/qeq.py +9 -0
  41. openinterfaces-0.5.4/lang_python/oif_impl/openinterfaces/_impl/ivp/scipy_ode/scipy_ode.conf +2 -0
  42. openinterfaces-0.5.4/lang_python/oif_impl/openinterfaces/_impl/ivp/scipy_ode/scipy_ode.py +98 -0
  43. openinterfaces-0.5.4/lang_python/oif_impl/openinterfaces/_impl/linsolve/numpy/linsolve.py +7 -0
  44. openinterfaces-0.5.4/lang_python/oif_impl/openinterfaces/_impl/linsolve/numpy/numpy.conf +2 -0
  45. openinterfaces-0.5.4/lang_python/oif_impl/openinterfaces/_impl/qeq/py_qeq_solver/py_qeq_solver.conf +2 -0
  46. openinterfaces-0.5.4/lang_python/oif_impl/openinterfaces/_impl/qeq/py_qeq_solver/qeq_solver.py +38 -0
  47. openinterfaces-0.5.4/lang_python/oif_impl/openinterfaces/callback.py +59 -0
  48. openinterfaces-0.5.4/lang_python/oif_interfaces/openinterfaces/interfaces/ivp.py +151 -0
  49. openinterfaces-0.5.4/lang_python/oif_interfaces/openinterfaces/interfaces/linsolve.py +54 -0
  50. openinterfaces-0.5.4/lang_python/oif_interfaces/openinterfaces/interfaces/qeq.py +71 -0
  51. openinterfaces-0.5.4/pyproject.toml +87 -0
  52. openinterfaces-0.5.4/tests/CMakeLists.txt +6 -0
  53. openinterfaces-0.5.4/tests/lang_c/CMakeLists.txt +35 -0
  54. openinterfaces-0.5.4/tests/lang_python/test_ivp.py +374 -0
  55. openinterfaces-0.5.4/tests/lang_python/test_linsolve.py +22 -0
  56. openinterfaces-0.5.4/tests/lang_python/test_qeq.py +49 -0
  57. openinterfaces-0.5.4/tests/lang_python/test_util.py +104 -0
  58. openinterfaces-0.5.4/vendor/CMakeLists.txt +19 -0
@@ -0,0 +1,8 @@
1
+ # pytest cache directory #
2
+
3
+ This directory contains data from the pytest's cache plugin,
4
+ which provides the `--lf` and `--ff` options, as well as the `cache` fixture.
5
+
6
+ **Do not** commit this to version control.
7
+
8
+ See [the docs](https://docs.pytest.org/en/stable/how-to/cache.html) for more information.
@@ -0,0 +1,60 @@
1
+ cmake_minimum_required(VERSION 3.18)
2
+
3
+ project(
4
+ oif-toy-example
5
+ LANGUAGES C CXX
6
+ VERSION 0.5.4)
7
+
8
+ # Enforce using `-std=c11`, without any extensions like `gnu11`.
9
+ set(CMAKE_C_STANDARD 11)
10
+ set(CMAKE_C_STANDARD_REQUIRED ON)
11
+
12
+ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
13
+ message("Disable optimizations for Debug build type")
14
+ string(PREPEND CMAKE_C_FLAGS_DEBUG "-O0 ")
15
+ endif()
16
+
17
+ # Incorporate additions by X/Open 7, that includes POSIX 17 additions and allow
18
+ # to use things like the `M_PI` constant in the code without warnings from
19
+ # static analyzers.
20
+ add_compile_definitions(_XOPEN_SOURCE=700)
21
+
22
+ # DOWNLOAD_EXTRACT_TIMESTAMP = TRUE
23
+ if(POLICY CMP0135)
24
+ cmake_policy(SET CMP0135 NEW)
25
+ endif()
26
+
27
+ # Copy all built library targets to a common directory, so that it is easy to
28
+ # find and load them.
29
+ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
30
+
31
+ # when building, don't use the install RPATH already (but later on when
32
+ # installing)
33
+ set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
34
+
35
+ # Make sure that libraries can be found by the linker.
36
+ set(CMAKE_INSTALL_RPATH "$ORIGIN")
37
+
38
+ # Add additional cmake module to find packages.
39
+ list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
40
+
41
+ add_subdirectory(vendor)
42
+
43
+ add_subdirectory(common)
44
+ add_subdirectory(dispatch)
45
+
46
+ add_subdirectory(lang_python)
47
+
48
+ if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/oif")
49
+ add_subdirectory(oif)
50
+ endif()
51
+ if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/oif_impl")
52
+ add_subdirectory(oif_impl)
53
+ endif()
54
+
55
+ if(EXISTS examples/CMakeLists.txt)
56
+ add_subdirectory(examples)
57
+ endif()
58
+
59
+ enable_testing()
60
+ add_subdirectory(tests)
@@ -0,0 +1,24 @@
1
+ BSD 2-Clause License
2
+
3
+ Copyright (c) 2025, MaRDI Open Interfaces authors and contributors
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
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,98 @@
1
+ Metadata-Version: 2.4
2
+ Name: openinterfaces
3
+ Version: 0.5.4
4
+ Summary: Open Interfaces for improving Interoperability in Scientific Computing
5
+ Author-Email: "Dmitry I. Kabanov" <dmitry.kabanov@uni-muenster.de>, Stephan Rave <stephan.rave@uni-muenster.de>, Mario Ohlberger <mario.ohlberger@uni-muenster.de>
6
+ License-File: LICENSE
7
+ Classifier: Development Status :: 4 - Beta
8
+ Classifier: Environment :: Console
9
+ Classifier: Intended Audience :: Science/Research
10
+ Classifier: Operating System :: Unix
11
+ Classifier: Programming Language :: C
12
+ Classifier: Programming Language :: Other
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Scientific/Engineering
19
+ Classifier: Topic :: Software Development :: Libraries
20
+ Project-URL: homepage, https://github.com/MaRDI4NFDI/open-interfaces
21
+ Project-URL: documentation, https://mardi4nfdi.github.io/open-interfaces/
22
+ Project-URL: issues, https://github.com/MaRDI4NFDI/open-interfaces/issues
23
+ Project-URL: source, https://github.com/MaRDI4NFDI/open-interfaces
24
+ Requires-Python: >=3.9
25
+ Requires-Dist: numpy
26
+ Requires-Dist: scipy
27
+ Requires-Dist: msgpack
28
+ Description-Content-Type: text/markdown
29
+
30
+ <h1 align="center">
31
+ <img src="https://raw.githubusercontent.com/MaRDI4NFDI/open-interfaces/refs/heads/main/assets/mardi-oif-logo.svg" width="40" style="vertical-align: text-bottom;" />
32
+ MaRDI Open Interfaces
33
+ </h1>
34
+
35
+ [![QA](https://github.com/MaRDI4NFDI/open-interfaces/actions/workflows/qa.yaml/badge.svg)](https://github.com/MaRDI4NFDI/open-interfaces/actions/workflows/qa.yaml)
36
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.13753666.svg)](https://doi.org/10.5281/zenodo.13753666)
37
+
38
+ _MaRDI Open Interfaces_ is a project aiming to improve interoperability
39
+ in scientific computing by removing two hurdles that computational scientists
40
+ usually face in their daily work.
41
+
42
+ These hurdles are the following.
43
+ First, numerical solvers are often implemented in different programming
44
+ languages.
45
+ Second, these solvers have potentially significantly diverging interfaces
46
+ in terms of function names, order of function arguments, and the invocation
47
+ order.
48
+ Therefore, when a computational scientist wants to switch from one solver
49
+ to another, it could take non-negligible effort in code modification
50
+ and testing for the correctness.
51
+
52
+ _Open Interfaces_ aim to alleviate these problems by providing automatic data
53
+ marshalling between different languages and a set of interfaces for typical
54
+ numerical problems such as integration of differential equations and
55
+ optimization.
56
+
57
+ This project is the part of the [_Mathematical Research Data Initiative
58
+ (MaRDI)_](https://mardi4nfdi.de).
59
+
60
+ ## Data flow
61
+
62
+ ![Architecture of the MaRDI Open Interfaces](https://media.githubusercontent.com/media/MaRDI4NFDI/open-interfaces/refs/heads/main/assets/arch.png)
63
+
64
+ This figure shows the software architecture of the _MaRDI Open Interfaces_.
65
+ There are two principal decoupled parts. The left part is user-facing
66
+ and allows a user to request an implementation of some numerical procedure
67
+ and then invoke different functions in this implementation to conduct
68
+ computations using a unified interface (Gateway)
69
+ that hides discrepancies between different implementations.
70
+ The other part (on the right) is completely hidden from the user
71
+ and works with an implementation of the interface.
72
+ Particularly, it loads the implementation and its adapter and converts
73
+ user data to the native data for the implementation.
74
+
75
+ ## Installation of Python bindings and implementations
76
+
77
+ The Python bindings and implementations of the interfaces are available
78
+ from [Python Package Index (PyPI)](https://pypi.org/)
79
+ and can be installed using
80
+ ```shell
81
+ pip install openinterfaces
82
+ ```
83
+
84
+ ## Run examples
85
+
86
+ Examples are provided in the `examples` directory in this repository.
87
+ Documentation explaining some of these examples is available here:
88
+ <https://mardi4nfdi.github.io/open-interfaces/>.
89
+
90
+
91
+ ## Funding
92
+
93
+ This work is funded by the _Deutsche Forschungsgemeinschaft_ (DFG, _German
94
+ Research Foundation_) under Germany's Excellence Strategy EXC 2044-390685587,
95
+ “Mathematics Münster: Dynamics–Geometry–Structure” and the National Research
96
+ Data Infrastructure, project number&nbsp;460135501, NFDI&nbsp;29/1
97
+ “MaRDI – Mathematical Research Data Initiative
98
+ [Mathematische Forschungsdateninitiative]”.
@@ -0,0 +1,69 @@
1
+ <h1 align="center">
2
+ <img src="https://raw.githubusercontent.com/MaRDI4NFDI/open-interfaces/refs/heads/main/assets/mardi-oif-logo.svg" width="40" style="vertical-align: text-bottom;" />
3
+ MaRDI Open Interfaces
4
+ </h1>
5
+
6
+ [![QA](https://github.com/MaRDI4NFDI/open-interfaces/actions/workflows/qa.yaml/badge.svg)](https://github.com/MaRDI4NFDI/open-interfaces/actions/workflows/qa.yaml)
7
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.13753666.svg)](https://doi.org/10.5281/zenodo.13753666)
8
+
9
+ _MaRDI Open Interfaces_ is a project aiming to improve interoperability
10
+ in scientific computing by removing two hurdles that computational scientists
11
+ usually face in their daily work.
12
+
13
+ These hurdles are the following.
14
+ First, numerical solvers are often implemented in different programming
15
+ languages.
16
+ Second, these solvers have potentially significantly diverging interfaces
17
+ in terms of function names, order of function arguments, and the invocation
18
+ order.
19
+ Therefore, when a computational scientist wants to switch from one solver
20
+ to another, it could take non-negligible effort in code modification
21
+ and testing for the correctness.
22
+
23
+ _Open Interfaces_ aim to alleviate these problems by providing automatic data
24
+ marshalling between different languages and a set of interfaces for typical
25
+ numerical problems such as integration of differential equations and
26
+ optimization.
27
+
28
+ This project is the part of the [_Mathematical Research Data Initiative
29
+ (MaRDI)_](https://mardi4nfdi.de).
30
+
31
+ ## Data flow
32
+
33
+ ![Architecture of the MaRDI Open Interfaces](https://media.githubusercontent.com/media/MaRDI4NFDI/open-interfaces/refs/heads/main/assets/arch.png)
34
+
35
+ This figure shows the software architecture of the _MaRDI Open Interfaces_.
36
+ There are two principal decoupled parts. The left part is user-facing
37
+ and allows a user to request an implementation of some numerical procedure
38
+ and then invoke different functions in this implementation to conduct
39
+ computations using a unified interface (Gateway)
40
+ that hides discrepancies between different implementations.
41
+ The other part (on the right) is completely hidden from the user
42
+ and works with an implementation of the interface.
43
+ Particularly, it loads the implementation and its adapter and converts
44
+ user data to the native data for the implementation.
45
+
46
+ ## Installation of Python bindings and implementations
47
+
48
+ The Python bindings and implementations of the interfaces are available
49
+ from [Python Package Index (PyPI)](https://pypi.org/)
50
+ and can be installed using
51
+ ```shell
52
+ pip install openinterfaces
53
+ ```
54
+
55
+ ## Run examples
56
+
57
+ Examples are provided in the `examples` directory in this repository.
58
+ Documentation explaining some of these examples is available here:
59
+ <https://mardi4nfdi.github.io/open-interfaces/>.
60
+
61
+
62
+ ## Funding
63
+
64
+ This work is funded by the _Deutsche Forschungsgemeinschaft_ (DFG, _German
65
+ Research Foundation_) under Germany's Excellence Strategy EXC 2044-390685587,
66
+ “Mathematics Münster: Dynamics–Geometry–Structure” and the National Research
67
+ Data Infrastructure, project number&nbsp;460135501, NFDI&nbsp;29/1
68
+ “MaRDI – Mathematical Research Data Initiative
69
+ [Mathematische Forschungsdateninitiative]”.
@@ -0,0 +1,22 @@
1
+ # Common components that are used by C codes: utility functions and data
2
+ # structures.
3
+
4
+ # -----------------------------------------------------------------------------
5
+ # Library oif_common_util
6
+ add_library(oif_common_util SHARED util.c)
7
+ target_include_directories(oif_common_util PUBLIC ${CMAKE_SOURCE_DIR}/include)
8
+ install(TARGETS oif_common_util DESTINATION lib)
9
+
10
+ # -----------------------------------------------------------------------------
11
+ # Library oif_common_data_structures
12
+ get_property(cwpack_SOURCE_DIR GLOBAL PROPERTY cwpack_SOURCE_DIR)
13
+
14
+ add_library(oif_common_data_structures SHARED oif_config_dict.c
15
+ ${cwpack_SOURCE_DIR}/src/cwpack.c)
16
+ target_include_directories(oif_common_data_structures
17
+ PUBLIC ${CMAKE_SOURCE_DIR}/include)
18
+ target_include_directories(oif_common_data_structures
19
+ PRIVATE ${cwpack_SOURCE_DIR}/src)
20
+ target_link_libraries(oif_common_data_structures PRIVATE oif_common_util)
21
+ target_link_libraries(oif_common_data_structures PRIVATE HashMap::HashMap)
22
+ install(TARGETS oif_common_data_structures DESTINATION lib)