Introduce BulkRate class template#1187
Conversation
ArrheniusRate is defined as BulkRate<Arrhenius3, ArrheniusData>
1ede573 to
6982dd1
Compare
6982dd1 to
3441bc2
Compare
Codecov Report
@@ Coverage Diff @@
## main #1187 +/- ##
==========================================
- Coverage 65.44% 65.41% -0.04%
==========================================
Files 318 318
Lines 46106 46085 -21
Branches 19604 19604
==========================================
- Hits 30175 30145 -30
+ Misses 13435 13426 -9
- Partials 2496 2514 +18
Continue to review full report at Codecov.
|
bc9cccf to
ec87d6f
Compare
ec87d6f to
7fc759c
Compare
|
This is ready for review. The four cancelled CI runs are due to a Windows-2016 brown-out. Edit: retriggered ... |
7fc759c to
4a7c4ae
Compare
While multiple inheritance avoids the introduction of virtual functions, a direct inheritance scheme may avoid a small speed penalty.
4a7c4ae to
49ff30b
Compare
speth
left a comment
There was a problem hiding this comment.
I like the simplification that this achieves, both in complexity and lines of code, by eliminating the use of multiple inheritance with the ReactionRate class. But I think we might be able to actually go a step further and skip the BulkRate template entirely with no real loss, since it's just delegating almost all of its behavior to ArrheniusBase.
I can still see this template structure potentially being useful in the case you mentioned of interface reactions, where we need to handle some common operations on top of either the base Arrhenius or Blowers-Masel rate types. And I can see retaining BulkRate if there's some set of behaviors that we need for bulk rates that shouldn't be part of the interface rates, but I don't see anything like that in the current implementation.
|
@speth ... thanks for the comment! I removed the chained function calls, although I don't think there is any performance penalty. Based on your explanation, I don't see any benefit in keeping this around.
There is the exception of
Fwiw, So I think it may make sense to keep |
You're right that I guess eliminating |
That would be my preference. I don’t see |
|
@speth ... fwiw, I believe that by renaming At the moment, I'll wait for this PR to be merged before getting back to #1181. |
speth
left a comment
There was a problem hiding this comment.
I had just a couple of very minor comments. Otherwise this looks good to me.
04d9346 to
e0095a4
Compare
|
@speth ... thank you for the review! I updated as requested. |
Changes proposed in this pull request
The clear separation of
ArrheniusBaseandArrheniusRateintroduced in #1184 created an opening for the creation of class templates that can be further developed in #1181. Specifically, this PR introducesBulkRate<RateType,DataType>, along with stripped-down classesArrhenius3,TwoTempPlasmaandBlowersMasel.The pre-existing classes are now defined as
typedef's as:Beyond, additional streamlining targets the elimination of
TwoTempPlasmaReaction, as well as some updates intest_reaction.py.It is anticipated that the definition of
Arrhenius3andBlowersMaselwill facilitate the introduction of class templatesInterfaceRate<>andStickingRate<>in #1181. In addition, there is a potential use ofArrhenius3for aThreeBodyRate<>template in a future resolution of Cantera/enhancements#133.Also: eliminate multiple inheritance; while this allowed avoiding several
virtualmethods, multiple inheritance in combination with templates resulted in a small speed penalty, although the origin is inconclusive. While elimination of multiple inheritance shows a small improvement, tests on windows/MSVC indicate that #1184 did not introduce any noticeable regressions.Checklist
scons build&scons test) and unit tests address code coverage