From 06df1fff27baa0c3b95d5543c333e818c52827a5 Mon Sep 17 00:00:00 2001 From: Ian Hinder Date: Wed, 19 Oct 2011 03:42:59 +0200 Subject: 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. --- Carpet/CarpetIOASCII/src/util/Carpet2ygraph.pl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Carpet/CarpetIOASCII') 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 () @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 () if (0 == $componentflag{$refinementlevel}) { push(@outputdata, ("\"",$line)); # Add ygraph comment marker + $newflag = 0; } else { @@ -96,11 +98,11 @@ while () 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"); -- cgit v1.2.3