00001 #include <stdio.h>
00002 #include <stdlib.h>
00003
00004 #include <polylib/polylib.h>
00005
00006 #define WS 0
00007
00008 int main() {
00009
00010 Matrix *a, *b;
00011 Polyhedron *A, *B;
00012 Param_Polyhedron *PA;
00013 Param_Domain *P;
00014 Param_Vertices *V;
00015 int nbPV, i, j;
00016 const char **param_name;
00017
00018 a = Matrix_Read();
00019 if(!a || a->NbColumns == 0) {
00020 fprintf(stderr,"Input error: empty matrix\n");
00021 exit(0);
00022 }
00023 A = Constraints2Polyhedron(a, WS);
00024 Matrix_Free(a);
00025 b = Matrix_Read();
00026
00027 if(!b || b->NbColumns == 0) {
00028 fprintf(stderr, "Input error: empty matrix\n");
00029 exit(0);
00030 }
00031 B = Constraints2Polyhedron(b, WS);
00032 Matrix_Free(b);
00033
00034
00035 param_name = Read_ParamNames(stdin, B->Dimension);
00036 PA = Polyhedron2Param_Domain(A,B,WS);
00037 if(!PA || PA->D==NULL) {
00038 printf("---------------------------------------\n");
00039 printf("Empty polyhedron\n");
00040 return 0;
00041 }
00042 nbPV = PA->nbV;
00043 Domain_Free(A);
00044 Domain_Free(B);
00045
00046 if (PA->Rays->NbRows > 0) {
00047 printf( "---------------------------------------\n" );
00048 printf( "Overall rays :\n");
00049 for (i = 0; i < PA->Rays->NbRows; i++) {
00050 if (value_zero_p(PA->Rays->p[i][0]))
00051 printf("Line: [");
00052 else
00053 printf("Ray: [");
00054 for (j = 1; j < PA->Rays->NbColumns-1; j++) {
00055 value_print(stdout,P_VALUE_FMT,PA->Rays->p[i][j]);
00056 }
00057 printf(" ]\n");
00058 }
00059 }
00060
00061
00062
00063 for(P=PA->D;P;P=P->next) {
00064
00065
00066 printf( "---------------------------------------\n" );
00067 printf( "Domain :\n");
00068 Print_Domain( stdout, P->Domain, param_name );
00069
00070
00071 printf( "Vertices :\n");
00072 FORALL_PVertex_in_ParamPolyhedron(V,P,PA) {
00073
00074
00075 Print_Vertex( stdout, V->Vertex, param_name );
00076 printf( "\n" );
00077 }
00078 END_FORALL_PVertex_in_ParamPolyhedron;
00079 }
00080
00081
00082 Param_Polyhedron_Free( PA );
00083 free(param_name);
00084
00085 return 0;
00086 }
00087