cuikatlascenters.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 
72 int main(int argc, char **arg)
73 {
74  TAtlasBase world; /* The set of mechanism and obstacles. */
75  Tparameters parameters; /* Parameters used in the Cuik process. */
76  Tatlas atlas; /* The atlas to process. */
77 
78  Tfilename fparam;
79  Tfilename fatlas;
80 
81  boolean withDummies;
82  boolean middlePoint;
83  boolean inside;
84 
85  if (argc>1)
86  {
87  /*Init parameters*/
88  CreateFileName(NULL,arg[1],NULL,PARAM_EXT,&fparam);
89  fprintf(stderr,"Reading parameters from : %s\n",GetFileFullName(&fparam));
90  InitParametersFromFile(GetFileFullName(&fparam),&parameters);
91 
92  /*Read the world/cuik from file*/
93  CS_WD_INIT(&parameters,arg[1],&world);
94 
95  CreateFileName(NULL,arg[1],NULL,ATLAS_EXT,&fatlas);
96  fprintf(stderr,"Reading atlas from : %s\n",GetFileFullName(&fatlas));
97  LoadAtlas(&parameters,&fatlas,&world,&atlas);
98 
99  if (argc>2)
100  withDummies=atoi(arg[2]);
101  else
102  withDummies=FALSE;
103 
104  if (argc>3)
105  inside=atoi(arg[3]);
106  else
107  inside=FALSE;
108 
109  if (argc>4)
110  middlePoint=atoi(arg[4]);
111  else
112  middlePoint=FALSE;
113 
114  SaveChartCenters(&parameters,arg[1],inside,withDummies,middlePoint,&atlas);
115 
116  DeleteParameters(&parameters);
117 
118  CS_WD_DELETE(&world);
119 
120  DeleteAtlas(&atlas);
121 
122  DeleteFileName(&fatlas);
123  DeleteFileName(&fparam);
124  }
125  else
126  {
127  fprintf(stderr," Wrong number of parameters.\n");
128  fprintf(stderr," Use:\n");
129  fprintf(stderr," cuikatlascenters <problem filename>.%s [dummies] [insied] [middle]\n",CS_WD_EXT);
130  fprintf(stderr," where <problem filename> is the atlas with the center to extract.\n");
131  fprintf(stderr," [dummies] is 1 if you want the dummy variables in the output.\n");
132  fprintf(stderr," This is only necessary if you plan to unsimplify the\n");
133  fprintf(stderr," output points (default 0).\n");
134  fprintf(stderr," [inside] optional. If 1, output the center of the charts that are\n");
135  fprintf(stderr," fully inside the domain (default 0).\n");
136  fprintf(stderr," [middle] is 1 if you want intermediate points in between.\n");
137  fprintf(stderr," chart centers. This is only necessary if you\n");
138  fprintf(stderr," need a denser grid of points and do not want to\n");
139  fprintf(stderr," generate the atlas again with smaller R (default 0)\n");
140 
141  }
142  return(EXIT_SUCCESS);
143 }
144 
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
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.
A table of parameters.
int main(int argc, char **arg)
Main body of the cuikatlascenters application.
void CreateFileName(char *path, char *name, char *suffix, char *ext, Tfilename *fn)
Constructor.
Definition: filename.c:22
void SaveChartCenters(Tparameters *pr, char *fname, boolean inside, boolean saveWithDummies, boolean middlePoint, Tatlas *a)
Stores the centers of the charts.
Definition: atlas.c:3987
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.