72 const regExp matcher(
"processors?[0-9]+(_[0-9]+-[0-9]+)?");
74 bool isProcessorDir(
const string& dir)
76 return (dir.
starts_with(
"processor") && matcher.match(dir));
82 int main(
int argc,
char *argv[])
86 "List times using the timeSelector," 87 " or use to remove selected time directories" 97 "List times from processor0/ directory" 102 "Remove selected time directories" 106 "Report progress of -rm option" 112 const bool removeFiles(
args.
found(
"rm"));
130 <<
"No processor* directories found" 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)
static void noJobInfo()
Suppress JobInfo, overriding controlDict setting.
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
static void addNote(const string ¬e)
Add extra notes for the usage information.
A class for handling file names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
messageStream InfoErr
Information stream (stderr output on master, null elsewhere)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
static void noParallel()
Remove the parallel options.
autoPtr< fileOperation > fileHandler(std::nullptr_t)
Delete current file handler.
instantList select(const instantList ×) const
Select a list of Time values that are within the ranges.
void inplaceSubsetList(ListType &input, const UnaryPredicate &pred, const bool invert=false)
Inplace subset of the list when predicate is true.
static void disable()
Disallow profiling by forcing the InfoSwitch off.
Various functions to operate on Lists.
A class for handling words, derived from Foam::string.
static void addVerboseOption(const string &usage, bool advanced=false)
Enable a 'verbose' bool option, with usage information.
const fileName & caseName() const noexcept
Return case name (parallel run) or global case (serial run)
bool rmDir(const fileName &directory, const bool silent=false, const bool emptyOnly=false)
Remove a directory and its contents recursively,.
const fileName & rootPath() const noexcept
Return root path.
fileName path() const
Return the full path to the (processor local) case.
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name...
Wrapper around POSIX extended regular expressions with some additional prefix-handling. The prefix-handling is loosely oriented on PCRE regular expressions and provides a simple means of tuning the expressions.
bool starts_with(char c) const
True if string starts with given character (cf. C++20)
Ostream & flush(Ostream &os)
Flush stream.
instantList times() const
Search the case for valid time directories.
messageStream Info
Information stream (stdout output on master, null elsewhere)
static void noBanner()
Disable emitting the banner information.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
#define forAllReverse(list, i)
Reverse loop across all elements in list.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
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.
Foam::argList args(argc, argv)
int verbose() const noexcept
Return the verbose flag.
bool found(const word &optName) const
Return true if the named option is found.
static void addOptions(const bool constant=true, const bool withZero=false)
Add timeSelector options to argList::validOptions.