1 /* Definition of functions yielding maximal space dimensions.
2 Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it>
3 Copyright (C) 2010-2016 BUGSENG srl (http://bugseng.com)
4
5 This file is part of the Parma Polyhedra Library (PPL).
6
7 The PPL is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11
12 The PPL is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
20
21 For the most up-to-date information see the Parma Polyhedra Library
22 site: http://bugseng.com/products/ppl/ . */
23
24 #ifndef PPL_max_space_dimension_hh
25 #define PPL_max_space_dimension_hh 1
26
27 #include "Polyhedron_defs.hh"
28 #include "C_Polyhedron_defs.hh"
29 #include "NNC_Polyhedron_defs.hh"
30 #include "Grid_defs.hh"
31 #include "Rational_Box.hh"
32 #include "BD_Shape_defs.hh"
33 #include "Octagonal_Shape_defs.hh"
34 #include <algorithm>
35
36 namespace Parma_Polyhedra_Library {
37
38 //! Returns the maximum space dimension this library can handle.
39 inline dimension_type
max_space_dimension()40 max_space_dimension() {
41 // Note: we assume that the powerset and the ask-and-tell construction
42 // do not limit the space dimension more than their parameters.
43 static bool computed = false;
44 static dimension_type d = not_a_dimension();
45 if (!computed) {
46 d = Variable::max_space_dimension();
47 d = std::min(d, C_Polyhedron::max_space_dimension());
48 d = std::min(d, NNC_Polyhedron::max_space_dimension());
49 d = std::min(d, Grid::max_space_dimension());
50 // FIXME: what about all other boxes?
51 d = std::min(d, Rational_Box::max_space_dimension());
52 d = std::min(d, BD_Shape<int8_t>::max_space_dimension());
53 d = std::min(d, BD_Shape<int16_t>::max_space_dimension());
54 d = std::min(d, BD_Shape<int32_t>::max_space_dimension());
55 d = std::min(d, BD_Shape<int64_t>::max_space_dimension());
56 d = std::min(d, BD_Shape<float>::max_space_dimension());
57 d = std::min(d, BD_Shape<double>::max_space_dimension());
58 d = std::min(d, BD_Shape<long double>::max_space_dimension());
59 d = std::min(d, BD_Shape<mpz_class>::max_space_dimension());
60 d = std::min(d, BD_Shape<mpq_class>::max_space_dimension());
61 d = std::min(d, Octagonal_Shape<int8_t>::max_space_dimension());
62 d = std::min(d, Octagonal_Shape<int16_t>::max_space_dimension());
63 d = std::min(d, Octagonal_Shape<int32_t>::max_space_dimension());
64 d = std::min(d, Octagonal_Shape<int64_t>::max_space_dimension());
65 d = std::min(d, Octagonal_Shape<float>::max_space_dimension());
66 d = std::min(d, Octagonal_Shape<double>::max_space_dimension());
67 d = std::min(d, Octagonal_Shape<long double>::max_space_dimension());
68 d = std::min(d, Octagonal_Shape<mpz_class>::max_space_dimension());
69 d = std::min(d, Octagonal_Shape<mpq_class>::max_space_dimension());
70 computed = true;
71 }
72 return d;
73 }
74
75 } // namespace Parma_Polyhedra_Library
76
77 #endif // !defined(PPL_max_space_dimension_hh)
78