openfoam/applications/utilities/mesh/generation/PDRblockMesh/cleanMeshDirectory.H
Mark Olesen ca25929372 ENH: minor simplifications for handling region meshes
- static version of polyMesh::meshDir(), which takes a region name

      polyMesh::meshDir(regionName)
  vs
      polyMesh::regionName(regionName)/polyMesh::meshSubDir

STYLE: use polyMesh::regionName(..) instead of comparing to defaultRegion

STYLE: use getOrDefault when retrieving various -region options

FIX: polyMesh::dbDir() now checks registry name, not full path (#3033)
2023-12-07 17:42:24 +01:00

46 lines
1.4 KiB
C

/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
Description
Removal of polyMesh directory
\*---------------------------------------------------------------------------*/
{
// Shadows enclosing parameter (dictName)
const word blockMeshDictName("blockMeshDict");
const fileName polyMeshPath
(
runTime.path()/meshInstance/polyMesh::meshDir(regionName)
);
if (exists(polyMeshPath))
{
if (exists(polyMeshPath/blockMeshDictName))
{
Info<< "Not deleting polyMesh directory "
<< runTime.relativePath(polyMeshPath) << nl
<< " because it contains " << blockMeshDictName << endl;
}
else
{
Info<< "Deleting polyMesh directory "
<< runTime.relativePath(polyMeshPath) << endl;
rmDir(polyMeshPath);
}
}
}
// ************************************************************************* //