mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add 'filtered' polyMesh regionName() method
- in various situations with mesh regions it is also useful to
filter out or remove the defaultRegion name (ie, "region0").
Can now do that conveniently from the polyMesh itself or as a static
function. Simply use this
const word& regionDir = polyMesh::regionName(regionName);
OR mesh.regionName()
instead of
const word& regionDir =
(
regionName != polyMesh::defaultRegion
? regionName
: word::null
);
Additionally, since the string '/' join operator filters out empty
strings, the following will work correctly:
(polyMesh::regionName(regionName)/polyMesh::meshSubDir)
(mesh.regionName()/polyMesh::meshSubDir)
This commit is contained in:
@ -1015,10 +1015,8 @@ Foam::label Foam::checkGeometry
|
||||
|
||||
const fileName outputDir
|
||||
(
|
||||
mesh.time().globalPath()
|
||||
/functionObject::outputPrefix
|
||||
/(mesh.name() == polyMesh::defaultRegion ? word::null : mesh.name())
|
||||
/"checkMesh"
|
||||
mesh.time().globalPath()/functionObject::outputPrefix
|
||||
/ mesh.regionName()/"checkMesh"
|
||||
);
|
||||
|
||||
forAll(pbm, patchi)
|
||||
|
||||
@ -52,15 +52,8 @@ License
|
||||
|
||||
void Foam::printMeshStats(const polyMesh& mesh, const bool allTopology)
|
||||
{
|
||||
if (mesh.name() == Foam::polyMesh::defaultRegion)
|
||||
{
|
||||
Info<< "Mesh stats" << nl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "Mesh " << mesh.name() << " stats" << nl;
|
||||
}
|
||||
Info<< " points: "
|
||||
Info<< "Mesh stats " << mesh.regionName() << nl
|
||||
<< " points: "
|
||||
<< returnReduce(mesh.points().size(), sumOp<label>()) << nl;
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -130,11 +130,10 @@ int main(int argc, char *argv[])
|
||||
forAll(regionNames, regioni)
|
||||
{
|
||||
const word& regionName = regionNames[regioni];
|
||||
const word& regionDir =
|
||||
const fileName meshDir
|
||||
(
|
||||
regionName == polyMesh::defaultRegion ? word::null : regionName
|
||||
polyMesh::regionName(regionName)/polyMesh::meshSubDir
|
||||
);
|
||||
const fileName meshDir = regionDir/polyMesh::meshSubDir;
|
||||
|
||||
if (regionNames.size() > 1)
|
||||
{
|
||||
|
||||
@ -369,11 +369,10 @@ int main(int argc, char *argv[])
|
||||
forAll(regionNames, regioni)
|
||||
{
|
||||
const word& regionName = regionNames[regioni];
|
||||
const word& regionDir =
|
||||
const fileName meshDir
|
||||
(
|
||||
regionName == polyMesh::defaultRegion ? word::null : regionName
|
||||
polyMesh::regionName(regionName)/polyMesh::meshSubDir
|
||||
);
|
||||
const fileName meshDir = regionDir/polyMesh::meshSubDir;
|
||||
|
||||
if (regionNames.size() > 1)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user