Commit Graph

13 Commits

Author SHA1 Message Date
Mark Olesen
097008544c STYLE: adjust range check in Foam::factorial (FULLDEBUG)
STYLE: consistent use of $(LIB_SRC) in Make/options
2022-09-07 16:25:45 +02:00
Mark Olesen
95cd8ee75c 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.
2021-04-19 16:33:42 +00:00
Mark Olesen
8ec64d8128 STYLE: compilation of some unit tests 2017-10-26 23:59:18 +02:00
Henry Weller
58f905ff70 C++11: Replaced the C NULL with the safer C++11 nullptr
Requires gcc version 4.7 or higher
2016-08-05 17:19:38 +01:00
Henry Weller
95d146ecdf Rationalized the indentation of C-preprocessor directives 2016-02-29 15:42:03 +00:00
Henry Weller
72300041df Removed use of the deprecated "register" keyword
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4340.html
2015-06-30 10:26:44 +01:00
Henry
c778346c96 Formatting: Rationalized the indentation of #include 2015-02-10 20:35:50 +00:00
Henry
c93f87cc7f Added support for glibc < 2.18
Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=1474
2015-01-04 20:13:37 +00:00
mattijs
20a3d67c93 STYLE: various: small coding issues 2013-10-14 14:48:05 +01:00
Mark Olesen
499d48cfdb STYLE: uniform 'Test-' prefix for all applications/test
- easier to clean, avoid confusion with 'real' applications, etc.
2010-11-23 16:26:04 +01:00
graham
28345247a7 STYLE: Fixing code style requirements for more files - those not
picked up by a copyright change.
2010-07-29 11:28:44 +01:00
Mark Olesen
17548296be Switched from old hashing functions to use Bob Jenkins' hash routine
- If the underlying type is contiguous, FixedList hashes its storage directly.
- Drop labelPairHash (non-commutative) from fvMeshDistribute since
  FixedList::Hash does the right thing anyhow.
- Hash<edge> specialization is commutative, without multiplication.
- Hash<triFace> specialization kept multiplication (but now uLabel).
  There's not much point optimizing it, since it's not used much anyhow.

Misc. changes

- added StaticAssert to NamedEnum.H
- label.H / uLabel.H : define FOAM_LABEL_MAX, FOAM_ULABEL_MAX with the
  values finally used for the storage.  These can be useful for pre-processor
  checks elsewhere (although I stopped needing them in the meantime).
2009-03-04 10:50:14 +01:00
Mark Olesen
44a86232af Added Jenkin's hash functions in C++ form
- not much speed difference between SuperFastHash and Jenkin's lookup3 but
  both are 5-10% faster than what is currently implemented in Foam::string,
  albeit inlining probably helps there.

- TODO: integration with existing infrastructure
2009-03-02 19:57:17 +01:00