1 #include "vektor.h" 2 #include "printer.h" 3 #include "parser.h" 4 #include "gfanapplication.h" 5 #include "lp.h" 6 #include "polyhedralcone.h" 7 #include "polyhedralfan.h" 8 9 using namespace std; 10 11 class UnfoldApplication : public GFanApplication 12 { 13 class Edge{ 14 public: 15 int i,j; 16 }; 17 18 class Facet{ 19 vector<Edge> edges; 20 public: 21 22 }; 23 24 class Surface{ 25 vector<Edge> edges; 26 vector<Facet> facets; 27 public: 28 29 }; 30 31 32 public: includeInDefaultInstallation()33 bool includeInDefaultInstallation() // Not included since the program has no relation to the main programs 34 { 35 return false; 36 } UnfoldApplication()37 UnfoldApplication(): 38 input1Option("-i1","Specify the name of the first input file.","polymake.out") 39 { 40 registerOptions(); 41 } name()42 const char *name() 43 { 44 return "_unfold"; 45 } main()46 int main() 47 { 48 FileParser P(Stdin); 49 50 PolyhedralFan f1=PolyhedralFan::readFan(input1Option.getValue()); 51 52 assert(f1.getAmbientDimension()==4); 53 54 int boxSize=2; 55 IntegerVectorList equations; 56 IntegerVectorList inequalities; 57 inequalities.push_back(boxSize*IntegerVector::standardVector(4,0)+IntegerVector::standardVector(n,1)); 58 inequalities.push_back(boxSize*IntegerVector::standardVector(4,0)+IntegerVector::standardVector(n,2)); 59 inequalities.push_back(boxSize*IntegerVector::standardVector(4,0)+IntegerVector::standardVector(n,3)); 60 61 PolyhedralCone C(inequalities,equalities,4); 62 C.canonicalize(); 63 PolyhedralFan F(4); 64 F.insert(C); 65 66 PolyhedralFan f2=refinement(f1,F); 67 68 IntegerVectorList rays=f2.getRays(); 69 70 Surface s; 71 72 for(PolyhedralFan::coneIterator i=f2.conesBegin();i!=f2.conesEnd();i++) 73 { 74 if(i->dimension()==3) 75 { 76 PolyhedralFan f3=PolyhedralFan::facetsOfCone(*i); 77 for(PolyhedralFan::coneIterator i=f3.conesBegin();i!=f3.conesEnd();i++) 78 { 79 Facet F; 80 int J=0; 81 for(IntegerVectorList::const_iterator j=rays.begin();j!=rays.end();j++,J++) 82 if(i->contains(*j)) 83 F.edges.push_back(J); 84 } 85 } 86 s.facets.push_back(F); 87 } 88 89 90 IntegerVectorList v=P.parseIntegerVectorList(); 91 fprintf(Stderr,"Rank:%i\n",rankOfMatrix(v)); 92 AsciiPrinter(Stdout).printVectorList(transposeIntegerVectorList(v)); 93 return 0; 94 } helpText()95 const char *helpText() 96 { 97 return "\n"; 98 } 99 }; 100 101 static UnfoldApplication theApplication; 102