Cantera / cantera

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

Implement local AnyMap ordering rules #1778

Closed ischoegl closed 3 months ago

ischoegl commented 3 months ago

Changes proposed in this pull request

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

Closes #1776

Checklist

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 84.61538% with 6 lines in your changes missing coverage. Please review.

Project coverage is 73.23%. Comparing base (4c8f9e9) to head (5a840f3). Report is 52 commits behind head on main.

Files Patch % Lines
src/base/AnyMap.cpp 81.81% 2 Missing and 4 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1778 +/- ## ======================================= Coverage 73.22% 73.23% ======================================= Files 381 381 Lines 54344 54362 +18 Branches 9247 9251 +4 ======================================= + Hits 39796 39812 +16 - Misses 11574 11576 +2 Partials 2974 2974 ```

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

speth commented 3 months ago

I think this might be more complexity than we need in manipulating the output order of AnyMap items. The main way of ordering items is to add them to the AnyMap in the order they should be output. The additional option of using addOrderingRules is there to handle cases where it's difficult to just add everything in order because the data is coming from multiple sources, such as different base / derived classes.

It seems like all that's really needed in the case of the 1D output is to promote a few of the metadata fields to the front, and all of the fields with dynamic names (state vector components) will just appear in their natural order after that. I've provided an implementation of this approach in #1781.