Loading...
Searching...
No Matches
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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2017 OpenFOAM Foundation
9 Copyright (C) 2019-2025 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::fileOperations::masterUncollatedFileOperation
29
30Description
31 fileOperations that performs all file operations on the master processor.
32 Requires the calls to be parallel synchronised!
33
34 Limitations
35 - no /processor in filename
36 - no /uniform/ in the filename
37
38 The main logic is in ::filePath which returns a
39 - same path on all processors. This can either be a global file
40 (system/controlDict, processorXXX/0/uniform/) or a collated file
41 (processors/0/p)
42 - same path on all processors of the local communicator
43 (processors4_0-1/0/p)
44 - different path on all processors (processor0/0/p)
45
46 system/controlDict:
47 filePath worldmaster: <globalRoot>/system/controlDict
48 localmaster: ,,
49 slave : ,,
50
51 processor0/uniform/time
52 filePath worldmaster: <globalRoot>/processorXXX/uniform/time
53 localmaster: ,,
54 slave : ,,
55
56 processors0/0/p
57 processors10/0/p
58 processors10_2-4/0/p
59
60\*---------------------------------------------------------------------------*/
61
62#ifndef Foam_fileOperations_masterUncollatedFileOperation_H
63#define Foam_fileOperations_masterUncollatedFileOperation_H
64
65#include "fileOperation.H"
66#include "OSspecific.H"
67#include "HashPtrTable.H"
68#include "DynamicList.H"
69
70// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
71
72namespace Foam
73{
74
75// Forward Declarations
76class PstreamBuffers;
77
79{
80
81/*---------------------------------------------------------------------------*\
82 Class masterUncollatedFileOperation Declaration
83\*---------------------------------------------------------------------------*/
84
86:
87 public fileOperation
88{
89 // Private Data
90
91 //- Communicator allocated/managed by us
92 mutable label managedComm_;
93
94
95 // Private Member Functions
96
97 //- Any initialisation steps after constructing
98 void init(bool verbose);
99
100
101protected:
102
103 // Protected Data
104
105 //- Cached times for a given directory
107
108
109 // Protected Operation Functors
111 class mkDirOp
112 {
113 const mode_t mode_;
114 public:
115 mkDirOp(const mode_t mode)
116 :
117 mode_(mode)
118 {}
120 bool operator()(const fileName& f) const
121 {
122 return Foam::mkDir(f, mode_);
123 }
124 };
126 class chModOp
127 {
128 const mode_t mode_;
129 public:
130 chModOp(const mode_t mode)
131 :
132 mode_(mode)
133 {}
135 bool operator()(const fileName& f) const
136 {
137 return Foam::chMod(f, mode_);
138 }
139 };
141 class modeOp
142 {
143 const bool followLink_;
144 public:
145 modeOp(const bool followLink)
146 :
147 followLink_(followLink)
148 {}
150 mode_t operator()(const fileName& f) const
151 {
152 return Foam::mode(f, followLink_);
153 }
154 };
156 class typeOp
157 {
158 const bool followLink_;
159 public:
160 typeOp(const bool followLink)
161 :
162 followLink_(followLink)
163 {}
164
165 // Returns int (for reductions) instead of fileName::Type
166 int operator()(const fileName& f) const
167 {
168 return Foam::type(f, followLink_);
169 }
170 };
172 class existsOp
173 {
174 const bool checkGzip_;
175 const bool followLink_;
176 public:
177 existsOp(const bool checkGzip, const bool followLink)
178 :
179 checkGzip_(checkGzip),
180 followLink_(followLink)
181 {}
183 bool operator()(const fileName& f) const
184 {
185 return Foam::exists(f, checkGzip_, followLink_);
186 }
187 };
189 class isDirOp
190 {
191 const bool followLink_;
192 public:
193 isDirOp(const bool followLink)
194 :
195 followLink_(followLink)
196 {}
198 bool operator()(const fileName& f) const
199 {
200 return Foam::isDir(f, followLink_);
201 }
202 };
204 class isFileOp
205 {
206 const bool checkGzip_;
207 const bool followLink_;
208 public:
209 isFileOp(const bool checkGzip, const bool followLink)
210 :
211 checkGzip_(checkGzip),
212 followLink_(followLink)
213 {}
215 bool operator()(const fileName& f) const
216 {
217 return Foam::isFile(f, checkGzip_, followLink_);
218 }
219 };
221 class fileSizeOp
222 {
223 const bool followLink_;
224 public:
225 fileSizeOp(bool followLink) noexcept
226 :
227 followLink_(followLink)
228 {}
230 off_t operator()(const fileName& f) const
231 {
232 return Foam::fileSize(f, followLink_);
233 }
234 };
236 class lastModifiedOp
237 {
238 const bool followLink_;
239 public:
240 lastModifiedOp(const bool followLink)
241 :
242 followLink_(followLink)
243 {}
245 time_t operator()(const fileName& f) const
246 {
247 return Foam::lastModified(f, followLink_);
248 }
249 };
252 {
253 const bool followLink_;
254 public:
255 highResLastModifiedOp(const bool followLink)
256 :
257 followLink_(followLink)
258 {}
260 double operator()(const fileName& f) const
261 {
262 return Foam::highResLastModified(f, followLink_);
263 }
264 };
266 class mvBakOp
267 {
268 std::string ext_;
269 public:
270 mvBakOp(const std::string& ext)
271 :
272 ext_(ext)
273 {}
275 bool operator()(const fileName& f) const
276 {
277 return Foam::mvBak(f, ext_);
278 }
279 };
281 class rmOp
282 {
283 public:
284 bool operator()(const fileName& f) const
285 {
286 return Foam::rm(f);
287 }
288 };
290 class rmDirOp
291 {
292 bool silent_;
293 bool emptyOnly_;
294 public:
295 rmDirOp(bool silent=false, bool emptyOnly=false)
296 :
297 silent_(silent),
298 emptyOnly_(emptyOnly)
299 {}
301 bool operator()(const fileName& f) const
302 {
303 return Foam::rmDir(f, silent_, emptyOnly_);
304 }
305 };
307 class cpOp
308 {
309 const bool followLink_;
310 public:
311 cpOp(const bool followLink)
312 :
313 followLink_(followLink)
314 {}
316 bool operator()(const fileName& src, const fileName& dest) const
317 {
318 return Foam::cp(src, dest, followLink_);
319 }
320 };
322 class lnOp
323 {
324 public:
325 bool operator()(const fileName& src, const fileName& dest) const
326 {
327 return Foam::ln(src, dest);
328 }
329 };
331 class mvOp
332 {
333 const bool followLink_;
334 public:
335 mvOp(const bool followLink)
336 :
337 followLink_(followLink)
338 {}
340 bool operator()(const fileName& src, const fileName& dest) const
341 {
342 return Foam::mv(src, dest, followLink_);
343 }
344 };
346 class fileOrNullOp
347 {
348 const bool isFile_;
349 public:
350 fileOrNullOp(const bool isFile)
351 :
352 isFile_(isFile)
353 {}
355 const fileName& operator()(const fileName& f) const
356 {
357 return
358 (
359 (isFile_ ? Foam::isFile(f) : Foam::isDir(f))
360 ? f
361 : fileName::null // const reference, not temporary
362 );
363 }
364 };
366 class readDirOp
367 {
368 const fileName::Type type_;
369 const bool filtergz_;
370 const bool followLink_;
371 public:
373 (
374 const fileName::Type type,
375 const bool filtergz,
376 const bool followLink
377 )
378 :
379 type_(type),
380 filtergz_(filtergz),
381 followLink_(followLink)
382 {}
384 fileNameList operator()(const fileName& f) const
385 {
386 return Foam::readDir(f, type_, filtergz_, followLink_);
387 }
388 };
389
390
391 // Private Member Functions
392
393 template<class Type, class FileOp>
394 Type masterOp
395 (
396 const fileName& fName,
397 const FileOp& fop,
398 const int tag,
399 const label comm
400 ) const;
401
402 template<class Type, class FileOp>
403 Type masterOp
404 (
405 const fileName& src,
406 const fileName& dest,
407 const FileOp& fop,
408 const int tag,
409 const label comm
410 ) const;
411
412 //- Search (locally!) for object; return info on how it was found.
413 // Does not do any parallel communication.
414 virtual fileName filePathInfo
415 (
417 const bool checkGlobal,
419 const bool isFile,
420 const IOobject& io,
421 const dirIndexList& pDirs,
422 const bool search,
424 pathType& searchType,
428 word& instance
429 ) const;
430
431 //- Construct filePath
433 (
434 const IOobject&,
435 const pathType& searchType,
436 const word& processorsDir,
437 const word& instancePath
438 ) const;
439
440 //- Read file contents and send to processors.
441 // Handles compressed or uncompressed files
442 static void readAndSend
443 (
444 const fileName& filePath,
445 const labelUList& recvProcs,
446 PstreamBuffers& pBufs
447 );
448
449 //- Read files on comms master
451 (
452 IOobject& io,
453 const label comm,
454 const bool uniform, // on comms master only
455 const fileNameList& filePaths, // on comms master and sub-ranks
456 const boolUList& readOnProcs // on comms master and sub-ranks
457 );
458
459 //- Helper: check IO for local existence. Like filePathInfo but
460 // without parent searchign and instance searching
461 bool exists(const dirIndexList&, IOobject& io) const;
462
463
464public:
465
466 //- Runtime type information
467 TypeName("masterUncollated");
468
469
470 // Static Data
471
472 //- Max size of parallel communications. Switches from non-blocking
473 // to scheduled when reading/writing files. Read as float to enable
474 // easy specification of large sizes.
475 static float maxMasterFileBufferSize;
476
477
478 // Constructors
479
480 //- Default construct
481 explicit masterUncollatedFileOperation(bool verbose = false);
482
483 //- Construct from communicator with specified io-ranks
485 (
486 const Tuple2<label, labelList>& commAndIORanks,
487 const bool distributedRoots,
488 bool verbose = false
489 );
490
491
492 //- Destructor
494
495
496 // Member Functions
497
498 //- Transfer ownership of communicator to this fileOperation.
499 //- Use with caution
500 virtual void storeComm() const;
501
502
503 // OSSpecific equivalents
504
505 //- Make directory
506 virtual bool mkDir(const fileName&, mode_t=0777) const;
507
508 //- Set the file mode
509 virtual bool chMod(const fileName&, const mode_t) const;
510
511 //- Return the file mode
512 virtual mode_t mode
513 (
514 const fileName&,
515 const bool followLink = true
516 ) const;
517
518 //- Return the file type: DIRECTORY, FILE or SYMLINK
519 virtual fileName::Type type
520 (
521 const fileName&,
522 const bool followLink = true
523 ) const;
524
525 //- Does the name exist (as DIRECTORY or FILE) in the file system?
526 // Optionally enable/disable check for gzip file.
527 virtual bool exists
528 (
529 const fileName&,
530 const bool checkGzip=true,
531 const bool followLink = true
532 ) const;
533
534 //- Does the name exist as a DIRECTORY in the file system?
535 virtual bool isDir
536 (
537 const fileName&,
538 const bool followLink = true
539 ) const;
540
541 //- Does the name exist as a FILE in the file system?
542 // Optionally enable/disable check for gzip file.
543 virtual bool isFile
544 (
545 const fileName&,
546 const bool checkGzip=true,
547 const bool followLink = true
548 ) const;
549
550 //- Return size of file
551 virtual off_t fileSize
552 (
553 const fileName&,
554 const bool followLink = true
555 ) const;
556
557 //- Return time of last file modification
558 virtual time_t lastModified
559 (
560 const fileName&,
561 const bool followLink = true
562 ) const;
563
564 //- Return time of last file modification
565 virtual double highResLastModified
566 (
567 const fileName&,
568 const bool followLink = true
569 ) const;
570
571 //- Read a directory and return the entries as a string list
572 virtual fileNameList readDir
573 (
574 const fileName&,
576 const bool filtergz=true,
577 const bool followLink = true
578 ) const;
579
580 //- Copy, recursively if necessary, the source to the destination
581 virtual bool cp
582 (
583 const fileName& src,
584 const fileName& dst,
585 const bool followLink = true
586 ) const;
587
588 //- Create a softlink. dst should not exist. Returns true if
589 // successful.
590 virtual bool ln(const fileName& src, const fileName& dst) const;
591
592 //- Rename src to dst
593 virtual bool mv
594 (
595 const fileName& src,
596 const fileName& dst,
597 const bool followLink = false
598 ) const;
599
600 //- Rename to a corresponding backup file
601 // If the backup file already exists, attempt with
602 // "01" .. "99" suffix
603 virtual bool mvBak
604 (
605 const fileName&,
606 const std::string& ext = "bak"
607 ) const;
608
609 //- Remove a file, returning true if successful otherwise false
610 virtual bool rm(const fileName&) const;
611
612 //- Remove a directory and its contents
613 // \param dir the directory to remove
614 // \param silent do not report missing directory
615 // \param emptyOnly only remove empty directories (recursive)
616 virtual bool rmDir
617 (
618 const fileName& dir,
619 const bool silent = false,
620 const bool emptyOnly = false
621 ) const;
622
623
624 // (reg)IOobject functinality
625
626 //- Search for an object
627 virtual fileName filePath
628 (
630 const bool checkGlobal,
631 const IOobject& io,
632 const word& typeName,
633 const bool search
634 ) const;
635
636 //- Search for a directory
637 virtual fileName dirPath
638 (
640 const bool checkGlobal,
641 const IOobject& io,
642 const bool search
643 ) const;
644
645 //- Search directory for objects. Used in IOobjectList.
647 (
648 const objectRegistry& db,
649 const fileName& instance,
650 const fileName& local,
651 word& newInstance
652 ) const;
653
654 //- Read object header from supplied file
655 virtual bool readHeader
656 (
657 IOobject&,
658 const fileName&,
659 const word& typeName
660 ) const;
661
662 //- Reads header for regIOobject and returns an ISstream
663 //- to read the contents.
665 (
667 const fileName&,
668 const word& typeName,
669 const bool readOnProc = true
670 ) const;
671
672 //- Top-level read
673 virtual bool read
674 (
676 const bool masterOnly,
680 const word& typeName
681 ) const;
682
683 //- Writes a regIOobject (so header, contents and divider).
684 // Returns success state.
685 virtual bool writeObject
686 (
687 const regIOobject& io,
688 IOstreamOption streamOpt = IOstreamOption(),
689 const bool writeOnProc = true
690 ) const;
691
692 //- Generate an ISstream that reads a file
693 virtual autoPtr<ISstream> NewIFstream(const fileName&) const;
694
695 //- Generate an OSstream that writes a file
697 (
698 const fileName& pathname,
699 IOstreamOption streamOpt = IOstreamOption(),
700 const bool writeOnProc = true
701 ) const;
702
703 //- Generate an OSstream that writes a file
705 (
707 const fileName& pathname,
708 IOstreamOption streamOpt = IOstreamOption(),
709 const bool writeOnProc = true
710 ) const;
711
712
713 // File modification checking
714
715 //- Add watching of a file. Returns handle
716 virtual label addWatch(const fileName&) const;
717
718 //- Remove watch on a file (using handle)
719 virtual bool removeWatch(const label) const;
720
721 //- Find index (or -1) of file in list of handles
722 virtual label findWatch
723 (
724 const labelList& watchIndices,
725 const fileName&
726 ) const;
727
728 //- Helper: add watches for list of regIOobjects
729 virtual void addWatches(regIOobject&, const fileNameList&) const;
730
731 //- Get name of file being watched (using handle)
732 virtual fileName getFile(const label) const;
733
734 //- Update state of all files
735 virtual void updateStates
736 (
737 const bool masterOnly,
738 const bool syncPar
739 ) const;
740
741 //- Get current state of file (using handle)
742 virtual fileMonitor::fileState getState(const label) const;
743
744 //- Set current state of file (using handle) to unmodified
745 virtual void setUnmodified(const label) const;
746
747
748 // Other
749
750 //- Get sorted list of times
751 virtual instantList findTimes
752 (
754 const fileName& directory,
756 const word& constantName = "constant"
757 ) const;
758
759 //- Find time instance where IOobject is located.
760 //- The name of the IOobject can be empty, in which case only the
761 //- IOobject::local() is checked.
762 //- Does not search beyond \c stopInstance (if set) or \c constant.
763 // If the instance cannot be found:
764 // - FatalError when readOpt is (MUST_READ or READ_MODIFIED)
765 // - returns the \c stopInstance (if set and reached)
766 // - return \c constant if constant_fallback is true.
767 // - return an empty word if constant_fallback is false.
768 // .
769 virtual IOobject findInstance
770 (
771 const IOobject& io,
772 const scalar startValue,
774 const word& stopInstance = "",
776 const bool constant_fallback = true
777 ) const;
778
779 //- Callback for time change
780 virtual void setTime(const Time&) const;
781
782 //- Forcibly wait until all output done. Flush any cached data
783 virtual void flush() const;
784
785 //- Forcibly parallel sync
786 virtual void sync();
787
788 //- Return cached times
790 {
791 return times_;
792 }
793};
794
795
796// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
797
798} // End namespace fileOperations
799} // End namespace Foam
800
801// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
802
803#ifdef NoRepository
805#endif
806
807// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
808
809#endif
810
811// ************************************************************************* //
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
A HashTable of pointers to objects of type <T>, with deallocation management of the pointers.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition IOobject.H:191
A simple container for options an IOstream can normally have.
streamFormat
Data format (ascii | binary | coherent).
atomicType
Atomic operations (output).
Buffers for inter-processor communications streams (UOPstream, UIPstream).
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
Definition Tuple2.H:51
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
fileState
Enumeration defining the file state.
Definition fileMonitor.H:71
A class for handling file names.
Definition fileName.H:75
Type
Enumerations to handle directory entry types.
Definition fileName.H:82
@ FILE
A regular file.
Definition fileName.H:84
static const fileName null
An empty fileName.
Definition fileName.H:111
List< dirIndex > dirIndexList
virtual word processorsDir(const IOobject &io) const
Actual name of processors dir (for use in mode PROCOBJECT, PROCINSTANCE).
pathType
Enumeration for the location of an IOobject.
label comm() const noexcept
Communicator to use.
fileOperation(const label comm, const labelUList &ioRanks=labelUList::null(), const bool distributedRoots=false)
Construct from communicator, optionally with specified io-ranks and/or distributed roots.
bool operator()(const fileName &src, const fileName &dest) const
bool operator()(const fileName &src, const fileName &dest) const
bool operator()(const fileName &src, const fileName &dest) const
readDirOp(const fileName::Type type, const bool filtergz, const bool followLink)
virtual void addWatches(regIOobject &, const fileNameList &) const
Helper: add watches for list of regIOobjects.
virtual double highResLastModified(const fileName &, const bool followLink=true) const
Return time of last file modification.
virtual fileName filePathInfo(const bool checkGlobal, const bool isFile, const IOobject &io, const dirIndexList &pDirs, const bool search, pathType &searchType, word &processorsDir, word &instance) const
Search (locally!) for object; return info on how it was found.
virtual autoPtr< OSstream > NewOFstream(const fileName &pathname, IOstreamOption streamOpt=IOstreamOption(), const bool writeOnProc=true) const
Generate an OSstream that writes a file.
const HashPtrTable< DynamicList< instant > > & times() const noexcept
Return cached times.
virtual instantList findTimes(const fileName &directory, const word &constantName="constant") const
Get sorted list of times.
virtual label addWatch(const fileName &) const
Add watching of a file. Returns handle.
static void readAndSend(const fileName &filePath, const labelUList &recvProcs, PstreamBuffers &pBufs)
Read file contents and send to processors.
virtual bool rmDir(const fileName &dir, const bool silent=false, const bool emptyOnly=false) const
Remove a directory and its contents.
virtual mode_t mode(const fileName &, const bool followLink=true) const
Return the file mode.
virtual void setTime(const Time &) const
Callback for time change.
virtual autoPtr< ISstream > readStream(regIOobject &, const fileName &, const word &typeName, const bool readOnProc=true) const
Reads header for regIOobject and returns an ISstream to read the contents.
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 void flush() const
Forcibly wait until all output done. Flush any cached data.
static float maxMasterFileBufferSize
Max size of parallel communications. Switches from non-blocking.
virtual bool removeWatch(const label) const
Remove watch on a file (using handle).
virtual bool readHeader(IOobject &, const fileName &, const word &typeName) const
Read object header from supplied file.
virtual bool mvBak(const fileName &, const std::string &ext="bak") const
Rename to a corresponding backup file.
virtual fileNameList readObjects(const objectRegistry &db, const fileName &instance, const fileName &local, word &newInstance) const
Search directory for objects. Used in IOobjectList.
virtual label findWatch(const labelList &watchIndices, const fileName &) const
Find index (or -1) of file in list of handles.
virtual time_t lastModified(const fileName &, const bool followLink=true) const
Return time of last file modification.
virtual fileName dirPath(const bool checkGlobal, const IOobject &io, const bool search) const
Search for a directory.
virtual bool chMod(const fileName &, const mode_t) const
Set the file mode.
Type masterOp(const fileName &fName, const FileOp &fop, const int tag, const label comm) const
bool exists(const dirIndexList &, IOobject &io) const
Helper: check IO for local existence. Like filePathInfo but.
virtual off_t fileSize(const fileName &, const bool followLink=true) const
Return size of file.
masterUncollatedFileOperation(bool verbose=false)
Default construct.
virtual bool rm(const fileName &) const
Remove a file, returning true if successful otherwise false.
virtual autoPtr< ISstream > NewIFstream(const fileName &) const
Generate an ISstream that reads a file.
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 bool isDir(const fileName &, const bool followLink=true) const
Does the name exist as a DIRECTORY in the file system?
virtual fileMonitor::fileState getState(const label) const
Get current state of file (using handle).
virtual fileName filePath(const bool checkGlobal, const IOobject &io, const word &typeName, const bool search) const
Search for an object.
virtual void setUnmodified(const label) const
Set current state of file (using handle) to unmodified.
HashPtrTable< DynamicList< instant > > times_
Cached times for a given directory.
virtual void updateStates(const bool masterOnly, const bool syncPar) const
Update state of all files.
virtual void storeComm() const
Transfer ownership of communicator to this fileOperation. Use with caution.
virtual bool mkDir(const fileName &, mode_t=0777) const
Make directory.
virtual IOobject findInstance(const IOobject &io, const scalar startValue, const word &stopInstance="", const bool constant_fallback=true) const
Find time instance where IOobject is located. The name of the IOobject can be empty,...
virtual fileName::Type type(const fileName &, const bool followLink=true) const
Return the file type: DIRECTORY, FILE or SYMLINK.
virtual bool writeObject(const regIOobject &io, IOstreamOption streamOpt=IOstreamOption(), const bool writeOnProc=true) const
Writes a regIOobject (so header, contents and divider).
TypeName("masterUncollated")
Runtime type information.
static autoPtr< ISstream > read(IOobject &io, const label comm, const bool uniform, const fileNameList &filePaths, const boolUList &readOnProcs)
Read files on comms master.
virtual bool mv(const fileName &src, const fileName &dst, const bool followLink=false) const
Rename src to dst.
virtual bool ln(const fileName &src, const fileName &dst) const
Create a softlink. dst should not exist. Returns true if.
fileName localObjectPath(const IOobject &, const pathType &searchType, const word &processorsDir, const word &instancePath) const
Construct filePath.
virtual fileName getFile(const label) const
Get name of file being watched (using handle).
Registry of regIOobjects.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition regIOobject.H:71
A class for handling words, derived from Foam::string.
Definition word.H:66
bool local
Definition EEqn.H:20
const auto & io
Namespace for implementations of a fileOperation.
Definition regIOobject.H:60
Namespace for OpenFOAM.
bool rm(const fileName &file)
Remove a file (or its gz equivalent), returning true if successful.
Definition POSIX.C:1406
time_t lastModified(const fileName &name, const bool followLink=true)
Return time of last file modification (normally follows symbolic links).
Definition POSIX.C:932
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:837
List< label > labelList
A List of labels.
Definition List.H:62
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:616
List< fileName > fileNameList
List of fileName.
mode_t mode(const fileName &name, const bool followLink=true)
Return the file mode, normally following symbolic links.
Definition POSIX.C:775
List< instant > instantList
List of instants.
Definition instantList.H:41
bool chMod(const fileName &name, const mode_t mode)
Set the file/directory mode, return true on success.
Definition POSIX.C:759
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition POSIX.C:801
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
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:907
bool rmDir(const fileName &directory, const bool silent=false, const bool emptyOnly=false)
Remove a directory and its contents recursively,.
Definition POSIX.C:1435
double highResLastModified(const fileName &, const bool followLink=true)
Return time of last file modification.
Definition POSIX.C:948
UList< bool > boolUList
A UList of bools.
Definition UList.H:73
const direction noexcept
Definition scalarImpl.H:265
bool mvBak(const fileName &src, const std::string &ext="bak")
Rename to a corresponding backup file.
Definition POSIX.C:1359
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:879
bool cp(const fileName &src, const fileName &dst, const bool followLink=true)
Copy the source to the destination (recursively if necessary).
Definition POSIX.C:1065
bool mv(const fileName &src, const fileName &dst, const bool followLink=false)
Rename src to dst.
Definition POSIX.C:1326
UList< label > labelUList
A UList of labels.
Definition UList.H:75
bool ln(const fileName &src, const fileName &dst)
Create a softlink. dst should not exist. Returns true if successful.
Definition POSIX.C:1239
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
Definition POSIX.C:862
fileName search(const word &file, const fileName &directory)
Recursively search the given directory for the file.
Definition fileName.C:642
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:965
word format(conversionProperties.get< word >("format"))
labelList f(nPoints)
const volScalarField & cp
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68