ENH: return old file handler on change

- intended for the following type of use:

      auto oldHandler = fileHandler(fileOperation::NewUncollated());

      ... do something that only works with uncollated

      // Restore previous (if any)
      if (oldHandler)
      {
          fileHandler(std::move(oldHandler));
      }

ENH: make fileOperation distributed(bool) mutable

- use is "static-like" and akin to Pstream::parRun(bool),
  thus allow toggling of the switch without a const_cast
This commit is contained in:
Mark Olesen
2021-05-11 13:17:43 +02:00
parent 2a438385a3
commit 5022591c36
4 changed files with 42 additions and 17 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2016-2020 OpenCFD Ltd.
Copyright (C) 2016-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -116,7 +116,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
// As much as possible avoid synchronised operation
const_cast<fileOperation&>(fileHandler()).distributed(true);
fileHandler().distributed(true);
#include "createTime.H"