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