1. 18 Feb, 2020 9 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
      4e1bc2d2
    • Mark Olesen's avatar
      d7969b1b
  2. 06 Feb, 2020 1 commit
  3. 03 Feb, 2020 1 commit
  4. 31 Jan, 2020 1 commit
  5. 28 Jan, 2020 1 commit
  6. 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
  7. 20 Jan, 2020 2 commits
  8. 09 Jan, 2020 1 commit
  9. 13 Jan, 2020 3 commits
    • Mark Olesen's avatar
      ENH: regIOobject store() now also registers the object · b0072bfa
      Mark Olesen authored
      - previously the store() method just set the ownedByRegistry flag.
        Now ensure that it is indeed registered first.
      
      - support register/store of tmp<> items.
        The tmp parameter is not cleared, but changed from PTR to CREF
        to allow further use.
      
        The implicit registration allows code simplification using the
        GeometricField::New factory method, for example.
      
        Old Code
        ========
            volScalarField* ptr = new volScalarField
            (
                IOobject
                (
                    fieldName,
                    mesh.time().timeName(),
                    mesh,
                    IOobject::NO_READ,
                    IOobject::NO_WRITE,
                    true  // Register
                ),
                mesh,
                dimless,
                zeroGradientFvPatchField<scalar>::typeName
            );
            ptr->store();
      
        New Code
        ========
            auto tptr = volScalarField::New
            (
                fieldName,
                mesh,
                dimless,
                zeroGradientFvPatchField<scalar>::typeName
            );
            regIOobject::store(tptr);
      
        or even
            regIOobject::store
            (
                volScalarField::New
                (
                    fieldName,
                    mesh,
                    dimless,
                    zeroGradientFvPatchField<scalar>::typeName
                )
            );
      b0072bfa
    • mattijs's avatar
      12bd4567
    • mattijs's avatar
      BUG: collated: correctly handle ascii writing. See #1545. · b1a866c3
      mattijs authored
      The collated container ('decomposedBlockData') is always binary
      but the 'payload' might be ascii so use that header information
      instead of the decomposeBlockData header.
      b1a866c3
  10. 09 Jan, 2020 1 commit
  11. 17 Dec, 2019 2 commits
  12. 16 Dec, 2019 2 commits
  13. 15 Dec, 2019 2 commits
  14. 13 Dec, 2019 3 commits
  15. 12 Dec, 2019 2 commits
    • Andrew Heather's avatar
      ff995c5d
    • Mark Olesen's avatar
      ENH: update handling of "writeTime" in timeControl class · 280be631
      Mark Olesen authored
      - handle zero or negative values as being identical to 1.
        As per timeStep control and what the comments suggested.
      
      - drop old outputTime enumeration, since this is covered by the
        writeTime enumeration and a corresponding Enum name.
      
      - support construction of a "pass-through" control object that always
        executes and add some method to test for these conditions and be able
        to output some meaning full information.
        Eg,
      
           if (ctrl.execute())
           {
               if (!ctrl.always())
               {
                   Info<< "Sampling executed based on " << ctrl.type() << nl;
               }
               ...
           }
      
           To produce "Sampling executed based on runTime"
      280be631
  16. 11 Dec, 2019 1 commit
  17. 10 Dec, 2019 1 commit
  18. 09 Dec, 2019 1 commit
    • Mark Olesen's avatar
      ENH: generalize string expression evaluation · c2123452
      Mark Olesen authored
      - replace stringOps::toScalar with a more generic stringOps::evaluate
        method that handles scalars, vectors etc.
      
      - improve #eval to handle various mathematical operations.
        Previously only handled scalars. Now produce vectors, tensors etc
        for the entries. These tokens are streamed directly into the entry.
      c2123452
  19. 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
  20. 07 Dec, 2019 1 commit
  21. 27 Nov, 2019 1 commit
  22. 26 Nov, 2019 1 commit
  23. 20 Nov, 2019 1 commit