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:
Mark Olesen
2021-05-05 14:18:55 +02:00
parent 86a2ae4f03
commit c410edf928
26 changed files with 595 additions and 364 deletions

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd.
Copyright (C) 2017-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -280,11 +280,10 @@ bool Foam::functionObjects::vtkWrite::write()
label regioni = 0;
for (const word& regionName : meshes_.sortedToc())
{
fileName regionPrefix;
if (regionName != polyMesh::defaultRegion)
{
regionPrefix = regionName;
}
const word& regionDir =
(
regionName == polyMesh::defaultRegion ? word::null : regionName
);
auto& meshProxy = meshSubsets_[regioni];
auto& vtuMeshCells = vtuMappings_[regioni];
@ -331,7 +330,7 @@ bool Foam::functionObjects::vtkWrite::write()
fileName vtmOutputBase
(
outputDir_/regionPrefix/vtkName + timeDesc
outputDir_/regionDir/vtkName + timeDesc
);
// Combined internal + boundary in a vtm file
@ -412,7 +411,7 @@ bool Foam::functionObjects::vtkWrite::write()
// Output name for one patch: "boundary"
(
writeOpts_.legacy()
? (outputDir_/regionPrefix/"boundary"/"boundary" + timeDesc)
? (outputDir_/regionDir/"boundary"/"boundary" + timeDesc)
: (vtmOutputBase / "boundary")
),
Pstream::parRun()
@ -464,7 +463,7 @@ bool Foam::functionObjects::vtkWrite::write()
writeOpts_.legacy()
?
(
outputDir_/regionPrefix/pp.name()
outputDir_/regionDir/pp.name()
/ (pp.name()) + timeDesc
)
: (vtmOutputBase / "boundary" / pp.name())
@ -704,7 +703,7 @@ bool Foam::functionObjects::vtkWrite::write()
series.write(seriesName);
// Add to multi-region vtm
vtmMultiRegion.add(regionName, regionPrefix, vtmWriter);
vtmMultiRegion.add(regionName, regionDir, vtmWriter);
}
if (vtmBoundaries.size())