1 #include "parser.h"
2 #include "printer.h"
3 #include "lp.h"
4 #include "gfanapplication.h"
5 #include "polyhedralcone.h"
6 #include "polyhedralfan.h"
7 #include "polymakefile.h"
8 
9 class CommonRefinementApplication : public GFanApplication
10 {
11   StringOption input1Option;
12   StringOption input2Option;
13   SimpleOption stableOption;
14 public:
helpText()15   const char *helpText()
16   {
17     return "This program takes two polyhedral fans and computes their common refinement.\n";
18   }
CommonRefinementApplication()19   CommonRefinementApplication():
20     input1Option("-i1","Specify the name of the first input file.","polymake.out"),
21     input2Option("-i2","Specify the name of the second input file.","polymake.out"),
22     stableOption("--stable","Compute the stable intersection.")
23   {
24     //    stableOption.hide();
25     registerOptions();
26   }
27 
name()28   const char *name()
29   {
30     return "_fancommonrefinement";
31   }
32 
main()33   int main()
34   {
35     PolyhedralFan f1=PolyhedralFan::readFan(input1Option.getValue());
36     PolyhedralFan f2=PolyhedralFan::readFan(input2Option.getValue());
37 
38     PolyhedralFan f=refinement(f1,f2,-1,false,stableOption.getValue());
39 
40     AsciiPrinter P(Stdout);
41 
42     f.printWithIndices(&P,FPF_default/*|(stableOption.getValue()?FPF_multiplicities:0)|FPF_values*/);
43     /* TODO: If one wants to do intersection theory as Fulton and Sturmfels
44      * it would be very convenient that multiplicities are output here.
45      * Unfortunately the refinement command does not compute multiplicities at the moment.
46      * This should be fixed to make gfan more useful.
47      * */
48 
49 
50     return 0;
51   }
52 };
53 
54 static CommonRefinementApplication theApplication;
55