diff options
author | Ian Hinder <ian.hinder@aei.mpg.de> | 2011-10-19 03:42:59 +0200 |
---|---|---|
committer | Barry Wardell <barry.wardell@gmail.com> | 2011-12-14 19:54:51 +0000 |
commit | 06df1fff27baa0c3b95d5543c333e818c52827a5 (patch) | |
tree | 72d1da3590e371167eb5764bf39b08d7c01df355 /Carpet/CarpetIOASCII | |
parent | 232a7236b58002de48688fc8c77164a389787939 (diff) |
Fix Carpet2ygraph.pl to work with new Carpet
The script CarpetIOASCII/src/util/Carpet2ygraph.pl (it is the same
both in the git and hg versions of Carpet) is not working anymore. I
modified it in order to be able again to produce different output for
the different refinement levels and now it can also work with more
than 9 refinement levels. I have attached my version and the diff with
the version in the repository.
Diffstat (limited to 'Carpet/CarpetIOASCII')
-rwxr-xr-x | Carpet/CarpetIOASCII/src/util/Carpet2ygraph.pl | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Carpet/CarpetIOASCII/src/util/Carpet2ygraph.pl b/Carpet/CarpetIOASCII/src/util/Carpet2ygraph.pl index 29a6a0483..051150721 100755 --- a/Carpet/CarpetIOASCII/src/util/Carpet2ygraph.pl +++ b/Carpet/CarpetIOASCII/src/util/Carpet2ygraph.pl @@ -34,6 +34,7 @@ open(CARPETFILE, "<$ARGV[1]") || die "Unable to find file \"$ARGV[1]\"."; my $direction = $ARGV[0]+9; my $flag = 0; +my $newflag = 0; my $refinementlevel = 0; my %componentflag = (); $componentflag{$refinementlevel} = 0; @@ -66,7 +67,7 @@ while (<CARPETFILE>) @outputdata=("\n"); $flag = 0; } - if ($line =~ /refinement level ([0-9])/) # Line gives ref. level + if ($line =~ /refinement level ([0-9]{1,2})/) # Line gives ref. level { $refinementlevel = $1; $line =~ /component ([0-9+])/; @@ -86,6 +87,7 @@ while (<CARPETFILE>) if (0 == $componentflag{$refinementlevel}) { push(@outputdata, ("\"",$line)); # Add ygraph comment marker + $newflag = 0; } else { @@ -96,11 +98,11 @@ while (<CARPETFILE>) else # The line contains real data { @data = split(/[ \t]+/,$line); - if ($flag== 0) # This is the first line of data + if (($newflag==0)) # This is the first line of data { - $flag = 1; + $newflag = 1; my $timeset = $data[8]; # Magic number gives the Cactus time - @outputdata = ("\n\"Time = $timeset",@outputdata); + @outputdata = ("\n\n\#Time = $timeset \n",@outputdata); } chomp ($data[12]); push(@outputdata, "$data[$direction] $data[12]\n"); |