Skip to content
Snippets Groups Projects
Commit 9b319dab authored by Henry Weller's avatar Henry Weller
Browse files

blockMesh: Delete the polyMesh directory before meshing

unless the blockMeshDict is in the polyMesh directory or the "-noClean" option
is specified.

This avoids problems running snappyHexMesh without first clearing files from
polyMesh which interfere with the operation of snappyHexMesh.
parent 192b5d91
No related merge requests found
......@@ -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,
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment