2 #---------------------------------*- sh -*-------------------------------------
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
6 # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
8 #------------------------------------------------------------------------------
10 # This file is part of OpenFOAM.
12 # OpenFOAM is free software: you can redistribute it and/or modify it
13 # under the terms of the GNU General Public License as published by
14 # the Free Software Foundation, either version 3 of the License, or
15 # (at your option) any later version.
17 # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
18 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 # You should have received a copy of the GNU General Public License
23 # along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
29 # Remove the contents of the constant/polyMesh directory
30 # as per the Foam::polyMesh::removeFiles() method.
32 #------------------------------------------------------------------------------
34 while [ "$#" -ge 1 ]; do echo "$1" 1>&2; shift; done
37 usage: ${0##*/} [-case dir] [-region name]
39 Remove the contents of the constant/polyMesh directory
40 as per the Foam::polyMesh::removeFiles() method.
46 unset caseDir regionName
48 # parse a single option
56 [ "$#" -ge 2 ] || usage
"'$1' option requires an argument"
57 cd "$2" 2>/dev
/null || usage
"directory does not exist: '$2'"
62 [ "$#" -ge 2 ] || usage
"'$1' option requires an argument"
67 usage
"unknown option/argument: '$*'"
72 if [ -n "$regionName" ]
74 meshDir
=$regionName/polyMesh
79 # if -case was specified: insist upon 'constant/polyMesh'
82 if [ -d constant
/$meshDir ]
84 # use constant/polyMesh
85 meshDir
=constant
/$meshDir
87 echo "Error: no 'constant/$meshDir' in $caseDir" 1>&2
91 if [ -d constant
/$meshDir ]
93 # use constant/polyMesh
94 meshDir
=constant
/$meshDir
97 # likely already in constant/ - do not adjust anything
99 elif [ "${PWD##*/}" = polyMesh
-a -z "$regionName" ]
101 # apparently already within polyMesh/
104 echo "Error: no appropriate 'polyMesh/' directory found" 1>&2
111 # remove files (mesh itself, modifiers, snappyHexMesh ones) and subdirectories
113 echo "Clearing ${caseDir:-.}/$meshDir" 1>&2
146 refinementHistory.gz \
153 #------------------------------------------------------------------------------