PIPS
test_chernikova.c
Go to the documentation of this file.
1 /*
2 
3  $Id: test_chernikova.c 1641 2016-03-02 08:20:19Z coelho $
4 
5  Copyright 1989-2016 MINES ParisTech
6 
7  This file is part of Linear/C3 Library.
8 
9  Linear/C3 Library is free software: you can redistribute it and/or modify it
10  under the terms of the GNU Lesser General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  any later version.
13 
14  Linear/C3 Library is distributed in the hope that it will be useful, but WITHOUT ANY
15  WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  FITNESS FOR A PARTICULAR PURPOSE.
17 
18  See the GNU Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with Linear/C3 Library. If not, see <http://www.gnu.org/licenses/>.
22 
23 */
24 
25  /* test de chernikovaa */
26 
27 #ifdef HAVE_CONFIG_H
28  #include "config.h"
29 #endif
30 
31 #include <stdio.h>
32 #include <string.h>
33 
34 #include "boolean.h"
35 #include "arithmetique.h"
36 
37 #include "vecteur.h"
38 #include "contrainte.h"
39 #include "ray_dte.h"
40 #include "sommet.h"
41 #include "sc.h"
42 #include "sg.h"
43 
44 typedef struct vector
45 {
46  int size;
47  int *p;
49 
50 
51 typedef struct matrix
52 {
53  int nbrows;
54  int nbcolumns;
55  int **p;
56  int *p_init;
58 
59 
60 int main(
61  int argc,
62  char **argv)
63 {
64  FILE * f;
65  char * filename = "stdin";
66  Psysteme sc=SC_EMPTY;
67  Psysteme sc1;
68  Ptsg sg;
69 
70  if(argc==1) {
71  f = stdin;
72  fprintf(stderr,"From stdin\n");
73  }
74  else if (argc==2) {
75  filename = strdup(argv[1]);
76  if((f = fopen(filename,"r")) == NULL) {
77  fprintf(stderr,"Cannot open file %s\n", filename);
78  return 4;
79  }
80  }
81  else {
82  fprintf(stderr,"Usage: test_chernikova [filename]\n");
83  return 1;
84  }
85 
86  sg = sg_new();
87  if(sc_fscan(f,&sc)) {
88  printf("Initial constraint system:\n");
89  sc_fprint(stdout,sc,*variable_default_name);
90 
91  sg = sc_to_sg_chernikova(sc);
92  printf("Generating system\n");
94 
95  sc1 = sc_new();
96  sc1 = sg_to_sc_chernikova(sg);
97  printf("Regenerated constraint system:\n");
98  sc_fprint(stdout,sc,*variable_default_name);
99  }
100  else {
101  fprintf(stderr,"syntax error in %s\n",filename);
102  }
103  return 0;
104 } /* main */
Psysteme sg_to_sc_chernikova(Ptsg sg)
Definition: chernikova.c:58
Ptsg sc_to_sg_chernikova(Psysteme sc)
chernikova_mulprec.c
Definition: chernikova.c:42
Ptsg sg
char * variable_default_name(Variable v)
char * variable_default_name(Variable v): returns the name of variable v
Definition: variable.c:81
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15
Psysteme sc_new(void)
Psysteme sc_new(): alloue un systeme vide, initialise tous les champs avec des valeurs nulles,...
Definition: sc_alloc.c:55
void sc_fprint(FILE *fp, Psysteme ps, get_variable_name_t nom_var)
void sc_fprint(FILE * f, Psysteme ps, char * (*nom_var)()): cette fonction imprime dans le fichier po...
Definition: sc_io.c:220
bool sc_fscan(FILE *f, Psysteme *ps)
bool sc_fscan(FILE * f, Psysteme * ps): construit un systeme d'inegalites et d'egalites lineaires a p...
Definition: sc_io.c:121
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
char * strdup()
int printf()
Ptsg sg_new()
Ptsg sg_new(): allocation d'un systeme generateur et initialisation a la valeur ensemble vide.
Definition: sg.c:55
void sg_fprint(FILE *f, Ptsg sg, char *(*nom_var)(Variable))
void sg_fprint(FILE * f, Ptsg sg, char * (*nom_var)()): impression d'un systeme generateur
Definition: sg.c:262
int ** p
int nbcolumns
int * p_init
Representation d'un systeme generateur par trois ensembles de sommets de rayons et de droites.
Definition: sg-local.h:66
test de chernikovaa
int main(int argc, char **argv)
struct vector vector
test de chernikovaa
struct matrix matrix