cuikdim.c
Go to the documentation of this file.
1 #include "filename.h"
2 #include "error.h"
3 #include "parameters.h"
4 #include "atlas.h"
5 #include "samples.h"
6 
7 
8 #include <stdio.h>
9 #include <math.h>
10 
95 int main(int argc, char **arg)
96 {
97  Tparameters parameters;
98  TAtlasBase world;
99  Tfilename fparam;
100  Tatlas atlas;
101  double *configuration;
102 
103  if (argc>1)
104  {
105  /* Init parameters */
106  CreateFileName(NULL,arg[1],NULL,PARAM_EXT,&fparam);
107  fprintf(stderr,"Reading parameters : %s\n",GetFileFullName(&fparam));
108  InitParametersFromFile(GetFileFullName(&fparam),&parameters);
109 
110  /* Read the world from file */
111  CS_WD_INIT(&parameters,arg[1],&world);
112 
113  /* Read start sample */
114  ReadOneSample(&parameters,arg[1],CS_WD_GET_NUM_SYSTEM_VARS(&world),&configuration);
115 
116  /* Set the N_DOF parameter to 0 */
117  ChangeParameter(CT_N_DOF,0,&parameters);
118 
119  /* Initialize the atlas */
120  InitAtlasFromPoint(&parameters,FALSE,TRUE,configuration,&world,&atlas);
121 
122  /* Print the N_DOF determined in the atlas initialization */
123  DeleteAtlas(&atlas);
124  DeleteFileName(&fparam);
125  DeleteParameters(&parameters);
126  CS_WD_DELETE(&world);
127  }
128  else
129  {
130  fprintf(stderr,"Use:\n");
131  fprintf(stderr," cuikdim <problem_name> \n");
132  fprintf(stderr," <problem_name> the input problem.\n");
133  }
134 
135  return(EXIT_SUCCESS);
136 }
#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.
#define TRUE
TRUE.
Definition: boolean.h:21
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
Error and warning functions.
void DeleteFileName(Tfilename *fn)
Destructor.
Definition: filename.c:205
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
int main(int argc, char **arg)
Main body of the cuikdim application.
Definition: cuikdim.c:95
A atlas on a manifold.
Definition: atlas.h:289
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
#define CS_WD_GET_NUM_SYSTEM_VARS(wcs)
Gets the number of system variables.
Definition: wcs.h:250
#define CT_N_DOF
Dimensionality of the solution space for the mechanism at hand.
Definition: parameters.h:318
Auxiliary functions to deal with sets of samples.
boolean InitAtlasFromPoint(Tparameters *pr, boolean parallel, boolean simpleChart, double *p, TAtlasBase *w, Tatlas *a)
Initializes an atlas from a given point.
Definition: atlas.c:2742
Definition of the Tparameters type and the associated functions.
void ChangeParameter(unsigned int n, double v, Tparameters *p)
Sets the value for a particular parameter.
Definition: parameters.c:164
unsigned int ReadOneSample(Tparameters *p, char *fname, unsigned int nvs, double **s)
Reads one sample from a file.
Definition: samples.c:1216