uncollatedFileOperation.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 OpenFOAM Foundation
9  Copyright (C) 2020-2022 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 
30 #include "Time.H"
31 #include "Fstream.H"
33 #include "decomposedBlockData.H"
34 #include "dummyISstream.H"
35 #include "unthreadedInitialise.H"
36 
37 /* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */
38 
39 namespace Foam
40 {
41 namespace fileOperations
42 {
43  defineTypeNameAndDebug(uncollatedFileOperation, 0);
44  addToRunTimeSelectionTable(fileOperation, uncollatedFileOperation, word);
45 
46  // Mark as not needing threaded mpi
48  (
49  fileOperationInitialise,
50  unthreadedInitialise,
51  word,
52  uncollated
53  );
54 }
55 }
56 
57 
58 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
59 
61 (
62  const bool checkGlobal,
63  const bool isFile,
64  const IOobject& io,
65  const bool search
66 ) const
67 {
68  if (io.instance().isAbsolute())
69  {
70  fileName objectPath(io.instance()/io.name());
71 
73  {
74  return objectPath;
75  }
76  }
77  else
78  {
79  fileName path(io.path());
80  fileName objectPath(path/io.name());
81 
83  {
84  return objectPath;
85  }
86  else
87  {
88  if
89  (
90  checkGlobal
91  && io.time().processorCase()
92  && (
93  io.instance() == io.time().system()
94  || io.instance() == io.time().constant()
95  )
96  )
97  {
98  // Constant & system can come from global case
99 
100  fileName parentObjectPath =
101  io.rootPath()/io.time().globalCaseName()
102  /io.instance()/io.db().dbDir()/io.local()/io.name();
103 
104  if (isFileOrDir(isFile, parentObjectPath))
105  {
106  return parentObjectPath;
107  }
108  }
109 
110  // Check if parallel "procesors" directory
111  if (io.time().processorCase())
112  {
113  refPtr<dirIndexList> pDirs
114  (
116  (
117  io.objectPath(),
118  false // No additional parallel synchronisation
119  )
120  );
121 
122  for (const dirIndex& dirIdx : pDirs())
123  {
124  const fileName& pDir = dirIdx.first();
125  fileName objPath =
126  processorsPath(io, io.instance(), pDir)
127  /io.name();
128  if (objPath != objectPath && isFileOrDir(isFile, objPath))
129  {
130  return objPath;
131  }
132  }
133  }
134 
135 
136  // Check for approximately same time. E.g. if time = 1e-2 and
137  // directory is 0.01 (due to different time formats)
138  if (search && !Foam::isDir(path))
139  {
140  word newInstancePath = io.time().findInstancePath
141  (
142  instant(io.instance())
143  );
144 
145  if (newInstancePath.size())
146  {
147  fileName fName
148  (
149  io.rootPath()/io.caseName()
150  /newInstancePath/io.db().dbDir()/io.local()/io.name()
151  );
152 
153  if (isFileOrDir(isFile, fName))
154  {
155  return fName;
156  }
157  }
158  }
159  }
160  }
162  return fileName::null;
163 }
164 
165 
168 (
169  const fileName& fName
170 ) const
171 {
172  // No additional parallel synchronisation
173  return fileOperation::lookupAndCacheProcessorsPath(fName, false);
174 }
175 
176 
177 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
178 
179 void Foam::fileOperations::uncollatedFileOperation::init(bool verbose)
180 {
181  verbose = (verbose && Foam::infoDetailLevel > 0);
182 
183  if (verbose)
184  {
186  << "I/O : " << typeName << endl;
187  }
188 }
189 
190 
192 (
193  bool verbose
194 )
195 :
196  fileOperation(UPstream::worldComm),
197  managedComm_(-1) // worldComm is externally managed
198 {
199  init(verbose);
200 }
201 
202 
203 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
204 
206 {
207  if (UPstream::isUserComm(managedComm_))
208  {
209  UPstream::freeCommunicator(managedComm_);
210  }
211 }
212 
213 
214 // * * * * * * * * * * * * * Filesystem Operations * * * * * * * * * * * * * //
215 
217 (
218  const fileName& dir,
219  mode_t mode
220 ) const
221 {
222  return Foam::mkDir(dir, mode);
223 }
224 
225 
227 (
228  const fileName& fName,
229  mode_t mode
230 ) const
231 {
232  return Foam::chMod(fName, mode);
233 }
234 
235 
237 (
238  const fileName& fName,
239  const bool followLink
240 ) const
241 {
242  return Foam::mode(fName, followLink);
243 }
244 
245 
247 (
248  const fileName& fName,
249  const bool followLink
250 ) const
251 {
252  return Foam::type(fName, followLink);
253 }
254 
255 
257 (
258  const fileName& fName,
259  const bool checkGzip,
260  const bool followLink
261 ) const
262 {
263  return Foam::exists(fName, checkGzip, followLink);
264 }
265 
266 
268 (
269  const fileName& fName,
270  const bool followLink
271 ) const
272 {
273  return Foam::isDir(fName, followLink);
274 }
275 
276 
278 (
279  const fileName& fName,
280  const bool checkGzip,
281  const bool followLink
282 ) const
283 {
284  return Foam::isFile(fName, checkGzip, followLink);
285 }
286 
287 
289 (
290  const fileName& fName,
291  const bool followLink
292 ) const
293 {
294  return Foam::fileSize(fName, followLink);
295 }
296 
297 
299 (
300  const fileName& fName,
301  const bool followLink
302 ) const
303 {
304  return Foam::lastModified(fName, followLink);
305 }
306 
307 
309 (
310  const fileName& fName,
311  const bool followLink
312 ) const
313 {
314  return Foam::highResLastModified(fName, followLink);
315 }
316 
317 
319 (
320  const fileName& fName,
321  const std::string& ext
322 ) const
323 {
324  return Foam::mvBak(fName, ext);
325 }
326 
327 
329 (
330  const fileName& fName
331 ) const
332 {
333  return Foam::rm(fName);
334 }
335 
336 
338 (
339  const fileName& dir,
340  const bool silent,
341  const bool emptyOnly
342 ) const
343 {
344  return Foam::rmDir(dir, silent, emptyOnly);
345 }
346 
347 
349 (
350  const fileName& dir,
351  const fileName::Type type,
352  const bool filtergz,
353  const bool followLink
354 ) const
355 {
356  return Foam::readDir(dir, type, filtergz, followLink);
357 }
358 
359 
361 (
362  const fileName& src,
363  const fileName& dst,
364  const bool followLink
365 ) const
366 {
367  return Foam::cp(src, dst, followLink);
368 }
369 
370 
372 (
373  const fileName& src,
374  const fileName& dst
375 ) const
376 {
377  return Foam::ln(src, dst);
378 }
379 
380 
382 (
383  const fileName& src,
384  const fileName& dst,
385  const bool followLink
386 ) const
387 {
388  return Foam::mv(src, dst, followLink);
389 }
390 
391 
392 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
393 
395 (
396  const bool checkGlobal,
397  const IOobject& io,
398  const word& typeName,
399  const bool search
400 ) const
401 {
402  if (debug)
403  {
404  Pout<< "uncollatedFileOperation::filePath :"
405  << " objectPath:" << io.objectPath()
406  << " checkGlobal:" << checkGlobal << endl;
407  }
408 
409  fileName objPath(filePathInfo(checkGlobal, true, io, search));
410 
411  if (debug)
412  {
413  Pout<< "uncollatedFileOperation::filePath :"
414  << " Returning from file searching:" << endl
415  << " objectPath:" << io.objectPath() << endl
416  << " filePath :" << objPath << endl << endl;
417  }
418  return objPath;
419 }
420 
421 
423 (
424  const bool checkGlobal,
425  const IOobject& io,
426  const bool search
427 ) const
428 {
429  if (debug)
430  {
431  Pout<< "uncollatedFileOperation::dirPath :"
432  << " objectPath:" << io.objectPath()
433  << " checkGlobal:" << checkGlobal << endl;
434  }
435 
436  fileName objPath(filePathInfo(checkGlobal, false, io, search));
437 
438  if (debug)
439  {
440  Pout<< "uncollatedFileOperation::dirPath :"
441  << " Returning from directory searching:" << endl
442  << " objectPath:" << io.objectPath() << endl
443  << " dirPath :" << objPath << endl << endl;
444  }
445  return objPath;
446 }
447 
448 
450 (
451  const objectRegistry& db,
452  const fileName& instance,
453  const fileName& local,
454  word& newInstance
455 ) const
456 {
457  if (debug)
458  {
459  Pout<< "uncollatedFileOperation::readObjects :"
460  << " db:" << db.objectPath()
461  << " instance:" << instance << endl;
462  }
463 
464  //- Use non-time searching version
465  fileNameList objectNames
466  (
467  fileOperation::readObjects(db, instance, local, newInstance)
468  );
469 
470  if (newInstance.empty())
471  {
472  // Find similar time
473  fileName newInst = db.time().findInstancePath(instant(instance));
474  if (!newInst.empty() && newInst != instance)
475  {
476  // Try with new time
477  objectNames = fileOperation::readObjects
478  (
479  db,
480  newInst,
481  local,
482  newInstance
483  );
484  }
485  }
486 
487  if (debug)
488  {
489  Pout<< "uncollatedFileOperation::readObjects :"
490  << " newInstance:" << newInstance
491  << " objectNames:" << objectNames << endl;
492  }
493 
494  return objectNames;
495 }
496 
497 
499 (
500  IOobject& io,
501  const fileName& fName,
502  const word& typeName
503 ) const
504 {
505  if (debug)
506  {
507  Pout<< "uncollatedFileOperation::readHeader :"
508  << " fName:" << fName
509  << " typeName:" << typeName << endl;
510  }
511  if (fName.empty())
512  {
513  if (IOobject::debug)
514  {
516  << "file " << io.objectPath() << " could not be opened"
517  << endl;
518  }
519 
520  return false;
521  }
522 
523  autoPtr<ISstream> isPtr(NewIFstream(fName));
524 
525  if (!isPtr || !isPtr->good())
526  {
527  return false;
528  }
529 
530  // Regular header or from decomposed data
531  bool ok = decomposedBlockData::readHeader(io, *isPtr);
532 
533  if (debug)
534  {
535  Pout<< "uncollatedFileOperation::readHeader :"
536  << " for fName:" << fName
537  << " ok:" << ok
538  << " headerClassName:" << io.headerClassName() << endl;
539  }
540 
541  return ok;
542 }
543 
544 
547 (
548  regIOobject& io,
549  const fileName& fName,
550  const word& typeName,
551  const bool valid
552 ) const
553 {
554  if (!valid)
555  {
556  return autoPtr<ISstream>(new dummyISstream());
557  }
558 
559  if (fName.empty())
560  {
562  << "cannot find file " << io.objectPath()
563  << exit(FatalError);
564  }
565 
566  autoPtr<ISstream> isPtr = NewIFstream(fName);
567 
568  if (!isPtr || !isPtr->good())
569  {
571  (
572  "uncollatedFileOperation::readStream()",
573  __FILE__,
574  __LINE__,
575  fName,
576  0
577  ) << "cannot open file"
578  << exit(FatalIOError);
579  }
580  else if (!io.readHeader(*isPtr))
581  {
582  FatalIOErrorInFunction(*isPtr)
583  << "problem while reading header for object " << io.name()
584  << exit(FatalIOError);
585  }
586 
588  {
589  // Short circuit: non-collated format.
590  return isPtr;
591  }
592  else
593  {
594  // Analyse the objectpath to find out the processor we're trying
595  // to access
596  label proci = detectProcessorPath(io.objectPath());
597 
598  if (proci == -1)
599  {
600  FatalIOErrorInFunction(*isPtr)
601  << "could not detect processor number"
602  << " from objectPath:" << io.objectPath()
603  << " fName:" << fName
604  << exit(FatalIOError);
605  }
606 
607  // Analyse the fileName for any processor subset. Note: this
608  // should really be part of filePath() which should return
609  // both file and index in file.
610  fileName path, procDir, local;
611  procRangeType group;
612  label nProcs;
613  splitProcessorPath(fName, path, procDir, local, group, nProcs);
614 
615  // The local rank (offset)
616  if (!group.empty())
617  {
618  proci = proci - group.start();
619  }
620 
621  // Read data and return as stream
622  return decomposedBlockData::readBlock(proci, *isPtr, io);
623  }
624 }
625 
626 
628 (
629  regIOobject& io,
630  const bool masterOnly,
632  const word& typeName
633 ) const
634 {
635  bool ok = false;
636 
637  if (!masterOnly || Pstream::master(UPstream::worldComm))
638  {
639  if (debug)
640  {
641  Pout<< "uncollatedFileOperation::read :"
642  << " Reading object " << io.objectPath()
643  << " from file " << endl;
644  }
645 
646  // Set flag for e.g. codeStream
647  const bool oldGlobal = io.globalObject(masterOnly);
648 
649  // If codeStream originates from dictionary which is
650  // not IOdictionary we have a problem so use global
651  const bool oldMasterOnly = regIOobject::masterOnlyReading;
652  regIOobject::masterOnlyReading = masterOnly;
653 
654  // Read file
655  ok = io.readData(io.readStream(typeName));
656  io.close();
657 
658  // Restore flags
659  io.globalObject(oldGlobal);
660  regIOobject::masterOnlyReading = oldMasterOnly;
661 
662  if (debug)
663  {
664  Pout<< "uncollatedFileOperation::read :"
665  << " Done reading object " << io.objectPath()
666  << " from file " << endl;
667  }
668  }
669 
670  if (masterOnly && Pstream::parRun())
671  {
673  (
675  io.headerClassName(),
676  io.note()
677  );
678 
680  {
681  OPBstream toAll
682  (
685  format
686  );
687  bool okWrite = io.writeData(toAll);
688  ok = ok && okWrite;
689  }
690  else
691  {
692  IPBstream fromMaster
693  (
696  format
697  );
698  ok = io.readData(fromMaster);
699  }
700  }
701 
702  return ok;
703 }
704 
705 
708 (
709  const fileName& filePath
710 ) const
711 {
712  return autoPtr<ISstream>(new IFstream(filePath));
713 }
714 
715 
718 (
719  const fileName& pathName,
720  IOstreamOption streamOpt,
721  const bool valid
722 ) const
723 {
724  return autoPtr<OSstream>(new OFstream(pathName, streamOpt));
725 }
726 
727 
730 (
732  const fileName& pathName,
733  IOstreamOption streamOpt,
734  const bool valid
735 ) const
736 {
737  return autoPtr<OSstream>(new OFstream(atomic, pathName, streamOpt));
738 }
739 
740 
741 // ************************************************************************* //
bool mvBak(const fileName &src, const std::string &ext="bak")
Rename to a corresponding backup file.
Definition: POSIX.C:1310
virtual bool exists(const fileName &, const bool checkGzip=true, const bool followLink=true) const
Does the name exist (as DIRECTORY or FILE) in the file system?
bool mv(const fileName &src, const fileName &dst, const bool followLink=false)
Rename src to dst.
Definition: POSIX.C:1277
A class for handling file names.
Definition: fileName.H:71
off_t fileSize(const fileName &name, const bool followLink=true)
Return size of file or -1 on failure (normally follows symbolic links).
Definition: POSIX.C:858
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:125
error FatalError
Error stream (stdout output on all processes), with additional &#39;FOAM FATAL ERROR&#39; header text and sta...
virtual bool mv(const fileName &src, const fileName &dst, const bool followLink=false) const
Rename src to dst.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:578
virtual bool chMod(const fileName &, const mode_t) const
Set the file mode.
static autoPtr< ISstream > readBlock(const label blocki, ISstream &is, IOobject &headerIO)
Read selected block (non-seeking) + header information.
virtual fileName filePath(const bool checkGlobal, const IOobject &io, const word &typeName, const bool search) const
Search for an object. checkGlobal : also check undecomposed case.
Output to file stream, using an OSstream.
Definition: OFstream.H:49
int infoDetailLevel
Global for selective suppression of Info output.
virtual bool read(regIOobject &, const bool masterOnly, const IOstreamOption::streamFormat format, const word &typeName) const
Top-level read.
static const fileName null
An empty fileName.
Definition: fileName.H:110
virtual mode_t mode(const fileName &, const bool followLink=true) const
Return the file mode.
virtual fileNameList readObjects(const objectRegistry &db, const fileName &instance, const fileName &local, word &newInstance) const
Search directory for objects. Used in IOobjectList.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:487
bool cp(const fileName &src, const fileName &dst, const bool followLink=true)
Copy the source to the destination (recursively if necessary).
Definition: POSIX.C:1016
fileName filePathInfo(const bool checkGlobal, const bool isFile, const IOobject &io, const bool search) const
Search for an object.
static bool & parRun() noexcept
Test if this a parallel run.
Definition: UPstream.H:639
virtual bool readHeader(IOobject &, const fileName &, const word &typeName) const
Read object header from supplied file.
virtual bool rmDir(const fileName &dir, const bool silent=false, const bool emptyOnly=false) const
Remove a directory and its contents.
virtual double highResLastModified(const fileName &, const bool followLink=true) const
Return time of last file modification.
A simple container for options an IOstream can normally have.
virtual bool mkDir(const fileName &, mode_t=0777) const
Make directory.
static label worldComm
Default world communicator (all processors). May differ from globalComm if local worlds are in use...
Definition: UPstream.H:361
virtual autoPtr< OSstream > NewOFstream(const fileName &pathname, IOstreamOption streamOpt=IOstreamOption(), const bool valid=true) const
Generate an OSstream that writes a file.
fileName processorsPath(const IOobject &, const word &instance, const word &procDir) const
Generate path (like io.path) with provided instance and any.
A class for managing references or pointers (no reference counting)
Definition: HashPtrTable.H:49
An encapsulation of filesystem-related operations.
Definition: fileOperation.H:63
fileName objectPath() const
The complete path + object name.
Definition: IOobjectI.H:239
Macros for easy insertion into run-time selection tables.
addNamedToRunTimeSelectionTable(fileOperationInitialise, collatedFileOperationInitialise, word, collated)
virtual bool isFile(const fileName &, const bool checkGzip=true, const bool followLink=true) const
Does the name exist as a FILE in the file system?
refPtr< dirIndexList > lookupAndCacheProcessorsPath(const fileName &objectPath, const bool syncPar) const
Lookup name of processorsDDD using cache.
constexpr const char *const group
Group name for atomic constants.
addToRunTimeSelectionTable(fileOperation, collatedFileOperation, word)
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
Definition: POSIX.C:813
Tuple2< fileName, Tuple2< pathType, int > > dirIndex
Augment fileName with pathType and local offset.
Definition: fileOperation.H:99
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: POSIX.C:752
atomicType
Atomic operations (output)
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
Definition: POSIX.C:567
virtual fileNameList readDir(const fileName &, const fileName::Type=fileName::FILE, const bool filtergz=true, const bool followLink=true) const
Read a directory and return the entries as a string list.
virtual bool isDir(const fileName &, const bool followLink=true) const
Does the name exist as a DIRECTORY in the file system?
virtual autoPtr< ISstream > NewIFstream(const fileName &) const
Generate an ISstream that reads a file.
A class for handling words, derived from Foam::string.
Definition: word.H:63
const Time & time() const noexcept
Return time registry.
virtual bool cp(const fileName &src, const fileName &dst, const bool followLink=true) const
Copy, recursively if necessary, the source to the destination.
static constexpr int masterNo() noexcept
Process index of the master (always 0)
Definition: UPstream.H:664
virtual refPtr< dirIndexList > lookupProcessorsPath(const fileName &) const
Lookup name of processorsDDD using cache.
time_t lastModified(const fileName &name, const bool followLink=true)
Return time of last file modification (normally follows symbolic links).
Definition: POSIX.C:883
bool exists(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist (as DIRECTORY or FILE) in the file system?
Definition: POSIX.C:788
virtual off_t fileSize(const fileName &, const bool followLink=true) const
Return size of file.
bool local
Definition: EEqn.H:20
virtual time_t lastModified(const fileName &, const bool followLink=true) const
Return time of last file modification.
virtual bool rm(const fileName &) const
Remove a file, returning true if successful otherwise false.
static bool isCollatedType(const word &objectType)
True if object type is a known collated type.
#define DetailInfo
Definition: evalEntry.C:30
static bool readHeader(IOobject &io, Istream &is)
Read header as per IOobject with additional handling of decomposedBlockData.
static bool isUserComm(label communicator) noexcept
True if communicator appears to be user-allocated.
Definition: UPstream.H:386
bool ln(const fileName &src, const fileName &dst)
Create a softlink. dst should not exist. Returns true if successful.
Definition: POSIX.C:1190
bool rmDir(const fileName &directory, const bool silent=false, const bool emptyOnly=false)
Remove a directory and its contents recursively,.
Definition: POSIX.C:1386
virtual bool ln(const fileName &src, const fileName &dst) const
Create a softlink. dst should not exist. Returns true if.
int debug
Static debugging option.
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
Input from file stream, using an ISstream.
Definition: IFstream.H:49
virtual fileName dirPath(const bool checkGlobal, const IOobject &io, const bool search) const
Search for a directory. checkGlobal : also check undecomposed.
bool chMod(const fileName &name, const mode_t mode)
Set the file/directory mode, return true on success.
Definition: POSIX.C:710
static void broadcasts(const label comm, Type &arg1, Args &&... args)
Broadcast multiple items to all processes in communicator.
static bool isFileOrDir(const bool isFile, const fileName &)
Helper: check for file (isFile) or directory (!isFile)
word format(conversionProperties.get< word >("format"))
static bool masterOnlyReading
To flag master-only reading of objects.
Definition: regIOobject.H:87
bool isFile(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist as a FILE in the file system?
Definition: POSIX.C:830
word findInstancePath(const fileName &directory, const instant &t) const
Search the case for the time directory path corresponding to the given instance.
Definition: Time.C:801
virtual autoPtr< ISstream > readStream(regIOobject &, const fileName &, const word &typeName, const bool procValid=true) const
Reads header for regIOobject and returns an ISstream.
virtual bool mvBak(const fileName &, const std::string &ext="bak") const
Rename to a corresponding backup file.
uncollatedFileOperation(bool verbose)
Default construct.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:607
static bool master(const label communicator=worldComm)
Am I the master rank.
Definition: UPstream.H:672
virtual fileNameList readObjects(const objectRegistry &db, const fileName &instance, const fileName &local, word &newInstance) const
Search directory for objects. Used in IOobjectList.
streamFormat
Data format (ascii | binary)
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:69
fileName search(const word &file, const fileName &directory)
Recursively search the given directory for the file.
Definition: fileName.C:640
defineTypeNameAndDebug(collatedFileOperation, 0)
Registry of regIOobjects.
fileNameList readDir(const fileName &directory, const fileName::Type type=fileName::Type::FILE, const bool filtergz=true, const bool followLink=true)
Read a directory and return the entries as a fileName List.
Definition: POSIX.C:916
List< fileName > fileNameList
A List of fileNames.
Definition: fileNameList.H:54
Dummy input stream, which can be used as a placeholder for interfaces taking an Istream or ISstream...
Definition: dummyISstream.H:52
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:166
mode_t mode(const fileName &name, const bool followLink=true)
Return the file mode, normally following symbolic links.
Definition: POSIX.C:726
virtual fileName objectPath(const IOobject &io, const word &typeName) const
Generate disk file name for object. Opposite of filePath.
virtual fileName::Type type(const fileName &, const bool followLink=true) const
Return the file type: DIRECTORY, FILE or SYMLINK.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
Inter-processor communications stream.
Definition: UPstream.H:54
static void freeCommunicator(const label communicator, const bool doPstream=true)
Free a previously allocated communicator.
Definition: UPstream.C:239
Type
Enumerations to handle directory entry types.
Definition: fileName.H:80
Namespace for OpenFOAM.
double highResLastModified(const fileName &, const bool followLink=true)
Return time of last file modification.
Definition: POSIX.C:899
bool rm(const fileName &file)
Remove a file (or its gz equivalent), returning true if successful.
Definition: POSIX.C:1357
IOerror FatalIOError
Error stream (stdout output on all processes), with additional &#39;FOAM FATAL IO ERROR&#39; header text and ...
#define InfoInFunction
Report an information message using Foam::Info.