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:
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2018 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -58,14 +58,11 @@ Foam::fileName Foam::functionObjects::writeFile::baseFileDir() const
|
||||
/ functionObject::outputPrefix
|
||||
);
|
||||
|
||||
// Append mesh name if not default region
|
||||
if (isA<polyMesh>(fileObr_))
|
||||
// Append mesh region name if not default region
|
||||
const auto* meshPtr = isA<polyMesh>(fileObr_);
|
||||
if (meshPtr)
|
||||
{
|
||||
const polyMesh& mesh = refCast<const polyMesh>(fileObr_);
|
||||
if (mesh.name() != polyMesh::defaultRegion)
|
||||
{
|
||||
baseDir /= mesh.name();
|
||||
}
|
||||
baseDir /= meshPtr->regionName();
|
||||
}
|
||||
baseDir.clean(); // Remove unneeded ".."
|
||||
|
||||
|
||||
Reference in New Issue
Block a user