Skip to content
Snippets Groups Projects
Commit 95cd8ee7 authored by Mark OLESEN's avatar Mark OLESEN Committed by Andrew Heather
Browse files

ENH: improve hashing overloads of string-types and HashTable/HashSet

- additional dummy template parameter to assist with supporting
  derived classes. Currently just used for string types, but can be
  extended.

- provide hash specialization for various integer types.
  Removes the need for any forwarding.

- change default hasher for HashSet/HashTable from 'string::hash'
  to `Hash<Key>`. This avoids questionable hashing calls and/or
  avoids compiler resolution problems.

  For example,
  HashSet<label>::hasher and labelHashSet::hasher now both properly
  map to Hash<label> whereas previously HashSet<label> would have
  persistently mapped to string::hash, which was incorrect.

- standardize internal hashing functors.

  Functor name is 'hasher', as per STL set/map and the OpenFOAM
  HashSet/HashTable definitions.

  Older code had a local templated name, which added unnecessary
  clutter and the template parameter was always defaulted.
  For example,

      Old:  `FixedList<label, 3>::Hash<>()`
      New:  `FixedList<label, 3>::hasher()`
      Unchanged:  `labelHashSet::hasher()`

  Existing `Hash<>` functor namings are still supported,
  but deprecated.

- define hasher and Hash specialization for bitSet and PackedList

- add symmetric hasher for 'face'.
  Starts with lowest vertex value and walks in the direction
  of the next lowest value. This ensures that the hash code is
  independent of face orientation and face rotation.

NB:
  - some of keys for multiphase handling (eg, phasePairKey)
    still use yet another function naming: `hash` and `symmHash`.
    This will be targeted for alignment in the future.
parent b060378d
Branches
Tags
Showing
with 611 additions and 66 deletions
  • Mark OLESEN @mark

    mentioned in commit 028ca266

    ·

    mentioned in commit 028ca266

    Toggle commit list
  • Mark OLESEN @mark

    mentioned in commit ff79657a119d34fda246f4aed7c3479e5de10276

    ·

    mentioned in commit ff79657a119d34fda246f4aed7c3479e5de10276

    Toggle commit list
  • Mark OLESEN @mark

    mentioned in commit bdf77bbd

    ·

    mentioned in commit bdf77bbd

    Toggle commit list
  • Mark OLESEN @mark

    mentioned in commit 42178fdd

    ·

    mentioned in commit 42178fdd

    Toggle commit list
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment