File: app_unfold.cpp

package info (click to toggle)
gfan 0.5%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 8,348 kB
  • ctags: 5,683
  • sloc: cpp: 39,675; makefile: 454; sh: 1
file content (101 lines) | stat: -rw-r--r-- 2,199 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#include "vektor.h"
#include "printer.h"
#include "parser.h"
#include "gfanapplication.h"
#include "lp.h"
#include "polyhedralcone.h"
#include "polyhedralfan.h"

using namespace std;

class UnfoldApplication : public GFanApplication
{
	class Edge{
	public:
		int i,j;
	};

	class Facet{
	  vector<Edge> edges;
	public:

	};

	class Surface{
		vector<Edge> edges;
		vector<Facet> facets;
	public:

	};


public:
  bool includeInDefaultInstallation() // Not included since the program has no relation to the main programs
  {
    return false;
  }
  UnfoldApplication():
	  input1Option("-i1","Specify the name of the first input file.","polymake.out")
  {
    registerOptions();
  }
  const char *name()
  {
    return "_unfold";
  }
  int main()
  {
    FileParser P(Stdin);

    PolyhedralFan f1=PolyhedralFan::readFan(input1Option.getValue());

    assert(f1.getAmbientDimension()==4);

    int boxSize=2;
    IntegerVectorList equations;
	IntegerVectorList inequalities;
	inequalities.push_back(boxSize*IntegerVector::standardVector(4,0)+IntegerVector::standardVector(n,1));
	inequalities.push_back(boxSize*IntegerVector::standardVector(4,0)+IntegerVector::standardVector(n,2));
	inequalities.push_back(boxSize*IntegerVector::standardVector(4,0)+IntegerVector::standardVector(n,3));

	PolyhedralCone C(inequalities,equalities,4);
	C.canonicalize();
	PolyhedralFan F(4);
	F.insert(C);

	PolyhedralFan f2=refinement(f1,F);

	IntegerVectorList rays=f2.getRays();

	Surface s;

	for(PolyhedralFan::coneIterator i=f2.conesBegin();i!=f2.conesEnd();i++)
	{
		if(i->dimension()==3)
		{
			PolyhedralFan f3=PolyhedralFan::facetsOfCone(*i);
			for(PolyhedralFan::coneIterator i=f3.conesBegin();i!=f3.conesEnd();i++)
			{
				Facet F;
				int J=0;
				for(IntegerVectorList::const_iterator j=rays.begin();j!=rays.end();j++,J++)
					if(i->contains(*j))
						F.edges.push_back(J);
			}
		}
		s.facets.push_back(F);
	}


    IntegerVectorList v=P.parseIntegerVectorList();
    fprintf(Stderr,"Rank:%i\n",rankOfMatrix(v));
    AsciiPrinter(Stdout).printVectorList(transposeIntegerVectorList(v));
    return 0;
  }
  const char *helpText()
  {
    return "\n";
  }
};

static UnfoldApplication theApplication;