Commit 99609776 authored by Mark Olesen's avatar Mark Olesen
Browse files

foamCopySettings enhancement

- read ~OpenFOAM/foamCopySettings.rc file for an extra rsync options
  for example, to ignore post-processing or sampling directories
parent ef37a55f
......@@ -32,18 +32,27 @@
# Copy OpenFOAM settings from one case to another, without copying
# the mesh or results
# - requires rsync
#
# Note
# The foamCopySettings.rc (found with the ~OpenFOAM expansion) can be used
# to add any custom rsync options.
#------------------------------------------------------------------------------
Script=${0##*/}
if [ "$1" = "-h" -o "$1" = "-help" -o "$#" -ne 2 ]
then
cat <<USAGE 1>&2
Usage: ${0##*/} srcDir dstDir
Usage: $Script srcDir dstDir
Copy OpenFOAM settings from one case to another, without copying
the mesh or results.
- requires rsync
Note
The $Script.rc (found with the ~OpenFOAM expansion) can be used
to add any custom rsync options.
USAGE
exit 1
exit 1
fi
srcDir=${1%/}
......@@ -66,13 +75,40 @@ do
done
# files and directories to copy
# avoid processor directories
# avoid processor directories here too to make for cleaner output
fileList=$(find -H $srcDir -mindepth 1 -maxdepth 1 -not -name "processor*")
# avoid polyMesh and processor* directories
rsync="rsync --exclude polyMesh --exclude processor*"
#
# get any extra options
# only extract lines starting with --option xxx
#
if rcFile=$(foamEtcFile $Script.rc)
then
userOpts=$(
cat $rcFile | while read userOpts
do
[ "${userOpts##--}" != "${userOpts}" ] && echo $userOpts
done
)
rsync="$rsync $userOpts"
fi
# TODO:
# - verify that it works with multiple mesh regions
# - special treatment for starting with negative crank angles
echo
echo "synchronizing with"
echo " $rsync"
echo
for i in $fileList
do
name="${i##*/}"
......@@ -85,7 +121,7 @@ do
;;
*)
echo "$i -> $dstDir/$name"
rsync --exclude polyMesh --exclude "processor*" -a $i $dstDir
$rsync -a $i $dstDir
;;
esac
done
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment