diff options
author | jthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2004-04-21 14:09:47 +0000 |
---|---|---|
committer | jthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2004-04-21 14:09:47 +0000 |
commit | 3887e67d79703d2fa5d0d48526f57fb5b7bde071 (patch) | |
tree | 1d89de840964f5c8bee8e88db907ecf022133e7f /src | |
parent | 431bfc0de7e6c3ea3ea5249f0d3597da034b6cf4 (diff) |
script to select xy/xz/yz-plane from AHFinderDirect output files
(this is a kludge; it would be better for AHFinderDirect to have
options to output plane intersections directly)
git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@1310 f88db872-0e4f-0410-b76b-b9085cfa78c5
Diffstat (limited to 'src')
-rwxr-xr-x | src/misc/select.plane | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/misc/select.plane b/src/misc/select.plane new file mode 100755 index 0000000..062f12d --- /dev/null +++ b/src/misc/select.plane @@ -0,0 +1,50 @@ +#!/usr/bin/perl -w +use strict; +my $true = 1; +my $false = 0; + +######################################## + +my $usage_msg = <<'EOF'; +Usage: + select.plane [ xy | xz | yz ] + +This script reads an AHFinderDirect horizon-shape data file from +standard input, with file format + dpx dpy radius x y z +selects the subset of the data which lies in the specified plane, +and writes that to standard output. +EOF + +######################################## + +if (scalar(@ARGV) != 1) + { die $usage_msg; } + +my $xy_plane_flag = $false; +my $xz_plane_flag = $false; +my $yz_plane_flag = $false; +if ($ARGV[0] eq 'xy') { $xy_plane_flag = $true; } +elsif ($ARGV[0] eq 'xz') { $xz_plane_flag = $true; } +elsif ($ARGV[0] eq 'yz') { $yz_plane_flag = $true; } +else { die $usage_msg; } + + + while (my $line = <STDIN>) + { + chomp($line); + + # echo blank or comment lines + if (($line =~ /^$/) || ($line =~ /^#/)) + { + print $line, "\n"; + next; # *** LOOP CONTROL *** + } + + my ($dpx,$dpy,$radius,$x,$y,$z) = split(/\s+/, $line); + + if ( ($xy_plane_flag && (abs($z) <= 1.0e-10)) + || ($xz_plane_flag && (abs($y) <= 1.0e-10)) + || ($yz_plane_flag && (abs($x) <= 1.0e-10)) ) + { print $line, "\n"; } + } |