cleanMeshDirectory.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2020 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
12 
13 Description
14  Removal of polyMesh directory
15 
16 \*---------------------------------------------------------------------------*/
17 
18 {
19  // Shadows enclosing parameter (dictName)
20  const word blockMeshDictName("blockMeshDict");
21 
22  const fileName polyMeshPath
23  (
24  runTime.path()/meshInstance/regionPath/polyMesh::meshSubDir
25  );
26 
27  if (exists(polyMeshPath))
28  {
29  if (exists(polyMeshPath/blockMeshDictName))
30  {
31  Info<< "Not deleting polyMesh directory "
32  << runTime.relativePath(polyMeshPath) << nl
33  << " because it contains " << blockMeshDictName << endl;
34  }
35  else
36  {
37  Info<< "Deleting polyMesh directory "
38  << runTime.relativePath(polyMeshPath) << endl;
40  }
41  }
42 }
43 
44 
45 // ************************************************************************* //
runTime
engineTime & runTime
Definition: createEngineTime.H:13
Foam::exists
bool exists(const fileName &name, const bool checkGzip=true, const bool followLink=true)
Does the name exist (as DIRECTORY or FILE) in the file system?
Definition: MSwindows.C:625
polyMeshPath
const fileName polyMeshPath(runTime.path()/meshInstance/regionPath/polyMesh::meshSubDir)
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:350
Foam::Info
messageStream Info
Information stream (uses stdout - output is on the master only)
Foam::nl
constexpr char nl
Definition: Ostream.H:385
Foam::rmDir
bool rmDir(const fileName &directory, const bool silent=false)
Remove a directory and its contents (optionally silencing warnings)
Definition: MSwindows.C:1018