initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / bin / tools / CleanFunctions
blob4a2015febfd45def70f081c9752b1cb17faa8fdf
1 #---------------------------------*- sh -*-------------------------------------
2 # =========                 |
3 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4 #  \\    /   O peration     |
5 #   \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
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 the
13 #     Free Software Foundation; either version 2 of the License, or (at your
14 #     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, write to the Free Software Foundation,
23 #     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 # Script
26 #     CleanFunctions
28 # Description
30 #------------------------------------------------------------------------------
32 #cleanTimeDirectories ()
34 #    echo "Cleaning $case case of $application application"
35 #    TIME_DIRS=`foamInfoExec . $1 -times | sed '1,/constant/d'`
36 #    for T in $TIME_DIRS
37 #    do
38 #        if [ $T != "0" ] ; then
39 #            echo "Deleting directory $T"
40 #            rm -rf ${T} > /dev/null 2>&1
41 #        fi
42 #    done
43 #    rm -rf {log,log.*,log-*,logSummary.*,.fxLock,*.xml,ParaView*,paraFoam*,*.OpenFOAM} > /dev/null 2>&1
46 cleanTimeDirectories ()
48     echo "Cleaning $PWD case"
49     nZeros=0
50     zeros=""
51     while [ $nZeros -lt 8 ] ; do
52         timeDir="0.${zeros}[1-9]*"
53         rm -rf ${timeDir} > /dev/null 2>&1
54         rm -rf ./-${timeDir} > /dev/null 2>&1
55         zeros=`printf %0${nZeros}d 0`
56         nZeros=$(($nZeros + 1))
57     done
58     rm -rf ./{[1-9]*,-[1-9]*,log,log.*,log-*,logSummary.*,.fxLock,*.xml,ParaView*,paraFoam*,*.OpenFOAM} > /dev/null 2>&1
61 cleanCase ()
63     cleanTimeDirectories
64     rm -rf processor* > /dev/null 2>&1
65     rm -rf probes* > /dev/null 2>&1
66     rm -rf forces* > /dev/null 2>&1
68     rm -rf system/machines \
69            constant/polyMesh/{allOwner*,cell*,face*,meshModifiers*} \
70            constant/polyMesh/{owner*,neighbour*,point*,edge*} \
71            constant/polyMesh/{cellLevel*,pointLevel*,refinementHistory*,surfaceIndex*} \
72            constant/{cellToRegion,cellLevel*,pointLevel*} \
73            constant/polyMesh/sets/ \
74            VTK \
75            > /dev/null 2>&1
77     for f in `find . -name "*Dict"`
78     do
79         sed -e /arguments/d $f > temp.$$
80         mv temp.$$ $f
81     done
84 removeCase ()
86     echo "Removing $case case"
87     rm -rf $1
90 cleanSamples ()
92     rm -rf {sets,samples,sampleSurfaces} > /dev/null 2>&1
95 cleanUcomponents ()
97     rm -rf 0/{Ux,Uy,Uz} > /dev/null 2>&1
100 cleanApplication ()
102     echo "Cleaning $PWD application"
103     wclean
107 #------------------------------------------------------------------------------