# Copyright (c) 1997-2006 # Ewgenij Gawrilow, Michael Joswig (Technische Universitaet Berlin, Germany) # http://www.math.tu-berlin.de/polymake, mailto:polymake@math.tu-berlin.de # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2, or (at your option) any # later version: http://www.gnu.org/licenses/gpl.txt. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. #----------------------------------------------------------------------------- # $Project: polymake $$Id: topcom.rules 7044 2006-02-21 19:34:28Z gawrilow $ # path to the programs from the TOPCOM package custom $topcom; CONFIGURE { $topcom=find_via_path("points2chiro") or die "TOPCOM program 'points2chiro' not found\n"; $topcom =~ s/points2chiro$//; } object Polytope; # category: Oriented matroids # Chirotope corresponding to @see VERTICES property CHIROTOPE $type="chirotope"; $apply_diff{VERTICES}=sub { die "CHIROTOPE must be recomputed\n" }; # category: Oriented matroids # Chirotope corresponding to @see POINTS. property CHIROTOPE_INT $type="chirotope"; # Category: Triangulation and volume # Use the @see external.TOPCOM package for computing polytope triangulation. label topcom sub call_topcom_chiro($) { my $P=new Poly::ProgramPipe("$topcom/points2chiro"); print $P "["; my $first=1; local $_; foreach my $point (@{$_[0]}) { $_=$point; s/^\s*(.*)\s*$/[$1]/; s/\s+/,/g; print $P "," unless ($first); print $P $_; $first=0; } print $P "]\n"; [ <$P> ]; } sub call_topcom_triang($) { my $P=new Poly::ProgramPipe("$topcom/chiro2placingtriang"); print $P @{$_[0]}; local $_=<$P>; chomp; s/,/ /g; s/\{\{/\{/; s/\}\}/\}/; s/\}\s*\{/\}\n\{/g; [ split /(?<=\n)/s, $_ ]; } CHIROTOPE : VERTICES WEIGHT 6.10 $this->CHIROTOPE=call_topcom_chiro($this->VERTICES); CHIROTOPE_INT : POINTS WEIGHT 6.20 $this->CHIROTOPE_INT=call_topcom_chiro($this->POINTS); topcom.triangulation: TRIANGULATION : CHIROTOPE $this->TRIANGULATION=call_topcom_triang($this->CHIROTOPE); topcom.triangulation: TRIANGULATION_INT : CHIROTOPE_INT $this->TRIANGULATION_INT=call_topcom_triang($this->CHIROTOPE_INT); # Local Variables: # mode: perl # c-basic-offset:3 # End: