Merge ssh://repo.or.cz/srv/git/polylib
[polylib.git] / applications / disjoint_union_sep.c
bloba3fb85ebf3624f472e4056c7be49c4a5827c7fa2
1 /* Polyhedron disjoint intersections
2 */
3 /*
4 This file is part of PolyLib.
6 PolyLib is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 PolyLib is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with PolyLib. If not, see <http://www.gnu.org/licenses/>.
22 disjoint_union_sep computes the disjoint union of the given list of domains.
23 input:
24 (integer) # of polyhedra
25 list of polyhedra in the usual matrix (constraints) format
27 output:
28 list of polyhedra (constraint matrices) having no integer point in common
31 #include <stdio.h>
32 #include <stdlib.h>
34 #include <polylib/polylib.h>
36 #define WS 0
39 /* Procedure to print constraints of a domain */
40 void AffContraintes(Polyhedron *p)
42 for( ;p;p=p->next)
44 Polyhedron_PrintConstraints(stdout, P_VALUE_FMT, p );
45 printf("\n");
50 int main() {
52 int np, i;
54 Matrix *a;
55 Polyhedron *A, *tmp, *DD;
57 scanf( "%d", &np );
59 A = NULL;
60 for( i=0 ; i<np ; i++ )
62 a = Matrix_Read();
63 tmp = Constraints2Polyhedron(a,WS);
64 Matrix_Free(a);
65 tmp ->next = A;
66 A = tmp;
70 DD = Disjoint_Domain( A, 0, WS );
72 AffContraintes(DD);
74 Domain_Free( DD );
75 Domain_Free( A );
77 return 0;