ENH: autoLayerDriver: better layering information message
[OpenFOAM-2.0.x.git] / bin / tools / CleanFunctions
blob6e67f8ffbeb5009651412f1866b2b250089a7e97
1 #---------------------------------*- sh -*-------------------------------------
2 # =========                 |
3 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4 #  \\    /   O peration     |
5 #   \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
6 #    \\/     M anipulation  |
7 #------------------------------------------------------------------------------
8 # License
9 #     This file is part of OpenFOAM.
11 #     OpenFOAM is free software: you can redistribute it and/or modify it
12 #     under the terms of the GNU General Public License as published by
13 #     the Free Software Foundation, either version 3 of the License, or
14 #     (at your option) any later version.
16 #     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 #     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 #     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19 #     for more details.
21 #     You should have received a copy of the GNU General Public License
22 #     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
24 # Script
25 #     CleanFunctions
27 # Description
28 #     Miscellaneous cleanup functions for tutorial cases
29 #------------------------------------------------------------------------------
31 #cleanTimeDirectories()
33 #    echo "Cleaning $PWD case"
34 #    for time in $(foamInfoExec -times)
35 #    do
36 #        # keep 0 and constant directories
37 #        [ "$time" = "0" -o "$time" = constant ] || {
38 #            echo "Deleting directory $time"
39 #            rm -rf $time > /dev/null 2>&1
40 #        }
41 #    done
42 #    rm -rf {log,log.*,log-*,logSummary.*,.fxLock,*.xml,ParaView*,paraFoam*,*.OpenFOAM} > /dev/null 2>&1
45 cleanTimeDirectories()
47     echo "Cleaning $PWD case"
48     zeros=""
49     while [ ${#zeros} -lt 8 ]
50     do
51         timeDir="0.${zeros}[1-9]*"
52         rm -rf ./${timeDir} ./-${timeDir} > /dev/null 2>&1
53         zeros="0$zeros"
54     done
55     rm -rf ./[1-9]* ./-[1-9]* ./log ./log.* ./log-* ./logSummary.* ./.fxLock ./*.xml ./ParaView* ./paraFoam* ./*.OpenFOAM ./.setSet > /dev/null 2>&1
60 # Remove dynamicCode subdirectory if it looks appropriate
62 cleanDynamicCode()
64     if [ -d system -a -d dynamicCode ]
65     then
66         rm -rf dynamicCode > /dev/null 2>&1
67     fi
71 cleanCase()
73     cleanTimeDirectories
74     cleanDynamicCode
76     rm -rf processor* > /dev/null 2>&1
77     rm -rf probes* > /dev/null 2>&1
78     rm -rf forces* > /dev/null 2>&1
79     rm -rf graphs* > /dev/null 2>&1
80     rm -rf sets > /dev/null 2>&1
81     rm -rf surfaceSampling > /dev/null 2>&1
82     rm -rf cuttingPlane > /dev/null 2>&1
83     rm -rf system/machines > /dev/null 2>&1
85     if [ -d constant/polyMesh ]
86     then
87         (cd constant/polyMesh && \
88             rm -rf \
89             allOwner* cell* face* meshModifiers* \
90             owner* neighbour* point* edge* \
91             cellLevel* pointLevel* refinementHistory* surfaceIndex* sets \
92             > /dev/null 2>&1 \
93         )
94     fi
95     (cd constant && \
96         rm -rf \
97         cellToRegion cellLevel* pointLevel* \
98         > /dev/null 2>&1 \
99     )
100     rm -rf VTK > /dev/null 2>&1
101     rm -f 0/cellLevel 0/pointLevel
103     if [ -e constant/polyMesh/blockMeshDict.m4 ]
104     then
105         rm -f constant/polyMesh/blockMeshDict > /dev/null 2>&1
106     fi
108     for f in `find . -name "*Dict"`
109     do
110         sed -e /arguments/d $f > temp.$$
111         mv temp.$$ $f
112     done
115 removeCase()
117     echo "Removing ${1:-unknown} case"
118     rm -rf $1
121 cleanSamples()
123     rm -rf ./sets ./samples ./sampleSurfaces > /dev/null 2>&1
126 cleanUcomponents()
128     rm -rf 0/Ux 0/Uy 0/Uz > /dev/null 2>&1
131 cleanApplication()
133     echo "Cleaning $PWD application"
134     wclean
138 #------------------------------------------------------------------------------