~ubuntu-branches/ubuntu/raring/rheolef/raring-proposed

« back to all changes in this revision

Viewing changes to nfem/pbin/msh2geo

  • Committer: Package Import Robot
  • Author(s): Pierre Saramito, Pierre Saramito, Sylvestre Ledru
  • Date: 2012-05-14 14:02:09 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20120514140209-dzbdlidkotyflf9e
Tags: 6.1-1
[ Pierre Saramito ]
* New upstream release 6.1 (minor changes):
  - support arbitrarily polynomial order Pk
  - source code supports g++-4.7 (closes: #671996)

[ Sylvestre Ledru ]
* update of the watch file

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
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
 
 
23
#Prog:msh2geo
 
24
#NAME: @code{msh2geo} - convert gmsh mesh in geo format
 
25
#@cindex mesh
 
26
#@toindex msh2geo
 
27
#@pindex geo
 
28
#@fiindex @file{.msh} gmsh mesh
 
29
#@fiindex @file{.geo} mesh
 
30
#@toindex @code{gmsh}
 
31
#SYNOPSIS:
 
32
#@example
 
33
#  msh2geo [-zr|-rz] @var{input}[.msh] > @var{output}.geo
 
34
#@end example
 
35
#
 
36
#DESCRIPTION:
 
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}.
 
41
#EXAMPLES:
 
42
#@example
 
43
#  gmsh -2 toto.mshcad -o toto.msh
 
44
#  msh2geo toto.msh > toto.geo
 
45
#
 
46
#  gmsh -2 -order 2 toto.mshcad -o toto2.msh
 
47
#  msh2geo toto2.msh > toto2.geo
 
48
#@end example
 
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}.
 
52
#@table @code
 
53
#@cindex axisymmetric coordinate system
 
54
#@itemx -zr
 
55
#@itemx -rz
 
56
#       the 2d mesh is axisymmetric: @code{zr} (resp. @code{rz}) stands when the symmetry is related
 
57
#       to the first (resp. second) coordinate.
 
58
#@end table
 
59
#NOTES:
 
60
#Pk triangle, when k>=5, may have internal nodes renumbered: from the
 
61
#gmsh documentation:
 
62
#  @example
 
63
#  The nodes of a curved element are numbered in the following order:
 
64
#
 
65
#    the element principal vertices;
 
66
#    the internal nodes for each edge;
 
67
#    the internal nodes for each face;
 
68
#    the volume internal nodes. 
 
69
#
 
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. 
 
73
#  @end example
 
74
#
 
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 
 
78
#conversion.
 
79
#
 
80
#Pk tetrahedrons and hexaedrons in gmsh and rheolef has not the same edge-node order
 
81
#nd orientation.
 
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.
 
85
#
 
86
#TODO:
 
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.
 
90
#
 
91
#See also hexa edges orient and faces numbers and orient.
 
92
#
 
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.
 
95
#
 
96
#Support for high order >= 6 element ? not documented in gmsh, but gmsh supports it at run
 
97
#End:
 
98
 
 
99
opts=""
 
100
if test $# -eq 0; then
 
101
   echo "msh2geo: usage: msh2geo [-rz|-zr] file.msgh > file.geo" 1>&2
 
102
   exit 1
 
103
fi
 
104
if test x"$1" = x"-rz" -o x"$1" = x"-zr"; then
 
105
  opts=$1
 
106
  shift
 
107
fi
 
108
msh_file=$1
 
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
 
113
   exit 1
 
114
fi
 
115
pkglibdir=`rheolef-config --pkglibdir 2>/dev/null`
 
116
$pkglibdir/msh2geo_int < ${msh_file} | geo -geo -upgrade -
 
117
status=$?
 
118
if test $status -ne 0; then
 
119
    echo "msh2geo: failed." >&2
 
120
    exit 1
 
121
fi