Link C++ and Python SolutionArray implementations#1426
Merged
speth merged 15 commits intoCantera:mainfrom Mar 16, 2023
Merged
Conversation
9686661 to
87aaf27
Compare
Codecov Report
@@ Coverage Diff @@
## main #1426 +/- ##
==========================================
+ Coverage 69.61% 69.87% +0.26%
==========================================
Files 373 373
Lines 55846 56686 +840
Branches 18338 18883 +545
==========================================
+ Hits 38875 39609 +734
- Misses 14516 14564 +48
- Partials 2455 2513 +58
... and 2 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
e71a4fc to
7897e25
Compare
2ae1934 to
0787f94
Compare
13b2a17 to
d6b0de9
Compare
366c4dd to
ca809e8
Compare
This is a squashed commit implementing the following: - Make data shareable and sliceable - Order SolutionArray extra entries - Switch extra to AnyValue - Use AnyValue in addExtra - Set/get extra entries as AnyMap - Set/get components as AnyValue - Refine extra component handling - Add shape information in C++ - Add additional HDF storage modes - Access entries as 'loc' rather than 'index' (This change of nomenclature is inspired by pandas, where the index refers to the indexing column, while location refers to the row. - Update HDF subfolder logic - Address edge cases in HDF Storage wrapper - Fix edge cases in SolutionArray
Files written using legacy HDF format introduced in Cantera 2.5. All files are created based on the test suite of Cantera 2.6. Note: legacy (h5py-based) writer removed in Cantera 3.0; format remains readable with native (HighFive-based) HDF support.
Base class SolutionArrayBase (implemented in solythonbase.pyx) is used as interface
cf0796b to
4279e14
Compare
Disable creation of HDF using h5py Redirect SolutionArray.write_hdf to SolutionArray.save in order to prevent new files with deprecated HDF format.
4279e14 to
2259c5c
Compare
2259c5c to
2bccb33
Compare
Member
Author
Member
Author
|
@speth ... I adopted both suggestions/requests. |
This was referenced Mar 17, 2023
Merged
5 tasks
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes proposed in this pull request
Follow-up to #1385.
SolutionArrayto Python (asSolutionArrayBase)SolutionArrayformats from Pythonextratypes in C++SolutionArraythat are already available in Python, e.g. entries with typesstring,long int,vector<double>andvector<long int>(internal handling leveragesAnyValue)SolutionArrayh5pysupport and associated dedicated functions; continue support for pre-existing HDF format with core C++ HDF routines; disable creation of new HDF files with legacy format.With this change, all data available for
SolutionArrayare stored by the C++ core object, with the PythonSolutionArrayserving as an external API. At the same time, all property calculations are still handled by the Python interface, although states are being updated in the C++ core.Due to the size of the PR, some additional features are postponed for a follow-up:
SolutionArray.write_hdfcapabilities forSolutionArray.save: e.g. default group namesSolutionArray::show()with ascii pandas-style formatting.SolutionArraypicklable/copyable (via YAML)ReactorNet.saveimplementation for single-reactor networksH5Ldeletesee SO post, which is exposed in HighFive asunlink(see declaration)If applicable, fill in the issue number this pull request is fixing
Resolves Cantera/enhancements#137
If applicable, provide an example illustrating new features this pull request is introducing
While the way data are handled internally is completely refactored, most changes are completely under the hood, with
SolutionArray.saveandSolutionArray.restorebeing an exception.Checklist
scons build&scons test) and unit tests address code coverage