mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: centralized handling of -allRegions, -regions, -region (#2072)
Step 1.
include "addAllRegionOptions.H"
Adds the -allRegions, -regions and -region options to argList.
Step 2.
include "getAllRegionOptions.H"
Processes the options with -allRegions selecting everything
from the regionProperties.
OR use -regions to specify multiple regions (from
regionProperties), and can also contain regular expressions
OR use the -region option
Specifying a single -regions NAME (not a regular expresssion)
is the same as -region NAME and doesn't use regionProperties
Creates a `wordList regionNames`
Step 3.
Do something with the region names.
Either directly, or quite commonly with the following
include "createNamedMeshes.H"
Creates a `PtrList<fvMesh> meshes`
STYLE: add description to some central include files
This commit is contained in:
@ -2263,12 +2263,9 @@ int main(int argc, char *argv[])
|
||||
// enable -constant ... if someone really wants it
|
||||
// enable -zeroTime to prevent accidentally trashing the initial fields
|
||||
timeSelector::addOptions(true, true);
|
||||
#include "addRegionOption.H"
|
||||
argList::addBoolOption
|
||||
(
|
||||
"allRegions",
|
||||
"operate on all regions in regionProperties"
|
||||
);
|
||||
|
||||
#include "addAllRegionOptions.H"
|
||||
|
||||
#include "addOverwriteOption.H"
|
||||
argList::addBoolOption("decompose", "Decompose case");
|
||||
argList::addBoolOption("reconstruct", "Reconstruct case");
|
||||
@ -2506,20 +2503,12 @@ int main(int argc, char *argv[])
|
||||
const fileName decompDictFile =
|
||||
args.getOrDefault<fileName>("decomposeParDict", "");
|
||||
|
||||
// Get all region names
|
||||
wordList regionNames;
|
||||
if (args.found("allRegions"))
|
||||
{
|
||||
regionNames = regionProperties(runTime).names();
|
||||
// Get region names
|
||||
#include "getAllRegionOptions.H"
|
||||
|
||||
Info<< "Decomposing all regions in regionProperties" << nl
|
||||
<< " " << flatOutput(regionNames) << nl << endl;
|
||||
}
|
||||
else
|
||||
if (regionNames.size() == 1 && regionNames[0] != polyMesh::defaultRegion)
|
||||
{
|
||||
regionNames.resize(1);
|
||||
regionNames.first() =
|
||||
args.getOrDefault<word>("region", fvMesh::defaultRegion);
|
||||
Info<< "Using region: " << regionNames[0] << nl << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -2553,12 +2542,11 @@ int main(int argc, char *argv[])
|
||||
forAll(regionNames, regioni)
|
||||
{
|
||||
const word& regionName = regionNames[regioni];
|
||||
const fileName meshSubDir
|
||||
const word& regionDir =
|
||||
(
|
||||
regionName == fvMesh::defaultRegion
|
||||
? fileName(polyMesh::meshSubDir)
|
||||
: regionNames[regioni]/polyMesh::meshSubDir
|
||||
regionName == polyMesh::defaultRegion ? word::null : regionName
|
||||
);
|
||||
const fileName meshSubDir(regionDir/polyMesh::meshSubDir);
|
||||
|
||||
Info<< "\n\nReconstructing mesh " << regionName << nl << endl;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user