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 1 commit
  10. 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.
  11. 04 Nov, 2017 2 commits
  12. 19 Nov, 2017 1 commit
  13. 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.
  14. 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
  15. 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();
  16. 24 Oct, 2017 1 commit
  17. 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
  18. 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();
  19. 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!
  20. 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).
  21. 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;
  22. 08 Feb, 2017 2 commits
  23. 20 Jan, 2017 1 commit
  24. 01 Jul, 2016 1 commit
  25. 06 May, 2016 1 commit
  26. 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>&);
  27. 22 Mar, 2016 1 commit
  28. 28 Feb, 2016 1 commit
  29. 29 Oct, 2015 1 commit
  30. 15 Dec, 2014 1 commit
  31. 01 May, 2013 2 commits
  32. 22 Feb, 2013 1 commit
  33. 12 Dec, 2012 1 commit
  34. 11 Dec, 2012 1 commit
  35. 14 Feb, 2012 1 commit
  36. 14 Aug, 2011 1 commit
  37. 08 Feb, 2011 1 commit