File: mesh_matlab_to_getfem

package info (click to toggle)
getfem%2B%2B 5.3%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 35,604 kB
  • sloc: cpp: 117,991; ansic: 73,600; fortran: 16,046; python: 7,403; sh: 3,624; perl: 1,722; makefile: 1,548
file content (62 lines) | stat: -rwxr-xr-x 1,868 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/perl
# Copyright (C) 1998-2017 Yves Renard
#
# This file is a part of GetFEM++
#
# GetFEM++  is  free software;  you  can  redistribute  it  and/or modify it
# under  the  terms  of the  GNU  Lesser General Public License as published
# by  the  Free Software Foundation;  either version 3 of the License,  or
# (at your option) any later version.
# This program  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 Lesser General Public
# License for more details.
# You  should  have received a copy of the GNU Lesser General Public License
# along  with  this program;  if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA.

#
# Transformation d'un maillage de la pde toolbox en maillage GETFEM
#
# 0) Faire le maillage avec PDETOOL et l'exporter dans les variables p,e et t
# 1) Sauvegarde du maillage avec les comandes :
#    fid = fopen('mesh_nodes', 'w');
#    fprintf(fid, '%f %f\n', p);
#    fclose(fid);
#    fid = fopen('mesh_triangles', 'w');
#    fprintf(fid, '%d %d %d %d\n', t);
#    fclose(fid);
# 2) utiliser ce shell
#    bin/mesh_matlab_to_getfem mesh_nodes mesh_triangles
#



open(F1, $ARGV[0]) or die "Open file impossible : $!\n";
open(F2, $ARGV[1]) or die "Open file impossible : $!\n";

print '% GETFEM MESH FILE', "\n\n";
print "BEGIN POINTS LIST \n\n";
$i = 0;
while ($ligne = <F1>)
{
  print "POINT $i ", $ligne;
  $i++;
}
print "\nEND POINTS LIST \n\n";



print "BEGIN MESH STRUCTURE DESCRIPTION\n\n";
$i = 0;
while ($ligne = <F2>)
{
  ($j, $k, $l, $m) = split(' ', $ligne, 4);
  print "CONVEX $i GT_PK(3,1) ", $j - 1,' ', $k - 1,' ', $l - 1, "\n";
  $i++;
}

print "END MESH STRUCTURE DESCRIPTION\n\n";

close(F1);
close(F2);