1 | /*****************************************************************************\ |
---|
2 | * Computer Algebra System SINGULAR |
---|
3 | \*****************************************************************************/ |
---|
4 | /** @file Cone.h |
---|
5 | * |
---|
6 | * This file provides the class Cone for storing cones in Gröbner fans. |
---|
7 | * |
---|
8 | * ABSTRACT: This file provides the class Cone for storing cones in Gröbner |
---|
9 | * fans. |
---|
10 | * (See the documentation of class Fan in Fan.h) |
---|
11 | * Each instance of class Cone holds a back link to a fan object where the |
---|
12 | * lineality space and all maximal rays and facet normals are stored. |
---|
13 | * Hence, each cone only needs to store indices to these maximal rays and/or |
---|
14 | * facet normals. |
---|
15 | * |
---|
16 | * @author Frank Seelisch |
---|
17 | * |
---|
18 | * @internal @version \$Id$ |
---|
19 | * |
---|
20 | **/ |
---|
21 | /*****************************************************************************/ |
---|
22 | |
---|
23 | #ifndef CONE_H |
---|
24 | #define CONE_H |
---|
25 | |
---|
26 | class Fan; |
---|
27 | |
---|
28 | class Cone |
---|
29 | { |
---|
30 | private: |
---|
31 | Fan* m_pFan; /* back pointer to the "parent" Gröbner fan */ |
---|
32 | intvec* m_rays; /* indices of maximal rays (stored in the fan) */ |
---|
33 | intvec* m_facetNs; /* indices of facet normals (stored in the fan) */ |
---|
34 | int m_dim; /* dimension of the given cone */ |
---|
35 | |
---|
36 | public: |
---|
37 | /** |
---|
38 | * Constructor for class Cone. |
---|
39 | * |
---|
40 | * Second and third argument may be NULL but not both simultaneously. |
---|
41 | * This constructor assumes that all data is valid. (This may be |
---|
42 | * checked beforehand using the static method checkConeData.) |
---|
43 | **/ |
---|
44 | Cone ( |
---|
45 | Fan* pFan, /**< [in] pointer to "parent" fan */ |
---|
46 | const intvec* rays, /**< [in] indices of maximal rays (at fan) */ |
---|
47 | const intvec* facetNs /**< [in] indices of facet normals (at fan) */ |
---|
48 | ); |
---|
49 | |
---|
50 | /** |
---|
51 | * Constructor for class Cone. |
---|
52 | * |
---|
53 | **/ |
---|
54 | Cone (); |
---|
55 | |
---|
56 | /** |
---|
57 | * Deep copy constructor for class Cone. |
---|
58 | * |
---|
59 | **/ |
---|
60 | Cone ( |
---|
61 | const Cone& c /**< [in] the cone to be deep copied */ |
---|
62 | ); |
---|
63 | |
---|
64 | /** |
---|
65 | * Destructor for class Cone. |
---|
66 | * |
---|
67 | **/ |
---|
68 | ~Cone (); |
---|
69 | |
---|
70 | /** |
---|
71 | * Getter for the indices of the maximal rays. |
---|
72 | * |
---|
73 | * These indices correspond to the maximal rays stored in the "parent" |
---|
74 | * fan. |
---|
75 | **/ |
---|
76 | intvec* getRays () const; |
---|
77 | |
---|
78 | /** |
---|
79 | * Getter for the indices of the facet normals. |
---|
80 | * |
---|
81 | * These indices correspond to the facet normals stored in the "parent" |
---|
82 | * fan. |
---|
83 | **/ |
---|
84 | intvec* getFacetNs () const; |
---|
85 | |
---|
86 | /** |
---|
87 | * Method for checking the validy of cone data (prior to calling the |
---|
88 | * constructor with the same arguments). |
---|
89 | * |
---|
90 | * If the method returns a positive int i, then the i-1st entry of |
---|
91 | * rays is not a valid maximal ray index in the "parent" fan. |
---|
92 | * If the method returns a negative int i, then the i-1st entry of |
---|
93 | * facetNs is not a valid facet normal index in the "parent" fan. |
---|
94 | * Otherwise, 0 is returned meaning that the data is valid. |
---|
95 | **/ |
---|
96 | static int checkConeData ( |
---|
97 | const Fan* pFan, /**< [in] pointer to "parent" fan */ |
---|
98 | const intvec* rays, /**< [in] indices of maximal rays (at fan) */ |
---|
99 | const intvec* facetNs /**< [in] indices of facet normals (at fan) */ |
---|
100 | ); |
---|
101 | |
---|
102 | /** |
---|
103 | * Method for obtaining a special cone represening a non-existing |
---|
104 | * intersection facet of two (non-adjacent) maximal cones. |
---|
105 | * This will be used in the context of adjacency information in the |
---|
106 | * "parent" fan. |
---|
107 | **/ |
---|
108 | static Cone* noAdjacency (); |
---|
109 | |
---|
110 | /** |
---|
111 | * Method for obtaining a special cone represening an existing |
---|
112 | * adjacency of two (adjacent) maximal cones, but without available |
---|
113 | * intersection facet. |
---|
114 | * This will be used in the context of adjacency information in the |
---|
115 | * "parent" fan. |
---|
116 | **/ |
---|
117 | static Cone* noFacet (); |
---|
118 | |
---|
119 | /** |
---|
120 | * Method for checking whether a given cone represents a cone similar |
---|
121 | * to the result of Cone::noFacet(). |
---|
122 | **/ |
---|
123 | bool isNoFacet (); |
---|
124 | |
---|
125 | /** |
---|
126 | * Method for checking whether a given cone represents a cone similar |
---|
127 | * to the result of Cone::noAdjacency(). |
---|
128 | **/ |
---|
129 | bool isNoAdj (); |
---|
130 | |
---|
131 | /** |
---|
132 | * For obtaining a printable representation of the given cone. |
---|
133 | * |
---|
134 | * The caller of this method is responsible for destructing |
---|
135 | * the obtained char*. |
---|
136 | **/ |
---|
137 | char* toString () const; |
---|
138 | |
---|
139 | /** |
---|
140 | * For printing a string representation of the given fan |
---|
141 | * to the console. |
---|
142 | **/ |
---|
143 | void print () const; |
---|
144 | |
---|
145 | /** |
---|
146 | * Getter for the "parent" fan of this cone. |
---|
147 | **/ |
---|
148 | Fan* getFan () const; |
---|
149 | |
---|
150 | /** |
---|
151 | * For retrieving the dimension of the given cone. |
---|
152 | * |
---|
153 | * Returns -1 for 'unknown', otherwise a number >= 0. |
---|
154 | **/ |
---|
155 | int getDim () const; |
---|
156 | |
---|
157 | /** |
---|
158 | * For setting the dimension of the given cone. |
---|
159 | * |
---|
160 | * Any negative input will be converted to -1. |
---|
161 | **/ |
---|
162 | void setDim ( |
---|
163 | const int dim /**< [in] the target dimension */ |
---|
164 | ); |
---|
165 | }; |
---|
166 | |
---|
167 | #endif |
---|
168 | /* CONE_H */ |
---|
169 | |
---|