Rheolef  7.2
an efficient C++ finite element environment
 
Loading...
Searching...
No Matches
mkgeo_grid.sh
Go to the documentation of this file.
1#!/bin/bash
2#
3# This file is part of Rheolef.
4#
5# Copyright (C) 2000-2009 Pierre Saramito
6#
7# Rheolef is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12# Rheolef is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with Rheolef; if not, write to the Free Software
19# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20#
21# -------------------------------------------------------------------------
22# the mkgeo_grid unix command
23# author: Pierre.Saramito@imag.fr
24# date: 2 february 2004
25
26
151
152usage="mkgeo_grid
153 [-{abcdfg} float]
154 [-{eptqTPH}]
155 [nx [ny nz]]]
156 [-[no]sides]
157 [-[no]boundary]
158 [-[no]region]
159 [-[no]corner]
160 [-rz|-zr]
161 [-v4]
162"
163
164if test $# -eq 0; then
165 echo ${usage} >&2
166 exit 0
167fi
168
169args=""
170dim="2d"
171sys_coord="cartesian"
172new_format=`rheolef-config --have-new-code 2>/dev/null`
173GEO_BIN=${GEO_BIN-"geo"}
174while test $# -ne 0; do
175 case $1 in
176 -h) echo ${usage} >&2; exit 0;;
177 -e) dim="1d"; args="$args $1";;
178 -[tq]) dim="2d"; args="$args $1";;
179 -[TPH]) dim="3d"; args="$args $1";;
180 [0-9]*) args="$args $1";;
181 -[abcdfg]) args="$args $1 $2"; shift;;
182 -rz) args="$args $1"; sys_coord="rz";;
183 -zr) args="$args $1"; sys_coord="zr";;
184 -sides | -boundary | -region | -corner | -nosides | -noboundary | -noregion | -nocorner)
185 args="$args $1";;
186 *) echo "mkgeo_grid: unexpected argument $1" 1>&2
187 echo ${usage} 1>&2; exit 1;;
188 esac
189 shift
190done
191if test ${new_format} = true; then
192 args="$args -v4"
193fi
194#echo "! GEO_BIN=${GEO_BIN}" >&2
195#echo "! new_format=${new_format}" >&2
196pkgbindir=`rheolef-config --pkglibdir`
197
198if test $sys_coord != "cartesian" -a $dim != 2d; then
199 echo "mkgeo_grid: incompatible $dim geometry and non-cartesian \"${sys_coord}\"coordinate system" >&2
200 exit 1
201fi
202
203command="$pkgbindir/mkgeo_grid_$dim $args 2>/dev/null"
204if test $dim = 3d || test ${new_format} = true; then
205 command="$command | ${GEO_BIN} -upgrade -geo - 2>/dev/null"
206fi
207#echo "! $command" >&2
208eval $command
209status=$?
210if test $status -ne 0; then
211 echo "$0: command failed" 1>&2
212 exit $status
213fi