Cantera / cantera

Chemical kinetics, thermodynamics, and transport tool suite
https://cantera.org
Other
602 stars 345 forks source link

Implement ThermoPhase species locks in C++ #1686

Closed ischoegl closed 5 months ago

ischoegl commented 6 months ago

Changes proposed in this pull request

Move sentinels preventing species addition for ThermoPhase objects used by ReactorBase, Domain1D, SolutionArray and MultiPhase instances from Python API to C++.

The implementation uses reference counters that should only be used within C++ (and not exposed at interfaces). This allows for most _WeakrefProxy sentinels to be be removed in Python. One exception is Quantity, which does not have a C++ equivalent.

The approach is relatively simple, and turns out to be independent of migrating various C++ classes to use Solution.

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

Closes #1457

Checklist

codecov[bot] commented 6 months ago

Codecov Report

Attention: Patch coverage is 76.11940% with 16 lines in your changes are missing coverage. Please review.

Project coverage is 72.75%. Comparing base (ed27faf) to head (2c99b2e).

Files Patch % Lines
src/oneD/Domain1D.cpp 54.54% 3 Missing and 2 partials :warning:
src/zeroD/ReactorBase.cpp 50.00% 3 Missing and 2 partials :warning:
src/thermo/Phase.cpp 70.00% 2 Missing and 1 partial :warning:
include/cantera/oneD/Boundary1D.h 75.00% 1 Missing :warning:
src/base/SolutionArray.cpp 83.33% 0 Missing and 1 partial :warning:
src/oneD/Boundary1D.cpp 87.50% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1686 +/- ## ========================================== - Coverage 72.76% 72.75% -0.02% ========================================== Files 378 378 Lines 56986 57015 +29 Branches 20691 20722 +31 ========================================== + Hits 41468 41483 +15 - Misses 12463 12471 +8 - Partials 3055 3061 +6 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.