Rheolef  7.2
an efficient C++ finite element environment
 
Loading...
Searching...
No Matches
mkgeo_sector.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# author: Pierre.Saramito@imag.fr
23# date: 2 february 2018
24
25
98
99n=""
100n_default=10
101a=1
102b=1
103name="sector"
104clean=true
105verbose=false
106
107usage="usage: mkgeo_contraction
108 [n=$n_default]
109 [-a float=$a]
110 [-b float=$b]
111 [-name string=$name]
112 [-[no]clean]
113 [-[no]verbose]
114"
115
116while test $# -ne 0; do
117 case $1 in
118 [0-9]*) if test x$n = x""; then n=$1; else m=$1; fi;;
119 -a) a="$2"; shift;;
120 -b) b="$2"; shift;;
121 -name) name=$2; shift;;
122 -clean) clean=true;;
123 -noclean) clean=false;;
124 -verbose) verbose=true;;
125 -noverbose) verbose=false;;
126 -h) echo ${usage} >&2; exit 0;;
127 *) echo ${usage} >&2; exit 1;;
128 esac
129 shift
130done
131if test x"$n" = x""; then
132 n=$n_default
133fi
134
135to_clean=""
136
137h=`echo $n | awk '{printf("%.15g\n", 1./$1)}'`
138cat > $name.bamgcad << EOF1
139 MeshVersionFormatted
140 0
141 Dimension
142 2
143 Vertices
144 3
145 0 0 1
146 $a 0 2
147 $a $b 3
148 Edges
149 3
150 1 2 101
151 2 3 102
152 3 1 103
153 hVertices
154 $h $h $h
155EOF1
156echo "! file $name.bamgcad created" 1>&2
157
158cat > $name.dmn << EOF2
159 EdgeDomainNames
160 3
161 axis
162 boundary
163 bisector
164EOF2
165echo "! file $name.dmn created" 1>&2
166
167command="bamg -g $name.bamgcad -o $name.bamg"
168if $verbose; then
169 echo "! $command" 1>&2
170 command="$command 1>&2"
171else
172 command="($command 2>&1) > $name.bamglog"
173 to_clean="$to_clean $name.bamglog"
174fi
175eval $command
176if test $? -ne 0; then
177 echo "$0: command failed"
178 if $verbose; then true; else cat $name.bamglog; fi
179 exit 1
180fi
181echo "! file $name.bamg created" 1>&2
182
183command="bamg2geo $name.bamg $name.dmn > $name.geo"
184if $verbose; then
185 echo "! $command" 1>&2
186else
187 command="$command 2> $name.bamglog"
188 to_clean="$to_clean $name.bamglog"
189fi
190eval $command
191if test $? -ne 0; then
192 echo "$0: command failed"
193 if $verbose; then true; else cat $name.bamglog; fi
194 exit 1
195fi
196echo "! file $name.geo created" 1>&2
197
198if $clean; then
199 command="rm -f $to_clean"
200 $verbose && echo "! $command" 1>&2
201 eval $command
202fi