2 #------------------------------------------------------------------------------
4 # \\ / F ield | foam-extend: Open Source CFD
6 # \\ / A nd | For copyright notice see file Copyright
8 #------------------------------------------------------------------------------
10 # This file is part of foam-extend.
12 # foam-extend is free software: you can redistribute it and/or modify it
13 # under the terms of the GNU General Public License as published by the
14 # Free Software Foundation, either version 3 of the License, or (at your
15 # option) any later version.
17 # foam-extend is distributed in the hope that it will be useful, but
18 # WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 # General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with foam-extend. 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 #------------------------------------------------------------------------------