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. 06 Aug, 2018 1 commit
  4. 02 Aug, 2018 1 commit
  5. 01 Aug, 2018 2 commits
  6. 27 Jul, 2018 1 commit
  7. 30 May, 2018 2 commits
  8. 29 May, 2018 1 commit
  9. 27 Apr, 2018 1 commit
    • Mark OLESEN's avatar
      ENH: ListOp::inplaceMapValue using a Map<label> for the mapping. · 10b69fa2
      Mark OLESEN authored
      For example, with some HashTable or Map container of models
          { model0 => 1, model1 => 4, model2 => 5, model3 => 12, model4 => 15, }
      specify the remapping
          Map<label> mapper({{1, 3}, {2, 6}, {3, 12}, {5, 8}});
      inplaceMapValue(mapper, models) then yields
          { model0 => 3, model1 => 4, model2 => 8, model3 => 12, model4 => 15, }
      ENH: extend bitSet::count() to optionally count unset bits instead.
      ENH: BitOps compatibility methods for boolList.
      - These ease coding that uses a boolList instead of bitSet and use
        short-circuit logic when possible.
        Eg, when 'bitset' and 'bools' contain the same information
            bitset.count()  <->  BitOps::count(bools)
            bitset.all()    <->  BitOps::all(bools)
            bitset.any()    <->  BitOps::any(bools)
            bitset.none()   <->  BitOps::none(bools)
        These methods can then be used directly in parameters or in logic.
            returnReduce(bitset.any(), orOp<bool>());
            returnReduce(BitOps::any(bools), orOp<bool>());
            if (BitOps::any(bools)) ...
  10. 28 Mar, 2018 1 commit
  11. 11 Apr, 2018 1 commit
  12. 22 Mar, 2018 1 commit
  13. 19 Mar, 2018 1 commit
  14. 15 Mar, 2018 1 commit
  15. 13 Mar, 2018 1 commit
    • Mark OLESEN's avatar
      ENH: code reduction in PackedList, PackedBoolList (issue #751) · 5d1fb235
      Mark OLESEN authored
      - eliminate iterators from PackedList since they were unused, had
        lower performance than direct access and added unneeded complexity.
      - eliminate auto-vivify for the PackedList '[] operator.
        The set() method provides any required auto-vivification and
        removing this ability from the '[]' operator allows for a lower
        when accessing the values. Replaced the previous cascade of iterators
        with simpler reference class.
      - (temporarily) eliminate logic and addition operators since
        these contained partially unclear semantics.
      - the new test() method tests the value of a single bit position and
        returns a bool without any ambiguity caused by the return type
        (like the get() method), nor the const/non-const access (like
        operator[] has). The name corresponds to what std::bitset uses.
      - more consistent use of PackedBoolList test(), set(), unset() methods
        for fewer operation and clearer code. Eg,
            if (list.test(index)) ...    |  if (list[index]) ...
            if (!list.test(index)) ...   |  if (list[index] == 0u) ...
            list.set(index);             |  list[index] = 1u;
            list.unset(index);           |  list[index] = 0u;
      - deleted the operator=(const labelUList&) and replaced with a setMany()
        method for more clarity about the intended operation and to avoid any
        potential inadvertent behaviour.
  16. 07 Mar, 2018 2 commits
    • Mark OLESEN's avatar
      ENH: provide iterators for IndirectList, UIndirectList · 23b6ea4b
      Mark OLESEN authored
      - consistency with other containers.
        Allows range-for, enables various std algorithms, and can be used
        with ListOp::create() with an iterator range.
    • Mark OLESEN's avatar
      ENH: new bitSet class and improved PackedList class (closes #751) · bac943e6
      Mark OLESEN authored
      - The bitSet class replaces the old PackedBoolList class.
        The redesign provides better block-wise access and reduced method
        calls. This helps both in cases where the bitSet may be relatively
        sparse, and in cases where advantage of contiguous operations can be
        made. This makes it easier to work with a bitSet as top-level object.
        In addition to the previously available count() method to determine
        if a bitSet is being used, now have simpler queries:
          - all()  - true if all bits in the addressable range are empty
          - any()  - true if any bits are set at all.
          - none() - true if no bits are set.
        These are faster than count() and allow early termination.
        The new test() method tests the value of a single bit position and
        returns a bool without any ambiguity caused by the return type
        (like the get() method), nor the const/non-const access (like
        operator[] has). The name corresponds to what std::bitset uses.
        The new find_first(), find_last(), find_next() methods provide a faster
        means of searching for bits that are set.
        This can be especially useful when using a bitSet to control an
        OLD (with macro):
            forAll(selected, celli)
                if (selected[celli])
                    sumVol += mesh_.cellVolumes()[celli];
        NEW (with const_iterator):
            for (const label celli : selected)
                sumVol += mesh_.cellVolumes()[celli];
            or manually
                label celli = selected.find_first();
                celli != -1;
                celli = selected.find_next()
                sumVol += mesh_.cellVolumes()[celli];
      - When marking up contiguous parts of a bitset, an interval can be
        represented more efficiently as a labelRange of start/size.
        For example,
            if (isA<processorPolyPatch>(pp))
                forAll(pp, i)
            if (isA<processorPolyPatch>(pp))
  17. 05 Mar, 2018 1 commit
  18. 26 Feb, 2018 1 commit
  19. 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()));
  20. 22 Feb, 2018 1 commit
  21. 28 Feb, 2018 2 commits
  22. 22 Feb, 2018 1 commit
    • Mark OLESEN's avatar
      STYLE: remove deprecated and unused ListOps · 3a4b92c4
      Mark OLESEN authored
      - deprecated MAR-2017
          subset(const UList<T>& select, const T& value, const ListType&);
          inplaceSubset(const UList<T>& select, const T& value, ListType&);
        The subsetList/inplaceSubsetList variants with a unary predicate
        provide more flexible and robuster solutions.
      - deprecated MAR-2017
          initList(const T[mRows]);
          initListList(const T[mRows][nColumns]);
        Required prior to the addition of constructors with
  23. 21 Feb, 2018 2 commits
  24. 09 Feb, 2018 1 commit
    • Mark OLESEN's avatar
      STYLE: simplify hashing to use struct instead of class · 3e3c9739
      Mark OLESEN authored
      - more consistent with STL practices for function classes.
      - string::hash function class now operates on std::string rather
        than Foam::string since we have now avoided inadvertent use of
        string conversion from int in more places.
  25. 08 Feb, 2018 1 commit
    • Mark OLESEN's avatar
      ENH: cleanup List constructors (issue #725) · e42c2281
      Mark OLESEN authored
      - add copy construct from UList
      - remove copy construct from dissimilar types.
        This templated constructor was too generous in what it accepted.
        For the special cases where a copy constructor is required with
        a change in the data type, now use the createList factory method,
        which accepts a unary operator. Eg,
            auto scalars = scalarList::createList
                [](const label& val){ return 1.5*val; }
  26. 26 Jan, 2018 2 commits
  27. 25 Jan, 2018 2 commits
    • Mark OLESEN's avatar
      ENH: improved swap/transfer methods for FixedList · d029f4c5
      Mark OLESEN authored
      - the transfer method was previously a copy
      - use std::reverse_iterator adaptors in FixedList
        This greatly reduces the amount of code and now avoids the array-bounds
        warning for FixedList::rend()
      - use pointer arithmetic instead of dereferencing the internal array
    • Mark OLESEN's avatar
      ENH: allow early completion in PackedBoolList::used() · 7ee93afe
      Mark OLESEN authored
      - can stop producing content when the target number of entries has
        been reached.
      - change return type to labelList instead an Xfer container.
        This allows return-value-optimization and avoids a surrounding
        allocation. This potentially breaks existing code.
      - make PackedList and PackedBoolList moveable. Drop xfer wrappers.
  28. 09 Jan, 2018 1 commit
  29. 04 Jan, 2018 1 commit
  30. 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
  31. 09 Nov, 2017 1 commit
  32. 05 Nov, 2017 1 commit
  33. 02 Jul, 2018 1 commit
    • Mark OLESEN's avatar
      ENH: improve controls for Time (issue #910) · 2662042d
      Mark OLESEN authored
      - relocate some standard functionality to TimePaths to allow a lighter
        means of managing time directories without using the entire Time
      - optional enableLibs for Time construction (default is on)
        and a corresponding argList::noLibs() and "-no-libs" option
      - mark Time::outputTime() as deprecated MAY-2016
      - use pre-increment for runTime, although there is no difference in
        behaviour or performance.