Skip to content
Snippets Groups Projects
  1. Mar 15, 2018
  2. Mar 14, 2018
  3. Mar 13, 2018
    • 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
  4. Mar 07, 2018
  5. Mar 15, 2018
    • 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
  6. Mar 14, 2018
  7. Mar 16, 2018
  8. Feb 23, 2018
  9. Mar 15, 2018
  10. Mar 14, 2018
  11. Mar 12, 2018
  12. Mar 08, 2018
  13. Feb 21, 2018
  14. Mar 07, 2018
  15. Mar 06, 2018
  16. Mar 05, 2018
  17. Feb 28, 2018
  18. Feb 27, 2018
  19. Feb 26, 2018
    • 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,
      
          ...
      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