polylib: disjoint_union_sep.c Source File

- Main Page
- Classes
- Files

# disjoint_union_sep.c

Go to the documentation of this file.

    00001 /*       Polyhedron disjoint intersections
    00002  */
    00003
    00004 /*
    00005  disjoint_union_sep computes the disjoint union of the given list of domains.
    00006  input:
    00007     (integer) # of polyhedra
    00008     list of polyhedra in the usual matrix (constraints) format
    00009
    00010  output:
    00011     list of polyhedra (constraint matrices) having no integer point in common
    00012 */
    00013
    00014 #include <stdio.h>
    00015 #include <stdlib.h>
    00016
    00017 #include <polylib/polylib.h>
    00018
    00019 #define WS 0
    00020
    00021
    00022 /* Procedure to print constraints of a domain */
    00023 void AffContraintes(Polyhedron *p)
    00024 {
    00025         for( ;p;p=p->next)
    00026         {
    00027                 Polyhedron_PrintConstraints(stdout, P_VALUE_FMT, p );
    00028                 printf("\n");
    00029         }
    00030 }
    00031
    00032
    00033 int main() {
    00034
    00035         int np, i;
    00036
    00037         Matrix *a;
    00038         Polyhedron *A, *tmp, *DD;
    00039
    00040         scanf( "%d", &np );
    00041
    00042         A = NULL;
    00043         for( i=0 ; i<np ; i++ )
    00044         {
    00045                 a = Matrix_Read();
    00046                 tmp = Constraints2Polyhedron(a,WS);
    00047                 Matrix_Free(a);
    00048                 tmp ->next = A;
    00049                 A = tmp;
    00050         }
    00051
    00052
    00053         DD = Disjoint_Domain( A, 0, WS );
    00054
    00055         AffContraintes(DD);
    00056
    00057         Domain_Free( DD );
    00058         Domain_Free( A );
    00059
    00060         return 0;
    00061 }
    00062
    00063
    00064