1. 27 Apr, 2020 1 commit
  2. 19 Feb, 2020 2 commits
  3. 18 Feb, 2020 1 commit
    • 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 th...
      33f9ae50
  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. 13 Jan, 2020 1 commit
  7. 09 Jan, 2020 1 commit
  8. 31 Oct, 2019 1 commit
  9. 05 Nov, 2019 1 commit
  10. 06 Feb, 2019 1 commit
  11. 10 Jan, 2019 1 commit
  12. 11 Dec, 2018 1 commit
    • Mark Olesen's avatar
      ENH: use Zero when zero-initializing types · 1d85fecf
      Mark Olesen authored
      - makes the intent clearer and avoids the need for additional
        constructor casting. Eg,
      
            labelList(10, Zero)    vs.  labelList(10, 0)
            scalarField(10, Zero)  vs.  scalarField(10, scalar(0))
            vectorField(10, Zero)  vs.  vectorField(10, vector::zero)
      1d85fecf
  13. 22 Nov, 2018 1 commit
    • Mark Olesen's avatar
      ENH: isolate version information in foamVersion names instead of globals · 083e9e96
      Mark Olesen authored
      - For compatibility, access to the old global names is provided via
        macros
              #define FOAMversion     foamVersion::version
              #define FOAMbuild       foamVersion::build
              #define FOAMbuildArch   foamVersion::buildArch
      
      - this isolation makes it easier to provide additional scoped methods
        for dealing with version related information.  Eg, printBuildInfo()
      083e9e96
  14. 06 Nov, 2018 1 commit
  15. 30 Jul, 2018 1 commit
  16. 24 Jul, 2018 1 commit
  17. 14 Jun, 2018 1 commit
    • Will Bainbridge's avatar
      twoPhaseMixtureThermo: Fix for collated file operation · 70bc72c2
      Will Bainbridge authored
      twoPhaseMixtureThermo writes the temperatures during construction only
      for them to be read again immediately after by construction of the
      individual phases' thermo models. When running with collated file
      handling this behaviour is not thread safe. This change deactivates
      threading for the duration of this behaviour.
      
      Patch contributed by Mattijs Janssens
      70bc72c2
  18. 12 Apr, 2018 1 commit
    • Mark Olesen's avatar
      STYLE: reorder/refactor stream format options · 4cf932b2
      Mark Olesen authored
      - IOstreamOption class to encapsulate format, compression, version.
        This is ordered to avoid internal padding in the structure, which
        reduces several bytes of memory overhead for stream objects
        and other things using this combination of data.
      
        Byte-sizes:
            old  IOstream:48  PstreamBuffers:88  Time:928
            new  IOstream:24  PstreamBuffers:72  Time:904
      
      ====
      
      STYLE: remove support for deprecated uncompressed/compressed selectors
      
      In older versions, the system/controlDict used these types of
      specifications:
      
          writeCompression uncompressed;
          writeCompression compressed;
      
      As of DEC-2009, these were deprecated in favour of using normal switch
      names:
      
          writeCompression true;
          writeCompression false;
          writeCompression on;
          writeCompression off;
      
      Now removed these deprecated names and treat like any other unknown
      input and issue a warning. Eg,
      
         Unknown compression specifier 'compressed', assuming no compression
      
      ====
      
      STYLE: provide Enum of stream format names (ascii, binary)
      
      ====
      
      COMP: fixed incorrect IFstream construct in FIREMeshReader
      
      - spurious bool argument (presumably meant as uncompressed) was being
        implicitly converted to a versionNumber. Now caught by making
        IOstreamOption::versionNumber constructor explicit.
      
      - bad version specifier in changeDictionary
      4cf932b2
  19. 05 Mar, 2018 1 commit
  20. 27 Feb, 2018 1 commit
  21. 26 Feb, 2018 1 commit
    • 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 c...
      660f3e54
  22. 11 Dec, 2017 1 commit
  23. 27 Oct, 2017 1 commit
  24. 22 Sep, 2017 1 commit
  25. 21 Mar, 2018 1 commit
    • Henry Weller's avatar
      ENH: Improvements to the fileHandler and collated IO · 8959b8e0
      Henry Weller authored
      Improvements to existing functionality
      --------------------------------------
        - MPI is initialised without thread support if it is not needed e.g. uncollated
        - Use native c++11 threading; avoids problem with static destruction order.
        - etc/cellModels now only read if needed.
        - etc/controlDict can now be read from the environment variable FOAM_CONTROLDICT
        - Uniform files (e.g. '0/uniform/time') are now read only once on the master only
          (with the masterUncollated or collated file handlers)
        - collated format writes to 'processorsNNN' instead of 'processors'.  The file
          format is unchanged.
        - Thread buffer and file buffer size are no longer limited to 2Gb.
      
      The global controlDict file contains parameters for file handling.  Under some
      circumstances, e.g. running in parallel on a system without NFS, the user may
      need to set some parameters, e.g. fileHandler, before the global controlDict
      file is read from file.  To support this, OpenFOAM now allows the global
      controlDict to be read as a string set to the FOAM_CONTROLDICT environment
      variable.
      
      The FOAM_CONTROLDICT environment variable can be set to the content the global
      controlDict file, e.g. from a sh/bash shell:
      
          export FOAM_CONTROLDICT=$(foamDictionary $FOAM_ETC/controlDict)
      
      FOAM_CONTROLDICT can then be passed to mpirun using the -x option, e.g.:
      
          mpirun -np 2 -x FOAM_CONTROLDICT simpleFoam -parallel
      
      Note that while this avoids the need for NFS to read the OpenFOAM configuration
      the executable still needs to load shared libraries which must either be copied
      locally or available via NFS or equivalent.
      
      New: Multiple IO ranks
      ----------------------
      The masterUncollated and collated fileHandlers can now use multiple ranks for
      writing e.g.:
      
          mpirun -np 6 simpleFoam -parallel -ioRanks '(0 3)'
      
      In this example ranks 0 ('processor0') and 3 ('processor3') now handle all the
      I/O.  Rank 0 handles 0,1,2 and rank 3 handles 3,4,5.  The set of IO ranks should always
      include 0 as first element and be sorted in increasing order.
      
      The collated fileHandler uses the directory naming processorsNNN_XXX-YYY where
      NNN is the total number of processors and XXX and YYY are first and last
      processor in the rank, e.g. in above example the directories would be
      
          processors6_0-2
          processors6_3-5
      
      and each of the collated files in these contains data of the local ranks
      only. The same naming also applies when e.g. running decomposePar:
      
      decomposePar -fileHandler collated -ioRanks '(0 3)'
      
      New: Distributed data
      ---------------------
      
      The individual root directories can be placed on different hosts with different
      paths if necessary.  In the current framework it is necessary to specify the
      root per slave process but this has been simplified with the option of specifying
      the root per host with the -hostRoots command line option:
      
          mpirun -np 6 simpleFoam -parallel -ioRanks '(0 3)' \
              -hostRoots '("machineA" "/tmp/" "machineB" "/tmp")'
      
      The hostRoots option is followed by a list of machine name + root directory, the
      machine name can contain regular expressions.
      
      New: hostCollated
      -----------------
      
      The new hostCollated fileHandler automatically sets the 'ioRanks' according to
      the host name with the lowest rank e.g. to run simpleFoam on 6 processors with
      ranks 0-2 on machineA and ranks 3-5 on machineB with the machines specified in
      the hostfile:
      
          mpirun -np 6 --hostfile hostfile simpleFoam -parallel -fileHandler hostCollated
      
      This is equivalent to
      
          mpirun -np 6 --hostfile hostfile simpleFoam -parallel -fileHandler collated -ioRanks '(0 3)'
      
      This example will write directories:
      
          processors6_0-2/
          processors6_3-5/
      
      A typical example would use distributed data e.g. no two nodes, machineA and
      machineB, each with three processes:
      
          decomposePar -fileHandler collated -case cavity
      
          # Copy case (constant/*, system/*, processors6/) to master:
          rsync -a cavity machineA:/tmp/
      
          # Create root on slave:
          ssh machineB mkdir -p /tmp/cavity
      
          # Run
          mpirun --hostfile hostfile icoFoam \
              -case /tmp/cavity -parallel -fileHandler hostCollated \
              -hostRoots '("machineA" "/tmp" "machineB" "/tmp")'
      
      Contributed by Mattijs Janssens
      8959b8e0
  26. 10 Nov, 2017 1 commit
  27. 24 Oct, 2017 1 commit
  28. 19 Oct, 2017 1 commit
  29. 06 Sep, 2017 1 commit
  30. 07 Jul, 2017 1 commit
    • Andrew Heather's avatar
      INT: Integration of Mattijs' collocated parallel IO additions · d8d6030a
      Andrew Heather authored
      Original commit message:
      ------------------------
      
      Parallel IO: New collated file format
      
      When an OpenFOAM simulation runs in parallel, the data for decomposed fields and
      mesh(es) has historically been stored in multiple files within separate
      directories for each processor.  Processor directories are named 'processorN',
      where N is the processor number.
      
      This commit introduces an alternative "collated" file format where the data for
      each decomposed field (and mesh) is collated into a single file, which is
      written and read on the master processor.  The files are stored in a single
      directory named 'processors'.
      
      The new format produces significantly fewer files - one per field, instead of N
      per field.  For large parallel cases, this avoids the restriction on the number
      of open files imposed by the operating system limits.
      
      The file writing can be threaded allowing the simulation to continue running
      while the data is being written to file.  NFS (Network File System) is not
      needed when using the the collated format and additionally, there is an option
      to run without NFS with the original uncollated approach, known as
      "masterUncollated".
      
      The controls for the file handling are in the OptimisationSwitches of
      etc/controlDict:
      
      OptimisationSwitches
      {
          ...
      
          //- Parallel IO file handler
          //  uncollated (default), collated or masterUncollated
          fileHandler uncollated;
      
          //- collated: thread buffer size for queued file writes.
          //  If set to 0 or not sufficient for the file size threading is not used.
          //  Default: 2e9
          maxThreadFileBufferSize 2e9;
      
          //- masterUncollated: non-blocking buffer size.
          //  If the file exceeds this buffer size scheduled transfer is used.
          //  Default: 2e9
          maxMasterFileBufferSize 2e9;
      }
      
      When using the collated file handling, memory is allocated for the data in the
      thread.  maxThreadFileBufferSize sets the maximum size of memory in bytes that
      is allocated.  If the data exceeds this size, the write does not use threading.
      
      When using the masterUncollated file handling, non-blocking MPI communication
      requires a sufficiently large memory buffer on the master node.
      maxMasterFileBufferSize sets the maximum size in bytes of the buffer.  If the
      data exceeds this size, the system uses scheduled communication.
      
      The installation defaults for the fileHandler choice, maxThreadFileBufferSize
      and maxMasterFileBufferSize (set in etc/controlDict) can be over-ridden within
      the case controlDict file, like other parameters.  Additionally the fileHandler
      can be set by:
      - the "-fileHandler" command line argument;
      - a FOAM_FILEHANDLER environment variable.
      
      A foamFormatConvert utility allows users to convert files between the collated
      and uncollated formats, e.g.
          mpirun -np 2 foamFormatConvert -parallel -fileHandler uncollated
      
      An example case demonstrating the file handling methods is provided in:
      $FOAM_TUTORIALS/IO/fileHandling
      
      The work was undertaken by Mattijs Janssens, in collaboration with Henry Weller.
      d8d6030a
  31. 10 Mar, 2017 1 commit
  32. 21 Nov, 2016 1 commit
  33. 20 Nov, 2016 1 commit
  34. 17 Jun, 2016 1 commit
  35. 25 Apr, 2016 1 commit
  36. 02 Apr, 2016 1 commit
    • Henry Weller's avatar
      Pstream: optimisation of data exchange · 88bd9123
      Henry Weller authored
      Contributed by Mattijs Janssens.
      
      1. Any non-blocking data exchange needs to know in advance the sizes to
         receive so it can size the buffer.  For "halo" exchanges this is not
         a problem since the sizes are known in advance but or all other data
         exchanges these sizes need to be exchanged in advance.
      
         This was previously done by having all processors send the sizes of data to
         send to the master and send it back such that all processors
         - had the same information
         - all could work out who was sending what to where and hence what needed to
           be received.
      
         This is now changed such that we only send the size to the
         destination processor (instead of to all as previously). This means
         that
         - the list of sizes to send is now of size nProcs v.s. nProcs*nProcs before
         - we cut out the route to the master and back by using a native MPI
           call
      
         It causes a small change to the API of exchange and PstreamBuffers -
         they now return the sizes of the local buffers only (a labelList) and
         not the sizes of the buffers on all processors (labelListList)
      
      2. Reversing the order of the way in which the sending is done when
         scattering information from the master processor to the other
         processors. This is done in a tree like fashion. Each processor has a
         set of processors to receive from/ send to. When receiving it will
         first receive from the processors with the least amount of
         sub-processors (i.e. the ones which return first). When sending it
         needs to do the opposite: start sending to the processor with the
         most amount of sub-tree since this is the critical path.
      88bd9123
  37. 29 Feb, 2016 2 commits
  38. 25 Jan, 2016 1 commit
    • mattijs's avatar
      ENH: glboal file handling: initial commit · e4240592
      mattijs authored
      Moved file path handling to regIOobject and made it type specific so
      now every object can have its own rules. Examples:
      - faceZones are now processor local (and don't search up anymore)
      - timeStampMaster is now no longer hardcoded inside IOdictionary
        (e.g. uniformDimensionedFields support it as well)
      - the distributedTriSurfaceMesh is properly processor-local; no need
        for fileModificationChecking manipulation.
      e4240592