polylib 5.22.8
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 nbPV, i, j;
16 const 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 nbPV = PA->nbV;
43 Domain_Free(A);
44 Domain_Free(B);
45
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]);
56 }
57 printf(" ]\n");
58 }
59 }
60
61 /*****************************/
62 /* Scan the validity domains */
63 for(P=PA->D;P;P=P->next) {
64
65 /* prints current val. dom. */
66 printf( "---------------------------------------\n" );
67 printf( "Domain :\n");
68 Print_Domain( stdout, P->Domain, param_name );
69
70 /* scan the vertices */
71 printf( "Vertices :\n");
73
74 /* prints each vertex */
75 Print_Vertex( stdout, V->Vertex, param_name );
76 printf( "\n" );
77 }
79 }
80 /*****************************/
81
83 free(param_name);
84
85 return 0;
86} /* main */
87
#define value_zero_p(val)
Definition: arithmetique.h:575
#define value_print(Dst, fmt, val)
Definition: arithmetique.h:487
Matrix * Matrix_Read(void)
Definition: matrix.c:209
void Matrix_Free(Matrix *Mat)
Definition: matrix.c:71
const 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:1905
void Domain_Free(Polyhedron *Pol)
Definition: polyhedron.c:1626
static int nbPV
Definition: polyparam.c:293
void Param_Polyhedron_Free(Param_Polyhedron *P)
Definition: polyparam.c:1875
void Print_Vertex(FILE *DST, Matrix *V, const char **param_names)
Definition: polyparam.c:1583
void Print_Domain(FILE *DST, Polyhedron *D, const char **pname)
Definition: polyparam.c:1680
Param_Polyhedron * Polyhedron2Param_Domain(Polyhedron *Din, Polyhedron *Cin, int working_space)
Definition: polyparam.c:1755
#define WS
Definition: pp.c:6
int main()
Definition: pp.c:8
struct _Param_Domain * next
Definition: types.h:138
Polyhedron * Domain
Definition: types.h:137
Param_Domain * D
Definition: types.h:144
Matrix * Rays
Definition: types.h:146
Matrix * Vertex
Definition: types.h:126
Definition: types.h:75
unsigned NbRows
Definition: types.h:76
Value ** p
Definition: types.h:77
unsigned NbColumns
Definition: types.h:76
unsigned Dimension
Definition: types.h:94
#define END_FORALL_PVertex_in_ParamPolyhedron
Definition: types.h:157
#define P_VALUE_FMT
Definition: types.h:39
#define FORALL_PVertex_in_ParamPolyhedron(_V, _D, _P)
Definition: types.h:149