cuikatlas2graph.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 
62 int main(int argc, char **arg)
63 {
64  TAtlasBase world; /* The set of mechanism and obstacles. */
65  Tparameters parameters; /* Parameters used in the Cuik process. */
66  Tatlas atlas; /* The atlas to process. */
67 
68  Tfilename fparam;
69  Tfilename fatlas;
70 
71  if (argc>1)
72  {
73  /*Init parameters*/
74  CreateFileName(NULL,arg[1],NULL,PARAM_EXT,&fparam);
75  fprintf(stderr,"Reading parameters from : %s\n",GetFileFullName(&fparam));
76  InitParametersFromFile(GetFileFullName(&fparam),&parameters);
77 
78  /*Read the world/cuik from file*/
79  CS_WD_INIT(&parameters,arg[1],&world);
80 
81  CreateFileName(NULL,arg[1],NULL,ATLAS_EXT,&fatlas);
82  fprintf(stderr,"Reading atlas from : %s\n",GetFileFullName(&fatlas));
83  LoadAtlas(&parameters,&fatlas,&world,&atlas);
84 
85  SaveAtlasGraph(arg[1],&atlas);
86 
87  DeleteParameters(&parameters);
88 
89  CS_WD_DELETE(&world);
90  DeleteAtlas(&atlas);
91 
92  DeleteFileName(&fatlas);
93  DeleteFileName(&fparam);
94  }
95  else
96  {
97  fprintf(stderr," Wrong number of parameters.\n");
98  fprintf(stderr," Use:\n");
99  fprintf(stderr," cuikatlas2graph <problem filename>.%s\n",CS_WD_EXT);
100  fprintf(stderr," where <problem filename> is the atlas with the graph.\n");
101 
102  }
103  return(EXIT_SUCCESS);
104 }
105 
void LoadAtlas(Tparameters *pr, Tfilename *fname, TAtlasBase *w, Tatlas *a)
Defines an atlas from the information on a file.
Definition: atlas.c:3973
Data structure to hold the information about the name of a file.
Definition: filename.h:271
Definition of the Tfilename type and the associated functions.
void DeleteAtlas(Tatlas *a)
Destructor.
Definition: atlas.c:4634
#define PARAM_EXT
File extension for parameter files.
Definition: filename.h:132
#define CS_WD_DELETE(wcs)
Destructor of the equation structure.
Definition: wcs.h:592
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:200
Definitions of constants and macros used in several parts of the cuik library.
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:294
void SaveAtlasGraph(char *fname, Tatlas *a)
Saves the graph structure of the atlas.
Definition: atlas.c:4091
#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.
int main(int argc, char **arg)
Main body of the cuikatlas2graph application.