Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reproducible names for zeroD objects #1765

Merged
merged 9 commits into from
Aug 24, 2024
Merged

Conversation

ischoegl
Copy link
Member

@ischoegl ischoegl commented Aug 8, 2024

Changes proposed in this pull request

This PR seeks to implement reproducible (and unique) reactor, flow device and wall names in the C++ layer, which was previously only handled by the Python API. Rather than auto-creating unique names based on the number of certain object types created within a Cantera session, this PR switches to an approach that creates names dependent on ReactorNet objects, which guarantees that reproducible auto-generated names are attached to various zeroD objects.

If applicable, fill in the issue number this pull request is fixing

Closes #1764

If applicable, provide an example illustrating new features this pull request is introducing

Checklist

  • The pull request includes a clear description of this code change
  • Commit messages have short titles and reference relevant issues
  • Build passes (scons build & scons test) and unit tests address code coverage
  • Style & formatting of contributed code follows contributing guidelines
  • The pull request is ready for review

Copy link

codecov bot commented Aug 8, 2024

Codecov Report

Attention: Patch coverage is 74.38424% with 52 lines in your changes missing coverage. Please review.

Project coverage is 73.23%. Comparing base (c16cbe6) to head (afed40f).
Report is 14 commits behind head on main.

Files Patch % Lines
src/clib/ctreactor.cpp 11.90% 37 Missing ⚠️
src/zeroD/ReactorFactory.cpp 83.67% 8 Missing ⚠️
src/zeroD/ReactorBase.cpp 84.61% 0 Missing and 2 partials ⚠️
src/zeroD/ReactorSurface.cpp 71.42% 1 Missing and 1 partial ⚠️
src/zeroD/FlowDeviceFactory.cpp 88.88% 1 Missing ⚠️
src/zeroD/Reactor.cpp 75.00% 0 Missing and 1 partial ⚠️
src/zeroD/WallFactory.cpp 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1765      +/-   ##
==========================================
+ Coverage   73.20%   73.23%   +0.03%     
==========================================
  Files         381      381              
  Lines       54240    54371     +131     
  Branches     9236     9251      +15     
==========================================
+ Hits        39707    39820     +113     
- Misses      11564    11578      +14     
- Partials     2969     2973       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ischoegl
Copy link
Member Author

The PR goes somewhat beyond fixing #1764, as it pushes all names to C++ and exposes them to MATLAB as well. It should be ready for a review.

@ischoegl
Copy link
Member Author

ischoegl commented Aug 10, 2024

Minor cleanup. As an aside, I believe we should deprecate creation of empty Wall and FlowDevice objects as well (similar to the recent decision about empty Reactor objects); Python doesn't allow for it (and this PR removes support from MATLAB), so we should not support it at the C++ level either. A corresponding change goes beyond the scope of this PR.

@ischoegl

This comment was marked as outdated.

@ischoegl ischoegl force-pushed the zerod-names branch 2 times, most recently from 9ca3883 to 4031555 Compare August 14, 2024 19:20
@ischoegl
Copy link
Member Author

ischoegl commented Aug 14, 2024

Rebased, with commits removing obsolete CLib methods moved to #1773.

Copy link
Member

@speth speth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @ischoegl. Moving this naming process to the C++ level certainly makes sense. Just a few comments on the implementation.

include/cantera/zeroD/FlowDevice.h Outdated Show resolved Hide resolved
include/cantera/zeroD/ReactorBase.h Outdated Show resolved Hide resolved
src/zeroD/ReactorBase.cpp Outdated Show resolved Hide resolved
src/zeroD/ReactorNet.cpp Outdated Show resolved Hide resolved
src/zeroD/ReactorNet.cpp Outdated Show resolved Hide resolved
test/clib/test_ctreactor.cpp Outdated Show resolved Hide resolved
test/python/test_reactor.py Outdated Show resolved Hide resolved
@ischoegl
Copy link
Member Author

@speth ... thanks for the review! Your suggestion to simplify setDefaultName is much appreciated!

@ischoegl ischoegl requested a review from speth August 19, 2024 12:42
@ischoegl
Copy link
Member Author

@speth ... assuming that this is ready to merge, I'll use this to start on Cantera/enhancements#213.

@speth speth merged commit dd26e18 into Cantera:main Aug 24, 2024
50 checks passed
@ischoegl ischoegl deleted the zerod-names branch August 24, 2024 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Broken name attribute for reactor Wall objects
2 participants