mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +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:
@ -1,22 +1,52 @@
|
||||
Info<< "Create dynamic mesh for time = "
|
||||
<< runTime.timeName() << nl << endl;
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
|
||||
autoPtr<dynamicFvMesh> meshPtr
|
||||
Description
|
||||
Create a dynamicFvMesh, with init()
|
||||
|
||||
Required Variables
|
||||
- runTime [Time]
|
||||
|
||||
Provided Variables
|
||||
- mesh [dynamicFvMesh], meshPtr
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
Foam::autoPtr<Foam::dynamicFvMesh> meshPtr;
|
||||
|
||||
{
|
||||
Foam::Info << "Create dynamic mesh for time = "
|
||||
<< runTime.timeName() << Foam::nl;
|
||||
|
||||
meshPtr = dynamicFvMesh::New
|
||||
(
|
||||
dynamicFvMesh::New
|
||||
IOobject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
polyMesh::defaultRegion,
|
||||
runTime.timeName(),
|
||||
runTime,
|
||||
IOobject::MUST_READ
|
||||
)
|
||||
polyMesh::defaultRegion,
|
||||
runTime.timeName(),
|
||||
runTime,
|
||||
IOobject::MUST_READ
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
dynamicFvMesh& mesh = meshPtr();
|
||||
|
||||
// Calculate initial mesh-to-mesh mapping. Note that this should be
|
||||
// done under the hood, e.g. as a MeshObject
|
||||
mesh.update();
|
||||
dynamicFvMesh& mesh = meshPtr();
|
||||
|
||||
// Calculate initial mesh-to-mesh mapping. Note that this should be
|
||||
// done under the hood, e.g. as a MeshObject
|
||||
mesh.update();
|
||||
|
||||
Foam::Info << Foam::endl;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
Reference in New Issue
Block a user