Topic: Local numering is a headache
Short version
If we used a unordered_map instead of AList/vector to store Nodes and Elements, we could stick to global numbering everywhere!
With ranged-based for loops, most of the code would stay the same.
Long version
The local numbering we have is quite the headache, in particular, when it comes to load balancing.
Understanding the details of the innocently looking "Domain :: commitTransactions" function took me several days. I only had to do this because I wanted to switch out the container "AList<>" to a "vector<unique_ptr<>>" for the nodes and elements.
That function is so very sensitive to the order of which the operations occur.
We, of course, have to send the nodes in their global numbering, but now we have the old elements keeping track of the old local numbering, and the new elements keeping track of the global number. It's caused me many headaches.
All of these problems would instantly disappear if we just stuck with the global numbering all the time.
This would mean switching the vector to a unordered_map for storing Nodes and Elements. Moving nodes would be trivial. No renumbering anywhere. "Domain :: commitTransactions" would be just a few lines of code (removing or adding values to the existing maps).
It would of course come with the computational cost instead. Is the hash expensive? OOFEM does call "giveNode(int n)" a lot, and it could have a noticeable effect (though, considering we have to dereference several layers of pointers each time to access our data, a hashing function might be insignificant).
It's an idea worth considering.