feat: Model from StreamsContainer#3095
Open
PProfizi wants to merge 5 commits into
Open
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3095 +/- ##
=======================================
Coverage 82.84% 82.84%
=======================================
Files 93 93
Lines 11532 11568 +36
=======================================
+ Hits 9554 9584 +30
- Misses 1978 1984 +6 |
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.
This pull request adds support for constructing a
Modeldirectly from an existingStreamsContainer, improving performance and flexibility when working with file streams in DPF. It updates both the implementation and documentation to reflect this new capability, and introduces comprehensive tests to ensure correct behavior. The main changes are grouped below.New feature: StreamsContainer support in Model
src/ansys/dpf/core/model.py,src/ansys/dpf/core/_model_helpers.py: TheModelclass and its associatedMetadataclass now accept aStreamsContaineras input, in addition toDataSourcesand file paths. This allows users to avoid reopening file streams and enables sharing streams across multiple models or operators. [1] [2] [3]Implementation details and resource management
src/ansys/dpf/core/model.py,src/ansys/dpf/core/_model_helpers.py: Introduced internal properties and logic to distinguish between direct and internally-created streams, ensuring that streams provided by the user are not released by theModeldestructor, while internally-created streams are properly cleaned up. [1] [2] [3]StreamsContainerand operator-provided streams transparently. [1] [2] [3] [4] [5] [6]Documentation updates
src/ansys/dpf/core/model.py: Expanded docstrings and usage examples to document the newStreamsContainerinput option forModel. [1] [2] [3]Testing enhancements
tests/test_model.py: Added a suite of tests to validate all aspects of the newStreamsContainersupport, including construction, metadata access, results consistency, resource management, and correct handling of externally provided streams. [1] [2]These changes make the
Modelclass more flexible and efficient, especially in workflows involving multiple models or operators sharing the same file streams.