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 
void LoadAtlas(Tparameters *pr, Tfilename *fname, TAtlasBase *w, Tatlas *a)
Defines an atlas from the information on a file.
Definition: atlas.c:3869
#define FALSE
FALSE.
Definition: boolean.h:30
Data structure to hold the information about the name of a file.
Definition: filename.h:248
int main(int argc, char **arg)
Main body of the cuiksingularcharts application.
Definition of the Tfilename type and the associated functions.
void DeleteAtlas(Tatlas *a)
Destructor.
Definition: atlas.c:4561
#define PARAM_EXT
File extension for parameter files.
Definition: filename.h:131
#define CS_WD_DELETE(wcs)
Destructor of the equation structure.
Definition: wcs.h:500
Definition of the Tworld type and the associated functions.
Error and warning functions.
void DeleteFileName(Tfilename *fn)
Destructor.
Definition: filename.c:205
#define ATLAS_EXT
File extension for files storing atlas.
Definition: filename.h:199
Definitions of constants and macros used in several parts of the cuik library.
void SaveSingularCharts(Tparameters *pr, char *fname, boolean saveWithDummies, Tatlas *a)
Stores the centers of the singular charts.
Definition: atlas.c:4095
A table of parameters.
void CreateFileName(char *path, char *name, char *suffix, char *ext, Tfilename *fn)
Constructor.
Definition: filename.c:22
void InitParametersFromFile(char *file, Tparameters *p)
Constructor from a file.
Definition: parameters.c:51
Type defining the equations on which the atlas is defined.
Definition: wcs.h:30
Definition of an atlas on a manifold.
char * GetFileFullName(Tfilename *fn)
Gets the file full name (paht+name+extension).
Definition: filename.c:151
A atlas on a manifold.
Definition: atlas.h:289
#define CS_WD_EXT
Possible extensions for the equation files.
Definition: wcs.h:48
void DeleteParameters(Tparameters *p)
Destructor.
Definition: parameters.c:295
#define CS_WD_INIT(pr, name, wcs)
Initializes the equations from a file.
Definition: wcs.h:89
Definition of the Tparameters type and the associated functions.