autoconf warning missing files
[polylib.git] / applications / pp.c
blob3d645c6c907f5a6953f87f75d88afc4c9818e8c7
1 #include <stdio.h>
2 #include <stdlib.h>
4 #include <polylib/polylib.h>
6 #define WS 0
8 int main() {
10 Matrix *a, *b;
11 Polyhedron *A, *B;
12 Param_Polyhedron *PA;
13 Param_Domain *P;
14 Param_Vertices *V;
15 int nbPV, i, j;
16 const char **param_name;
18 a = Matrix_Read();
19 if(!a || a->NbColumns == 0) {
20 fprintf(stderr,"Input error: empty matrix\n");
21 exit(0);
23 A = Constraints2Polyhedron(a, WS);
24 Matrix_Free(a);
25 b = Matrix_Read();
27 if(!b || b->NbColumns == 0) {
28 fprintf(stderr, "Input error: empty matrix\n");
29 exit(0);
31 B = Constraints2Polyhedron(b, WS);
32 Matrix_Free(b);
34 /* Read the name of the parameters */
35 param_name = Read_ParamNames(stdin, B->Dimension);
36 PA = Polyhedron2Param_Domain(A,B,WS);
37 if(!PA || PA->D==NULL) {
38 printf("---------------------------------------\n");
39 printf("Empty polyhedron\n");
40 return 0;
42 nbPV = PA->nbV;
43 Domain_Free(A);
44 Domain_Free(B);
46 if (PA->Rays->NbRows > 0) {
47 printf( "---------------------------------------\n" );
48 printf( "Overall rays :\n");
49 for (i = 0; i < PA->Rays->NbRows; i++) {
50 if (value_zero_p(PA->Rays->p[i][0]))
51 printf("Line: [");
52 else
53 printf("Ray: [");
54 for (j = 1; j < PA->Rays->NbColumns-1; j++) {
55 value_print(stdout,P_VALUE_FMT,PA->Rays->p[i][j]);
57 printf(" ]\n");
61 /*****************************/
62 /* Scan the validity domains */
63 for(P=PA->D;P;P=P->next) {
65 /* prints current val. dom. */
66 printf( "---------------------------------------\n" );
67 printf( "Domain :\n");
68 Print_Domain( stdout, P->Domain, param_name );
70 /* scan the vertices */
71 printf( "Vertices :\n");
72 FORALL_PVertex_in_ParamPolyhedron(V,P,PA) {
74 /* prints each vertex */
75 Print_Vertex( stdout, V->Vertex, param_name );
76 printf( "\n" );
78 END_FORALL_PVertex_in_ParamPolyhedron;
80 /*****************************/
82 Param_Polyhedron_Free( PA );
83 free(param_name);
85 return 0;
86 } /* main */