2 #-------------------------------------------------------------------------------
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
6 # \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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 # Usage: foamCopySettings srcDir dstDir
31 # Copy OpenFOAM settings from one case to another, without copying
36 # The foamCopySettings.rc (found with the ~OpenFOAM expansion) can be used
37 # to add any custom rsync options.
38 #-------------------------------------------------------------------------------
41 #------------------------------------------------------------------------------
44 while [ "$#" -ge 1 ]; do echo "$1"; shift; done
47 Usage: $Script srcDir dstDir
49 Copy OpenFOAM settings from one case to another, without copying
54 The $Script.rc (found via the ~OpenFOAM expansion - see foamEtcFile)
55 can be used to add any custom rsync options.
60 #------------------------------------------------------------------------------
70 usage
"unknown option: '$*'"
79 type rsync
>/dev
/null
2>&1 || usage
"Error: 'rsync' seems to be missing"
81 [ "$#" -eq 2 ] || usage
"Error: incorrect number of arguments"
86 for i
in $srcDir $dstDir
88 [ -d "$i" ] ||
{ echo "Error: directory '$i' does not exist"; exit 1; }
91 # check that the srcDir looks okay
92 for i
in $srcDir/constant
$srcDir/system
96 echo "Error: no '${i##*/}' directory in '$srcDir'"
97 echo " does not appear to be an OpenFOAM case"
102 # files and directories to copy
103 # avoid processor directories here too to make for cleaner output
104 fileList
=$
(find -H $srcDir -mindepth 1 -maxdepth 1 -not -name "processor*")
106 # avoid polyMesh and processor* directories
107 rsync
="rsync --exclude polyMesh --exclude processor*"
110 # get any extra user options
111 # extract lines starting with '--longOption'
113 if rcFile
=$
(foamEtcFile
$Script.rc
)
115 rsync
="$rsync "$
(sed -ne '/^ *--/p' $rcFile |
tr '\n' ' ')
120 # - verify that it works with multiple mesh regions
121 # - special treatment for starting with negative crank angles
125 echo "synchronizing with"
132 # skip numerical (results) directories (except 0)
133 # and things that look like log files or queuing system output
135 ( [1-9] |
[0-9]?
* | log |
*.log | foam.
[eo
][1-9]* )
139 # skip things that look sampled directories and converted data
140 ( probes | sets | surfaces | En
[Ss
]ight
)
145 echo "$i -> $dstDir/$name"
151 # ------------------------------------------------------------------ end-of-file