1. 18 Feb, 2020 8 commits
    • Mark Olesen's avatar
      ENH: support use of IOstreamOption for IFstream/OFstream · e3f681fa
      Mark Olesen authored
      - can be convenient to bundle IO options as a single parameter
      e3f681fa
    • Mark Olesen's avatar
      STYLE: use unique_ptr for Fstream resource management · f3106ec1
      Mark Olesen authored
      STYLE: change return type of NewOFstream from Ostream to OSstream
      f3106ec1
    • Mark Olesen's avatar
      ENH: support IOstreamOption in abstract stream types · 3135dcf2
      Mark Olesen authored
      - expose the write IOstreamOption in Time
      3135dcf2
    • Mark Olesen's avatar
      ENH: improvements to IOstreamOption · 33f9ae50
      Mark Olesen authored
      * Support default values for format/compress enum lookups.
      
        - Avoids situations where the preferred default format is not ASCII.
          For example, with dictionary input:
      
              format binar;
      
          The typing mistake would previously have caused formatEnum to
          default to ASCII. We can now properly control its behaviour.
      
              IOstream::formatEnum
              (
                  dict.get<word>("format"), IOstream::BINARY
              );
      
          Allowing us to switch ascii/binary, using BINARY by default even in
          the case of spelling mistakes. The mistakes are flagged, but the
          return value can be non-ASCII.
      
      * The format/compression lookup behave as pass-through if the lookup
        string is empty.
      
        - Allows the following to work without complaint
      
            IOstream::formatEnum
            (
                dict.getOrDefault("format", word::null), IOstream::BINARY
            );
      
        - Or use constructor-like failsafe method
      
            IOstream::formatEnum("format", dict, IOstream::BINARY);
      
        - Apply the same behaviour with setting stream format/compression
          from a word.
      
             is.format("binar");
      
          will emit a warning, but leave the stream format UNCHANGED
      
      * Rationalize versionNumber construction
      
        - constexpr constructors where possible.
          Default construct is the "currentVersion"
      
        - Construct from token to shift the burden to versionNumber.
          Support token as argument to version().
      
          Now:
      
              is.version(headerDict.get<token>("version"));
      
          or failsafe constructor method
      
              is.version
              (
                  IOstreamOption::versionNumber("version", headerDict)
              );
      
          Before (controlled input):
      
              is.version
              (
                  IOstreamOption::versionNumber
                  (
                      headerDict.get<float>("version")
                  )
              );
      
          Old, uncontrolled input - has been removed:
      
              is.version(headerDict.lookup("version"));
      
      * improve consistency, default behaviour for IOstreamOption construct
      
        - constexpr constructors where possible
      
        - add copy construct with change of format.
      
        - construct IOstreamOption from streamFormat is now non-explicit.
          This is a commonly expected result with no ill-effects
      33f9ae50
    • Mark Olesen's avatar
      ENH: adjustments to Switch · bb53e8ad
      Mark Olesen authored
      - align Switch more with Enum.
        Now have find(), found() static methods.
        Constructors with failsafe option.
      
        The find() method makes for clearer coding:
      
        OLD
      
           Switch sw(some_string, true); // NB: true = allowBad
      
           if (sw.valid()) ...
      
        NOW
      
           Switch sw = Switch::find(some_string);
      
           if (sw.good()) ...
      
        or
      
           if (Switch::found(some_string)) ...
      
      - improve construct from dictionary to handle all valid token types.
        Previously just read in a word.
      
      - Remove asText() method - replaced by c_str() and str() several
        versions ago.
      bb53e8ad
    • Mark Olesen's avatar
      STYLE: provide return value for IOstream::fatalCheck() · ed4bd548
      Mark Olesen authored
      - allows reuse as base implementation for IOstream::check()
      ed4bd548
    • Mark Olesen's avatar
      STYLE: remove "originalVersion" face handling · 2834193c
      Mark Olesen authored
      - an old pre-OpenFOAM transitional feature (prior to 2004)
        for named faces.
      2834193c
    • Mark Olesen's avatar
      d7969b1b
  2. 06 Feb, 2020 1 commit
  3. 03 Feb, 2020 1 commit
  4. 28 Jan, 2020 1 commit
  5. 23 Jan, 2020 1 commit
    • Mark Olesen's avatar
      ENH: stream adjustments · 0ff02713
      Mark Olesen authored
      - make stream constructors explicit
      
      - remove "using std::ifstream", "using std::iofstream" statements
        for a cleaner namespace.
      
      * copy/move assignments for ITstream
      
      * IStringStream: default construct and construct from std::string
        instead of Foam::string
      
      - reduce some overhead in masterOFstream
      
      - simplify Pstream handling of string variants (#1525)
      0ff02713
  6. 20 Jan, 2020 2 commits
  7. 17 Dec, 2019 2 commits
  8. 15 Dec, 2019 2 commits
  9. 11 Dec, 2019 1 commit
  10. 10 Dec, 2019 1 commit
  11. 06 Dec, 2019 1 commit
    • 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 ...
      9fd696e1
  12. 07 Dec, 2019 1 commit
  13. 31 Oct, 2019 1 commit
  14. 05 Nov, 2019 1 commit
  15. 25 Oct, 2019 1 commit
    • Mark Olesen's avatar
      ENH: add flexible command options for setting Debug and Info switches #1467 · da332229
      Mark Olesen authored
      For example,
      
         $ someSolver -info-switch writeOptionalEntries
      
      - note that values changed via the command-line are changed after the
        etc/controlDict entries, but *before* any case-local
        system/controlDict entries.
      
        However, in many testing cases the command-line options eliminate
        the need for such local file modifications.
      
      ENH: cleanup handling of local debug switches in Time
      
      - add as methods directly on simpleObjectRegistry to avoid code
        duplication
      
      STYLE: adjust internal naming of ITstream parameters
      da332229
  16. 23 Oct, 2019 1 commit
  17. 08 Oct, 2019 4 commits
  18. 24 Sep, 2019 1 commit
  19. 20 Aug, 2019 2 commits
    • Mark Olesen's avatar
      ENH: suppress IOerror newlines if file name is empty · 3f06722a
      Mark Olesen authored
      - compacter messages in some cases
      
      STYLE: simplify output handling of line numbers
      3f06722a
    • Mark Olesen's avatar
      ENH: minor improvements, cleanup of token class · c9cb4ce3
      Mark Olesen authored
      - relax casting rules
        * down-cast of labelToken to boolToken
        * up-cast of wordToken to stringToken.
          Can use isStringType() test for word or string types
      
      - simplify constructors, move construct etc.
      
      - expose reset() method as public, which resets to UNDEFINED and
        clears allocated storage etc.
      
      DEFEATURE: remove assign from word or string pointer.
      
      - This was deprecated 2017-11 and now removed.
        For this type of content transfer, move assignment should be used
        instead of stealing pointers.
      c9cb4ce3
  20. 14 Aug, 2019 1 commit
  21. 29 Jul, 2019 2 commits
    • Mark Olesen's avatar
      ENH: add readContiguous detail (#1378) · 39834d8f
      Mark Olesen authored
      - allows some internal handling for reading dissimilar storage types.
        Eg, scalars written as float (WM_SP), but read as double (WM_DP)
      
      - reading binary parcel coordinates with dissimilar storage types is
        still pending
      39834d8f
    • Mark Olesen's avatar
      ENH: additional contiguous traits (#1378) · 1d79c045
      Mark Olesen authored
      - change contiguous from a series of global functions to separate
        templated traits classes:
      
          - is_contiguous
          - is_contiguous_label
          - is_contiguous_scalar
      
        The static constexpr 'value' and a constexpr conversion operator
        allow use in template expressions.  The change also makes it much
        easier to define general traits and to inherit from them.
      
        The is_contiguous_label and is_contiguous_scalar are special traits
        for handling data of homogeneous components of the respective types.
      1d79c045
  22. 07 Aug, 2019 1 commit
  23. 29 Jul, 2019 1 commit
  24. 31 Jul, 2019 2 commits
    • Mark Olesen's avatar
      ENH: make OSstream indentation adjustable · 8b3d77ba
      Mark Olesen authored
      - this is principally for cases where reduced indentation is desired,
        such as when streaming to a memory location. If the indentation size
        is zero or one, only a single space will be used to separate the
        key/value.
      
        This change does not affect the stream allocation size, since the
        extra data falls within the padding.
      
      ENH: relocate label/scalar sizes from Istream to IOstream.
      
      - could allow future use for output streams as well?
      
        Due to padding, reorganization has no effect on allocated size
        of output streams.
      
      STYLE: add read/write name qualifier to beginRaw, endRaw
      
      - removes ambiguity for bi-directional streams
      
      STYLE: fix inconsistent 'const' qualifier on std::streamsize
      
      - base Ostream was without const, some derived streams with const
      8b3d77ba
    • Mark Olesen's avatar
      ENH: add OListStream::swap(DynamicList<char>&) · 6f8da834
      Mark Olesen authored
      - allows full recovery of allocated space, not just addressable range.
      
        This can be particularly useful for code patterns that repeatedly
        reuse the same buffer space. For example,
      
            DynamicList<char> buf(1024);
      
            // some loop
            {
                OListStream os(std::move(buf));
                os << ...
      
                os.swap(buf);
            }
      
         Can read back from this buffer as a second operation:
      
            {
                UIListStream is(buf);
                is >> ...
            }
      6f8da834