1. 14 Mar, 2018 1 commit
  2. 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.
      
      PackedBoolList:
      
      - (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.
      5d1fb235
  3. 07 Mar, 2018 1 commit
  4. 15 Mar, 2018 1 commit
    • Mark Olesen's avatar
      ENH: reduce overhead for clockTime, cpuTime · 77338c8b
      Mark Olesen authored
      - clockValue class for managing the clock values only, with a null
        constructor that does not query the system clock (can defer to later).
        Can also be used directly for +/- operations.
      
      - refactor clockTime, cpuTime, clock to reduce storage.
      77338c8b
  5. 14 Mar, 2018 2 commits
  6. 16 Mar, 2018 2 commits
  7. 23 Feb, 2018 2 commits
  8. 15 Mar, 2018 5 commits
  9. 14 Mar, 2018 4 commits
  10. 12 Mar, 2018 2 commits
  11. 08 Mar, 2018 3 commits
  12. 21 Feb, 2018 1 commit
  13. 07 Mar, 2018 3 commits
  14. 06 Mar, 2018 1 commit
  15. 05 Mar, 2018 2 commits
  16. 28 Feb, 2018 4 commits
  17. 27 Feb, 2018 1 commit
  18. 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:
      
      cref()
          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()'
      
      constCast()
          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.
      
          Previously,
      
              const tmp<volScalarField>& tfld;
      
              const_cast<volScalarField&>(tfld()).rename("name");
              volScalarField& fld = const_cast<volScalarField&>(tfld());
      
          Now,
      
              tfld.constCast().rename("name");
              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).
      52b36f84
    • 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_();
      660f3e54
  19. 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>
            (
                mesh.boundaryMesh(),
                toLabelRange<polyPatch>()
            );
      
        to create a List<labelRange> representing the patch extents.
      fc92d30e