#!/bin/sh
#
# This file is part of Rheolef.
#
# Copyright (C) 2000-2018 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
# -------------------------------------------------------------------------
h=$1

cat > square-${h}.cad << EOF
MeshVersionFormatted
  0
Dimension
  2
Vertices
  4
  0  0     1
  1  0     2
  1  1     3
  0  1     4
Edges
  4
  1  2     1
  2  3     2
  3  4     3
  4  1     4
hVertices
  ${h} ${h} ${h} ${h}
EOF

echo "! file \"square-${h}.cad\" created." 1>&2

echo "bamg -g square-${h}.cad -o square-${h}.bamg" 1>&2
bamg -g square-${h}.cad -o square-${h}.bamg

cat > square.dmn << EOF
EdgeDomainNames
4
bottom
right
top
left
EOF
echo "! file \"square.dmn\" created." 1>&2

echo "bamg2geo square-${h}.bamg square.dmn > square-${h}.geo" 1>&2
bamg2geo square-${h}.bamg square.dmn > square-${h}.geo


