00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef PPL_Grid_Generator_inlines_hh
00025 #define PPL_Grid_Generator_inlines_hh 1
00026
00027 namespace Parma_Polyhedra_Library {
00028
00029 inline
00030 Grid_Generator::Grid_Generator(const Grid_Generator& g)
00031 : Generator(g) {
00032 }
00033
00034 inline
00035 Grid_Generator::~Grid_Generator() {
00036 }
00037
00038 inline
00039 Grid_Generator::Grid_Generator(Generator g)
00040 : Generator(Generator::point()) {
00041 Generator::swap(g);
00042 }
00043
00044 inline dimension_type
00045 Grid_Generator::size() const {
00046 return Generator::size();
00047 }
00048
00049 inline dimension_type
00050 Grid_Generator::max_space_dimension() {
00051 return Generator::max_space_dimension() - 1;
00052 }
00053
00054 inline Coefficient&
00055 Grid_Generator::operator[](dimension_type k) {
00056 return Generator::operator[](k);
00057 }
00058
00059 inline Coefficient_traits::const_reference
00060 Grid_Generator::operator[](dimension_type k) const {
00061 return Generator::operator[](k);
00062 }
00063
00064 inline dimension_type
00065 Grid_Generator::space_dimension() const {
00066 return Generator::space_dimension() - 1;
00067 }
00068
00069 inline Grid_Generator::Type
00070 Grid_Generator::type() const {
00071 switch (Generator::type()) {
00072 case Generator::POINT:
00073 return POINT;
00074 case Generator::RAY:
00075 return PARAMETER;
00076 case Generator::LINE:
00077 return LINE;
00078 case Generator::CLOSURE_POINT:
00079 default:
00080 PPL_ASSERT(false);
00081 return POINT;
00082 }
00083 }
00084
00085 inline bool
00086 Grid_Generator::is_line() const {
00087 return Generator::is_line();
00088 }
00089
00090 inline bool
00091 Grid_Generator::is_parameter() const {
00092 return is_ray();
00093 }
00094
00095 inline bool
00096 Grid_Generator::is_line_or_parameter() const {
00097 return is_line_or_ray();
00098 }
00099
00100 inline bool
00101 Grid_Generator::is_point() const {
00102 return Generator::is_point();
00103 }
00104
00105 inline bool
00106 Grid_Generator::is_parameter_or_point() const {
00107 return is_ray_or_point_or_inequality();
00108 }
00109
00110 inline void
00111 Grid_Generator::set_divisor(Coefficient_traits::const_reference d) {
00112 PPL_ASSERT(!is_line());
00113 if (is_line_or_parameter())
00114 Generator::operator[](size() - 1) = d;
00115 else
00116 Generator::operator[](0) = d;
00117 }
00118
00119 inline Coefficient_traits::const_reference
00120 Grid_Generator::divisor() const {
00121 if (is_line())
00122 throw_invalid_argument("divisor()", "*this is a line");
00123 if (is_line_or_parameter())
00124 return Generator::operator[](size() - 1);
00125 else
00126 return Generator::operator[](0);
00127 }
00128
00129 inline bool
00130 Grid_Generator::is_equal_at_dimension(dimension_type dim,
00131 const Grid_Generator& gg) const {
00132 return operator[](dim) * gg.divisor() == gg[dim] * divisor();
00133 }
00134
00135 inline void
00136 Grid_Generator::set_is_line() {
00137 Generator::set_is_line();
00138 }
00139
00140 inline void
00141 Grid_Generator::set_is_parameter_or_point() {
00142 Generator::set_is_ray_or_point();
00143 }
00144
00145 inline Grid_Generator&
00146 Grid_Generator::operator=(const Grid_Generator& g) {
00147 Generator::operator=(g);
00148 return *this;
00149 }
00150
00151 inline Grid_Generator&
00152 Grid_Generator::operator=(const Generator& g) {
00153 Generator::operator=(g);
00154 return *this;
00155 }
00156
00157 inline void
00158 Grid_Generator::negate(dimension_type start, dimension_type end) {
00159 while (start <= end)
00160 neg_assign(operator[](start++));
00161 }
00162
00163 inline Coefficient_traits::const_reference
00164 Grid_Generator::coefficient(const Variable v) const {
00165 if (v.space_dimension() > space_dimension())
00166 throw_dimension_incompatible("coefficient(v)", "v", v);
00167 return Generator::coefficient(v);
00168 }
00169
00170 inline memory_size_type
00171 Grid_Generator::total_memory_in_bytes() const {
00172 return Generator::total_memory_in_bytes();
00173 }
00174
00175 inline memory_size_type
00176 Grid_Generator::external_memory_in_bytes() const {
00177 return Generator::external_memory_in_bytes();
00178 }
00179
00180 inline const Grid_Generator&
00181 Grid_Generator::zero_dim_point() {
00182 PPL_ASSERT(zero_dim_point_p != 0);
00183 return *zero_dim_point_p;
00184 }
00185
00186 inline void
00187 Grid_Generator::strong_normalize() {
00188 Generator::strong_normalize();
00189 }
00190
00191 inline void
00192 Grid_Generator::swap(Grid_Generator& y) {
00193 Generator::swap(y);
00194 }
00195
00197 inline bool
00198 operator==(const Grid_Generator& x, const Grid_Generator& y) {
00199 return x.is_equivalent_to(y);
00200 }
00201
00203 inline bool
00204 operator!=(const Grid_Generator& x, const Grid_Generator& y) {
00205 return !(x == y);
00206 }
00207
00209 inline Grid_Generator
00210 grid_line(const Linear_Expression& e) {
00211 return Grid_Generator::grid_line(e);
00212 }
00213
00215 inline Grid_Generator
00216 parameter(const Linear_Expression& e,
00217 Coefficient_traits::const_reference d) {
00218 return Grid_Generator::parameter(e, d);
00219 }
00220
00222 inline Grid_Generator
00223 grid_point(const Linear_Expression& e,
00224 Coefficient_traits::const_reference d) {
00225 return Grid_Generator::grid_point(e, d);
00226 }
00227
00228 }
00229
00230 namespace std {
00231
00233 inline void
00234 swap(Parma_Polyhedra_Library::Grid_Generator& x,
00235 Parma_Polyhedra_Library::Grid_Generator& y) {
00236 x.swap(y);
00237 }
00238
00239 }
00240
00241 #endif // !defined(PPL_Grid_Generator_inlines_hh)