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:
@ -297,16 +297,18 @@ int main(int argc, char *argv[])
|
||||
IOobject::fileModificationChecking = IOobject::timeStamp;
|
||||
|
||||
|
||||
fileName meshDir = polyMesh::meshSubDir;
|
||||
fileName regionPrefix = "";
|
||||
word regionName = polyMesh::defaultRegion;
|
||||
word regionName(polyMesh::defaultRegion);
|
||||
if (args.readIfPresent("region", regionName))
|
||||
{
|
||||
Info<< "Using region " << regionName << nl << endl;
|
||||
regionPrefix = regionName;
|
||||
meshDir = regionName/polyMesh::meshSubDir;
|
||||
}
|
||||
|
||||
const fileName meshDir
|
||||
(
|
||||
polyMesh::regionName(regionName)/polyMesh::meshSubDir
|
||||
);
|
||||
|
||||
|
||||
Foam::instantList timeDirs = Foam::timeSelector::select0(runTime, args);
|
||||
|
||||
forAll(timeDirs, timeI)
|
||||
@ -349,7 +351,7 @@ int main(int argc, char *argv[])
|
||||
writeMeshObject<pointIOField>
|
||||
(
|
||||
"internalDelaunayVertices",
|
||||
regionPrefix,
|
||||
polyMesh::regionName(regionName),
|
||||
runTime
|
||||
);
|
||||
|
||||
@ -365,7 +367,12 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
// Get list of objects from the database
|
||||
IOobjectList objects(runTime, runTime.timeName(), regionPrefix);
|
||||
IOobjectList objects
|
||||
(
|
||||
runTime,
|
||||
runTime.timeName(),
|
||||
polyMesh::regionName(regionName)
|
||||
);
|
||||
|
||||
forAllConstIters(objects, iter)
|
||||
{
|
||||
@ -417,7 +424,7 @@ int main(int argc, char *argv[])
|
||||
fileHandler().filePath
|
||||
(
|
||||
runTime.timePath()
|
||||
/ regionPrefix
|
||||
/ polyMesh::regionName(regionName)
|
||||
/ cloud::prefix
|
||||
)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user