1. 30 Jul, 2018 1 commit
  2. 22 Jun, 2018 1 commit
  3. 13 Jun, 2018 1 commit
  4. 07 Jun, 2018 1 commit
  5. 04 Jun, 2018 1 commit
  6. 01 Jun, 2018 1 commit
    • Mark Olesen's avatar
      ENH: improve infrastructure for detecting excess tokens (issue #762) · 511b3562
      Mark Olesen authored
      - Always used for optional dictionary entries, since these are individual
        values, and not meant to be embedded in a larger stream of tokens.
      
        Methods:
           - lookupOrDefault, lookupOrAddDefault, lookupOrDefaultCompat
           - readIfPresent, readIfPresentCompat
      
      - Handling mandatory dictionary entries is slightly more complex,
        since these may be part of larger stream of tokens, and are often
        used in a constructor context. For example,
      
            word modelType(dict.lookup("type"));
      
        Or they are used without a definite context. For example,
      
            dict.lookup("format") >> outputFormat;
      
        Newly introduced methods for mandatory dictionary entries:
           - get, getCompat
           - read, readCompat
      
        In a constructor or assignment context:
      
            word modelType(dict.get<word>("type"));
            outputFormat = dict.lookup("format");
      
        without copy/move (similar to readIfPresent):
      
            dict.read("format", outputFormat);
      511b3562
  7. 30 May, 2018 2 commits
  8. 16 May, 2018 1 commit
  9. 08 May, 2018 1 commit
  10. 05 Mar, 2018 1 commit
    • Mark Olesen's avatar
      STYLE: use direct iteration for HashSet · 4fe8ed82
      Mark Olesen authored
      - The iterator for a HashSet dereferences directly to its key.
      
      - Eg,
      
            for (const label patchi : patchSet)
            {
                ...
            }
        vs.
            forAllConstIter(labelHashSet, patchSet, iter)
            {
                const label patchi = iter.key();
                ...
            }
      4fe8ed82
  11. 27 Apr, 2018 1 commit
  12. 24 Apr, 2018 2 commits
  13. 28 Mar, 2018 1 commit
  14. 16 Apr, 2018 1 commit
    • Mark Olesen's avatar
      ENH: add alternative STL ASCII parsers · ea71484e
      Mark Olesen authored
      - In addition to the traditional Flex-based parser, added a Ragel-based
        parser and a handwritten one.
      
        Some representative timings for reading 5874387 points (1958129 tris):
      
            Flex   Ragel   Manual
            5.2s   4.8s    6.7s         total reading time
            3.8s   3.4s    5.3s         without point merging
      ea71484e
  15. 13 Apr, 2018 1 commit
  16. 11 Apr, 2018 2 commits
  17. 09 Apr, 2018 1 commit
  18. 10 Apr, 2018 1 commit
    • Mark Olesen's avatar
      ENH: additional text expansion shortcuts (issue #792) · a9741cea
      Mark Olesen authored
      Support the following expansions when they occur at the start of a
      string:
      
          Short-form       Equivalent
          =========       ===========
            <etc>/          ~OpenFOAM/   (as per foamEtcFile)
            <case>/         $FOAM_CASE/
            <constant>/     $FOAM_CASE/constant/
            <system>/       $FOAM_CASE/system/
      
      These can be used in fileName expansions to improve clarity and reduce
      some typing
      
           "<constant>/reactions"   vs  "$FOAM_CASE/constant/reactions"
      a9741cea
  19. 09 Apr, 2018 1 commit
    • Mark Olesen's avatar
      ENH: provide Rand48 as generator in the expected C++11 form · b85d0b5c
      Mark Olesen authored
      - this removes an OS-specific dependency (eg, drand48_r is not POSIX)
        and allows easier use of other random number generators.
      
        The Rand48 generator has identical behaviour and period as the
        lrand48() library routine, but holds its own seed and state
        (which makes it re-entrant) and can be combined with other
        random distributions.
      
        However, when using the modified form to obtain scalar values
        they will not be identical to what drand48() yields.
      
        This is because drand48() uses the raw 48-bit values to directly
        set the mantissa of an IEEE double where as the newer distribution
        normalizes based on the 32-bit value.
      
      STYLE: simplify code in Random::shuffle and use Swap
      b85d0b5c
  20. 03 Apr, 2018 1 commit
  21. 26 Mar, 2018 1 commit
    • Mark Olesen's avatar
      STYLE: consistent lookupOrDefault template parameters · 36719bf5
      Mark Olesen authored
      - in many cases can just use lookupOrDefault("key", bool) instead of
        lookupOrDefault<bool> or lookupOrDefault<Switch> since reading a
        bool from an Istream uses the Switch(Istream&) anyhow
      
      STYLE: relocated Switch string names into file-local scope
      36719bf5
  22. 22 Mar, 2018 1 commit
  23. 21 Mar, 2018 1 commit
  24. 14 Mar, 2018 2 commits
  25. 05 Mar, 2018 1 commit
  26. 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
  27. 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
  28. 03 Mar, 2018 1 commit
  29. 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"
      13ea73c3
  30. 22 Feb, 2018 1 commit
    • Mark Olesen's avatar
      ENH: prevent conversion of string to regExp in stringListOps (closes #739) · ec38e7a4
      Mark Olesen authored
      * For most cases, this conversion would be largely unintentional
        and also less efficient. If the regex is desirable, the caller
        should invoke it explicitly.
        For example,
      
            findStrings(regExp(str), listOfStrings);
      
        Or use one of the keyType, wordRe, wordRes variants instead.
        If string is to be used as a plain (non-regex) matcher,
        this can be directly invoked
      
            findMatchingStrings(str, listOfStrings);
      
        or using the ListOps instead:
      
            findIndices(listOfStrings, str);
      
      * provide function interfaces for keyType.
      ec38e7a4
  31. 21 Feb, 2018 2 commits
  32. 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.
      3e3c9739
  33. 08 Feb, 2018 1 commit