72const regExp matcher(
"processors?[0-9]+(_[0-9]+-[0-9]+)?");
74bool isProcessorDir(
const string& dir)
76 return (dir.
starts_with(
"processor") && matcher.match(dir));
82int main(
int argc,
char *argv[])
86 "List times using the timeSelector,"
87 " or use to remove selected time directories"
89 timeSelector::addOptions(
true,
true);
91 argList::noParallel();
93 argList::noFunctionObjects();
94 argList::addBoolOption
97 "List times from processor0/ directory"
99 argList::addBoolOption
102 "Remove selected time directories"
104 argList::addVerboseOption
106 "Report progress of -rm option"
108 profiling::disable();
112 const bool removeFiles(
args.
found(
"rm"));
130 <<
"No processor* directories found"
151 const instantList timeDirs(timeSelector::select(timePaths->times(),
args));
153 const label nTimes = timeDirs.size();
178 <<
"Removing " << nTimes
179 <<
" times in " << procDirs.size()
180 <<
" processor directories" <<
endl;
184 if (procDirs.empty())
197 <<
" [" << (nTimes - timei) <<
'/' << nTimes <<
']'
201 for (
const fileName& procDir : procDirs)
212 <<
"Removing " << nTimes
213 <<
" time directories" <<
endl;
224 <<
" [" << (nTimes - timei) <<
'/' << nTimes <<
']'
235 for (
const instant& t : timeDirs)
Various functions to operate on Lists.
int verbose() const noexcept
Return the verbose flag.
const fileName & rootPath() const noexcept
Return root path.
bool found(const word &optName) const
Return true if the named option is found.
fileName path() const
Return the full path to the (processor local) case.
const fileName & caseName() const noexcept
Return case name (parallel run) or global case (serial run)
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A class for handling file names.
virtual label nProcs(const fileName &dir, const fileName &local="") const
Get number of processor directories/results. Used for e.g.
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name.
Wrapper around C++11 regular expressions with some additional prefix-handling. The prefix-handling is...
bool starts_with(const std::string &s) const
True if string starts with the given prefix (cf. C++20)
A class for handling words, derived from Foam::string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const fileOperation & fileHandler()
Get current file handler.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & endl(Ostream &os)
Add newline and flush stream.
void inplaceSubsetList(ListType &input, const UnaryPredicate &pred, const bool invert=false)
Inplace subset of the list when predicate is true.
bool rmDir(const fileName &directory, const bool silent=false)
Remove a directory and its contents (optionally silencing warnings)
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.
messageStream InfoErr
Information stream (stderr output on master, null elsewhere)
errorManipArg< error, int > exit(error &err, const int errNo=1)
Ostream & flush(Ostream &os)
Flush stream.
constexpr char nl
The newline '\n' character (0x0a)
Foam::argList args(argc, argv)
#define forAllReverse(list, i)
Reverse loop across all elements in list.