Main Page | Class List | File List | Class Members | File Members

pp.c

Go to the documentation of this file.
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;
00016   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   /* Read the name of the parameters */
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   /*****************************/
00047   /* Scan the validity domains */
00048   for(P=PA->D;P;P=P->next) {
00049     
00050     /* prints current val. dom. */
00051     printf( "---------------------------------------\n" );
00052     printf( "Domain :\n");
00053     Print_Domain( stdout, P->Domain, param_name );
00054     
00055     /* scan the vertices */
00056     printf( "Vertices :\n");
00057     FORALL_PVertex_in_ParamPolyhedron(V,P,PA) {
00058         
00059       /* prints each vertex */
00060       Print_Vertex( stdout, V->Vertex, param_name );
00061       printf( "\n" );
00062     }
00063     END_FORALL_PVertex_in_ParamPolyhedron;
00064   }
00065   /*****************************/
00066   
00067   Param_Polyhedron_Free( PA );
00068   free(param_name);
00069   
00070   return 0;
00071 } /* main */ 
00072 

Generated on Mon Sep 12 14:48:29 2005 for polylib by doxygen 1.3.5