diff --git a/applications/utilities/mesh/generation/blockMesh/blockMesh.C b/applications/utilities/mesh/generation/blockMesh/blockMesh.C index a7860c8f531f11bbbd7d5d1d85d55ebc2ef7b991..4b3b7266087f0a38acc87b23fe284b637d5d0d9d 100644 --- a/applications/utilities/mesh/generation/blockMesh/blockMesh.C +++ b/applications/utilities/mesh/generation/blockMesh/blockMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -76,6 +76,11 @@ int main(int argc, char *argv[]) "blockTopology", "write block edges and centres as .obj files" ); + argList::addBoolOption + ( + "noClean", + "keep the existing files in the polyMesh" + ); argList::addOption ( "dict", @@ -156,6 +161,30 @@ int main(int argc, char *argv[]) dictPath = runTime.system()/regionPath/dictName; } + if (!args.optionFound("noClean")) + { + fileName polyMeshPath + ( + runTime.path()/runTime.constant()/regionPath/polyMesh::meshSubDir + ); + + if (exists(polyMeshPath)) + { + if (exists(polyMeshPath/dictName)) + { + Info<< "Not deleting polyMesh directory " << nl + << " " << polyMeshPath << nl + << " because it contains " << dictName << endl; + } + else + { + Info<< "Deleting polyMesh directory" << nl + << " " << polyMeshPath << endl; + rmDir(polyMeshPath); + } + } + } + IOobject meshDictIO ( dictPath,