feat: Introduce DoubleKeyedMap for more generalised storage of pair-related data - #2214
Merged
trisyoungs merged 18 commits intoAug 15, 2025
Merged
Conversation
trisyoungs
changed the base branch from
develop2
to
dissolve2/no-atomtype-pointers
July 28, 2025 14:10
trisyoungs
force-pushed
the
dissolve2/no-atomtype-pointers
branch
from
July 31, 2025 12:38
ee8e1f4 to
b61bdcf
Compare
trisyoungs
force-pushed
the
dissolve2/double-keyed-map
branch
from
August 4, 2025 14:34
4ee479b to
ff94f7a
Compare
…finish refactoring with LUTs.
trisyoungs
force-pushed
the
dissolve2/double-keyed-map
branch
from
August 13, 2025 11:41
ec3eb2b to
08ac2ea
Compare
trisyoungs
marked this pull request as ready for review
August 13, 2025 11:47
| std::map<std::string, ValueClass> &map() { return data_; } | ||
| const std::map<std::string, ValueClass> &map() const { return data_; } | ||
| // Return number of data in map | ||
| int size() const { return data_.size(); } |
Contributor
There was a problem hiding this comment.
Since we have the possibility that A//B == B//A, do we need something like a countUnique() method to give the effective size of the data in terms of keys that have this mirror form (thus exluding the equivalent keys)? Would that be useful information to access from the point of view of the simulation?
Member
Author
There was a problem hiding this comment.
Good question. You might expect this to be quite a useful number ( the total number of unique pairs is (N * (N+1)) / 2)) but if you're not storing it in a 2D matrix and are just looking up numbers then you don't need to know, which is kinda nice.
RobBuchananCompPhys
approved these changes
Aug 13, 2025
Co-authored-by: Tristan Youngs <trisyoungs@googlemail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follows #2209
This PR replaces the
Array2Dstorage of RDFs and histograms, used extensively byPartialSet, with one based onstd::map. The principal reason for doing so is detailed in #2207 and removes any dependence of calculated partials on the order of the underlyingAtomTypes. A new classDoubleKeyedMapis introduced to implement this, and allows e.g. entries to be retrieved based on a key generated from two atom type names, also taking into account whether the terms i-j and j-i should be treated as equivalent (Array2D::half_ == true).