mkgeo_grid.sh
Go to the documentation of this file.
#!/bin/bash
#
# This file is part of Rheolef.
#
# Copyright (C) 2000-2009 Pierre Saramito
#
# Rheolef is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Rheolef is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Rheolef; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# -------------------------------------------------------------------------
# the mkgeo_grid unix command
# author: Pierre.Saramito@imag.fr
# date: 2 february 2004
usage="mkgeo_grid
[-{abcdfg} float]
[-{eptqTPH}]
[nx [ny nz]]]
[-[no]sides]
[-[no]boundary]
[-[no]region]
[-[no]corner]
[-rz|-zr]
[-v4]
"
if test $# -eq 0; then
echo ${usage} >&2
exit 0
fi
args=""
dim="2d"
sys_coord="cartesian"
new_format=`rheolef-config --have-new-code 2>/dev/null`
GEO_BIN=${GEO_BIN-"geo"}
while test $# -ne 0; do
case $1 in
-h) echo ${usage} >&2; exit 0;;
-e) dim="1d"; args="$args $1";;
-[tq]) dim="2d"; args="$args $1";;
-[TPH]) dim="3d"; args="$args $1";;
[0-9]*) args="$args $1";;
-[abcdfg]) args="$args $1 $2"; shift;;
-rz) args="$args $1"; sys_coord="rz";;
-zr) args="$args $1"; sys_coord="zr";;
-sides | -boundary | -region | -corner | -nosides | -noboundary | -noregion | -nocorner)
args="$args $1";;
*) echo "mkgeo_grid: unexpected argument $1" 1>&2
echo ${usage} 1>&2; exit 1;;
esac
shift
done
if test ${new_format} = true; then
args="$args -v4"
fi
#echo "! GEO_BIN=${GEO_BIN}" >&2
#echo "! new_format=${new_format}" >&2
pkgbindir=`rheolef-config --pkglibdir`
if test $sys_coord != "cartesian" -a $dim != 2d; then
echo "mkgeo_grid: incompatible $dim geometry and non-cartesian \"${sys_coord}\"coordinate system" >&2
exit 1
fi
command="$pkgbindir/mkgeo_grid_$dim $args 2>/dev/null"
if test $dim = 3d || test ${new_format} = true; then
command="$command | ${GEO_BIN} -upgrade -geo - 2>/dev/null"
fi
#echo "! $command" >&2
eval $command
status=$?
if test $status -ne 0; then
echo "$0: command failed" 1>&2
exit $status
fi