source: git/gfanlib/gfanlib_zfan.h @ 0acf3e

fieker-DuValspielwiese
Last change on this file since 0acf3e was f80a530, checked in by Yue Ren <ren@…>, 11 years ago
chg: print routines for polyhedral fans corresponds to 7add05a9a5fb7b1e61023a1b6873e366d004d453 in master
  • Property mode set to 100644
File size: 5.2 KB
Line 
1/*
2 * gfanlib_zfan.h
3 *
4 *  Created on: Nov 17, 2010
5 *      Author: anders
6 */
7
8#ifndef GFANLIB_ZFAN_H_
9#define GFANLIB_ZFAN_H_
10
11/*
12 * gfanlib_polyhedralfan.h
13 *
14 *  Created on: Nov 16, 2010
15 *      Author: anders
16 */
17
18#ifndef GFANLIB_ZFAN_H_INCLUDED
19#define GFANLIB_ZFAN_H_INCLUDED
20
21#include <set>
22#include <list>
23#include <map>
24#include "gfanlib_polyhedralfan.h"
25#include "gfanlib_symmetriccomplex.h"
26
27namespace gfan{
28
29/**
30 * This class represents a Polyhedral fan with the combined features of a SymmetricComplex, and
31 * a PolyhedralFan (which we regards as some collection of cones of the fan with the property that every cone
32 * of the fan is a face of these (up to action by the group)).
33 * It is important to distinguis between the cones of the collection, the cones of the fan as a mathematical object, and the orbits of cones of the fan.
34 *
35 *
36 * TEMPLATES SHOULD BE HIDDEN
37 */
38class ZFan
39{
40  mutable PolyhedralFan *coneCollection;
41  mutable SymmetricComplex *complex;
42  mutable std::vector<std::vector<IntVector > > cones;
43  mutable std::vector<std::vector<IntVector > > maximalCones;
44  mutable std::vector<std::vector<IntVector > > coneOrbits;
45  mutable std::vector<std::vector<IntVector > > maximalConeOrbits;
46
47
48  //  SymmetryGroup sym;
49
50  /**
51   * Functions that makes the symmetric complex invalid:
52   * insert() and construction
53   *
54   * Functions that make the cone collection invalid:
55   * readFan()
56   *
57   */
58  void ensureConeCollection()const;
59  void ensureComplex()const;
60  void killComplex()const;
61public:
62  std::vector<std::vector<IntVector> > &table(bool orbit, bool maximal)const;
63  ~ZFan();
64  ZFan():
65    coneCollection(0),
66    complex(0)
67  {}
68  ZFan(ZFan const& f);
69  /**
70   *
71   * To read from string, do the following:
72   *       std::string test="TEST";
73   *   std::istringstream s(test);
74   *   ZFan G(s);
75   *
76   */
77  ZFan(std::istream  &f);
78  ZFan& operator=(ZFan const &f);
79  /**
80   * Creates an empty fan in the ambient space of dimension n.
81   * It is a mistake to:
82   *  specify a negative ambientDimension.
83   */
84  ZFan(int ambientDimension);
85  /**
86   * Creates an empty fan in the ambient space with dimension equal to the number of elements being permuted by the group.
87   * The fan will have the symmmetries given by sym_ associated.
88   */
89  ZFan(SymmetryGroup const &sym_);
90  /**
91   * Creates the fan in dimension n consisting of the n-dimensional space.
92   */
93  static ZFan fullFan(int n);
94  /**
95   * Creates the full space as a fan in the ambient space with dimension equal to the number of elements being permuted by the group.
96   * The fan will have the symmetries given by sym_ associated.
97   */
98  static ZFan fullFan(SymmetryGroup const &sym_);
99  /**
100   * Reads from stream
101   */
102//  static ZFan readFan(string const &filename, bool onlyMaximal=true, IntegerVector *w=0, set<int> const *conesIndice=0, SymmetryGroup const *sym=0, bool readCompressedIfNotSym=false);
103  /**
104   * Writes to string
105   */
106  std::string toString(int flags=0)const;
107  std::string toStringJustRaysAndMaximalCones(int flags=0)const;
108  /**
109   * Returns the dimension of the ambient space.
110   */
111  int getAmbientDimension()const;
112  int getCodimension()const;
113  int getDimension()const;
114  int getLinealityDimension()const;
115  ZVector getFVector()const;
116  bool isSimplicial()const;
117  bool isPure()const;
118  bool isComplete()const;
119  /**
120   * Inserts c into the fan.
121   * It is a mistake to insert a cone which live in a space of the wrong dimension.
122   * It is a mistake to insert a cone which does not result in a fan satisfying the nice intersection properties of a fan.
123   * However, the second mistake will not cause the code to crash, but only give undefined results.
124   *
125   * The method insert() is expensive in the sense that calling it may require part of the representation
126   * of the fan to be recomputed. The recomputation only happens on request. Therefore it is expensive
127   * to have alternating calls to for example "insert()" and "numberOfConesOfDimension()".
128   *
129   * Notice that insert() has the effect of reordering cones, orbits and rays of the fan.
130   */
131  void insert(ZCone const &c);
132  void remove(ZCone const &c);
133  /**
134   * Returns the number of cones of dimension d in the collection.
135   */
136  int numberOfConesOfDimension(int d, bool orbit, bool maximal)const;
137  int numberOfConesInCollection()const;
138  /**
139   * Returns the largest dimension of a cone in the fan. If the fan is empty, then -1 is returned.
140   */
141  int dimension()const;
142  /**
143   * Returns the dimension of the lineality space of the fan. Notice that the lineality space of the
144   * empty fan is the ambient space.
145   */
146  // int getLinealityDimension();
147  /**
148   * Returns the cone in the collection given by the index. It is a mistake to specify an index which
149   * is out of range.
150   */
151  ZCone const &getConeInCollection(int index)const;
152  /**
153   * Returns the cone in the cone of the fan
154   */
155  ZCone getCone(int dimension, int index, bool orbit, bool maximal)const;
156  IntVector getConeIndices(int dimension, int index, bool orbit, bool maximal)const;
157
158//  ZFan expand()const;
159//  SymmetryGorup recoverAllSymmetries()const;
160
161/*  typedef PolyhedralConeList::const_iterator coneIterator;
162  PolyhedralFan::coneIterator conesBegin()const;
163  PolyhedralFan::coneIterator conesEnd()const;
164*/
165
166};
167
168}
169
170#endif
171
172#endif /* GFANLIB_ZFAN_H_ */
Note: See TracBrowser for help on using the repository browser.