polylib 7.01
pp.c
Go to the documentation of this file.
1#include <stdio.h>
2#include <stdlib.h>
3
4#include <polylib/polylib.h>
5
6#define WS 0
7
8int main() {
9
10 Matrix *a, *b;
11 Polyhedron *A, *B;
13 Param_Domain *P;
15 int i, j;
16 char **param_name;
17
18 a = Matrix_Read();
19 if(!a || a->NbColumns == 0) {
20 fprintf(stderr,"Input error: empty matrix\n");
21 exit(0);
22 }
24 Matrix_Free(a);
25 b = Matrix_Read();
26
27 if(!b || b->NbColumns == 0) {
28 fprintf(stderr, "Input error: empty matrix\n");
29 exit(0);
30 }
32 Matrix_Free(b);
33
34 /* Read the name of the parameters */
35 param_name = Read_ParamNames(stdin, B->Dimension);
37 if(!PA || PA->D==NULL) {
38 printf("---------------------------------------\n");
39 printf("Empty polyhedron\n");
40 return 0;
41 }
42 Domain_Free(A);
43 Domain_Free(B);
44
45 if (PA->Rays->NbRows > 0) {
46 printf( "---------------------------------------\n" );
47 printf( "Overall rays :\n");
48 for (i = 0; i < PA->Rays->NbRows; i++) {
49 if (value_zero_p(PA->Rays->p[i][0]))
50 printf("Line: [");
51 else
52 printf("Ray: [");
53 for (j = 1; j < PA->Rays->NbColumns-1; j++) {
54 value_print(stdout,P_VALUE_FMT,PA->Rays->p[i][j]);
55 }
56 printf(" ]\n");
57 }
58 }
59
60 /*****************************/
61 /* Scan the validity domains */
62 for(P=PA->D;P;P=P->next) {
63
64 /* prints current val. dom. */
65 printf( "---------------------------------------\n" );
66 printf( "Domain :\n");
67 Print_Domain( stdout, P->Domain, param_name );
68
69 /* scan the vertices */
70 printf( "Vertices :\n");
72
73 /* prints each vertex */
74 Print_Vertex( stdout, V->Vertex, param_name );
75 printf( "\n" );
76 }
78 }
79 /*****************************/
80
82 free(param_name);
83
84 return 0;
85} /* main */
86
#define value_zero_p(val)
Definition: arithmetique.h:578
#define value_print(Dst, fmt, val)
Definition: arithmetique.h:490
Matrix * Matrix_Read(void)
Definition: matrix.c:218
void Matrix_Free(Matrix *Mat)
Definition: matrix.c:69
char ** Read_ParamNames(FILE *in, int m)
Definition: param.c:14
Polyhedron * Constraints2Polyhedron(Matrix *Constraints, unsigned NbMaxRays)
Given a matrix of constraints ('Constraints'), construct and return a polyhedron.
Definition: polyhedron.c:1912
void Domain_Free(Polyhedron *Pol)
Definition: polyhedron.c:1633
void Param_Polyhedron_Free(Param_Polyhedron *P)
Definition: polyparam.c:1877
void Print_Vertex(FILE *DST, Matrix *V, char **param_names)
Definition: polyparam.c:1585
void Print_Domain(FILE *DST, Polyhedron *D, char **pname)
Definition: polyparam.c:1682
Param_Polyhedron * Polyhedron2Param_Domain(Polyhedron *Din, Polyhedron *Cin, int working_space)
Definition: polyparam.c:1757
#define WS
Definition: pp.c:6
int main()
Definition: pp.c:8
struct _Param_Domain * next
Definition: types.h:157
Polyhedron * Domain
Definition: types.h:156
Param_Domain * D
Definition: types.h:163
Matrix * Rays
Definition: types.h:165
Matrix * Vertex
Definition: types.h:145
Definition: types.h:88
unsigned NbRows
Definition: types.h:89
Value ** p
Definition: types.h:90
unsigned NbColumns
Definition: types.h:89
unsigned Dimension
Definition: types.h:110
#define END_FORALL_PVertex_in_ParamPolyhedron
Definition: types.h:176
#define P_VALUE_FMT
Definition: types.h:42
#define FORALL_PVertex_in_ParamPolyhedron(_V, _D, _P)
Definition: types.h:168