STYLE: more consistency in handling of -region vs -allRegions

This commit is contained in:
Mark Olesen
2018-07-19 09:15:33 +02:00
parent 8042647610
commit 7cb5b638ad
4 changed files with 20 additions and 29 deletions

View File

@ -108,16 +108,12 @@ int main(int argc, char *argv[])
} }
else else
{ {
word regionName; regionNames.resize(1, fvMesh::defaultRegion);
if (args.readIfPresent("region", regionName)) regionDirs.resize(1, word::null);
if (args.readIfPresent("region", regionNames.first()))
{ {
regionNames = wordList(1, regionName); regionDirs.first() = regionNames.first();
regionDirs = regionNames;
}
else
{
regionNames = wordList(1, fvMesh::defaultRegion);
regionDirs = wordList(1, word::null);
} }
} }

View File

@ -146,16 +146,12 @@ int main(int argc, char *argv[])
} }
else else
{ {
word regionName; regionNames.resize(1, fvMesh::defaultRegion);
if (args.readIfPresent("region", regionName)) regionDirs.resize(1, word::null);
if (args.readIfPresent("region", regionNames.first()))
{ {
regionNames = wordList(1, regionName); regionDirs.first() = regionNames.first();
regionDirs = regionNames;
}
else
{
regionNames = wordList(1, fvMesh::defaultRegion);
regionDirs = wordList(1, word::null);
} }
} }

View File

@ -247,7 +247,7 @@ int main(int argc, char *argv[])
argList::addBoolOption argList::addBoolOption
( (
"copyZero", "copyZero",
"Copy \a 0 directory to processor* rather than decompose the fields" "Copy a 0 directory to processor* rather than decompose the fields"
); );
argList::addBoolOption argList::addBoolOption
( (
@ -318,15 +318,16 @@ int main(int argc, char *argv[])
} }
else else
{ {
regionNames = {fvMesh::defaultRegion}; regionNames.resize(1);
args.readIfPresent("region", regionNames[0]); regionNames.first() =
args.lookupOrDefault<word>("region", fvMesh::defaultRegion);
} }
forAll(regionNames, regioni) forAll(regionNames, regioni)
{ {
const word& regionName = regionNames[regioni]; const word& regionName = regionNames[regioni];
const word& regionDir = const word& regionDir =
regionName == fvMesh::defaultRegion ? word::null : regionName; (regionName == fvMesh::defaultRegion ? word::null : regionName);
Info<< "\n\nDecomposing mesh " << regionName << nl << endl; Info<< "\n\nDecomposing mesh " << regionName << nl << endl;

View File

@ -194,14 +194,12 @@ int main(int argc, char *argv[])
} }
else else
{ {
regionNames = {fvMesh::defaultRegion}; regionNames.resize(1, fvMesh::defaultRegion);
if (args.readIfPresent("region", regionNames[0])) regionDirs.resize(1, word::null);
if (args.readIfPresent("region", regionNames.first()))
{ {
regionDirs = regionNames; regionDirs.first() = regionNames.first();
}
else
{
regionDirs = {word::null};
} }
} }