Reset platonic code.
[voro++.git] / branches / 2d / scripts / network.pl
blob12f857d167a0a9ab8764684f76755e761fd73be4
1 #!/usr/bin/perl
2 # This script takes a .vol file that has neighbor information created with
3 # the custom output string "%i %q %v %n", and creates a map of the network, by
4 # drawing a line between all particles which are neighbors
6 open A,"@ARGV[0].vol" or die "Can't open input file";
7 open B,">@ARGV[0].net" or die "Can't open output file";
9 $maxn=0;
11 while(<A>) {
12 @A=split;
13 $n=@A[0];
14 $x[$n]=@A[1];
15 $y[$n]=@A[2];
16 $c[$n]=$#A-4;
17 $l[$n][$_-4]=@A[$_] foreach 4..$#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]\n$x[$n] $y[$n]\n\n\n" if $j>=$n;