1. 05 Mar, 2018 1 commit
  2. 26 Feb, 2018 3 commits
    • Mark OLESEN's avatar
    • Mark OLESEN's avatar
      ENH: cleanup tmp class (issue #639) · 52b36f84
      Mark OLESEN authored
      Improve alignment of its behaviour with std::shared_ptr
        - element_type typedef
        - swap, reset methods
      * additional reference access methods:
          returns a const reference, synonymous with operator().
          This provides a more verbose alternative to using the '()' operator
          when that is desired.
              Mnemonic: a const form of 'ref()'
          returns a non-const reference, regardless if the underlying object
          itself is a managed pointer or a const object.
          This is similar to ref(), but more permissive.
              Mnemonic: const_cast<>
          Using the constCast() method greatly reduces the amount of typing
          and reading. And since the data type is already defined via the tmp
          template parameter, the type deduction is automatically known.
              const tmp<volScalarField>& tfld;
              volScalarField& fld = const_cast<volScalarField&>(tfld());
              auto& fld = tfld.constCast();
      BUG: attempts to move tmp value that may still be shared.
      - old code simply checked isTmp() to decide if the contents could be
        transfered. However, this means that the content of a shared tmp
        would be removed, leaving other instances without content.
      * movable() method checks that for a non-null temporary that is
        unique (not shared).
    • Mark OLESEN's avatar
      ENH: cleanup autoPtr class (issue #639) · 660f3e54
      Mark OLESEN authored
      Improve alignment of its behaviour with std::unique_ptr
        - element_type typedef
        - release() method - identical to ptr() method
        - get() method to get the pointer without checking and without releasing it.
        - operator*() for dereferencing
      Method name changes
        - renamed rawPtr() to get()
        - renamed rawRef() to ref(), removed unused const version.
      Removed methods/operators
        - assignment from a raw pointer was deleted (was rarely used).
          Can be convenient, but uncontrolled and potentially unsafe.
          Do allow assignment from a literal nullptr though, since this
          can never leak (and also corresponds to the unique_ptr API).
      Additional methods
        - clone() method: forwards to the clone() method of the underlying
          data object with argument forwarding.
        - reset(autoPtr&&) as an alternative to operator=(autoPtr&&)
      STYLE: avoid implicit conversion from autoPtr to object type in many places
      - existing implementation has the following:
           operator const T&() const { return operator*(); }
        which means that the following code works:
             autoPtr<mapPolyMesh> map = ...;
             updateMesh(*map);    // OK: explicit dereferencing
             updateMesh(map());   // OK: explicit dereferencing
             updateMesh(map);     // OK: implicit dereferencing
        for clarity it may preferable to avoid the implicit dereferencing
      - prefer operator* to operator() when deferenced a return value
        so it is clearer that a pointer is involve and not a function call
        etc    Eg,   return *meshPtr_;  vs.  return meshPtr_();
  3. 04 Mar, 2018 1 commit
    • Mark OLESEN's avatar
      ENH: improvements for labelRange · fc92d30e
      Mark OLESEN authored
      - constexpr, noexcept.
        Added an 'at()' method for returning an iterator within the range
        and changed operator()(label) to have behaviour as per found().
        This makes the labelRange usable as a unary predicate.
      - added templated conversion class 'toLabelRange'
      - add range() method to polyPatch and surfZone classes, and corresponding
        templated conversion functors.
        For example,
            auto patchDims = ListOps::create<labelRange>
        to create a List<labelRange> representing the patch extents.
  4. 06 Mar, 2018 1 commit
    • Mark OLESEN's avatar
      ENH: dedicated HashSetOps, HashTableOps namespaces · bcabe827
      Mark OLESEN authored
      - relocated HashSetPlusEqOp and HashTablePlusEqOp to
        HashSetOps::plusEqOp and HashTableOps::plusEqOp, respectively
      - additional functions for converting between a labelHashSet
        and a PackedBoolList or List<bool>:
        From lists selections to labelHashSet indices:
            HashSetOps::used(const PackedBoolList&);
            HashSetOps::used(const UList<bool>&);
        From labelHashSet to list forms:
            PackedBoolList bitset(const labelHashSet&);
            List<bool> bools(const labelHashSet&);
  5. 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()));
  6. 02 Mar, 2018 2 commits
  7. 03 Mar, 2018 1 commit
  8. 02 Mar, 2018 1 commit
    • Mark OLESEN's avatar
      ENH: cleanup, extend zero/one classes · 13ea73c3
      Mark OLESEN authored
      - constexpr, noexcept on various bits
      - addition of a 'one::minus' class that returns '-1' instead of '1'.
        There are no additional operations defined for this class,
        but it can be used in various places to signal alternative behaviour
        such as "initialize to a negative or other invalid value"
  9. 04 Mar, 2018 1 commit
    • Mark OLESEN's avatar
      ENH: pre-cleanup of Xfer class (issue #639) · b4703f4a
      Mark OLESEN authored
      - This class is largely a pre-C++11 holdover, prior to having movable
      - align internals with autoPtr instead of always unconditionally
        allocating memory. The valid() method can be used to check for a null
      - Consolidate into a single file, in anticipation of future removal.
  10. 28 Feb, 2018 1 commit
    • Mark OLESEN's avatar
      ENH: add Xfer rvalue(), valid() methods · 081783db
      Mark OLESEN authored
      - rvalue() is a (transitional) means of converting Xfer content to a
        reference for move construct, move assign semantics.
      - valid() method for consistency with autoPtr and tmp classes
  11. 27 Feb, 2018 1 commit
  12. 22 Feb, 2018 1 commit
  13. 28 Feb, 2018 2 commits
  14. 23 Feb, 2018 3 commits
  15. 22 Feb, 2018 6 commits
  16. 21 Feb, 2018 3 commits
  17. 20 Feb, 2018 7 commits
  18. 19 Feb, 2018 3 commits
  19. 21 Feb, 2018 1 commit