1 /***********************************************************************/
3 /* copyright 1997, Doran Wilde */
4 /* copyright 1997-2000, Vincent Loechner */
5 /* Permission is granted to copy, use, and distribute */
6 /* for any commercial or noncommercial purpose under the terms */
7 /* of the GNU General Public license, version 2, June 1991 */
8 /* (see file : LICENSING). */
9 /***********************************************************************/
18 #include <polylib/polylib.h>
22 define this to print all constraints on the validity domains if not
23 defined, only new constraints (not in validity domain given by the
27 #define EPRINT_ALL_VALIDITY_CONSTRAINTS
31 The following are mainly for debug purposes. You shouldn't need to
32 change anything for daily usage...
36 /** you may define each macro independently
38 <li> #define EDEBUG minimal debug
39 <li> #define EDEBUG1 prints enumeration points
40 <li> #define EDEBUG11 prints number of points
41 <li> #define EDEBUG2 prints domains
42 <li> #define EDEBUG21 prints more domains
43 <li> #define EDEBUG3 prints systems of equations that are solved
44 <li> #define EDEBUG4 prints message for degree reduction
45 <li> #define EDEBUG5 prints result before simplification
46 <li> #define EDEBUG6 prints domains in Preprocess
47 <li> #define EDEBUG61 prints even more in Preprocess
48 <li> #define EDEBUG62 prints domains in Preprocess2
52 /* #define EDEBUG */ /* minimal debug */
53 /* #define EDEBUG1 */ /* prints enumeration points */
54 /* #define EDEBUG11 */ /* prints number of points */
55 /* #define EDEBUG2 */ /* prints domains */
56 /* #define EDEBUG21 */ /* prints more domains */
57 /* #define EDEBUG3 */ /* prints systems of equations that are solved */
58 /* #define EDEBUG4 */ /* prints message for degree reduction */
59 /* #define EDEBUG5 */ /* prints result before simplification */
60 /* #define EDEBUG6 */ /* prints domains in Preprocess */
61 /* #define EDEBUG61 */ /* prints even more in Preprocess */
62 /* #define EDEBUG62 */ /* prints domains in Preprocess2 */
67 Reduce the degree of resulting polynomials
74 define this to print one warning message per domain overflow these
75 overflows should no longer happen since version 4.20
78 #define ALL_OVERFLOW_WARNINGS
82 EPRINT : print results while computing the ehrhart polynomial. this
83 is done by default if you build the executable ehrhart. (If EMAIN is
84 defined). Don't define EMAIN here, it is defined when necessary in
89 Notice: you may however define EPRINT without defining EMAIN, but in
90 this case, you have to initialize the global variable param_name by
91 calling Read_ParamNames before any call to ehrhart. This is NOT
92 recommanded, unless you know what you do. EPRINT causes more debug
93 messages to be printed.
104 Enumeration
*en
, *ee
;
114 if(C1
->NbColumns
< 2) {
115 fprintf( stderr
, "Not enough parameters !\n" );
118 P
= Constraints2Polyhedron(P1
,1024);
119 C
= Constraints2Polyhedron(C1
,1024);
123 /* Read the name of the parameters */
124 param_name
= Read_ParamNames(stdin
,C
->Dimension
);
125 en
= Polyhedron_Enumerate(P
,C
,1024,param_name
);
128 if( isatty(0) && C
->Dimension
!= 0)
129 { /* no tty input or no polyhedron -> no evaluation. */
130 printf("Evaluation of the Ehrhart polynomial :\n");
131 p
= (Value
*)malloc(sizeof(Value
) * (C
->Dimension
));
132 for(i
=0;i
<C
->Dimension
;i
++)
136 printf("Enter %d parameters : ",C
->Dimension
);
137 for(k
=0;k
<C
->Dimension
;++k
) {
139 value_read(p
[k
],str
);
141 fprintf(stdout
,"EP( ");
142 value_print(stdout
,VALUE_FMT
,p
[0]);
143 for(k
=1;k
<C
->Dimension
;++k
) {
145 value_print(stdout
,VALUE_FMT
,p
[k
]);
147 fprintf(stdout
," ) = ");
148 value_print(stdout
,VALUE_FMT
,*(tmp
=compute_poly(en
,p
)));
150 fprintf(stdout
,"\n");
153 #endif /* EP_EVALUATION */
157 free_evalue_refs( &(en
->EP
) );
158 Polyhedron_Free( en
->ValidityDomain
);
163 for( i
=0 ; i
<C
->Dimension
; i
++ )
164 free( param_name
[i
] );
166 Polyhedron_Free( P
);
167 Polyhedron_Free( C
);