1 | /* |
---|
2 | * gfanlib_polyhedralfan.h |
---|
3 | * |
---|
4 | * Created on: Nov 16, 2010 |
---|
5 | * Author: anders |
---|
6 | */ |
---|
7 | |
---|
8 | #ifndef GFANLIB_POLYHEDRALFAN_H_INCLUDED |
---|
9 | #define GFANLIB_POLYHEDRALFAN_H_INCLUDED |
---|
10 | |
---|
11 | #include <set> |
---|
12 | #include <list> |
---|
13 | #include <map> |
---|
14 | #include "gfanlib_symmetry.h" |
---|
15 | #include "gfanlib_matrix.h" |
---|
16 | #include "gfanlib_zcone.h" |
---|
17 | #include "gfanlib_symmetriccomplex.h" |
---|
18 | |
---|
19 | namespace gfan{ |
---|
20 | |
---|
21 | |
---|
22 | typedef std::set<ZCone> PolyhedralConeList; |
---|
23 | typedef std::list<IntVector> IntVectorList; |
---|
24 | typedef std::map<int,IntVectorList> IncidenceList; |
---|
25 | |
---|
26 | class PolyhedralFan ; |
---|
27 | |
---|
28 | PolyhedralFan refinement(const PolyhedralFan &a, const PolyhedralFan &b, int cutOffDimension=-1, bool allowASingleConeOfCutOffDimension=false); |
---|
29 | |
---|
30 | /** A PolyhedralFan is simply a collection of canonicalized PolyhedralCones. |
---|
31 | * It contains no combinatorial information in the sense of a polyhedral complex. |
---|
32 | * A cone being present in the PolyhedralFan corresponds to the cone and all its facets being present |
---|
33 | * in the mathematical object. |
---|
34 | * The intersection of cones in the fan must be a face of both. |
---|
35 | * In particular all cones in a PolyhedralFan have the same lineality space.*/ |
---|
36 | class PolyhedralFan |
---|
37 | { |
---|
38 | int n; |
---|
39 | SymmetryGroup symmetries; |
---|
40 | PolyhedralConeList cones; |
---|
41 | public: |
---|
42 | static class PolyhedralFan fullSpace(int n); |
---|
43 | static class PolyhedralFan facetsOfCone(ZCone const &c); |
---|
44 | PolyhedralFan(int ambientDimension); |
---|
45 | PolyhedralFan(SymmetryGroup const &sym); |
---|
46 | std::string toString(int flags=FPF_default)const; |
---|
47 | /* Read in a polyhedral fan, but with the cones containing w. If |
---|
48 | present, only read in cones among coneIndices. If sym is |
---|
49 | present, read COMPRESSED section and make w containment up to |
---|
50 | symmetry, taking all elements in the orbit that contains w into |
---|
51 | the fan. If onlyMaximal is set then only maximal cones are read |
---|
52 | in. |
---|
53 | */ |
---|
54 | int getAmbientDimension()const; |
---|
55 | int getMaxDimension()const; |
---|
56 | int getMinDimension()const; |
---|
57 | |
---|
58 | // friend PolyhedralFan refinement(const PolyhedralFan &a, const PolyhedralFan &b, int cutOffDimension=-1, bool allowASingleConeOfCutOffDimension=false); |
---|
59 | |
---|
60 | ZMatrix getRays(int dim=1);//This can be called for other dimensions than 1. The term "Rays" still makes sense modulo the common linearity space |
---|
61 | ZMatrix getRelativeInteriorPoints(); |
---|
62 | void insert(ZCone const &c); |
---|
63 | void remove(ZCone const &c); |
---|
64 | void removeAllLowerDimensional(); |
---|
65 | /** |
---|
66 | Since the cones stored in a PolyhedralFan are cones of a |
---|
67 | polyhedral fan, it is possible to identify non maximal cones by |
---|
68 | just checking containment of relative interior points in other |
---|
69 | cones. This routine removes all non-maximal cones. |
---|
70 | */ |
---|
71 | void removeNonMaximal(); |
---|
72 | /** |
---|
73 | Returns the number of cones stored in the fan. This is not the number of cones in the fan in a mathematical sense. |
---|
74 | */ |
---|
75 | int size()const; |
---|
76 | int dimensionOfLinealitySpace()const; |
---|
77 | void makePure(); |
---|
78 | bool contains(ZCone const &c)const; |
---|
79 | /** |
---|
80 | * For a vector contained in the support of the fan represented by the fan object, this function |
---|
81 | * computes the cone that contains the vector in its relative interior. |
---|
82 | */ |
---|
83 | ZCone coneContaining(ZVector const &v)const; |
---|
84 | PolyhedralFan facetComplex()const; |
---|
85 | |
---|
86 | ZMatrix getRaysInPrintingOrder(bool upToSymmetry=false)const; |
---|
87 | IncidenceList getIncidenceList(SymmetryGroup *sym=0)const; |
---|
88 | bool isEmpty()const; |
---|
89 | |
---|
90 | |
---|
91 | /** |
---|
92 | Computes the link of the face containing w in its relative interior. |
---|
93 | */ |
---|
94 | PolyhedralFan link(ZVector const &w)const; |
---|
95 | PolyhedralFan link(ZVector const &w, SymmetryGroup *sym)const; |
---|
96 | |
---|
97 | |
---|
98 | |
---|
99 | typedef PolyhedralConeList::const_iterator coneIterator; |
---|
100 | PolyhedralFan::coneIterator conesBegin()const; |
---|
101 | PolyhedralFan::coneIterator conesEnd()const; |
---|
102 | |
---|
103 | |
---|
104 | /** |
---|
105 | * Converts a PolyhedralFan into a SymmetricComplex. This is used for homology computations, but not for printing yet. |
---|
106 | */ |
---|
107 | SymmetricComplex toSymmetricComplex()const; |
---|
108 | // static PolyhedralFan readFan(string const &filename, bool onlyMaximal=true, IntegerVector *w=0, set<int> const *conesIndice=0, SymmetryGroup const *sym=0, bool readCompressedIfNotSym=false); |
---|
109 | }; |
---|
110 | |
---|
111 | |
---|
112 | void addFacesToSymmetricComplex(SymmetricComplex &c, ZCone const &cone, ZMatrix const &facetCandidates, ZMatrix const &generatorsOfLinealitySpace); |
---|
113 | void addFacesToSymmetricComplex(SymmetricComplex &c, std::set<int> const &indices, ZMatrix const &facetCandidates, int dimension, Integer multiplicity); |
---|
114 | |
---|
115 | } |
---|
116 | |
---|
117 | #endif |
---|