[Gmsh] number of digits

Jö Fahlke jorrit at jorrit.de
Fri Oct 7 01:57:30 CEST 2011


Am Thu,  6. Oct 2011, 21:00:30 +0300 schrieb panourg at mech.upatras.gr:
> How can i change the number of digits so that to describe the coordinates
> of nodes with more digits. As default the smallest number can be e-5 or e
> -6. I want to be e-8 or e-9.

I had a similar problem.  I solved it by writing the .geo in a size close to 1
and then rescaling the coordinates in the resulting .msh.  The script to do
this is attached.  It only works on ascii .msh file though.

Bye,
Jö.

-- 
Jorrit (Jö) Fahlke, Interdisciplinary Center for Scientific Computing,
Heidelberg University, Im Neuenheimer Feld 368, D-69120 Heidelberg
Tel: +49 6221 54 8890 Fax: +49 6221 54 8884

Kiss a non-smoker; taste the difference.
-- fortune
-------------- next part --------------
#!/usr/bin/perl

use strict;
use warnings;

my $scale = shift or die "Usage: scale-msh SCALE [INFILE]\n";

my $state = 'outside';
while(<>) {
    if($state eq 'outside') {
        if(/^\$Nodes$/) {
            $state = 'nodecount';
        }
    }
    elsif($state eq 'nodecount') {
        $state = 'nodes';
    }
    elsif($state eq 'nodes') {
        if(/^\$EndNodes$/) {
            $state = 'outside';
        }
        else {
            my($serial, @coords) = split;
            for(@coords) { $_ *= $scale }
            $_ = "$serial @coords\n";
        }
    }
    else { die "Unexpected internal state: $state" }
    print;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 828 bytes
Desc: Digital signature
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20111007/c3a1d3e2/attachment.asc>