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  double *configuration;
101  unsigned int k;
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  /* Estimate the dimesion of the solution manifold*/
117  k=CS_WD_MANIFOLD_DIMENSION(&parameters,configuration,&world);
118  fprintf(stderr,"N_DOF = %u\n",k);
119 
120  /* Print the N_DOF determined in the atlas initialization */
121  DeleteFileName(&fparam);
122  DeleteParameters(&parameters);
123  CS_WD_DELETE(&world);
124  }
125  else
126  {
127  fprintf(stderr,"Use:\n");
128  fprintf(stderr," cuikdim <problem_name> \n");
129  fprintf(stderr," <problem_name> the input problem.\n");
130  }
131 
132  return(EXIT_SUCCESS);
133 }
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.
#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
Error and warning functions.
void DeleteFileName(Tfilename *fn)
Destructor.
Definition: filename.c:205
#define CS_WD_MANIFOLD_DIMENSION(pr, p, wcs)
Computes the dimension of the solution set.
Definition: wcs.h:565
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
void DeleteParameters(Tparameters *p)
Destructor.
Definition: parameters.c:294
#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:264
Auxiliary functions to deal with sets of samples.
Definition of the Tparameters type and the associated functions.
unsigned int ReadOneSample(Tparameters *p, char *fname, unsigned int nvs, double **s)
Reads one sample from a file.
Definition: samples.c:2772