cuiksingularcharts.c
Go to the documentation of this file.
1 
2 #include "world.h"
3 #include "parameters.h"
4 
5 #include "defines.h"
6 #include "error.h"
7 #include "filename.h"
8 #include "atlas.h"
9 
10 #include <stdlib.h>
11 
66 int main(int argc, char **arg)
67 {
68  TAtlasBase world; /* The set of mechanism and obstacles. */
69  Tparameters parameters; /* Parameters used in the Cuik process. */
70  Tatlas atlas; /* The atlas to process. */
71 
72  Tfilename fparam;
73  Tfilename fatlas;
74 
75  boolean withDummies;
76 
77  if (argc>1)
78  {
79  /*Init parameters*/
80  CreateFileName(NULL,arg[1],NULL,PARAM_EXT,&fparam);
81  fprintf(stderr,"Reading parameters from : %s\n",GetFileFullName(&fparam));
82  InitParametersFromFile(GetFileFullName(&fparam),&parameters);
83 
84  /*Read the world/cuik from file*/
85  CS_WD_INIT(&parameters,arg[1],&world);
86 
87  CreateFileName(NULL,arg[1],NULL,ATLAS_EXT,&fatlas);
88  fprintf(stderr,"Reading atlas from : %s\n",GetFileFullName(&fatlas));
89  LoadAtlas(&parameters,&fatlas,&world,&atlas);
90 
91  if (argc>2)
92  withDummies=atoi(arg[2]);
93  else
94  withDummies=FALSE;
95 
96  SaveSingularCharts(&parameters,arg[1],withDummies,&atlas);
97 
98  DeleteParameters(&parameters);
99 
100  CS_WD_DELETE(&world);
101 
102  DeleteAtlas(&atlas);
103 
104  DeleteFileName(&fatlas);
105  DeleteFileName(&fparam);
106  }
107  else
108  {
109  fprintf(stderr," Wrong number of parameters.\n");
110  fprintf(stderr," Use:\n");
111  fprintf(stderr," cuiksingularcharts <problem filename>.%s [dummies]\n",CS_WD_EXT);
112  fprintf(stderr," where <problem filename> is the atlas with the singularities to extract.\n");
113  fprintf(stderr," [dummies] is 1 if you want the dummy variables in the output.\n");
114  fprintf(stderr," This is only necessary if you plan to unsimplify the\n");
115  fprintf(stderr," output points (default 0).\n");
116  }
117  return(EXIT_SUCCESS);
118 }
119