Main Page   Compound List   File List   Compound 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 int main() {
00007         
00008   Matrix *a, *b;
00009   Polyhedron *A, *B;
00010   Param_Polyhedron *PA;
00011   Param_Domain *P;
00012   Param_Vertices *V;
00013   int nbPV;
00014   char **param_name;
00015   
00016   a = Matrix_Read();
00017   if(!a || a->NbColumns == 0) {
00018     fprintf(stderr,"Input error: empty matrix\n");
00019     exit(0);
00020   }
00021   A = Constraints2Polyhedron(a, 200);
00022   Matrix_Free(a);
00023   b = Matrix_Read();
00024   
00025   if(!b || b->NbColumns == 0) {
00026     fprintf(stderr, "Input error: empty matrix\n");
00027     exit(0);
00028   }
00029   B = Constraints2Polyhedron(b, 200);
00030   Matrix_Free(b);
00031   
00032   /* Read the name of the parameters */
00033   param_name = Read_ParamNames(stdin, B->Dimension);
00034   PA = Polyhedron2Param_Domain(A,B,200);
00035   if(!PA || PA->D==NULL) {
00036     printf("---------------------------------------\n");
00037     printf("Empty polyhedron\n");
00038     return 0;
00039   }
00040   nbPV = PA->nbV;
00041   Domain_Free(A);
00042   Domain_Free(B);
00043 
00044   /*****************************/
00045   /* Scan the validity domains */
00046   for(P=PA->D;P;P=P->next) {
00047     
00048     /* prints current val. dom. */
00049     printf( "---------------------------------------\n" );
00050     printf( "Domain :\n");
00051     Print_Domain( stdout, P->Domain, param_name );
00052     
00053     /* scan the vertices */
00054     printf( "Vertices :\n");
00055     FORALL_PVertex_in_ParamPolyhedron(V,P,PA) {
00056         
00057       /* prints each vertex */
00058       Print_Vertex( stdout, V->Vertex, param_name );
00059       printf( "\n" );
00060     }
00061     END_FORALL_PVertex_in_ParamPolyhedron;
00062   }
00063   /*****************************/
00064   
00065   Param_Polyhedron_Free( PA );
00066   free(param_name);
00067   
00068   return 0;
00069 } /* main */ 
00070 

Generated on Mon Mar 15 10:59:51 2004 for polylib by doxygen1.2.18