1. 09 Aug, 2018 1 commit
  2. 08 Aug, 2018 1 commit
    • Mark OLESEN's avatar
      ENH: add missing Hash function for List/UList (issue #966) · dd9ecd49
      Mark OLESEN authored
      - there were previously no hashing mechanisms for lists so they
        would fall back to the definition for primitives and hash the
        memory location of the allocated List object.
      - provide a UList::Hash<> sub-class for inheritance, and also a global
        specialization for UList<T>, List<T> such that the hash value for
        List<List<T>> cascades properly.
      - provide similar function in triFace to ensure that it remains
        similar in behaviour to face.
      - added SymmHash to Pair, for use when order is unimportant.
      STYLE: use string::hash() more consistently
      - no particular reason to use Hash<word>() which forwards to
        string::hash() anyhow
  3. 01 Aug, 2018 1 commit
    • Mark OLESEN's avatar
      STYLE: ensure that emptyLabelList is known from List.H · d8c0167e
      Mark OLESEN authored
      - treat as a List constant without requiring inclusion of ListOps.H
      - replace use of emptyList<label>() with emptyLabelList directly.
        The emptyList<T>() casting is disallowed with many modern compilers
        and now marked as deprecated (expect early removal).
      - relocate labelList typedef to List.H for more general access.
        Similar reasoning to having labelUList defined in UList.H
  4. 27 Jul, 2018 1 commit
  5. 30 May, 2018 1 commit
  6. 28 Mar, 2018 1 commit
  7. 19 Mar, 2018 1 commit
  8. 01 Mar, 2018 1 commit
    • Mark OLESEN's avatar
      ENH: cleanup of ListOps, ListListOps. Adjustments to List, PackedList. · 15f72608
      Mark OLESEN authored
      - relocated ListAppendEqOp and ListUniqueEqOp to ListOps::appendEqOp
        and ListOps::UniqueEqOp, respectively for better code isolation and
        documentation of purpose.
      - relocated setValues to ListOps::setValue() with many more
        alternative selectors possible
      - relocated createWithValues to ListOps::createWithValue
        for better code isolation. The default initialization value is itself
        now a default parameter, which allow for less typing.
        Negative indices in the locations to set are now silently ignored,
        which makes it possible to use an oldToNew mapping that includes
        negative indices.
      - additional ListOps::createWithValue taking a single position to set,
        available both in copy assign and move assign versions.
        Since a negative index is ignored, it is possible to combine with
        the output of List::find() etc.
      STYLE: changes for PackedList
      - code simplication in the PackedList iterators, including dropping
        the unused operator() on iterators, which is not available in plain
        list versions either.
      - improved sizing for PackedBoolList creation from a labelUList.
      ENH: additional List constructors, for handling single element list.
      - can assist in reducing constructor ambiguity, but can also helps
        memory optimization when creating a single element list.
        For example,
          labelListList labels(one(), identity(mesh.nFaces()));
  9. 28 Feb, 2018 2 commits
  10. 21 Feb, 2018 1 commit
    • Mark OLESEN's avatar
      ENH: improve consistency of ListOps and stringListOps · f9599279
      Mark OLESEN authored
      - subsetList, inplaceSubsetList with optional inverted logic.
      - use moveable elements where possible.
      - allow optional starting offset for the identity global function.
        Eg,  'identity(10, start)' vs 'identity(10) + start'
  11. 26 Jan, 2018 1 commit
    • Mark OLESEN's avatar
      ENH: replace reverse iterators for UList · a0148ac0
      Mark OLESEN authored
      - use std::reverse_iterator adaptors, avoid the array-bounds warning
      - use pointer arithmetic instead of dereferencing the internal array
      - adjust logic to use 'operator<' instead of 'operator>' in sorting.
        This creates less work when making other classes sortable.
  12. 27 Nov, 2017 1 commit
    • Mark OLESEN's avatar
      ENH: several improvements for linked-lists · cc5f30f2
      Mark OLESEN authored
      - support move construct/assignment for linked-lists themselves
        and when moving into a 'normal' list
      - better consistency with begin/end signatures and the various
      - for indirect linked-lists, provide iterator access to the underlying
        data element address:   iter.get()  vs  &(iter())
      - add standard '->' indirection for iterators (as per normal STL
  13. 04 Nov, 2017 2 commits
  14. 19 Nov, 2017 1 commit
  15. 29 Oct, 2017 1 commit
    • Mark OLESEN's avatar
      ENH: consistent reverse iterator definitions for UList and FixedList · cd46cb70
      Mark OLESEN authored
      - consistent with C++ STL conventions, the reverse iterators should
        use operator++ to transit the list from rbegin() to rend().
        The previous implementation used raw pointers, which meant that they
        had the opposite behaviour: operator-- to transit from rbegin() to
        The updated version only has operator++ defined, thus the compiler
        should catch any possible instances where people were using the old
        (incorrect) versions.
      - updated forAllReverseIters() and forAllConstReverseIters() macros to
        be consistent with new implementation and with C++ STL conventions.
  16. 27 Oct, 2017 1 commit
    • Mark OLESEN's avatar
      ENH: allow passing of comparator to sortToc methods · 0a62fd2f
      Mark OLESEN authored
      - this increases the flexibility of the interface
      - Add stringOps 'natural' string sorting comparison.
        Digits are sorted in their natural order, which means that
            (file10.txt file05.txt file2.txt)
        are sorted as
            (file2.txt file05.txt file10.txt)
      STYLE: consistent naming of template parameters for comparators
        - Compare for normal binary predicates
        - ListComparePredicate for list compare binary predicates
  17. 25 Oct, 2017 1 commit
    • Mark OLESEN's avatar
      ENH: relocate protected List::size(label) to UList (issue #595) · 5c1ec7ec
      Mark OLESEN authored
      - makes it accessible for containers that manage their own storage
        and derive directly from UList.
      - DynamicList::min_size() method to access the corresponding
        SizeMin template parameter.
      - ensure consistency in the reserve size for the constructor
            DynamicList<..> lst(N);
        now has identical sizing as
            DynamicList<..> lst();
  18. 24 Oct, 2017 1 commit
  19. 20 Oct, 2017 1 commit
    • Mark OLESEN's avatar
      ENH: additional low-level raw binary output for Ostream. · 74f667a8
      Mark OLESEN authored
      - low-level beginRaw(), writeRaw(), endRaw() methods.
        These can be used to directly add '()' decorators for serial output
        or prepare/cleanup parallel buffers.
        Used, for example, when outputting indirect lists in binary to avoid.
  20. 20 Sep, 2017 2 commits
    • 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
    • Mark OLESEN's avatar
  21. 26 May, 2017 1 commit
  22. 07 May, 2017 1 commit
  23. 04 May, 2017 1 commit
    • Mark OLESEN's avatar
      ENH: simplify and extend labelRange · 5d541def
      Mark OLESEN authored
      - add increment/decrement, repositioning. Simplify const_iterator.
      - this makes is much easier to use labelRange for constructing ranges of
        sub-lists. For symmetry with setSize() it has a setStart() instead of
        simply assigning to start() directly. This would also provide the
        future possibility to imbue the labelRange with a particular policy
        (eg, no negative starts, max size etc) and ensure that they are
        A simple use case:
          // initialize each to zero...
          List<labelRange> subListRanges = ...;
          // scan and categorize
          if (condition)
             subListRanges[categoryI]++;  // increment size for that category
          // finally, set the starting points
          start = 0;
          for (labelRange& range : subListRanges)
              start += range.size();
  24. 01 May, 2017 1 commit
    • Mark OLESEN's avatar
      ENH: support UList[labelRange] and SubList construction with labelRange · 805b76d4
      Mark OLESEN authored
      This uses a concept similar to what std::valarray and std::slice do.
      A labelRange provides a convenient container for holding start/size
      and lends itself to addressing 'sliced' views of lists.
      For safety, the operations and constructors restricts the given input range
      to a valid addressible region of the underlying list, while the labelRange
      itself precludes negative sizes.
      The SubList version is useful for patches or other things that have a
      SubList as its parameter. Otherwise the UList [] operator will be the
      more natural solution. The slices can be done with a labelRange, or
      a {start,size} pair.
           labelList list1 = identity(20);
           list1[labelRange(18,10)]  = -1;
           list1[{-20,25}] = -2;
           list1[{1000,5}] = -3;
           const labelList list2 = identity(20);
           list2[{5,10}] = -3;  // ERROR: cannot assign to const!
  25. 29 Apr, 2017 1 commit
    • Mark OLESEN's avatar
      ENH: add some standard templates and macros into stdFoam.H · c65e2e58
      Mark OLESEN authored
      - some functionality similar to what the standary library <iterator>
        * stdFoam::begin() and stdFoam::end() do type deduction,
          which means that many cases it is possible to manage these types
          of changes.
          For example, when managing a number of indices:
             Map<labelHashSet> lookup;
          1) Longhand:
                  Map<labelHashSet>::const_iterator iter = lookup.begin();
                  iter != lookup.end();
              { .... }
          1b) The same, but wrapped via a macro:
              forAllConstIter(Map<labelHashSet>, lookup, iter)
              { .... }
          2) Using stdFoam begin/end templates directly
                  auto iter = stdFoam::begin(lookup);
                  iter != stdFoam::end(lookup);
              { .... }
          2b) The same, but wrapped via a macro:
              forAllConstIters(lookup, iter)
              { .... }
      Note that in many cases it is possible to simply use a range-based for.
           labelList myList;
           for (auto val : myList)
           { ... }
           for (const auto& val : myList)
           { ... }
      These however will not work with any of the OpenFOAM hash-tables,
      since the standard C++ concept of an iterator would return a key,value
      pair when deferencing the *iter.
      The deduction methods also exhibits some slightly odd behaviour with
      some PtrLists (needs some more investigation).
  26. 27 Apr, 2017 1 commit
  27. 26 Apr, 2017 1 commit
  28. 10 Feb, 2017 1 commit
    • Mark Olesen's avatar
      ENH: support ASCII List output on a single-line · e3d9084c
      Mark Olesen authored
      - Introduce writeList(Ostream&, label) method in various List classes to
        provide more flexibility and avoid hard-coded limits when deciding if a
        list is too long and should be broken up into multiple lines (ASCII only).
      - The old hard-code limit (10) is retained in the operator<< versions
      - This functionality is wrapped in the FlatOutput output adapter class
        and directly accessible via the 'flatOutput()' function.
          #include "ListOps.H"
          Info<< "methods: " << flatOutput(myLongList) << endl;
          // OR
          Info<< "methods: ";
          myLongList.writeList(os) << endl;
  29. 08 Feb, 2017 2 commits
  30. 24 Jan, 2017 1 commit
  31. 20 Jan, 2017 1 commit
  32. 04 Oct, 2016 1 commit
    • Mark Olesen's avatar
      ENH: remove unneeded lines in List binary output (issue #256) · 8dc3bbe6
      Mark Olesen authored
      Writing an empty list in binary results in unnecessary newlines that
      make the output 'noisier'.
      Old output
  33. 01 Jul, 2016 2 commits
  34. 06 May, 2016 1 commit
  35. 03 Apr, 2016 1 commit
    • Henry Weller's avatar
      UList: Rationalize assignment (shallow-copy vs deep-copy) · 6e573ad7
      Henry Weller authored
          //- Disallow default shallow-copy assignment
          //  Assignment of UList<T> may need to be either shallow (copy pointer)
          //  or deep (copy elements) depending on context or the particular type
          //  of list derived from UList and it is confusing and prone to error
          //  for the default assignment to be either.  The solution is to
          //  disallow default assignment and provide separate 'shallowCopy' and
          //  'deepCopy' member functions.
          void operator=(const UList<T>&) = delete;
          //- Copy the pointer held by the given UList.
          inline void shallowCopy(const UList<T>&);
          //- Copy elements of the given UList.
          void deepCopy(const UList<T>&);