ENH: additional constructor and methods for regionProperties

- can now construct with READ_IF_PRESENT and use count() to determine
  if it was loaded. names() and sortedNames() for a collected overview.
This commit is contained in:
Mark Olesen
2018-10-01 16:01:02 +02:00
parent e6a60f2de6
commit 501326b27a
6 changed files with 142 additions and 82 deletions

View File

@ -2499,21 +2499,16 @@ int main(int argc, char *argv[])
wordList regionNames;
if (args.found("allRegions"))
{
Info<< "Decomposing all regions in regionProperties" << nl << endl;
regionProperties rp(runTime);
regionNames = regionProperties(runTime).names();
wordHashSet names;
forAllConstIters(rp, iter)
{
names.insert(iter.object());
}
regionNames = names.sortedToc();
Info<< "Decomposing all regions in regionProperties" << nl
<< " " << flatOutput(regionNames) << nl << endl;
}
else
{
regionNames = {fvMesh::defaultRegion};
args.readIfPresent("region", regionNames[0]);
regionNames.resize(1);
regionNames.first() =
args.lookupOrDefault<word>("region", fvMesh::defaultRegion);
}