1 // This is a -*- C++ -*- header file.
2 
3 /* latte_cddlib.h -- Interface to cddlib
4 
5    Copyright 2006, 2007 Matthias Koeppe
6 
7    This file is part of LattE.
8 
9    LattE is free software; you can redistribute it and/or modify it
10    under the terms of the version 2 of the GNU General Public License
11    as published by the Free Software Foundation.
12 
13    LattE is distributed in the hope that it will be useful, but
14    WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16    General Public License for more details.
17 
18    You should have received a copy of the GNU General Public License
19    along with LattE; if not, write to the Free Software Foundation,
20    Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 */
22 
23 #ifndef LATTE_CDDLIB__H
24 #define LATTE_CDDLIB__H
25 
26 #include <gmp.h>
27 #include "config.h"
28 
29 #ifdef HAVE_CDDLIB_C_LINKAGE
30 extern "C" {
31 #endif
32 #define GMPRATIONAL
33 #include CDDLIB_SETOPER_H
34 #include CDDLIB_CDD_H
35 #ifdef HAVE_CDDLIB_C_LINKAGE
36 }
37 #endif
38 
39 #include "cone.h"
40 
41 /* Ensure initialization of the library by having a global constructor
42    called. */
43 class init_cddlib_class {
44 public:
45   init_cddlib_class();
46 };
47 extern init_cddlib_class init_cddlib;
48 
49 /* Check for and handle cddlib errors. */
50 void check_cddlib_error(dd_ErrorType error, const char *proc);
51 
52 /** Conversion from LattE data structures to cddlib data structures. **/
53 
54 /* Create a matrix whose rows are the RAYS.
55    NUM_HOMOGENIZATION_VARS extra coordinates, each set to zero,
56    are introduced in front of the ray data. */
57 dd_MatrixPtr
58 rays_to_cddlib_matrix(listVector *rays, int numOfVars,
59                       int num_homogenization_vars = 1,
60                       int num_extra_rows = 0);
61 
62 dd_PolyhedraPtr
63 cone_to_cddlib_polyhedron(listCone *cone, int numOfVars);
64 
65 /* MATRIX should be a CDDLIB representation of a cone.
66    Return a corresponding listCone. */
67 listCone *
68 cddlib_matrix_to_cone(dd_MatrixPtr matrix);
69 
70 /* MATRIX should be an H-representation of a polyhedron.
71    Return equations and inequalities. */
72 void
73 cddlib_matrix_to_equations_and_inequalities(dd_MatrixPtr matrix,
74                                             listVector **equations,
75                                             listVector **inequalities);
76 
77 #endif
78 
79