masterUncollatedFileOperation.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::fileOperations::masterUncollatedFileOperation
26 
27 Description
28  fileOperations that performs all file operations on the master processor.
29  Requires the calls to be parallel synchronised!
30 
31 \*---------------------------------------------------------------------------*/
32 
33 #ifndef fileOperations_masterUncollatedFileOperation_H
34 #define fileOperations_masterUncollatedFileOperation_H
35 
36 #include "fileOperation.H"
37 #include "OSspecific.H"
38 #include "HashPtrTable.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 class PstreamBuffers;
46 
47 namespace fileOperations
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class masterUncollatedFileOperation Declaration
52 \*---------------------------------------------------------------------------*/
53 
55 :
56  public fileOperation
57 {
58 protected:
59 
60  // Protected data
61 
62  //- Cached times for a given directory
64 
65 
66  // Protected classes
67 
68  class mkDirOp
69  {
70  const mode_t mode_;
71  public:
72  mkDirOp(const mode_t mode)
73  :
74  mode_(mode)
75  {}
76 
77  bool operator()(const fileName& fName) const
78  {
79  return Foam::mkDir(fName, mode_);
80  }
81  };
82 
83  class chModOp
84  {
85  const mode_t mode_;
86  public:
87  chModOp(const mode_t mode)
88  :
89  mode_(mode)
90  {}
91 
92  bool operator()(const fileName& fName) const
93  {
94  return Foam::chMod(fName, mode_);
95  }
96  };
97 
98  class modeOp
99  {
100  const bool followLink_;
101  public:
102  modeOp(const bool followLink)
103  :
104  followLink_(followLink)
105  {}
107  mode_t operator()(const fileName& fName) const
108  {
109  return Foam::mode(fName, followLink_);
110  }
111  };
113  class typeOp
114  {
115  const bool followLink_;
116  public:
117  typeOp(const bool followLink)
118  :
119  followLink_(followLink)
120  {}
122  label operator()(const fileName& fName) const
123  {
124  return Foam::type(fName, followLink_);
125  }
126  };
128  class existsOp
129  {
130  const bool checkGzip_;
131  const bool followLink_;
132  public:
133  existsOp(const bool checkGzip, const bool followLink)
134  :
135  checkGzip_(checkGzip),
136  followLink_(followLink)
137  {}
139  bool operator()(const fileName& fName) const
140  {
141  return Foam::exists(fName, checkGzip_, followLink_);
142  }
143  };
145  class isDirOp
146  {
147  const bool followLink_;
148  public:
149  isDirOp(const bool followLink)
150  :
151  followLink_(followLink)
152  {}
153 
154  public:
155  bool operator()(const fileName& fName) const
156  {
157  return Foam::isDir(fName, followLink_);
158  }
159  };
161  class isFileOp
162  {
163  const bool checkGzip_;
164  const bool followLink_;
165  public:
166  isFileOp(const bool checkGzip, const bool followLink)
167  :
168  checkGzip_(checkGzip),
169  followLink_(followLink)
170  {}
171  public:
172  bool operator()(const fileName& fName) const
173  {
174  return Foam::isFile(fName, checkGzip_, followLink_);
175  }
176  };
178  class fileSizeOp
179  {
180  const bool followLink_;
181  public:
182  fileSizeOp(const bool followLink)
183  :
184  followLink_(followLink)
185  {}
186 
187  public:
188  off_t operator()(const fileName& fName) const
189  {
190  return Foam::fileSize(fName, followLink_);
191  }
192  };
194  class lastModifiedOp
195  {
196  const bool followLink_;
197  public:
198  lastModifiedOp(const bool followLink)
199  :
200  followLink_(followLink)
201  {}
202 
203  public:
204  time_t operator()(const fileName& fName) const
205  {
206  return Foam::lastModified(fName, followLink_);
207  }
208  };
210  class lastModifiedHROp
211  {
212  const bool followLink_;
213  public:
214  lastModifiedHROp(const bool followLink)
215  :
216  followLink_(followLink)
217  {}
218 
219  public:
220  double operator()(const fileName& fName) const
221  {
222  return Foam::highResLastModified(fName, followLink_);
223  }
224  };
226  class mvBakOp
227  {
228  std::string ext_;
229  public:
230  mvBakOp(const std::string& ext)
231  :
232  ext_(ext)
233  {}
235  bool operator()(const fileName& fName) const
236  {
237  return Foam::mvBak(fName, ext_);
238  }
239  };
241  class rmOp
242  {
243  public:
244  bool operator()(const fileName& fName) const
245  {
246  return Foam::rm(fName);
247  }
248  };
250  class rmDirOp
251  {
252  public:
253  bool operator()(const fileName& fName) const
254  {
255  return Foam::rmDir(fName);
256  }
257  };
259  class cpOp
260  {
261  const bool followLink_;
262  public:
263  cpOp(const bool followLink)
264  :
265  followLink_(followLink)
266  {}
267 
268  public:
269  bool operator()(const fileName& src, const fileName& dest) const
270  {
271  return Foam::cp(src, dest, followLink_);
272  }
273  };
275  class lnOp
276  {
277  public:
278  bool operator()(const fileName& src, const fileName& dest) const
279  {
280  return Foam::ln(src, dest);
281  }
282  };
284  class mvOp
285  {
286  const bool followLink_;
287  public:
288  mvOp(const bool followLink)
289  :
290  followLink_(followLink)
291  {}
292 
293  public:
294  bool operator()(const fileName& src, const fileName& dest) const
295  {
296  return Foam::mv(src, dest, followLink_);
297  }
298  };
300  class fileOrNullOp
301  {
302  const bool isFile_;
303  public:
304  fileOrNullOp(const bool isFile)
305  :
306  isFile_(isFile)
307  {}
309  fileName operator()(const fileName& fName) const
310  {
311  return
312  (
313  (isFile_ && Foam::isFile(fName))
314  || (!isFile_ && Foam::isDir(fName))
315  ? fName
317  );
318  }
319  };
321  class readDirOp
322  {
323  const fileName::Type type_;
324  const bool filtergz_;
325  const bool followLink_;
326  public:
328  (
329  const fileName::Type type,
330  const bool filtergz,
331  const bool followLink
332  )
333  :
334  type_(type),
335  filtergz_(filtergz),
336  followLink_(followLink)
337  {}
339  fileNameList operator()(const fileName& fName) const
340  {
341  return Foam::readDir(fName, type_, filtergz_, followLink_);
342  }
343  };
344 
345 
346  // Private Member Functions
347 
348  template<class Type>
349  Type scatterList(const UList<Type>&) const;
350 
351  template<class Type, class fileOp>
352  Type masterOp(const fileName&, const fileOp& fop) const;
353 
354  template<class Type, class fileOp>
355  Type masterOp
356  (
357  const fileName&,
358  const fileName&,
359  const fileOp& fop
360  ) const;
361 
362  //- Equivalent of Time::findInstance
363  static word findInstancePath
364  (
365  const instantList& timeDirs,
366  const instant& t
367  );
368 
369  //- Search for object; return info on how it was found
370  // checkGlobal : also check undecomposed case
371  // isFile : true:check for file false:check for directory
373  (
374  const bool checkGlobal,
375  const bool isFile,
376  const IOobject&,
377  pathType&,
378  word&
379  ) const;
380 
381  //- Construct filePath
382  static fileName objectPath
383  (
384  const IOobject&,
385  const pathType&,
386  const word&
387  );
388 
389  //- Read file contents and send to processors
390  static void readAndSend
391  (
392  const fileName& filePath,
393  const IOstream::compressionType cmp,
394  const labelUList& procs,
395  PstreamBuffers& pBufs
396  );
397 
398 
399 public:
400 
401  //- Runtime type information
402  TypeName("masterUncollated");
403 
404 
405  // Static data
406 
407  //- Max size of parallel communications. Switches from non-blocking
408  // to scheduled when reading/writing files. Read as float to enable
409  // easy specificiation of large sizes.
410  static float maxMasterFileBufferSize;
411 
412 
413  // Constructors
414 
415  //- Construct null
416  masterUncollatedFileOperation(const bool verbose);
417 
418 
419  //- Destructor
421 
422 
423  // Member Functions
424 
425  // OSSpecific equivalents
426 
427  //- Make directory
428  virtual bool mkDir(const fileName&, mode_t=0777) const;
429 
430  //- Set the file mode
431  virtual bool chMod(const fileName&, const mode_t) const;
432 
433  //- Return the file mode
434  virtual mode_t mode
435  (
436  const fileName&,
437  const bool followLink = true
438  ) const;
439 
440  //- Return the file type: DIRECTORY, FILE or LINK
441  virtual fileName::Type type
442  (
443  const fileName&,
444  const bool followLink = true
445  ) const;
446 
447  //- Does the name exist (as DIRECTORY or FILE) in the file system?
448  // Optionally enable/disable check for gzip file.
449  virtual bool exists
450  (
451  const fileName&,
452  const bool checkGzip=true,
453  const bool followLink = true
454  ) const;
455 
456  //- Does the name exist as a DIRECTORY in the file system?
457  virtual bool isDir
458  (
459  const fileName&,
460  const bool followLink = true
461  ) const;
462 
463  //- Does the name exist as a FILE in the file system?
464  // Optionally enable/disable check for gzip file.
465  virtual bool isFile
466  (
467  const fileName&,
468  const bool checkGzip=true,
469  const bool followLink = true
470  ) const;
471 
472  //- Return size of file
473  virtual off_t fileSize
474  (
475  const fileName&,
476  const bool followLink = true
477  ) const;
478 
479  //- Return time of last file modification
480  virtual time_t lastModified
481  (
482  const fileName&,
483  const bool followLink = true
484  ) const;
485 
486  //- Return time of last file modification
487  virtual double highResLastModified
488  (
489  const fileName&,
490  const bool followLink = true
491  ) const;
492 
493  //- Read a directory and return the entries as a string list
494  virtual fileNameList readDir
495  (
496  const fileName&,
498  const bool filtergz=true,
499  const bool followLink = true
500  ) const;
501 
502  //- Copy, recursively if necessary, the source to the destination
503  virtual bool cp
504  (
505  const fileName& src,
506  const fileName& dst,
507  const bool followLink = true
508  ) const;
509 
510  //- Create a softlink. dst should not exist. Returns true if
511  // successful.
512  virtual bool ln(const fileName& src, const fileName& dst) const;
513 
514  //- Rename src to dst
515  virtual bool mv
516  (
517  const fileName& src,
518  const fileName& dst,
519  const bool followLink = false
520  ) const;
521 
522  //- Rename to a corresponding backup file
523  // If the backup file already exists, attempt with
524  // "01" .. "99" suffix
525  virtual bool mvBak
526  (
527  const fileName&,
528  const std::string& ext = "bak"
529  ) const;
530 
531  //- Remove a file, returning true if successful otherwise false
532  virtual bool rm(const fileName&) const;
533 
534  //- Remove a dirctory and its contents
535  virtual bool rmDir(const fileName&) const;
536 
537 // //- Open a shared library. Return handle to library. Print error
538 // // message if library cannot be loaded (check = true)
539 // virtual void* dlOpen
540 // (
541 // const fileName& lib,
542 // const bool check = true
543 // ) const;
544 
545 
546  // (reg)IOobject functinality
547 
548  //- Search for an object. checkGlobal : also check undecomposed case
549  virtual fileName filePath
550  (
551  const bool checkGlobal,
552  const IOobject&,
553  const word& typeName
554  ) const;
555 
556  //- Search for a directory. checkGlobal : also check undecomposed
557  // case
558  virtual fileName dirPath
559  (
560  const bool checkGlobal,
561  const IOobject&
562  ) const;
563 
564  //- Search directory for objects. Used in IOobjectList.
565  virtual fileNameList readObjects
566  (
567  const objectRegistry& db,
568  const fileName& instance,
569  const fileName& local,
570  word& newInstance
571  ) const;
572 
573  //- Read object header from supplied file
574  virtual bool readHeader
575  (
576  IOobject&,
577  const fileName&,
578  const word& typeName
579  ) const;
580 
581  //- Reads header for regIOobject and returns an ISstream
582  // to read the contents.
584  (
585  regIOobject&,
586  const fileName&,
587  const word& typeName,
588  const bool valid = true
589  ) const;
590 
591  //- Top-level read
592  virtual bool read
593  (
594  regIOobject&,
595  const bool masterOnly,
597  const word& typeName
598  ) const;
599 
600  //- Writes a regIOobject (so header, contents and divider).
601  // Returns success state.
602  virtual bool writeObject
603  (
604  const regIOobject&,
608  const bool valid = true
609  ) const;
610 
611  //- Generate an ISstream that reads a file
612  virtual autoPtr<ISstream> NewIFstream(const fileName&) const;
613 
614  //- Generate an Ostream that writes a file
616  (
617  const fileName& pathname,
621  const bool valid = true
622  ) const;
623 
624 
625  // File modification checking
626 
627  //- Add watching of a file. Returns handle
628  virtual label addWatch(const fileName&) const;
629 
630  //- Remove watch on a file (using handle)
631  virtual bool removeWatch(const label) const;
632 
633  //- Find index (or -1) of file in list of handles
634  virtual label findWatch
635  (
636  const labelList& watchIndices,
637  const fileName&
638  ) const;
639 
640  //- Helper: add watches for list of regIOobjects
641  virtual void addWatches(regIOobject&, const fileNameList&) const;
642 
643  //- Get name of file being watched (using handle)
644  virtual fileName getFile(const label) const;
645 
646  //- Update state of all files
647  virtual void updateStates
648  (
649  const bool masterOnly,
650  const bool syncPar
651  ) const;
652 
653  //- Get current state of file (using handle)
654  virtual fileMonitor::fileState getState(const label) const;
655 
656  //- Set current state of file (using handle) to unmodified
657  virtual void setUnmodified(const label) const;
658 
659 
660  // Other
661 
662  //- Same file?
663  static bool uniformFile(const fileNameList&);
664 
665  //- Get sorted list of times
666  virtual instantList findTimes(const fileName&, const word&) const;
667 
668  //- Callback for time change
669  virtual void setTime(const Time&) const;
670 
671  //- root+casename with any 'processorXXX' replaced by 'processsors'
672  static fileName processorsCasePath(const IOobject&);
673 
674  //- Like io.path with provided instance and any 'processorXXX'
675  // replaced by 'processsors'
676  static fileName processorsPath(const IOobject&, const word&);
677 
678  //- Operating on fileName: replace processorXXX with processors
679  static fileName processorsPath(const fileName&);
680 
681  //- Split fileName into part before processor and part after.
682  // Returns -1 or processor number. Use with care.
683  // - path/"processor" + Foam::name(proci)/local reconstructs input
684  // - path/"processors"/local reconstructs processors equivalence
686  (
687  const fileName&,
688  fileName& path,
689  fileName& local
690  );
691 
692  //- Return cached times
693  const HashPtrTable<instantList>& times() const
694  {
695  return times_;
696  }
697 };
698 
699 
700 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
701 
702 } // End namespace fileOperations
703 } // End namespace Foam
704 
705 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
706 
707 #ifdef NoRepository
709 #endif
710 
711 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
712 
713 #endif
714 
715 // ************************************************************************* //
pathType
Enumeration for the location of an IOobject.
Definition: fileOperation.H:87
virtual mode_t mode(const fileName &, const bool followLink=true) const
Return the file mode.
static word findInstancePath(const instantList &timeDirs, const instant &t)
Equivalent of Time::findInstance.
time_t lastModified(const fileName &, const bool followLink=true)
Return time of last file modification.
Definition: POSIX.C:594
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?
virtual fileMonitor::fileState getState(const label) const
Get current state of file (using handle)
virtual bool cp(const fileName &src, const fileName &dst, const bool followLink=true) const
Copy, recursively if necessary, the source to the destination.
virtual bool chMod(const fileName &, const mode_t) const
Set the file mode.
virtual bool mv(const fileName &src, const fileName &dst, const bool followLink=false) const
Rename src to dst.
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.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
bool mv(const fileName &src, const fileName &dst, const bool followLink=false)
Rename src to dst.
Definition: POSIX.C:913
A class for handling file names.
Definition: fileName.H:69
virtual time_t lastModified(const fileName &, const bool followLink=true) const
Return time of last file modification.
virtual label addWatch(const fileName &) const
Add watching of a file. Returns handle.
HashPtrTable< instantList > times_
Cached times for a given directory.
virtual autoPtr< Ostream > NewOFstream(const fileName &pathname, IOstream::streamFormat format=IOstream::ASCII, IOstream::versionNumber version=IOstream::currentVersion, IOstream::compressionType compression=IOstream::UNCOMPRESSED, const bool valid=true) const
Generate an Ostream that writes a file.
virtual autoPtr< ISstream > NewIFstream(const fileName &) const
Generate an ISstream that reads a file.
off_t fileSize(const fileName &, const bool followLink=true)
Return size of file.
Definition: POSIX.C:572
fileState
Enumeration defining the file state.
Definition: fileMonitor.H:69
virtual double highResLastModified(const fileName &, const bool followLink=true) const
Return time of last file modification.
static const fileName null
An empty fileName.
Definition: fileName.H:97
virtual autoPtr< ISstream > readStream(regIOobject &, const fileName &, const word &typeName, const bool valid=true) const
Reads header for regIOobject and returns an ISstream.
TypeName("masterUncollated")
Runtime type information.
virtual bool readHeader(IOobject &, const fileName &, const word &typeName) const
Read object header from supplied file.
virtual bool isDir(const fileName &, const bool followLink=true) const
Does the name exist as a DIRECTORY in the file system?
virtual bool rmDir(const fileName &) const
Remove a dirctory and its contents.
bool cp(const fileName &src, const fileName &dst, const bool followLink=true)
Copy, recursively if necessary, the source to the destination.
Definition: POSIX.C:739
word format(conversionProperties.lookup("format"))
virtual bool ln(const fileName &src, const fileName &dst) const
Create a softlink. dst should not exist. Returns true if.
A HashTable specialization for hashing pointers.
Definition: HashPtrTable.H:50
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
bool mvBak(const fileName &, const std::string &ext="bak")
Rename to a corresponding backup file.
Definition: POSIX.C:942
static fileName objectPath(const IOobject &, const pathType &, const word &)
Construct filePath.
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
virtual bool writeObject(const regIOobject &, IOstream::streamFormat format=IOstream::ASCII, IOstream::versionNumber version=IOstream::currentVersion, IOstream::compressionType compression=IOstream::UNCOMPRESSED, const bool valid=true) const
Writes a regIOobject (so header, contents and divider).
static label splitProcessorPath(const fileName &, fileName &path, fileName &local)
Split fileName into part before processor and part after.
fileName filePathInfo(const bool checkGlobal, const bool isFile, const IOobject &, pathType &, word &) const
Search for object; return info on how it was found.
static instantList timeDirs
Definition: globalFoam.H:44
static float maxMasterFileBufferSize
Max size of parallel communications. Switches from non-blocking.
bool isDir(const fileName &, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
Definition: POSIX.C:536
A class for handling words, derived from string.
Definition: word.H:59
mode_t mode(const fileName &, const bool followLink=true)
Return the file mode.
Definition: POSIX.C:467
virtual void addWatches(regIOobject &, const fileNameList &) const
Helper: add watches for list of regIOobjects.
static void readAndSend(const fileName &filePath, const IOstream::compressionType cmp, const labelUList &procs, PstreamBuffers &pBufs)
Read file contents and send to processors.
streamFormat
Enumeration for the format of data in the stream.
Definition: IOstream.H:86
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?
virtual bool removeWatch(const label) const
Remove watch on a file (using handle)
virtual void updateStates(const bool masterOnly, const bool syncPar) const
Update state of all files.
bool ln(const fileName &src, const fileName &dst)
Create a softlink. dst should not exist. Returns true if successful.
Definition: POSIX.C:872
compressionType
Enumeration for the format of data in the stream.
Definition: IOstream.H:193
bool rmDir(const fileName &)
Remove a dirctory and its contents.
Definition: POSIX.C:1008
bool isFile(const fileName &, const bool checkGzip=true, const bool followLink=true)
Does the name exist as a FILE in the file system?
Definition: POSIX.C:551
virtual fileName filePath(const bool checkGlobal, const IOobject &, const word &typeName) const
Search for an object. checkGlobal : also check undecomposed case.
virtual bool mvBak(const fileName &, const std::string &ext="bak") const
Rename to a corresponding backup file.
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
Buffers for inter-processor communications streams (UOPstream, UIPstream).
bool mkDir(const fileName &, mode_t=0777)
Make a directory and return an error if it could not be created.
Definition: POSIX.C:297
fileName::Type type(const fileName &, const bool followLink=true)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:485
virtual bool mkDir(const fileName &, mode_t=0777) const
Make directory.
virtual instantList findTimes(const fileName &, const word &) const
Get sorted list of times.
An instant of time. Contains the time value and name.
Definition: instant.H:66
virtual bool rm(const fileName &) const
Remove a file, returning true if successful otherwise false.
static bool uniformFile(const fileNameList &)
Same file?
static const versionNumber currentVersion
Current version number.
Definition: IOstream.H:206
static fileName processorsPath(const IOobject &, const word &)
Like io.path with provided instance and any &#39;processorXXX&#39;.
virtual bool read(regIOobject &, const bool masterOnly, const IOstream::streamFormat format, const word &typeName) const
Top-level read.
virtual void setUnmodified(const label) const
Set current state of file (using handle) to unmodified.
bool chMod(const fileName &, const mode_t)
Set the file mode.
Definition: POSIX.C:453
Version number type.
Definition: IOstream.H:96
const HashPtrTable< instantList > & times() const
Return cached times.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:65
fileNameList readDir(const fileName &, const fileName::Type=fileName::FILE, const bool filtergz=true, const bool followLink=true)
Read a directory and return the entries as a string list.
Definition: POSIX.C:641
virtual fileName::Type type(const fileName &, const bool followLink=true) const
Return the file type: DIRECTORY, FILE or LINK.
virtual fileName getFile(const label) const
Get name of file being watched (using handle)
virtual off_t fileSize(const fileName &, const bool followLink=true) const
Return size of file.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
virtual label findWatch(const labelList &watchIndices, const fileName &) const
Find index (or -1) of file in list of handles.
virtual fileNameList readObjects(const objectRegistry &db, const fileName &instance, const fileName &local, word &newInstance) const
Search directory for objects. Used in IOobjectList.
bool rm(const fileName &)
Remove a file, returning true if successful otherwise false.
Definition: POSIX.C:984
Registry of regIOobjects.
virtual void setTime(const Time &) const
Callback for time change.
fileOperations that performs all file operations on the master processor. Requires the calls to be pa...
virtual fileName dirPath(const bool checkGlobal, const IOobject &) const
Search for a directory. checkGlobal : also check undecomposed.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
static fileName processorsCasePath(const IOobject &)
root+casename with any &#39;processorXXX&#39; replaced by &#39;processsors&#39;
bool exists(const fileName &, const bool checkGzip=true, const bool followLink=true)
Does the name exist (as DIRECTORY or FILE) in the file system?
Definition: POSIX.C:517
Type
Enumerations to handle file types and modes.
Definition: fileName.H:82
Namespace for OpenFOAM.
double highResLastModified(const fileName &, const bool followLink=true)
Return time of last file modification.
Definition: POSIX.C:616