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 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  (
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 
72  if (isFileOrDir(isFile, objectPath))
73  {
74  return objectPath;
75  }
76  else
77  {
78  return fileName::null;
79  }
80  }
81  else
82  {
83  fileName path = io.path();
84  fileName objectPath = path/io.name();
85 
86  if (isFileOrDir(isFile, objectPath))
87  {
88  return objectPath;
89  }
90  else
91  {
92  if
93  (
94  checkGlobal
95  && io.time().processorCase()
96  && (
97  io.instance() == io.time().system()
98  || io.instance() == io.time().constant()
99  )
100  )
101  {
102  // Constant & system can come from global case
103 
104  fileName parentObjectPath =
105  io.rootPath()/io.time().globalCaseName()
106  /io.instance()/io.db().dbDir()/io.local()/io.name();
107 
108  if (isFileOrDir(isFile, parentObjectPath))
109  {
110  return parentObjectPath;
111  }
112  }
113 
114  // Check if parallel "procesors" directory
115  if (io.time().processorCase())
116  {
118  (
119  fileOperation::lookupAndCacheProcessorsPath
120  (
121  io.objectPath(),
122  false
123  )
124  );
125  forAll(pDirs(), i)
126  {
127  const fileName& pDir = pDirs()[i].first();
128  fileName objPath =
129  processorsPath(io, io.instance(), pDir)
130  /io.name();
131  if (objPath != objectPath && isFileOrDir(isFile, objPath))
132  {
133  return objPath;
134  }
135  }
136  }
137 
138 
139  // Check for approximately same time. E.g. if time = 1e-2 and
140  // directory is 0.01 (due to different time formats)
141  if (search && !Foam::isDir(path))
142  {
143  word newInstancePath = io.time().findInstancePath
144  (
145  instant(io.instance())
146  );
147 
148  if (newInstancePath.size())
149  {
150  fileName fName
151  (
152  io.rootPath()/io.caseName()
153  /newInstancePath/io.db().dbDir()/io.local()/io.name()
154  );
155 
156  if (isFileOrDir(isFile, fName))
157  {
158  return fName;
159  }
160  }
161  }
162  }
163 
164  return fileName::null;
165  }
166 }
167 
168 
171 (
172  const fileName& fName
173 ) const
174 {
175  // Do not use parallel synchronisation
176  return lookupAndCacheProcessorsPath(fName, false);
177 }
178 
179 
180 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
181 
183 (
184  bool verbose
185 )
186 :
187  fileOperation(Pstream::worldComm)
188 {
189  if (verbose)
190  {
191  DetailInfo
192  << "I/O : " << typeName << endl;
193  }
194 }
195 
196 
197 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
198 
200 (
201  const fileName& dir,
202  mode_t mode
203 ) const
204 {
205  return Foam::mkDir(dir, mode);
206 }
207 
208 
210 (
211  const fileName& fName,
212  mode_t mode
213 ) const
214 {
215  return Foam::chMod(fName, mode);
216 }
217 
218 
220 (
221  const fileName& fName,
222  const bool followLink
223 ) const
224 {
225  return Foam::mode(fName, followLink);
226 }
227 
228 
230 (
231  const fileName& fName,
232  const bool followLink
233 ) const
234 {
235  return Foam::type(fName, followLink);
236 }
237 
238 
240 (
241  const fileName& fName,
242  const bool checkGzip,
243  const bool followLink
244 ) const
245 {
246  return Foam::exists(fName, checkGzip, followLink);
247 }
248 
249 
251 (
252  const fileName& fName,
253  const bool followLink
254 ) const
255 {
256  return Foam::isDir(fName, followLink);
257 }
258 
259 
261 (
262  const fileName& fName,
263  const bool checkGzip,
264  const bool followLink
265 ) const
266 {
267  return Foam::isFile(fName, checkGzip, followLink);
268 }
269 
270 
272 (
273  const fileName& fName,
274  const bool followLink
275 ) const
276 {
277  return Foam::fileSize(fName, followLink);
278 }
279 
280 
282 (
283  const fileName& fName,
284  const bool followLink
285 ) const
286 {
287  return Foam::lastModified(fName, followLink);
288 }
289 
290 
292 (
293  const fileName& fName,
294  const bool followLink
295 ) const
296 {
297  return Foam::highResLastModified(fName, followLink);
298 }
299 
300 
302 (
303  const fileName& fName,
304  const std::string& ext
305 ) const
306 {
307  return Foam::mvBak(fName, ext);
308 }
309 
310 
312 (
313  const fileName& fName
314 ) const
315 {
316  return Foam::rm(fName);
317 }
318 
319 
321 (
322  const fileName& dir,
323  const bool silent
324 ) const
325 {
326  return Foam::rmDir(dir, silent);
327 }
328 
329 
331 (
332  const fileName& dir,
333  const fileName::Type type,
334  const bool filtergz,
335  const bool followLink
336 ) const
337 {
338  return Foam::readDir(dir, type, filtergz, followLink);
339 }
340 
341 
343 (
344  const fileName& src,
345  const fileName& dst,
346  const bool followLink
347 ) const
348 {
349  return Foam::cp(src, dst, followLink);
350 }
351 
352 
354 (
355  const fileName& src,
356  const fileName& dst
357 ) const
358 {
359  return Foam::ln(src, dst);
360 }
361 
362 
364 (
365  const fileName& src,
366  const fileName& dst,
367  const bool followLink
368 ) const
369 {
370  return Foam::mv(src, dst, followLink);
371 }
372 
373 
375 (
376  const bool checkGlobal,
377  const IOobject& io,
378  const word& typeName,
379  const bool search
380 ) const
381 {
382  if (debug)
383  {
384  Pout<< "uncollatedFileOperation::filePath :"
385  << " objectPath:" << io.objectPath()
386  << " checkGlobal:" << checkGlobal << endl;
387  }
388 
389  fileName objPath(filePathInfo(checkGlobal, true, io, search));
390 
391  if (debug)
392  {
393  Pout<< "uncollatedFileOperation::filePath :"
394  << " Returning from file searching:" << endl
395  << " objectPath:" << io.objectPath() << endl
396  << " filePath :" << objPath << endl << endl;
397  }
398  return objPath;
399 }
400 
401 
403 (
404  const bool checkGlobal,
405  const IOobject& io,
406  const bool search
407 ) const
408 {
409  if (debug)
410  {
411  Pout<< "uncollatedFileOperation::dirPath :"
412  << " objectPath:" << io.objectPath()
413  << " checkGlobal:" << checkGlobal << endl;
414  }
415 
416  fileName objPath(filePathInfo(checkGlobal, false, io, search));
417 
418  if (debug)
419  {
420  Pout<< "uncollatedFileOperation::dirPath :"
421  << " Returning from directory searching:" << endl
422  << " objectPath:" << io.objectPath() << endl
423  << " dirPath :" << objPath << endl << endl;
424  }
425  return objPath;
426 }
427 
428 
430 (
431  const objectRegistry& db,
432  const fileName& instance,
433  const fileName& local,
434  word& newInstance
435 ) const
436 {
437  if (debug)
438  {
439  Pout<< "uncollatedFileOperation::readObjects :"
440  << " db:" << db.objectPath()
441  << " instance:" << instance << endl;
442  }
443 
444  //- Use non-time searching version
445  fileNameList objectNames
446  (
447  fileOperation::readObjects(db, instance, local, newInstance)
448  );
449 
450  if (newInstance.empty())
451  {
452  // Find similar time
453  fileName newInst = db.time().findInstancePath(instant(instance));
454  if (!newInst.empty() && newInst != instance)
455  {
456  // Try with new time
457  objectNames = fileOperation::readObjects
458  (
459  db,
460  newInst,
461  local,
462  newInstance
463  );
464  }
465  }
466 
467  if (debug)
468  {
469  Pout<< "uncollatedFileOperation::readObjects :"
470  << " newInstance:" << newInstance
471  << " objectNames:" << objectNames << endl;
472  }
473 
474  return objectNames;
475 }
476 
477 
479 (
480  IOobject& io,
481  const fileName& fName,
482  const word& typeName
483 ) const
484 {
485  if (debug)
486  {
487  Pout<< "uncollatedFileOperation::readHeader :"
488  << " fName:" << fName
489  << " typeName:" << typeName << endl;
490  }
491  if (fName.empty())
492  {
493  if (IOobject::debug)
494  {
496  << "file " << io.objectPath() << " could not be opened"
497  << endl;
498  }
499 
500  return false;
501  }
502 
503  autoPtr<ISstream> isPtr(NewIFstream(fName));
504 
505  if (!isPtr || !isPtr->good())
506  {
507  return false;
508  }
509 
510  bool ok = io.readHeader(*isPtr);
511 
512  if (io.headerClassName() == decomposedBlockData::typeName)
513  {
514  // Read the header inside the container (master data)
515  ok = decomposedBlockData::readMasterHeader(io, *isPtr);
516  }
517 
518  if (debug)
519  {
520  Pout<< "uncollatedFileOperation::readHeader :"
521  << " for fName:" << fName
522  << " ok:" << ok
523  << " headerClassName:" << io.headerClassName() << endl;
524  }
525 
526  return ok;
527 }
528 
529 
532 (
533  regIOobject& io,
534  const fileName& fName,
535  const word& typeName,
536  const bool valid
537 ) const
538 {
539  if (!valid)
540  {
541  return autoPtr<ISstream>(new dummyISstream());
542  }
543 
544  if (fName.empty())
545  {
547  << "cannot find file " << io.objectPath()
548  << exit(FatalError);
549  }
550 
551  autoPtr<ISstream> isPtr = NewIFstream(fName);
552 
553  if (!isPtr || !isPtr->good())
554  {
556  (
557  "uncollatedFileOperation::readStream()",
558  __FILE__,
559  __LINE__,
560  fName,
561  0
562  ) << "cannot open file"
563  << exit(FatalIOError);
564  }
565  else if (!io.readHeader(*isPtr))
566  {
567  FatalIOErrorInFunction(*isPtr)
568  << "problem while reading header for object " << io.name()
569  << exit(FatalIOError);
570  }
571 
572  if (io.headerClassName() != decomposedBlockData::typeName)
573  {
574  return isPtr;
575  }
576  else
577  {
578  // Analyse the objectpath to find out the processor we're trying
579  // to access
580  label proci = detectProcessorPath(io.objectPath());
581 
582  if (proci == -1)
583  {
584  FatalIOErrorInFunction(*isPtr)
585  << "could not detect processor number"
586  << " from objectPath:" << io.objectPath()
587  << " fName:" << fName
588  << exit(FatalIOError);
589  }
590 
591  // Analyse the fileName for any processor subset. Note: this
592  // should really be part of filePath() which should return
593  // both file and index in file.
594  fileName path, procDir, local;
595  label groupStart, groupSize, nProcs;
596  splitProcessorPath
597  (
598  fName,
599  path,
600  procDir,
601  local,
602  groupStart,
603  groupSize,
604  nProcs
605  );
606  if (groupStart != -1 && groupSize > 0)
607  {
608  proci = proci-groupStart;
609  }
610 
611  // Read data and return as stream
612  return decomposedBlockData::readBlock(proci, *isPtr, io);
613  }
614 }
615 
616 
618 (
619  regIOobject& io,
620  const bool masterOnly,
622  const word& typeName
623 ) const
624 {
625  bool ok = true;
626  if (Pstream::master() || !masterOnly)
627  {
628  if (debug)
629  {
630  Pout<< "uncollatedFileOperation::read :"
631  << " Reading object " << io.objectPath()
632  << " from file " << endl;
633  }
634 
635  // Set flag for e.g. codeStream
636  const bool oldGlobal = io.globalObject();
637  io.globalObject() = masterOnly;
638  // If codeStream originates from dictionary which is
639  // not IOdictionary we have a problem so use global
640  const bool oldFlag = regIOobject::masterOnlyReading;
641  regIOobject::masterOnlyReading = masterOnly;
642 
643  // Read file
644  ok = io.readData(io.readStream(typeName));
645  io.close();
646 
647  // Restore flags
648  io.globalObject() = oldGlobal;
649  regIOobject::masterOnlyReading = oldFlag;
650 
651  if (debug)
652  {
653  Pout<< "uncollatedFileOperation::read :"
654  << " Done reading object " << io.objectPath()
655  << " from file " << endl;
656  }
657  }
658 
659  if (masterOnly && Pstream::parRun())
660  {
661  // Master reads headerclassname from file. Make sure this gets
662  // transferred as well as contents.
663  Pstream::scatter(io.headerClassName());
664  Pstream::scatter(io.note());
665 
666  // Get my communication order
667  const List<Pstream::commsStruct>& comms =
668  (
669  (Pstream::nProcs() < Pstream::nProcsSimpleSum)
670  ? Pstream::linearCommunication()
671  : Pstream::treeCommunication()
672  );
673  const Pstream::commsStruct& myComm = comms[Pstream::myProcNo()];
674 
675  // Receive from up
676  if (myComm.above() != -1)
677  {
678  IPstream fromAbove
679  (
680  Pstream::commsTypes::scheduled,
681  myComm.above(),
682  0,
683  Pstream::msgType(),
684  Pstream::worldComm,
685  format
686  );
687  ok = io.readData(fromAbove);
688  }
689 
690  // Send to my downstairs neighbours
691  forAll(myComm.below(), belowI)
692  {
693  OPstream toBelow
694  (
695  Pstream::commsTypes::scheduled,
696  myComm.below()[belowI],
697  0,
698  Pstream::msgType(),
699  Pstream::worldComm,
700  format
701  );
702  bool okWrite = io.writeData(toBelow);
703  ok = ok && okWrite;
704  }
705  }
706  return ok;
707 }
708 
709 
712 (
713  const fileName& filePath
714 ) const
715 {
716  return autoPtr<ISstream>(new IFstream(filePath));
717 }
718 
719 
722 (
723  const fileName& pathName,
724  IOstreamOption streamOpt,
725  const bool valid
726 ) const
727 {
728  return autoPtr<OSstream>(new OFstream(pathName, streamOpt));
729 }
730 
731 
732 // ************************************************************************* //
Foam::expressions::patchExpr::debug
int debug
Static debugging option.
uncollatedFileOperation.H
Foam::TimePaths::globalCaseName
const fileName & globalCaseName() const
Return global case name.
Definition: TimePathsI.H:48
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:104
InfoInFunction
#define InfoInFunction
Report an information message using Foam::Info.
Definition: messageStream.H:320
Foam::exists
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: MSwindows.C:625
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::fileOperation
An encapsulation of filesystem-related operations.
Definition: fileOperation.H:77
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::chMod
bool chMod(const fileName &name, const mode_t mode)
Set the file/directory mode, return true on success.
Definition: MSwindows.C:557
Foam::fileOperations::uncollatedFileOperation::mkDir
virtual bool mkDir(const fileName &, mode_t=0777) const
Make directory.
Definition: uncollatedFileOperation.C:200
Foam::fileOperations::uncollatedFileOperation::rm
virtual bool rm(const fileName &) const
Remove a file, returning true if successful otherwise false.
Definition: uncollatedFileOperation.C:312
Foam::IFstream
Input from file stream, using an ISstream.
Definition: IFstream.H:85
unthreadedInitialise
Foam::OPstream
Output inter-processor communications stream.
Definition: OPstream.H:52
Foam::regIOobject::writeData
virtual bool writeData(Ostream &) const =0
Pure virtual writeData function.
Foam::dummyISstream
Dummy input stream, which can be used as a placeholder for interfaces taking an Istream or ISstream....
Definition: dummyISstream.H:56
Foam::IOobject::rootPath
const fileName & rootPath() const
Definition: IOobject.C:455
Foam::IOobject::instance
const fileName & instance() const
Definition: IOobjectI.H:191
Foam::objectRegistry::time
const Time & time() const
Return time.
Definition: objectRegistry.H:186
Foam::fileName::Type
Type
Enumerations to handle directory entry types.
Definition: fileName.H:76
Foam::isFile
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: MSwindows.C:658
Foam::fileOperations::uncollatedFileOperation::mode
virtual mode_t mode(const fileName &, const bool followLink=true) const
Return the file mode.
Definition: uncollatedFileOperation.C:220
Foam::fileOperations::uncollatedFileOperation::filePathInfo
fileName filePathInfo(const bool checkGlobal, const bool isFile, const IOobject &io, const bool search) const
Search for an object.
Definition: uncollatedFileOperation.C:61
Foam::rm
bool rm(const fileName &file)
Remove a file (or its gz equivalent), returning true if successful.
Definition: MSwindows.C:994
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
An Ostream wrapper for parallel output to std::cout.
Foam::fileOperations::uncollatedFileOperation::mvBak
virtual bool mvBak(const fileName &, const std::string &ext="bak") const
Rename to a corresponding backup file.
Definition: uncollatedFileOperation.C:302
Foam::IOobject::time
const Time & time() const
Return time.
Definition: IOobject.C:449
Foam::fileOperations::uncollatedFileOperation::dirPath
virtual fileName dirPath(const bool checkGlobal, const IOobject &io, const bool search) const
Search for a directory. checkGlobal : also check undecomposed.
Definition: uncollatedFileOperation.C:403
Foam::fileOperations::uncollatedFileOperation::chMod
virtual bool chMod(const fileName &, const mode_t) const
Set the file mode.
Definition: uncollatedFileOperation.C:210
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::fileOperations::uncollatedFileOperation::filePath
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.
Definition: uncollatedFileOperation.C:375
Foam::IOobject::readHeader
bool readHeader(Istream &is)
Read header.
Definition: IOobjectReadHeader.C:35
dummyISstream.H
Foam::IOobject::db
const objectRegistry & db() const
Return the local objectRegistry.
Definition: IOobject.C:443
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:60
Foam::mode
mode_t mode(const fileName &name, const bool followLink=true)
Return the file mode, normally following symbolic links.
Definition: MSwindows.C:564
Foam::fileOperations::uncollatedFileOperation::fileSize
virtual off_t fileSize(const fileName &, const bool followLink=true) const
Return size of file.
Definition: uncollatedFileOperation.C:272
format
word format(conversionProperties.get< word >("format"))
Foam::objectRegistry::dbDir
virtual const fileName & dbDir() const
Local directory path of this objectRegistry relative to the time.
Definition: objectRegistry.H:198
Foam::IOobject::local
const fileName & local() const
Definition: IOobjectI.H:203
Foam::fileSize
off_t fileSize(const fileName &name, const bool followLink=true)
Return size of file or -1 on failure (normally follows symbolic links).
Definition: MSwindows.C:676
Foam::fileOperations::uncollatedFileOperation::readHeader
virtual bool readHeader(IOobject &, const fileName &, const word &typeName) const
Read object header from supplied file.
Definition: uncollatedFileOperation.C:479
Foam::tmpNrc
A class for managing temporary objects without reference counting.
Definition: tmpNrc.H:56
Foam::fileOperations::uncollatedFileOperation::highResLastModified
virtual double highResLastModified(const fileName &, const bool followLink=true) const
Return time of last file modification.
Definition: uncollatedFileOperation.C:292
Foam::IOobject::caseName
const fileName & caseName() const
Definition: IOobject.C:461
Foam::fileOperations::addToRunTimeSelectionTable
addToRunTimeSelectionTable(fileOperation, collatedFileOperation, word)
Foam::fileOperations::uncollatedFileOperation::mv
virtual bool mv(const fileName &src, const fileName &dst, const bool followLink=false) const
Rename src to dst.
Definition: uncollatedFileOperation.C:364
Foam::IOobject::globalObject
bool globalObject() const
Is object same for all processors?
Definition: IOobjectI.H:124
Foam::IOstreamOption
The IOstreamOption is a simple container for options an IOstream can normally have.
Definition: IOstreamOption.H:63
Foam::highResLastModified
double highResLastModified(const fileName &, const bool followLink=true)
Return time of last file modification.
Definition: MSwindows.C:699
DetailInfo
#define DetailInfo
Definition: evalEntry.C:36
Foam::IOstreamOption::streamFormat
streamFormat
Data format (ascii | binary)
Definition: IOstreamOption.H:70
Foam::FatalError
error FatalError
Foam::mv
bool mv(const fileName &src, const fileName &dst, const bool followLink=false)
Rename src to dst.
Definition: MSwindows.C:929
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam::fileOperations::uncollatedFileOperation::readObjects
virtual fileNameList readObjects(const objectRegistry &db, const fileName &instance, const fileName &local, word &newInstance) const
Search directory for objects. Used in IOobjectList.
Definition: uncollatedFileOperation.C:430
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::fileOperations::uncollatedFileOperation::NewIFstream
virtual autoPtr< ISstream > NewIFstream(const fileName &) const
Generate an ISstream that reads a file.
Definition: uncollatedFileOperation.C:712
Foam::fileOperations::uncollatedFileOperation::readDir
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.
Definition: uncollatedFileOperation.C:331
Foam::fileOperations::uncollatedFileOperation::lookupProcessorsPath
virtual tmpNrc< dirIndexList > lookupProcessorsPath(const fileName &) const
Lookup name of processorsDDD using cache. Return empty fileName.
Definition: uncollatedFileOperation.C:171
Foam::fileOperations::uncollatedFileOperation::isDir
virtual bool isDir(const fileName &, const bool followLink=true) const
Does the name exist as a DIRECTORY in the file system?
Definition: uncollatedFileOperation.C:251
fileOperationInitialise
Foam::UPstream::commsStruct::above
label above() const
Definition: UPstream.H:129
Foam::fileOperations::uncollatedFileOperation::rmDir
virtual bool rmDir(const fileName &dir, const bool silent=false) const
Remove a directory and its contents.
Definition: uncollatedFileOperation.C:321
Foam::UPstream::commsStruct
Structure for communicating between processors.
Definition: UPstream.H:80
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:87
Foam::IOobject::headerClassName
const word & headerClassName() const
Return name of the class name read from header.
Definition: IOobjectI.H:88
unthreadedInitialise.H
Foam::mvBak
bool mvBak(const fileName &src, const std::string &ext="bak")
Rename to a corresponding backup file.
Definition: MSwindows.C:958
Time.H
Foam::IOobject::note
const string & note() const
Return the optional note.
Definition: IOobjectI.H:100
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::regIOobject
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:68
Foam::Time::findInstancePath
word findInstancePath(const fileName &directory, const instant &t) const
Definition: Time.C:832
Foam::TimePaths::system
const word & system() const
Return system name.
Definition: TimePathsI.H:94
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:372
Foam::cp
bool cp(const fileName &src, const fileName &dst, const bool followLink=true)
Copy the source to the destination (recursively if necessary).
Definition: MSwindows.C:802
Fstream.H
Input/output from file streams.
Foam::rmDir
bool rmDir(const fileName &directory, const bool silent=false)
Remove a directory and its contents (optionally silencing warnings)
Definition: MSwindows.C:1018
Foam::regIOobject::close
void close()
Close Istream.
Definition: regIOobjectRead.C:182
decomposedBlockData.H
Foam::List< fileName >
Foam::fileOperations::uncollatedFileOperation::ln
virtual bool ln(const fileName &src, const fileName &dst) const
Create a softlink. dst should not exist. Returns true if.
Definition: uncollatedFileOperation.C:354
Foam::fileOperations::uncollatedFileOperation::uncollatedFileOperation
uncollatedFileOperation(bool verbose)
Construct null.
Definition: uncollatedFileOperation.C:183
Foam::type
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:590
path
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
Foam::search
fileName search(const word &file, const fileName &directory)
Recursively search the given directory for the file.
Definition: fileName.C:576
Foam::roots::type
type
Types of root.
Definition: Roots.H:54
Foam::fileOperations::uncollatedFileOperation::read
virtual bool read(regIOobject &, const bool masterOnly, const IOstream::streamFormat format, const word &typeName) const
Top-level read.
Definition: uncollatedFileOperation.C:618
Foam::regIOobject::readData
virtual bool readData(Istream &)
Virtual readData function.
Definition: regIOobjectRead.C:196
Foam::ln
bool ln(const fileName &src, const fileName &dst)
Create a softlink. dst should not exist. Returns true if successful.
Definition: MSwindows.C:915
Foam::IPstream
Input inter-processor communications stream.
Definition: IPstream.H:52
FatalIOErrorInFunction
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:392
Foam::instant
An instant of time. Contains the time value and name.
Definition: instant.H:52
Foam::fileOperations::uncollatedFileOperation::exists
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?
Definition: uncollatedFileOperation.C:240
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::fileOperations::uncollatedFileOperation::readStream
virtual autoPtr< ISstream > readStream(regIOobject &, const fileName &, const word &typeName, const bool procValid=true) const
Reads header for regIOobject and returns an ISstream.
Definition: uncollatedFileOperation.C:532
Foam::TimePaths::constant
const word & constant() const
Return constant name.
Definition: TimePathsI.H:88
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::fileOperations::uncollatedFileOperation::cp
virtual bool cp(const fileName &src, const fileName &dst, const bool followLink=true) const
Copy, recursively if necessary, the source to the destination.
Definition: uncollatedFileOperation.C:343
Foam::IOobject::path
fileName path() const
The complete path.
Definition: IOobject.C:467
Foam::readDir
fileNameList readDir(const fileName &directory, const fileName::Type type=fileName::FILE, const bool filtergz=true, const bool followLink=true)
Read a directory and return the entries as a fileName List.
Definition: MSwindows.C:707
Foam::fileOperations::uncollatedFileOperation::NewOFstream
virtual autoPtr< OSstream > NewOFstream(const fileName &pathname, IOstreamOption streamOpt=IOstreamOption(), const bool valid=true) const
Generate an OSstream that writes a file.
Definition: uncollatedFileOperation.C:722
Foam::fileName::isAbsolute
static bool isAbsolute(const std::string &str)
Return true if string starts with a '/'.
Definition: fileNameI.H:136
Foam::fileOperations::uncollatedFileOperation::isFile
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?
Definition: uncollatedFileOperation.C:261
Foam::lastModified
time_t lastModified(const fileName &name, const bool followLink=true)
Return time of last file modification (normally follows symbolic links).
Definition: MSwindows.C:692
Foam::fileOperations::defineTypeNameAndDebug
defineTypeNameAndDebug(collatedFileOperation, 0)
Foam::UPstream::commsStruct::below
const labelList & below() const
Definition: UPstream.H:134
Foam::isDir
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
Definition: MSwindows.C:643
Foam::fileOperations::uncollatedFileOperation::type
virtual fileName::Type type(const fileName &, const bool followLink=true) const
Return the file type: DIRECTORY, FILE or LINK.
Definition: uncollatedFileOperation.C:230
Foam::fileOperations::uncollatedFileOperation::lastModified
virtual time_t lastModified(const fileName &, const bool followLink=true) const
Return time of last file modification.
Definition: uncollatedFileOperation.C:282