source: git/gfanlib/gfanlib_zfan.h @ 08a955

spielwiese
Last change on this file since 08a955 was 26b713, checked in by Yue Ren <ren@…>, 11 years ago
chg: updated gfanlib package to newest version 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  /**
108   * Returns the dimension of the ambient space.
109   */
110  int getAmbientDimension()const;
111  int getCodimension()const;
112  int getDimension()const;
113  int getLinealityDimension()const;
114  ZVector getFVector()const;
115  bool isSimplicial()const;
116  bool isPure()const;
117  bool isComplete()const;
118  /**
119   * Inserts c into the fan.
120   * It is a mistake to insert a cone which live in a space of the wrong dimension.
121   * It is a mistake to insert a cone which does not result in a fan satisfying the nice intersection properties of a fan.
122   * However, the second mistake will not cause the code to crash, but only give undefined results.
123   *
124   * The method insert() is expensive in the sense that calling it may require part of the representation
125   * of the fan to be recomputed. The recomputation only happens on request. Therefore it is expensive
126   * to have alternating calls to for example "insert()" and "numberOfConesOfDimension()".
127   *
128   * Notice that insert() has the effect of reordering cones, orbits and rays of the fan.
129   */
130  void insert(ZCone const &c);
131  void remove(ZCone const &c);
132  /**
133   * Returns the number of cones of dimension d in the collection.
134   */
135  int numberOfConesOfDimension(int d, bool orbit, bool maximal)const;
136  int numberOfConesInCollection()const;
137  /**
138   * Returns the largest dimension of a cone in the fan. If the fan is empty, then -1 is returned.
139   */
140  int dimension()const;
141  /**
142   * Returns the dimension of the lineality space of the fan. Notice that the lineality space of the
143   * empty fan is the ambient space.
144   */
145  // int getLinealityDimension();
146  /**
147   * Returns the cone in the collection given by the index. It is a mistake to specify an index which
148   * is out of range.
149   */
150  ZCone const &getConeInCollection(int index)const;
151  /**
152   * Returns the cone in the cone of the fan
153   */
154  ZCone getCone(int dimension, int index, bool orbit, bool maximal)const;
155  IntVector getConeIndices(int dimension, int index, bool orbit, bool maximal)const;
156
157//  ZFan expand()const;
158//  SymmetryGorup recoverAllSymmetries()const;
159
160/*  typedef PolyhedralConeList::const_iterator coneIterator;
161  PolyhedralFan::coneIterator conesBegin()const;
162  PolyhedralFan::coneIterator conesEnd()const;
163*/
164
165};
166
167}
168
169#endif
170
171#endif /* GFANLIB_ZFAN_H_ */
Note: See TracBrowser for help on using the repository browser.