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) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -76,17 +76,11 @@ void Foam::probes::createProbeFiles(const wordList& fieldNames)
|
||||
// Put in undecomposed case
|
||||
// (Note: gives problems for distributed data running)
|
||||
|
||||
fileName probeSubDir = name();
|
||||
if (mesh_.name() != polyMesh::defaultRegion)
|
||||
{
|
||||
probeSubDir = probeSubDir/mesh_.name();
|
||||
}
|
||||
|
||||
fileName probeDir
|
||||
(
|
||||
mesh_.time().globalPath()
|
||||
/ functionObject::outputPrefix
|
||||
/ probeSubDir
|
||||
/ name()/mesh_.regionName()
|
||||
// Use startTime as the instance for output files
|
||||
/ mesh_.time().timeName(mesh_.time().startTime().value())
|
||||
);
|
||||
|
||||
@ -88,17 +88,11 @@ Foam::OFstream* Foam::sampledSets::createProbeFile(const word& fieldName)
|
||||
// Put in undecomposed case
|
||||
// (Note: gives problems for distributed data running)
|
||||
|
||||
fileName probeSubDir = name();
|
||||
if (mesh_.name() != polyMesh::defaultRegion)
|
||||
{
|
||||
probeSubDir = probeSubDir/mesh_.name();
|
||||
}
|
||||
|
||||
fileName probeDir
|
||||
(
|
||||
mesh_.time().globalPath()
|
||||
/ functionObject::outputPrefix
|
||||
/ probeSubDir
|
||||
/ name()/mesh_.regionName()
|
||||
// Use startTime as the instance for output files
|
||||
/ mesh_.time().timeName(mesh_.time().startTime().value())
|
||||
);
|
||||
@ -446,7 +440,8 @@ Foam::sampledSets::sampledSets
|
||||
writeAsProbes_(false),
|
||||
outputPath_
|
||||
(
|
||||
time_.globalPath()/functionObject::outputPrefix/name
|
||||
time_.globalPath()/functionObject::outputPrefix
|
||||
/ name/mesh_.regionName()
|
||||
),
|
||||
searchEngine_(mesh_),
|
||||
samplePointScheme_(),
|
||||
@ -459,10 +454,6 @@ Foam::sampledSets::sampledSets
|
||||
gatheredSorting_(),
|
||||
globalIndices_()
|
||||
{
|
||||
if (mesh_.name() != polyMesh::defaultRegion)
|
||||
{
|
||||
outputPath_ /= mesh_.name();
|
||||
}
|
||||
outputPath_.clean(); // Remove unneeded ".."
|
||||
|
||||
read(dict);
|
||||
@ -487,7 +478,8 @@ Foam::sampledSets::sampledSets
|
||||
writeAsProbes_(false),
|
||||
outputPath_
|
||||
(
|
||||
time_.globalPath()/functionObject::outputPrefix/name
|
||||
time_.globalPath()/functionObject::outputPrefix
|
||||
/ name/mesh_.regionName()
|
||||
),
|
||||
searchEngine_(mesh_),
|
||||
samplePointScheme_(),
|
||||
@ -500,10 +492,6 @@ Foam::sampledSets::sampledSets
|
||||
gatheredSorting_(),
|
||||
globalIndices_()
|
||||
{
|
||||
if (mesh_.name() != polyMesh::defaultRegion)
|
||||
{
|
||||
outputPath_ /= mesh_.name();
|
||||
}
|
||||
outputPath_.clean(); // Remove unneeded ".."
|
||||
|
||||
read(dict);
|
||||
|
||||
Reference in New Issue
Block a user