ENH: robuster fileOperations splitProcessorPath

- robuster matching behaviour when encountering paths that themselves
  contain the word "processor" in them. For example,

    "/path/processor0generation2/case1/processor10/system"
    will now correctly match on processor10 instead of failing.

- use procRangeType for encapsulating the processor ranges

- provision for information of distributed vs non-distributed roots.
  The information is currently available from the initial setup, but
  can useful to access directly within fileOperation.

STYLE: modernize list iteration
This commit is contained in:
Mark Olesen
2020-12-04 21:33:50 +01:00
parent a939042e1b
commit df74e8448c
14 changed files with 521 additions and 264 deletions

View File

@ -519,29 +519,26 @@ int main(int argc, char *argv[])
{
const fileName& d = dirs[diri];
// Starts with 'processors'
if (d.find("processors") == 0)
label proci = -1;
if
(
d.starts_with("processor")
&&
(
// Collated is "processors"
d[9] == 's'
// Uncollated has integer(s) after 'processor'
|| Foam::read(d.substr(9), proci)
)
)
{
if (fileHandler().exists(d))
{
fileHandler().rmDir(d);
}
}
// Starts with 'processor'
if (d.find("processor") == 0)
{
// Check that integer after processor
fileName num(d.substr(9));
label proci = -1;
if (Foam::read(num.c_str(), proci))
{
if (fileHandler().exists(d))
{
fileHandler().rmDir(d);
}
}
}
}
procDirsProblem = false;