3
# This file is part of Rheolef.
5
# Copyright (C) 2000-2009 Pierre Saramito
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.
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.
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
21
# -------------------------------------------------------------------------
24
#NAME: @code{msh2geo} - convert gmsh mesh in geo format
28
#@fiindex @file{.msh} gmsh mesh
29
#@fiindex @file{.geo} mesh
33
# msh2geo [-zr|-rz] @var{input}[.msh] > @var{output}.geo
37
#Convert a gmsh @file{.msh} into @file{.geo} one.
38
#The output goes to standart output.
39
#See the @code{gmsh} documentation for a detailed description
40
#of the @file{.mshcad} input file for @code{gmsh}.
43
# gmsh -2 toto.mshcad -o toto.msh
44
# msh2geo toto.msh > toto.geo
46
# gmsh -2 -order 2 toto.mshcad -o toto2.msh
47
# msh2geo toto2.msh > toto2.geo
49
#COORDINATE SYSTEM OPTION:
50
#Most of rheolef codes are coordinate-system independant.
51
#The coordinate system is specified in the geometry file @file{.geo}.
53
#@cindex axisymmetric coordinate system
56
# the 2d mesh is axisymmetric: @code{zr} (resp. @code{rz}) stands when the symmetry is related
57
# to the first (resp. second) coordinate.
60
#Pk triangle, when k>=5, may have internal nodes renumbered: from the
63
# The nodes of a curved element are numbered in the following order:
65
# the element principal vertices;
66
# the internal nodes for each edge;
67
# the internal nodes for each face;
68
# the volume internal nodes.
70
# The numbering for face and volume internal nodes is recursive,
71
# i.e., the numbering follows that of the nodes of an embedded face/volume.
72
# The higher order nodes are assumed to be equispaced on the element.
75
#In rheolef, internal triangle nodes are numbered from left to right and then
76
#from bottom to top. The numbering differ for triangle when k >= 5.
77
#Thus, @code{msh2geo} fix the corresponding internal nodes numbering during the
80
#Pk tetrahedrons and hexaedrons in gmsh and rheolef has not the same edge-node order
82
#E.g. for tetrahedrons, edges 13 and 23 should be swaped
83
#and reoriented as 32 and 31.
84
#Thus, @code{msh2geo} fix the corresponding internal nodes numbering.
87
#Fix for P3-tetra: swap edges orientations for 3,4,5
88
#and swap faces 1 and 2. Check P4(T) for face orientation.
89
#Perform face visualisation with gnuplot face fill.
91
#See also hexa edges orient and faces numbers and orient.
93
#Check that node are numbered by vertex-node, then edge-node, then face(tri,qua)-node and then volume(T,P,H)-node.
94
#Otherwise, renumber all nodes.
96
#Support for high order >= 6 element ? not documented in gmsh, but gmsh supports it at run
100
if test $# -eq 0; then
101
echo "msh2geo: usage: msh2geo [-rz|-zr] file.msgh > file.geo" 1>&2
104
if test x"$1" = x"-rz" -o x"$1" = x"-zr"; then
109
basename=`basename ${msh_file}`
110
basename=`expr ${msh_file} : '\(.*\).msh' \| ${msh_file}`
111
if test ! -f ${msh_file}; then
112
echo "msh2geo: \"${msh_file}\" file not found" 1>&2
115
pkglibdir=`rheolef-config --pkglibdir 2>/dev/null`
116
$pkglibdir/msh2geo_int < ${msh_file} | geo -geo -upgrade -
118
if test $status -ne 0; then
119
echo "msh2geo: failed." >&2