1
#include "traverser_secondaryfan.h"
7
Triangulation2 triangulationWithFullDimensionalIntersection(Triangulation2 g, PolyhedralCone const &c)
10
PolyhedralCone A=intersection(c,g.secondaryFanSupport());
12
IntegerVector v=A.getRelativeInteriorPoint();
13
IntegerVectorList l=c.generatorsOfSpan();
17
g.changeToTriangulationInducedBy(T);
21
SecondaryFanTraverser::SecondaryFanTraverser(Triangulation2 const &triangulation_):
22
theTriangulation(triangulation_),
23
theCone(triangulation_.getN()),
24
theRestrictingCone(triangulation_.getN())
26
isHomogeneous=theTriangulation.isHomogeneous();
27
// debug<<"SUPPORT"<<theTriangulation.secondaryFanSupport();
30
theRestrictingCone=intersection(theRestrictingCone,theTriangulation.secondaryFanSupport());
31
//debug<<"SUPPORT"<<theTriangulation.secondaryFanSupport();
32
//debug<<"RESTRICTING"<<theRestrictingCone;
33
n=triangulation_.getN();
35
d=theRestrictingCone.dimension();
36
updatePolyhedralCone();
39
SecondaryFanTraverser::SecondaryFanTraverser(Triangulation2 const &triangulation_, PolyhedralCone const &restrictingCone):
40
theTriangulation(triangulation_),
41
theCone(triangulation_.getN()),
42
theRestrictingCone(restrictingCone)
44
isHomogeneous=theTriangulation.isHomogeneous();
45
theRestrictingCone=intersection(theRestrictingCone,theTriangulation.secondaryFanSupport());
46
d=theRestrictingCone.dimension();
47
n=triangulation_.getN();
48
updatePolyhedralCone();
52
void SecondaryFanTraverser::updatePolyhedralCone()
54
IntegerVectorList empty;
56
theCone=theTriangulation.secondaryCone().negated();
57
//debug<<"THECONE"<<theCone;
59
theCone=intersection(theCone,theRestrictingCone);
60
theCone.canonicalize();
63
if(theCone.dimension()!=d)
65
cerr<<"WARNING THIS CONE HAS THE WRONG DIMENSION!"<<endl;
69
AsciiPrinter P(Stderr);
70
theRestrictingCone.print(&P);
75
void SecondaryFanTraverser::changeCone(IntegerVector const &ridgeVector, IntegerVector const &rayVector)
77
// debug<<"changeCone\n";
78
assert(theCone.contains(ridgeVector));
79
// debug<<"ridgeVector"<<ridgeVector<<"\n";
80
// debug<<"rayVector"<<rayVector<<"\n";
83
/* If we are traversing a full-dimensional fan, then the rayVector is
84
* the unique (up to scaling) normal vector of the lineality space.*/
85
theTriangulation.flipNew(-rayVector);
90
m.push_back(ridgeVector);
91
m.push_back(rayVector);
92
m.push_back(IntegerVector::allOnes(n));//Tie break with degree order - this might not be necessary.
94
theTriangulation.changeToTriangulationInducedBy(T);
96
updatePolyhedralCone();
97
// debug<<"END changeCone\n";
100
IntegerVectorList SecondaryFanTraverser::link(IntegerVector const &ridgeVector)
102
IntegerVectorList ret;
103
IntegerVector v=theCone.link(ridgeVector).getUniquePoint();
107
if(!theRestrictingCone.containsRelatively(ridgeVector))return ret;
115
// If the ideal is known to be homogeneous in a positive grading then we don't have to make the following test
116
// Furthermore, for restricted traversals the following test test the ridge for having a positive vector - another definitions of flipability would be to check the lifting of the ridge to the full space.
117
PolyhedralCone temp=theCone.faceContaining(ridgeVector);
118
if(temp.containsPositiveVector())ret.push_back(-v);
119
// cerr<<"THIS NEEDS TO BE FIXED!!!\n";
120
// ret.push_back(-v);
124
PolyhedralCone & SecondaryFanTraverser::refToPolyhedralCone()