Skip to content
Snippets Groups Projects
  1. Oct 29, 2021
    • Mark OLESEN's avatar
      ENH: additional 'nocopy' methods for List resize/reserve methods · b8a4b7e8
      Mark OLESEN authored
      - the size of a List often requires adjustment prior to an operation,
        but old values (if any) are not of interest and will be overwritten.
      
        In these cases can use the _nocopy versions to avoid additional memory
        overhead of the intermediate list and the copy/move overhead of
        retaining the old values (that we will subsequently discard anyhow).
      
        No equivalent for PtrList/UPtrList - this would be too fragile.
      
      - add swap DynamicField with DynamicList
      
      BUG: fixed Dynamic{Field,List} setCapacity corner case
      
      - for the case when the newly requested capacity coincides with the
        current addressable size, the resize of the underlying list would have
        been bypassed - ie, the real capacity was not actually changed.
      
      - remove (unused) PtrDynList setCapacity method as too fragile
      b8a4b7e8
  2. Apr 27, 2021
  3. Apr 19, 2021
  4. Jan 26, 2021
    • Mark OLESEN's avatar
      ENH: rename protected UList size(label) -> setAddressableSize(label) · 2c7e95d2
      Mark OLESEN authored
      - modification/continuation of 8d63073b and 5c1ec7ec (#595).
      
        Although this protected function is only used internally, the name
        `size(label)` is too easily confused with `resize(label)` and
        `setSize(label)`. The longer method name eliminates some ambiguity.
        Name consistent with PtrListDetail.
      
      - leave size(label) method (for possible compatibility),
        but mark as deprecated
      
      - improve sizing consistency for (Istream >> DynamicList)
      
      STYLE: more consistent use of resize vs setSize in DynamicList
      
      - more consistency between DynamicList and DynamicField.
        There were some inconsistencies in how construct with a size was
        interpreted.
      
      STYLE: more consistent declaration/use of Swap
      2c7e95d2
  5. Nov 19, 2020
    • Mark OLESEN's avatar
      STYLE: prefix zero/one with Foam:: qualifier · 98d05fa8
      Mark OLESEN authored
      ENH: support construction of zero-sized IndirectList
      
      - useful when addressing is to be generated in-place after construction.
        Eg,
      
            indirectPrimitivePatch myPatches
            (
                IndirectList<face>(mesh.faces(), Zero),
                mesh.points()
            );
            labelList& patchFaces = myPatches.addressing();
      
            patchFaces.resize(...);
            // populate patchFaces
      
      STYLE: add noexcept for zero/one fields and remove old dependency files
      
      COMP: correct typedefs for geometricOneField, geometricZeroField
      98d05fa8
  6. Dec 10, 2019
  7. Dec 06, 2019
    • Mark OLESEN's avatar
      ENH: add ITstream append and seek methods. · 9fd696e1
      Mark OLESEN authored
      - ITstream append() would previously have used the append from the
        underlying tokenList, which leaves the tokenIndex untouched and
        renders the freshly appended tokens effectively invisible if
        interspersed with primitiveEntry::read() that itself uses tokenIndex
        when building the list.
      
        The new append() method makes this hidden ITstream bi-directionality
        easier to manage. For efficiency, we only append lists
        (not individual tokens) and support a 'lazy' resizing that allows
        the final resizing to occur later when all tokens have been appended.
      
      - The new ITstream seek() method provides a conveniently means to move
        to the end of the list or reposition to the middle.
        Using rewind() and using seek(0) are identical.
      
      ENH: added OTstream to output directly to a list of tokens
      
      ---
      
      BUG: List::newElem resized incorrectly
      
      - had a simple doubling of the List size without checking that this
        would indeed be sufficient for the requested index.
      
        Bug was not triggered since primitiveEntry was the only class using
        this call, and it added the tokens sequentially.
      9fd696e1
  8. Oct 31, 2019
  9. Nov 05, 2019
  10. Apr 11, 2019
    • Mark OLESEN's avatar
      ENH: generalize indirect lists and support new types · 765493b6
      Mark OLESEN authored
      - use an IndirectListBase class for various indirect list types.
      
      - new SortList type
      
        In some places the SortList can be used as a lightweight alternative
        to SortableList to have the convenience of bundling data and sort
        indices together, but while operating on existing data lists.
        In other situations, it can be useful as an alternative to
        sortedOrder.  For example,
      
              pointField points = ...;
      
              labelList order;
              sortedOrder(points, order);
      
              forAll(order, i)
              {
                  points[order[i]] = ...;
              }
      
         Can be replaced with the following (with the same memory overhead)
      
              pointField points = ...;
      
              SortList<point> sortedPoints(points);
      
              for (point& pt : sortedPoints)
              {
                  pt = ...;
              }
      
      - new SliceList type (#1220), which can be used for stride-based
        addressing into existing lists
      765493b6
  11. Feb 06, 2019
  12. Jul 27, 2018
  13. Mar 05, 2018
  14. Feb 26, 2018
  15. Mar 01, 2018
    • 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()));
      15f72608
  16. Feb 08, 2018
    • 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
            (
                labels,
                [](const label& val){ return 1.5*val; }
            );
      e42c2281
  17. Nov 05, 2017
  18. Oct 25, 2017
    • 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
  19. Sep 20, 2017
    • 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
  20. May 14, 2017
    • Mark OLESEN's avatar
      ENH: avoid std::distance for std::initializer_list · 0c53a815
      Mark OLESEN authored
      - std::initializer_list has its own size() method, so no need to use
        std::distance.
      
      STYLE/BUG: use separate iterator de-reference and increment in List
      
      - avoids unnecessary copying of iterators, and avoids any potentially
        odd behaviour with the combination with incrementing.
      
      ENH: support construct from iterator pair for DynamicList, SortableList
      0c53a815
  21. Aug 09, 2016
  22. Mar 22, 2016
  23. Jan 10, 2016
  24. Nov 08, 2015
  25. Dec 15, 2014
  26. Aug 14, 2011
  27. Jan 19, 2011
  28. Jan 14, 2011
  29. Jan 07, 2011
  30. Jan 05, 2011
  31. Jun 07, 2010
  32. Mar 29, 2010
  33. Jan 15, 2010
  34. Apr 27, 2009
  35. Jan 20, 2009
  36. Jan 16, 2009
    • Mark Olesen's avatar
      consistency update for null pointers · 246d569c
      Mark Olesen authored
      - uniform use of reinterpret_cast<foo*>(0) instead of
        reinterpret_cast<foo*>(NULL)
      
      - make all static null() members inline since they are really only a cast:
            "*reinterpret_cast<foo*>(0)"
      246d569c
  37. Jan 05, 2009
    • Mark Olesen's avatar
      rename xfer<T> class to Xfer<T> · 19503c93
      Mark Olesen authored
      - The capitalization is consistent with most other template classes, but
        more importantly frees up xfer() for use as method name without needing
        special treatment to avoid ambiguities.
      
        It seems reasonable to have different names for transfer(...) and xfer()
        methods, since the transfer is occuring in different directions.
        The xfer() method can thus replace the recently introduced zero-parameter
        transfer() methods.
        Other name candidates (eg, yield, release, etc.) were deemed too abstract.
      19503c93
  38. Jan 02, 2009
    • Mark Olesen's avatar
      added xfer<...> transfer() method to various containers · cf488912
      Mark Olesen authored
      - this should provide a slightly more naturally means to using transfer
        constructors, for example
                labelList list2(list1.transfer());
            vs. labelList list2(xferMove(list1));
      
      - returns a plain list where appropriate (eg, DynamicList, SortableList)
        for example
                labelList list2(dynList1.transfer());
            vs. labelList list2(xferMoveTo<labelList>(dynList1));
      cf488912