1. 31 Oct, 2019 1 commit
  2. 02 Oct, 2019 1 commit
  3. 27 Sep, 2019 1 commit
    • Mark Olesen's avatar
      STYLE: adjustments to HashSet, HashTable · 0840bfdc
      Mark Olesen authored
      - use HashTable emplace instead of insert to avoid unneeded argument
        (for HashSet).
      
      - use emplace when generating zero-initialized values for
        HashTable::operator()
      
      - drop unused parameter from Detail::HashTableSingle,
        adjust templates parameter names
      
      - forward HashTable::operator[] to the semantically identical
        HashTable::at() to avoid code duplication
      0840bfdc
  4. 06 May, 2019 1 commit
    • Mark Olesen's avatar
      ENH: additional HashTable emplace/insert/set methods (#1286) · ac317699
      Mark Olesen authored
      - support move insert/set and emplace insertion.
      
        These adjustments can be used for improved memory efficiency, and
        allow hash tables of non-copyable objects (eg, std::unique_ptr).
      
      - extend special HashTable output treatment to include pointer-like
        objects such as autoPtr and unique_ptr.
      
      ENH: HashTable::at() method with checking. Fatal if entry does not exist.
      ac317699
  5. 06 Feb, 2019 1 commit
  6. 08 Jan, 2019 1 commit
    • Mark Olesen's avatar
      ENH: partial reorganization of HashTable internals (#1160) · 8eefc7b3
      Mark Olesen authored
      - relocate the pair_entry (HashTable) and unary_entry (HashSet) into
        the Detail namespace and add output handling.
      
        The output handling at this level removes the reliance on zero::null
        output (HashSet) and allows direct support of pointers.
        This means that the following now works
      
            HashTable<T*> tbl;
            os << tbl;
      
        It also means that we don't need to overload operator<< for
        HashPtrTable anymore.
      
      - avoid delete/new when calling HashSet::set(). If the entry already
        exists there is no reason to remove it and add another one with the
        same content.
      
      STYLE: HashTable iterators now have a val() method
      
      - identical to the object() iterator method, but shorter to type.
      8eefc7b3
  7. 17 May, 2018 1 commit
    • Mark Olesen's avatar
      ENH: avoid memory leaks for HashPtrTable, PtrMap insertion (issue #749) · 48d654cf
      Mark Olesen authored
      - disallow insert() of raw pointers, since a failed insertion
        (ie, entry already existed) results in an unmanaged pointer.
      
        Either insert using an autoPtr, or set() with raw pointers or autoPtr.
      
      - IOobjectList::add() now takes an autoPtr instead of an object reference
      
      - IOobjectList::remove() now returns an autoPtr instead of a raw pointer
      48d654cf
  8. 08 Feb, 2018 1 commit
  9. 25 Jan, 2018 1 commit
    • Mark Olesen's avatar
      ENH: remove Foam::Swap specializations for HashSet, HashTable · 915e8c9f
      Mark Olesen authored
      - without these will use the normal move construct + move assign.
        This is similarly efficient, but avoids the inadvertently having the
        incorrect Swap being used for derived classes.
      
      STYLE: remove unused xfer methods for HashTable, HashSet
      
      - unneeded since move construct and move assignment are possible
      915e8c9f
  10. 08 Nov, 2017 1 commit
  11. 31 Oct, 2017 1 commit
    • Mark Olesen's avatar
      ENH: improvements to HashTable internals · 053a648e
      Mark Olesen authored
      - make single-parameter construct (label) explicit
      - consolidate iterators
      - slightly reduced overhead for some HashSet types
      - improved resizing behaviour
      - compact output for empty Ptr hashes
      053a648e
  12. 20 Sep, 2017 1 commit
    • Mark Olesen's avatar
      ENH: update List and DynamicList methods (issue #595) · 049617d0
      Mark Olesen authored
      - improve functional compatibility with DynList (remove methods)
        * eg, remove an element from any position in a DynamicList
        * reduce the number of template parameters
        * remove/subset regions of DynamicList
      
      - propagate Swap template specializations for lists, hashtables
      
      - move construct/assignment to various containers.
      
      - add find/found methods for FixedList and UList for a more succinct
        (and clearer?) usage than the equivalent global findIndex() function.
      
      - simplify List_FOR_ALL loops
      049617d0
  13. 14 May, 2017 1 commit
  14. 11 May, 2017 1 commit
    • Mark Olesen's avatar
      ENH: added HashTable 'lookup' and 'retain' methods · f73b5b62
      Mark Olesen authored
      - lookup(): with a default value (const access)
        For example,
            Map<label> something;
            value = something.lookup(key, -1);
      
          being equivalent to the following:
      
            Map<label> something;
            value = -1;  // bad value
            if (something.found(key))
            {
                value = something[key];
            }
      
          except that lookup also makes it convenient to handle const references.
          Eg,
      
            const labelList& ids = someHash.lookup(key, labelList());
      
      - For consistency, provide a two parameter HashTable '()' operator.
        The lookup() method is, however, normally preferable when
        const-only access is to be ensured.
      
      - retain(): the counterpart to erase(), it only retains entries
        corresponding to the listed keys.
      
        For example,
            HashTable<someType> largeCache;
            wordHashSet preserve = ...;
      
            largeCache.retain(preserve);
      
          being roughly equivalent to the following two-stage process,
          but with reduced overhead and typing, and fewer potential mistakes.
      
            HashTable<someType> largeCache;
            wordHashSet preserve = ...;
      
            {
                wordHashSet cull(largeCache.toc()); // all keys
                cull.erase(preserve);               // except those to preserve
                largeCache.erase(cull);             //
            }
      
        The HashSet &= operator and retain() are functionally equivalent,
        but retain() also works with dissimilar value types.
      f73b5b62
  15. 04 May, 2017 1 commit
    • Mark Olesen's avatar
      ENH: improve HashTable iterator access and management · 03d18072
      Mark Olesen authored
      - provide key_iterator/const_key_iterator for all hashes,
        reuse directly for HashSet as iterator/const_iterator, respectively.
      
      - additional keys() method for HashTable that returns a wrapped to
        a pair of begin/end const_iterators with additional size/empty
        information that allows these to be used directly by anything else
        expecting things with begin/end/size. Unfortunately does not yet
        work with std::distance().
      
        Example,
           for (auto& k : labelHashTable.keys())
           {
              ...
           }
      03d18072
  16. 01 May, 2017 1 commit
    • Mark Olesen's avatar
      ENH: improve overall consistency of the HashTable and its iterators · c0a50dc6
      Mark Olesen authored
      - previously had a mismash of const/non-const attributes on iterators
        that were confused with the attributes of the object being accessed.
      
      - use the iterator keys() and object() methods consistently for all
        internal access of the HashTable iterators. This makes the intention
        clearer, the code easier to maintain, and protects against any
        possible changes in the definition of the operators.
      
      - 'operator*': The standard form expected by STL libraries.
        However, for the std::map, this dereferences to a <key,value> pair,
        whereas OpenFOAM dereferences simply to <value>.
      
      - 'operator()': OpenFOAM treats this like the 'operator*'
      
      - adjusted the values of end() and cend() to reinterpret from nullObject
        instead of returning a static iteratorEnd() object.
        This means that C++ templates can now correctly deduce and match
        the return types from begin() and end() consistently.
        So that range-based now works.
      
        Eg,
            HashTable<label> table1 = ...;
            for (auto i : table1)
            {
                Info<< i << endl;
            }
      
        Since the 'operator*' returns hash table values, this prints all the
        values in the table.
      c0a50dc6
  17. 11 Apr, 2017 1 commit
    • Mark Olesen's avatar
      ENH: provide HashTable::iterator::found() method · f2e3c1c4
      Mark Olesen authored
      - This can be used as a convenient alternative to comparing against end().
        Eg,
      
          dictionaryConstructorTable::iterator cstrIter =
              dictionaryConstructorTablePtr_->find(methodType);
      
          if (cstrIter.found())
          {
              ...
          }
        vs.
          if (cstrIter != dictionaryConstructorTablePtr_->end())
          {
              ...
          }
      f2e3c1c4
  18. 05 Aug, 2016 1 commit
  19. 31 May, 2016 1 commit
  20. 10 Jan, 2016 1 commit
  21. 08 Nov, 2015 1 commit
  22. 14 Aug, 2011 1 commit
  23. 09 Mar, 2011 1 commit
  24. 19 Jan, 2011 1 commit
  25. 14 Jan, 2011 1 commit
  26. 07 Jan, 2011 1 commit
  27. 05 Jan, 2011 2 commits
  28. 21 Dec, 2010 1 commit
  29. 28 Jul, 2010 1 commit
  30. 29 Mar, 2010 1 commit
  31. 06 Nov, 2009 1 commit
  32. 04 Nov, 2009 2 commits
  33. 22 Jun, 2009 1 commit
  34. 19 May, 2009 1 commit
    • Mark Olesen's avatar
      HashTable minor iterator issues · 1d2a94c3
      Mark Olesen authored
      - made const_iterator::operator* and const_iterator::operator() const only
      - added const versions of iterator::operator* and iterator::operator()
      1d2a94c3
  35. 04 Mar, 2009 1 commit
  36. 26 Feb, 2009 1 commit
    • Mark Olesen's avatar
      HashTable changes · a46c85f5
      Mark Olesen authored
      - make table power-of-two, but since it seems to give 1-2% performance
        improvement, maybe forget it too.
      
      - remove two-argument form of hashing classes and do the modulus direclty
        within HashTable instead. This simplifies things a fair bit.
      
      - migrate Hash<void*> from db/dlLibrary to primitives/hashes/Hash
      a46c85f5
  37. 25 Feb, 2009 1 commit
  38. 06 Feb, 2009 1 commit
    • Mark Olesen's avatar
      consistency update · 69918f23
      Mark Olesen authored
      - OSspecific: chmod() -> chMod(), even although it's not used anywhere
      
      - ListOps get subset() and inplaceSubset() templated on BoolListType
      
      - added UList<bool>::operator[](..) const specialization.
        Returns false (actually pTraits<bool>::zero) for out-of-range elements.
        This lets us use List<bool> with lazy evaluation and no noticeable
        change in performance.
      
      - use rcIndex() and fcIndex() wherever possible.
        Could check if branching or modulus is faster for fcIndex().
      
      - UList and FixedList get 'const T* cdata() const' and 'T* data()' members.
        Similar to the STL front() and std::string::data() methods, they return a
        pointer to the first element without needing to write '&myList[0]', recast
        begin() or violate const-ness.
      69918f23