[Input] Make accessing input file data outside of phase node easier#869
[Input] Make accessing input file data outside of phase node easier#869speth merged 1 commit intoCantera:masterfrom
Conversation
Some phase types utilize information in the input file that is contained outside the phase definition (e.g. phase definitions for nested phases). This change to ThermoPhase::setParameters makes it easier for those phases to have access to the full input file definition without re-reading and reparsing the YAML file.
Codecov Report
@@ Coverage Diff @@
## master #869 +/- ##
==========================================
- Coverage 71.57% 71.56% -0.01%
==========================================
Files 372 372
Lines 44503 44494 -9
==========================================
- Hits 31851 31843 -8
+ Misses 12652 12651 -1
Continue to review full report at Codecov.
|
bryanwweber
left a comment
There was a problem hiding this comment.
Small improvement here, otherwise seems like a good generalization.
|
|
||
| //! Set equation of state parameters from an AnyMap phase description | ||
| void setParameters(const AnyMap& phaseNode); | ||
| //! Set equation of state parameters from an AnyMap phase description. |
There was a problem hiding this comment.
Can this link to the AnyMap docs?
There was a problem hiding this comment.
I think Doxygen should do this automatically. See for example the docs for ThermoPhase::setState which contains automatically generated links to several classes:
cantera/include/cantera/thermo/ThermoPhase.h
Lines 1148 to 1171 in 8a591b4
(and one spurious one to
namespace Cantera.
There was a problem hiding this comment.
Great, I didn't know that Doxygen will autolink arbitrary words that it finds in the code. Guess you'd better not name a method with a common word 😂
|
Thanks, @speth. I looked over the code changes and don't have too much input, but agree that this looks really useful. One quasi-related question: could this generalization be useful when importing/initializing interface reactions, where access to phase properties is useful but a little convoluted (at least last time I looked at it, admittedly before yaml serialization)? |
|
@decaluwe, I don't think there's an obvious parallel with interface reactions, although there have been some changes with the way those are handled since introducing the YAML format. Namely, we now have made explicit the requirement that you have to have a |
Some phase types utilize information in the input file that is contained outside the phase definition (e.g. phase definitions for nested phases). This change to
ThermoPhase::setParametersmakes it easier for those phases to have access to the full inputfile definition without re-reading and reparsing the YAML file.
While I had originally thought that these cases were only in some of the dustier corners of Cantera, this also comes up in the new
PlasmaPhasetype being introduced in #700, so I think it's worth having a cleaner interface for this capability.scons build&scons test) and unit tests address code coverage