Strip extra spaces from code.
[voro++.git] / branches / dynamic / scripts / network.pl
blob9680fdd126655aa8a821384bb492ca6989771374
1 #!/usr/bin/perl
2 # This script takes a .vol file that has neighbor information, and creates a
3 # map of the network, by drawing a line between all particles which are
4 # neighbors
5 open A,"@ARGV[0].vol" or die "Can't open input file";
6 open B,">@ARGV[0].net" or die "Can't open output file";
8 $maxn=0;
10 while(<A>) {
11 @A=split;
12 $n=@A[0];
13 $x[$n]=@A[1];
14 $y[$n]=@A[2];
15 $z[$n]=@A[3];
16 $c[$n]=$#A-5;
17 $l[$n][$_-5]=@A[$_] foreach 5..$#A;
18 $maxn=$n if $n>$maxn;
21 foreach $n (1..$maxn) {
22 foreach (0..$c[$n]) {
23 $j=$l[$n][$_];
24 print B "$x[$j] $y[$j] $z[$j]\n$x[$n] $y[$n] $z[$n]\n\n\n" if $j>=$n;