~ubuntu-branches/ubuntu/saucy/gfan/saucy-proposed

« back to all changes in this revision

Viewing changes to app_unfold.cpp

  • Committer: Package Import Robot
  • Author(s): Cédric Boutillier
  • Date: 2013-07-09 10:44:01 UTC
  • mfrom: (2.1.2 experimental)
  • Revision ID: package-import@ubuntu.com-20130709104401-5q66ozz5j5af0dak
Tags: 0.5+dfsg-3
* Upload to unstable.
* modify remove_failing_tests_on_32bits.patch to replace command of
  0009RenderStairCase test with an empty one instead of deleting it.
* remove lintian override about spelling error

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
#include "parser.h"
4
4
#include "gfanapplication.h"
5
5
#include "lp.h"
6
 
 
 
6
#include "polyhedralcone.h"
 
7
#include "polyhedralfan.h"
7
8
 
8
9
using namespace std;
9
10
 
10
 
class Facet{
11
 
  IntegerVector indices;
12
 
public:
13
 
  
14
 
};
15
 
 
16
 
class Polytope{
17
 
  list<Facet> facets;
18
 
  IntegerMatrix vertices;
19
 
public:
20
 
  
21
 
};
22
 
 
23
 
typedef IntegerVector tree;
24
 
 
25
 
class UnfoldedPolytope{
26
 
};
27
 
 
28
 
 
29
11
class UnfoldApplication : public GFanApplication
30
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
        };
31
30
 
32
31
 
33
32
public:
35
34
  {
36
35
    return false;
37
36
  }
38
 
  TransposeMatrixApplication()
 
37
  UnfoldApplication():
 
38
          input1Option("-i1","Specify the name of the first input file.","polymake.out")
39
39
  {
40
40
    registerOptions();
41
41
  }
42
 
  char *name()
 
42
  const char *name()
43
43
  {
44
44
    return "_unfold";
45
45
  }
46
46
  int main()
47
47
  {
48
 
    lpSetSolver("cddgmp");
49
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
 
50
90
    IntegerVectorList v=P.parseIntegerVectorList();
51
91
    fprintf(Stderr,"Rank:%i\n",rankOfMatrix(v));
52
92
    AsciiPrinter(Stdout).printVectorList(transposeIntegerVectorList(v));