collatedFileOperation.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2017-2018 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "collatedFileOperation.H"
31 #include "Pstream.H"
32 #include "Time.H"
34 #include "decomposedBlockData.H"
35 #include "registerSwitch.H"
36 #include "masterOFstream.H"
37 #include "OFstream.H"
38 #include "foamVersion.H"
39 
40 /* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
41 
42 namespace Foam
43 {
44 namespace fileOperations
45 {
46  defineTypeNameAndDebug(collatedFileOperation, 0);
48  (
49  fileOperation,
50  collatedFileOperation,
51  word
52  );
53 
55  (
56  debug::floatOptimisationSwitch("maxThreadFileBufferSize", 1e9)
57  );
59  (
60  "maxThreadFileBufferSize",
61  float,
63  );
64 
65  // Mark as needing threaded mpi
67  (
69  collatedFileOperationInitialise,
70  word,
71  collated
72  );
73 }
74 }
75 
76 
77 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
78 
80 {
82 
83  string ioRanksString(getEnv("FOAM_IORANKS"));
84  if (!ioRanksString.empty())
85  {
86  IStringStream is(ioRanksString);
87  is >> ioRanks;
88  }
89 
90  return ioRanks;
91 }
92 
93 
95 (
96  const label proci
97 )
98 const
99 {
100  if (Pstream::parRun())
101  {
102  return Pstream::master(comm_);
103  }
104  else if (ioRanks_.size())
105  {
106  // Found myself in IO rank
107  return ioRanks_.found(proci);
108  }
109  else
110  {
111  // Assume all in single communicator
112  return proci == 0;
113  }
114 }
115 
116 
118 (
119  const regIOobject& io,
120  const fileName& pathName,
121  IOstreamOption streamOpt
122 ) const
123 {
124  // Append to processors/ file
125 
126  label proci = detectProcessorPath(io.objectPath());
127 
128  if (debug)
129  {
130  Pout<< "collatedFileOperation::writeObject :"
131  << " For local object : " << io.name()
132  << " appending processor " << proci
133  << " data to " << pathName << endl;
134  }
135 
136  if (proci == -1)
137  {
139  << "Not a valid processor path " << pathName
140  << exit(FatalError);
141  }
142 
143  const bool isMaster = isMasterRank(proci);
144 
145  // Determine local rank (offset) if the pathName is a per-rank one
146  label localProci = proci;
147  {
148  fileName path, procDir, local;
150  label nProcs;
151  splitProcessorPath(pathName, path, procDir, local, group, nProcs);
152 
153  // The local rank (offset)
154  if (!group.empty())
155  {
156  localProci = proci - group.start();
157  }
158  }
159 
160 
161  // Create string from all data to write
162  string buf;
163  {
164  OStringStream os(streamOpt.format(), streamOpt.version());
165  if (isMaster)
166  {
167  if (!io.writeHeader(os))
168  {
169  return false;
170  }
171  }
172 
173  // Write the data to the Ostream
174  if (!io.writeData(os))
175  {
176  return false;
177  }
178 
179  if (isMaster)
180  {
182  }
183 
184  buf = os.str();
185  }
186 
187 
188  // Note: cannot do append + compression. This is a limitation
189  // of ogzstream (or rather most compressed formats)
190 
191  OFstream os
192  (
193  pathName,
194  IOstreamOption(IOstream::BINARY, streamOpt.version()), // UNCOMPRESSED
195  !isMaster // append slaves
196  );
197 
198  if (!os.good())
199  {
201  << "Cannot open for appending"
202  << exit(FatalIOError);
203  }
204 
205  if (isMaster)
206  {
208  << "FoamFile\n{\n"
209  << " version " << os.version() << ";\n"
210  << " format " << os.format() << ";\n"
211  << " class " << decomposedBlockData::typeName
212  << ";\n";
213 
214  // This may be useful to have as well
215  if (os.format() == IOstream::BINARY)
216  {
217  os << " arch " << foamVersion::buildArch << ";\n";
218  }
219 
220  os << " location " << pathName << ";\n"
221  << " object " << pathName.name() << ";\n"
222  << "}" << nl;
223  IOobject::writeDivider(os) << nl;
224  }
225 
226  // Write data
227  UList<char> slice
228  (
229  const_cast<char*>(buf.data()),
230  label(buf.size())
231  );
232  os << nl << "// Processor" << localProci << nl << slice << nl;
233 
234  return os.good();
235 }
236 
237 
238 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
239 
241 (
242  bool verbose
243 )
244 :
246  (
247  (
248  ioRanks().size()
250  (
252  subRanks(Pstream::nProcs())
253  )
255  ),
256  false
257  ),
258  myComm_(comm_),
259  writer_(maxThreadFileBufferSize, comm_),
260  nProcs_(Pstream::nProcs()),
261  ioRanks_(ioRanks())
262 {
263  verbose = (verbose && Foam::infoDetailLevel > 0);
264 
265  if (verbose)
266  {
267  DetailInfo
268  << "I/O : " << typeName
269  << " (maxThreadFileBufferSize " << maxThreadFileBufferSize
270  << ')' << endl;
271 
272  if (maxThreadFileBufferSize == 0)
273  {
274  DetailInfo
275  << " Threading not activated "
276  "since maxThreadFileBufferSize = 0." << nl
277  << " Writing may run slowly for large file sizes."
278  << endl;
279  }
280  else
281  {
282  DetailInfo
283  << " Threading activated "
284  "since maxThreadFileBufferSize > 0." << nl
285  << " Requires large enough buffer to collect all data"
286  " or thread support " << nl
287  << " enabled in MPI. If thread support cannot be "
288  "enabled, deactivate" << nl
289  << " threading by setting maxThreadFileBufferSize "
290  "to 0 in" << nl
291  << " OpenFOAM etc/controlDict"
292  << endl;
293  }
294 
295  if (ioRanks_.size())
296  {
297  // Print a bit of information
298  stringList ioRanks(Pstream::nProcs());
299  if (Pstream::master(comm_))
300  {
301  ioRanks[Pstream::myProcNo()] = hostName()+"."+name(pid());
302  }
303  Pstream::gatherList(ioRanks);
304 
305  DetailInfo
306  << " IO nodes:" << nl;
307 
308  for (const string& ranks : ioRanks)
309  {
310  if (!ranks.empty())
311  {
312  DetailInfo
313  << " " << ranks << nl;
314  }
315  }
316  }
317 
318 
319  if
320  (
323  )
324  {
326  << "Resetting fileModificationChecking to inotify" << endl;
327  }
328 
329  if
330  (
333  )
334  {
336  << "Resetting fileModificationChecking to timeStamp" << endl;
337  }
338  }
339 }
340 
341 
343 (
344  const label comm,
345  const labelList& ioRanks,
346  const word& typeName,
347  bool verbose
348 )
349 :
350  masterUncollatedFileOperation(comm, false),
351  myComm_(-1),
352  writer_(maxThreadFileBufferSize, comm),
353  nProcs_(Pstream::nProcs()),
354  ioRanks_(ioRanks)
355 {
356  verbose = (verbose && Foam::infoDetailLevel > 0);
357 
358  if (verbose)
359  {
360  DetailInfo
361  << "I/O : " << typeName
362  << " (maxThreadFileBufferSize " << maxThreadFileBufferSize
363  << ')' << endl;
364 
365  if (maxThreadFileBufferSize == 0)
366  {
367  DetailInfo
368  << " Threading not activated "
369  "since maxThreadFileBufferSize = 0." << nl
370  << " Writing may run slowly for large file sizes."
371  << endl;
372  }
373  else
374  {
375  DetailInfo
376  << " Threading activated "
377  "since maxThreadFileBufferSize > 0." << nl
378  << " Requires large enough buffer to collect all data"
379  " or thread support " << nl
380  << " enabled in MPI. If thread support cannot be "
381  "enabled, deactivate" << nl
382  << " threading by setting maxThreadFileBufferSize "
383  "to 0 in the OpenFOAM etc/controlDict" << nl
384  << endl;
385  }
386 
387  if
388  (
391  )
392  {
394  << "Resetting fileModificationChecking to inotify" << endl;
395  }
396 
397  if
398  (
401  )
402  {
404  << "Resetting fileModificationChecking to timeStamp" << endl;
405  }
406  }
407 }
408 
409 
410 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
411 
413 {
414  if (myComm_ != -1 && myComm_ != UPstream::worldComm)
415  {
417  }
418 }
419 
420 
421 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
422 
424 (
425  const IOobject& io,
426  const word& typeName
427 ) const
428 {
429  // Replacement for objectPath
430  if (io.time().processorCase())
431  {
433  (
434  io,
436  "dummy", // not used for processorsobject
437  io.instance()
438  );
439  }
440  else
441  {
443  (
444  io,
446  word::null,
447  io.instance()
448  );
449  }
450 }
451 
452 
454 (
455  const regIOobject& io,
456  IOstreamOption streamOpt,
457  const bool valid
458 ) const
459 {
460  const Time& tm = io.time();
461  const fileName& inst = io.instance();
462 
463  if (inst.isAbsolute() || !tm.processorCase())
464  {
465  mkDir(io.path());
466  fileName pathName(io.objectPath());
467 
468  if (debug)
469  {
470  Pout<< "collatedFileOperation::writeObject :"
471  << " For object : " << io.name()
472  << " falling back to master-only output to " << io.path()
473  << endl;
474  }
475 
476  masterOFstream os
477  (
478  pathName,
479  streamOpt,
480  false, // append=false
481  valid
482  );
483 
484  // If any of these fail, return (leave error handling to Ostream class)
485  if (!os.good())
486  {
487  return false;
488  }
489  if (!io.writeHeader(os))
490  {
491  return false;
492  }
493  // Write the data to the Ostream
494  if (!io.writeData(os))
495  {
496  return false;
497  }
499 
500  return true;
501  }
502  else
503  {
504  // Construct the equivalent processors/ directory
505  fileName path(processorsPath(io, inst, processorsDir(io)));
506 
507  mkDir(path);
508  fileName pathName(path/io.name());
509 
510  if (io.global())
511  {
512  if (debug)
513  {
514  Pout<< "collatedFileOperation::writeObject :"
515  << " For global object : " << io.name()
516  << " falling back to master-only output to " << pathName
517  << endl;
518  }
519 
520  masterOFstream os
521  (
522  pathName,
523  streamOpt,
524  false, // append=false
525  valid
526  );
527 
528  // If any of these fail, return (leave error handling to Ostream
529  // class)
530  if (!os.good())
531  {
532  return false;
533  }
534  if (!io.writeHeader(os))
535  {
536  return false;
537  }
538  // Write the data to the Ostream
539  if (!io.writeData(os))
540  {
541  return false;
542  }
544 
545  return true;
546  }
547  else if (!Pstream::parRun())
548  {
549  // Special path for e.g. decomposePar. Append to
550  // processorsDDD/ file
551  if (debug)
552  {
553  Pout<< "collatedFileOperation::writeObject :"
554  << " For object : " << io.name()
555  << " appending to " << pathName << endl;
556  }
557 
558  return appendObject(io, pathName, streamOpt);
559  }
560  else
561  {
562  // Re-check static maxThreadFileBufferSize variable to see
563  // if needs to use threading
564  bool useThread = (maxThreadFileBufferSize > 0);
565 
566  if (debug)
567  {
568  Pout<< "collatedFileOperation::writeObject :"
569  << " For object : " << io.name()
570  << " starting collating output to " << pathName
571  << " useThread:" << useThread << endl;
572  }
573 
574  if (!useThread)
575  {
576  writer_.waitAll();
577  }
578 
580  (
581  writer_,
582  pathName,
583  streamOpt,
584  useThread
585  );
586 
587  // If any of these fail, return (leave error handling to Ostream
588  // class)
589  if (!os.good())
590  {
591  return false;
592  }
593  if (Pstream::master(comm_) && !io.writeHeader(os))
594  {
595  return false;
596  }
597  // Write the data to the Ostream
598  if (!io.writeData(os))
599  {
600  return false;
601  }
602  if (Pstream::master(comm_))
603  {
605  }
606 
607  return true;
608  }
609  }
610 }
611 
613 {
614  if (debug)
615  {
616  Pout<< "collatedFileOperation::flush : clearing and waiting for thread"
617  << endl;
618  }
620  // Wait for thread to finish (note: also removes thread)
621  writer_.waitAll();
622 }
623 
624 
626 (
627  const fileName& fName
628 ) const
629 {
630  if (Pstream::parRun())
631  {
632  const List<int>& procs(UPstream::procID(comm_));
633 
634  word procDir(processorsBaseDir+Foam::name(Pstream::nProcs()));
635 
636  if (procs.size() != Pstream::nProcs())
637  {
638  procDir +=
639  + "_"
640  + Foam::name(procs[0])
641  + "-"
642  + Foam::name(procs.last());
643  }
644  return procDir;
645  }
646  else
647  {
648  word procDir(processorsBaseDir+Foam::name(nProcs_));
649 
650  if (ioRanks_.size())
651  {
652  // Detect current processor number
653  label proci = detectProcessorPath(fName);
654 
655  if (proci != -1)
656  {
657  // Find lowest io rank
658  label minProc = 0;
659  label maxProc = nProcs_-1;
660  forAll(ioRanks_, i)
661  {
662  if (ioRanks_[i] >= nProcs_)
663  {
664  break;
665  }
666  else if (ioRanks_[i] <= proci)
667  {
668  minProc = ioRanks_[i];
669  }
670  else
671  {
672  maxProc = ioRanks_[i]-1;
673  break;
674  }
675  }
676  procDir +=
677  + "_"
678  + Foam::name(minProc)
679  + "-"
680  + Foam::name(maxProc);
681  }
682  }
683 
684  return procDir;
685  }
686 }
687 
688 
690 (
691  const IOobject& io
692 ) const
693 {
694  return processorsDir(io.objectPath());
695 }
696 
697 
699 {
700  nProcs_ = nProcs;
701 
702  if (debug)
703  {
704  Pout<< "collatedFileOperation::setNProcs :"
705  << " Setting number of processors to " << nProcs_ << endl;
706  }
707 }
708 
709 
710 // ************************************************************************* //
Foam::expressions::patchExpr::debug
int debug
Static debugging option.
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:104
collatedFileOperation.H
Foam::fileOperations::collatedFileOperation::maxThreadFileBufferSize
static float maxThreadFileBufferSize
Max size of thread buffer size. This is the overall size of.
Definition: collatedFileOperation.H:112
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
Foam::IOobject::name
const word & name() const
Return name.
Definition: IOobjectI.H:70
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::fileOperations::collatedFileOperation::~collatedFileOperation
virtual ~collatedFileOperation()
Destructor.
Definition: collatedFileOperation.C:412
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::fileOperations::collatedFileOperation::ioRanks
static labelList ioRanks()
Definition: collatedFileOperation.C:79
Foam::constant::atomic::group
constexpr const char *const group
Group name for atomic constants.
Definition: atomicConstants.H:52
Foam::fileOperations::collatedFileOperation::processorsDir
virtual word processorsDir(const IOobject &) const
Actual name of processors dir.
Definition: collatedFileOperation.C:690
Foam::IntRange
An interval of (signed) integers defined by a start and a size.
Definition: IntRange.H:63
Foam::IOobject::writeBanner
static Ostream & writeBanner(Ostream &os, bool noHint=false)
Write the standard OpenFOAM file/dictionary banner.
Definition: IOobjectWriteHeader.C:45
Foam::IOobject::writeEndDivider
static Ostream & writeEndDivider(Ostream &os)
Write the standard end file divider.
Definition: IOobjectWriteHeader.C:109
Foam::regIOobject::writeData
virtual bool writeData(Ostream &) const =0
Pure virtual writeData function.
masterOFstream.H
Foam::IOobject::instance
const fileName & instance() const
Definition: IOobjectI.H:191
Foam::fileName::name
static std::string name(const std::string &str)
Return basename (part beyond last /), including its extension.
Definition: fileNameI.H:209
Foam::IOobject::inotifyMaster
Definition: IOobject.H:139
Foam::UPstream::parRun
static bool & parRun()
Test if this a parallel run, or allow modify access.
Definition: UPstream.H:434
Foam::IOobject::timeStampMaster
Definition: IOobject.H:137
Foam::IOobject::fileModificationChecking
static fileCheckTypes fileModificationChecking
Type of file modification checking.
Definition: IOobject.H:211
Foam::IOstreamOption::format
streamFormat format() const noexcept
Get the current stream format.
Definition: IOstreamOption.H:289
Foam::UPstream::master
static bool master(const label communicator=worldComm)
Am I the master process.
Definition: UPstream.H:458
Foam::regIOobject::global
virtual bool global() const
Is object global.
Definition: regIOobject.H:342
Foam::fileOperations::addNamedToRunTimeSelectionTable
addNamedToRunTimeSelectionTable(fileOperationInitialise, collatedFileOperationInitialise, word, collated)
Foam::FatalIOError
IOerror FatalIOError
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:350
Foam::Pout
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
Foam::IOobject::time
const Time & time() const
Return time.
Definition: IOobject.C:463
Foam::getEnv
string getEnv(const std::string &envName)
Get environment value for given envName.
Definition: MSwindows.C:371
Foam::fileOperations::collatedFileOperation::objectPath
virtual fileName objectPath(const IOobject &io, const word &typeName) const
Generate disk file name for object. Opposite of filePath.
Definition: collatedFileOperation.C:424
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
OFstream.H
Foam::fileOperations::registerOptSwitch
registerOptSwitch("maxThreadFileBufferSize", float, collatedFileOperation::maxThreadFileBufferSize)
Foam::UPstream::allocateCommunicator
static label allocateCommunicator(const label parent, const labelList &subRanks, const bool doPstream=true)
Allocate a new communicator.
Definition: UPstream.C:100
Foam::fileOperations::collatedFileOperation::appendObject
bool appendObject(const regIOobject &io, const fileName &pathName, IOstreamOption streamOpt) const
Append to processors/ file.
Definition: collatedFileOperation.C:118
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
Foam::pid
pid_t pid()
Return the PID of this process.
Definition: MSwindows.C:330
Foam::fileOperations::addToRunTimeSelectionTable
addToRunTimeSelectionTable(fileOperation, collatedFileOperation, word)
Foam::fileOperations::collatedFileOperation::setNProcs
virtual void setNProcs(const label nProcs)
Set number of processor directories/results. Only used in.
Definition: collatedFileOperation.C:698
Foam::IOstreamOption
The IOstreamOption is a simple container for options an IOstream can normally have.
Definition: IOstreamOption.H:63
Foam::UPstream::procID
static List< int > & procID(label communicator)
Process ID of given process index.
Definition: UPstream.H:475
Foam::UPstream::freeCommunicator
static void freeCommunicator(const label communicator, const bool doPstream=true)
Free a previously allocated communicator.
Definition: UPstream.C:166
DetailInfo
#define DetailInfo
Definition: evalEntry.C:36
Foam::fileOperations::collatedFileOperation::isMasterRank
bool isMasterRank(const label proci) const
Is proci master of communicator (in parallel) or master of.
Definition: collatedFileOperation.C:95
Foam::fileOperations::collatedFileOperation::writeObject
virtual bool writeObject(const regIOobject &, IOstreamOption streamOpt=IOstreamOption(), const bool valid=true) const
Writes a regIOobject (so header, contents and divider).
Definition: collatedFileOperation.C:454
Foam::IOstreamOption::version
versionNumber version() const noexcept
Get the stream version.
Definition: IOstreamOption.H:341
Foam::threadedCollatedOFstream
Master-only drop-in replacement for OFstream.
Definition: threadedCollatedOFstream.H:52
threadedCollatedOFstream.H
Foam::FatalError
error FatalError
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Pstream.H
Foam::IStringStream
Input from string buffer, using a ISstream.
Definition: StringStream.H:111
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
fileOperationInitialise
Foam::infoDetailLevel
int infoDetailLevel
Global for selective suppression of Info output.
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::OFstream
Output to file stream, using an OSstream.
Definition: OFstream.H:53
Time.H
Foam::regIOobject
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:71
Foam::fileOperations::masterUncollatedFileOperation::flush
virtual void flush() const
Forcibly wait until all output done. Flush any cached data.
Definition: masterUncollatedFileOperation.C:2465
Foam::fileOperations::masterUncollatedFileOperation
fileOperations that performs all file operations on the master processor. Requires the calls to be pa...
Definition: masterUncollatedFileOperation.H:85
Foam::IOstreamOption::BINARY
"binary"
Definition: IOstreamOption.H:73
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:381
Foam::Pstream::gatherList
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
Definition: gatherScatterList.C:52
Foam::debug::floatOptimisationSwitch
float floatOptimisationSwitch(const char *name, const float deflt=0)
Lookup optimisation switch or add default value.
Definition: debug.C:243
Foam::UPstream::myProcNo
static int myProcNo(const label communicator=worldComm)
Number of this process (starting from masterNo() = 0)
Definition: UPstream.H:464
Foam::nl
constexpr char nl
Definition: Ostream.H:385
Foam::IOobject::writeDivider
static Ostream & writeDivider(Ostream &os)
Write the standard file section divider.
Definition: IOobjectWriteHeader.C:99
decomposedBlockData.H
Foam::UPstream::worldComm
static label worldComm
Default communicator (all processors)
Definition: UPstream.H:295
Foam::List< label >
Foam::OStringStream
Output to string buffer, using a OSstream.
Definition: StringStream.H:196
Foam::foamVersion::buildArch
const std::string buildArch
Foam::UList
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:103
Foam::hostName
string hostName(const bool full=false)
Return the system's host name, as per hostname(1)
Definition: MSwindows.C:410
path
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
Foam::word::null
static const word null
An empty word.
Definition: word.H:77
Foam::fileOperation::PROCOBJECT
Definition: fileOperation.H:91
Foam::fileOperations::masterUncollatedFileOperation::localObjectPath
fileName localObjectPath(const IOobject &, const pathType &searchType, const word &processorsDir, const word &instancePath) const
Construct filePath.
Definition: masterUncollatedFileOperation.C:337
Foam::IOobject::writeHeader
bool writeHeader(Ostream &os) const
Write header.
Definition: IOobjectWriteHeader.C:156
FatalIOErrorInFunction
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:401
registerSwitch.H
Foam::fileOperations::collatedFileOperation::collatedFileOperation
collatedFileOperation(bool verbose)
Construct null.
Definition: collatedFileOperation.C:241
Foam::IOstream::good
bool good() const
Return true if next operation might succeed.
Definition: IOstream.H:224
Foam::IOobject::objectPath
fileName objectPath() const
The complete path + object name.
Definition: IOobjectI.H:209
Foam::TimePaths::processorCase
bool processorCase() const
Return true if this is a processor case.
Definition: TimePathsI.H:36
Foam::mkDir
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
Definition: MSwindows.C:507
Foam::fileOperation::OBJECT
Definition: fileOperation.H:86
Foam::IOobject::path
fileName path() const
The complete path.
Definition: IOobject.C:481
Foam::fileOperations::collatedFileOperation::flush
virtual void flush() const
Forcibly wait until all output done. Flush any cached data.
Definition: collatedFileOperation.C:612
WarningInFunction
#define WarningInFunction
Report a warning using Foam::Warning.
Definition: messageStream.H:303
Foam::fileName::isAbsolute
static bool isAbsolute(const std::string &str)
Return true if string starts with a '/'.
Definition: fileNameI.H:136
Foam::masterOFstream
Master-only drop-in replacement for OFstream.
Definition: masterOFstream.H:51
Foam::UPstream::nProcs
static label nProcs(const label communicator=worldComm)
Number of processes in parallel run, and 1 for serial run.
Definition: UPstream.H:446
Foam::fileOperations::defineTypeNameAndDebug
defineTypeNameAndDebug(collatedFileOperation, 0)
foamVersion.H