-
Notifications
You must be signed in to change notification settings - Fork 7
Replace map with vector to remove key-pair restriction for System data #894
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors System.others_ from a map to a vector structure to support storing multiple properties (e.g., number concentration and density) for the same aerosol mode. Additionally, it introduces aerosol scoping functionality in ChemicalReactionBuilder to automatically prefix species names with mode and phase identifiers.
Key changes:
- Changed
System.others_fromstd::unordered_map<std::string, std::string>tostd::vector<std::string> - Added
JoinStringsutility function for concatenating dot-separated names - Introduced
SetAerosolScopemethod inChemicalReactionBuilderwith mutual exclusivity enforcement
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| include/micm/system/system.hpp | Changed others_ from map to vector, updated UniqueNames() and StateSize() methods, added JoinStrings usage |
| include/micm/util/utils.hpp | Added new JoinStrings utility function for joining strings with dot separators |
| include/micm/process/chemical_reaction_builder.hpp | Added SetAerosolScope method with scoping logic, updated SetReactants and SetProducts to support scoping |
| include/micm/process/process_error.hpp | Added InvalidConfiguration error code and updated error message ordering |
| include/micm/util/error.hpp | Added MICM_PROCESS_ERROR_CODE_INVALID_CONFIGURATION constant |
| test/unit/system/test_system.cpp | Updated test to use vector-based API with emplace_back |
| test/unit/solver/test_state.cpp | Updated tests to use vector-based API with push_back |
| test/unit/process/test_process_configuration.cpp | Added comprehensive tests for aerosol scoping functionality |
| test/unit/process/CMakeLists.txt | Registered new aerosol scope test |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #894 +/- ##
==========================================
+ Coverage 94.36% 94.66% +0.29%
==========================================
Files 65 66 +1
Lines 3197 3245 +48
==========================================
+ Hits 3017 3072 +55
+ Misses 180 173 -7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Waiting for #891 to be reveiwed/merged
Systems.others_is intended to store the data that are not species, such as mode specific number concentration. But because it is implemented as a map, for example, mode-specific density can not be stored alongside number concentration.This PR replaces the map with a vector, removing key-pair restriction.