1. 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
      0a62fd2f
  2. 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();
            reserve(N);
      5c1ec7ec
  3. 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
  4. 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
        enforced.
      
        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)
          {
              range.setStart(start);
              start += range.size();
          }
      5d541def
  5. 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.
      
      Examples,
           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!
      805b76d4
  6. 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>
        provides.
      
        * 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:
      
              for
              (
                  Map<labelHashSet>::const_iterator iter = lookup.begin();
                  iter != lookup.end();
                  ++iter
              )
              { .... }
      
          1b) The same, but wrapped via a macro:
      
              forAllConstIter(Map<labelHashSet>, lookup, iter)
              { .... }
      
          2) Using stdFoam begin/end templates directly
      
              for
              (
                  auto iter = stdFoam::begin(lookup);
                  iter != stdFoam::end(lookup);
                  ++iter
              )
              { .... }
      
          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.
      Eg,
           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).
      c65e2e58
  7. 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.
      
      Eg,
          #include "ListOps.H"
          Info<< "methods: " << flatOutput(myLongList) << endl;
      
          // OR
      
          Info<< "methods: ";
          myLongList.writeList(os) << endl;
      e3d9084c
  8. 08 Feb, 2017 2 commits
  9. 20 Jan, 2017 1 commit
  10. 01 Jul, 2016 1 commit
  11. 06 May, 2016 1 commit
  12. 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>&);
      6e573ad7
  13. 22 Mar, 2016 1 commit
  14. 28 Feb, 2016 1 commit
  15. 29 Oct, 2015 1 commit
  16. 15 Dec, 2014 1 commit
  17. 01 May, 2013 2 commits
  18. 22 Feb, 2013 1 commit
  19. 12 Dec, 2012 1 commit
  20. 11 Dec, 2012 1 commit
  21. 14 Feb, 2012 1 commit
  22. 14 Aug, 2011 1 commit
  23. 08 Feb, 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. 10 Nov, 2010 2 commits
  29. 13 Oct, 2010 1 commit
  30. 28 Jul, 2010 1 commit
  31. 29 Mar, 2010 1 commit
  32. 14 Jan, 2010 1 commit
  33. 25 Nov, 2009 1 commit
    • Mark Olesen's avatar
      Lists get first() and last() member functions · b2d7439b
      Mark Olesen authored
      - this builds on Mattijs' commit 968f0bbd but with a first()
        as well.
      
      - Added both to FixedList, IndirectList, UIndirectList and *PtrList and
        since they can certainly be useful there. Did not add to BiIndirectList,
        since I'm not sure what it should mean there. Did not add to PackedList,
        since it's not clear how useful they'd be yet in these contexts (and I'm
        not sure how it would interact with the iterator proxy implementation).
      
      - Note: STL defines front() and back() for these methods.
      b2d7439b
  34. 23 Nov, 2009 1 commit
  35. 25 Jun, 2009 1 commit
  36. 22 Jun, 2009 1 commit