1.5.1
CCC
 
ascii.cpp File Reference
#include "Core/Ascii.hpp"
#include "Core/io.hpp"
#include "Core/CSV.hpp"
#include "Anamorphosis/AAnam.hpp"
#include "Anamorphosis/AnamDiscreteIR.hpp"
#include "Anamorphosis/AnamHermite.hpp"
#include "Basic/String.hpp"
#include "Basic/OptDbg.hpp"
#include "Db/Db.hpp"
#include "LithoRule/Rule.hpp"
#include "Model/Model.hpp"
#include "Basic/Memory.hpp"

Functions

static int st_record_read (const char *title, const char *format,...)
 
static void st_record_write (const char *format,...)
 
static void st_filename_patch (const char *ref_name, int rank, int mode, char *file_name)
 
void ascii_filename (const char *type, int rank, int mode, char *filename)
 
void ascii_study_define (const char *study)
 
static void st_file_close (FILE *file)
 
static FILE * st_file_open (const char *filename, const char *filetype, int mode, int verbose)
 
void ascii_environ_read (char *file_name, int verbose)
 
void ascii_simu_read (char *file_name, int verbose, int *nbsimu, int *nbtuba, int *seed)
 
int ascii_option_defined (const char *file_name, int verbose, const char *option_name, int type, void *answer)
 
Dbdb_read_csv (const char *file_name, const CSVformat &csvfmt, int verbose, int ncol_max, int nrow_max, bool flagAddSampleRank)
 

Variables

static char STUDY [BUFFER_LENGTH] = "./"
 
static char EXT_DAT [] = "dat"
 
static char EXT_OUT [] = "out"
 
static char Fichier_environ [] = "Environ"
 
static char Fichier_donnees [] = "Data"
 
static char Fichier_grid [] = "Grid"
 
static char Fichier_vario [] = "Vario"
 
static char Fichier_model [] = "Model"
 
static char Fichier_neigh [] = "Neigh"
 
static char Fichier_polygon [] = "Polygon"
 
static char Fichier_option [] = "Option"
 
static char Fichier_rule [] = "Rule"
 
static char Fichier_simu [] = "Simu"
 
static char Fichier_frac [] = "Frac"
 

Function Documentation

◆ ascii_environ_read()

void ascii_environ_read ( char *  file_name,
int  verbose 
)

Read the Environment definition file

Parameters
[in]file_nameName of the ASCII file
[in]verboseVerbose option if the file cannot be opened

◆ ascii_filename()

void ascii_filename ( const char *  type,
int  rank,
int  mode,
char *  filename 
)

Returns the name of the file

Parameters
[in]typeType of the file to be named
[in]rankRank of the file (optional)
[in]mode0 for read; 1 for write
[out]filenameOutput filename

◆ ascii_option_defined()

int ascii_option_defined ( const char *  file_name,
int  verbose,
const char *  option_name,
int  type,
void *  answer 
)

Check if an option is defined in the Options ASCII file

Returns
1 if the option is defined and 0 otherwise
Parameters
[in]file_nameName of the ASCII file
[in]verboseVerbose option if the file cannot be opened
[in]option_nameKeyword for the requested option
[in]typeAnswer type
  • 0 : Logical (returned as 0 or 1)
  • 1 : integer
  • 2 : real (returned as a double)
[out]answerAnswer

◆ ascii_simu_read()

void ascii_simu_read ( char *  file_name,
int  verbose,
int *  nbsimu,
int *  nbtuba,
int *  seed 
)

Read the Simulation Characteristics

Parameters
[in]file_nameName of the ASCII file
[in]verboseVerbose option if the file cannot be opened
[out]nbsimuNumber of simulations
[out]nbtubaNumber of turning bands
[out]seedSeed for the random number generator

◆ ascii_study_define()

void ascii_study_define ( const char *  study)

Set the Study for the test data

Parameters
[in]studyLocal name of the study

◆ db_read_csv()

Db* db_read_csv ( const char *  file_name,
const CSVformat csvfmt,
int  verbose,
int  ncol_max,
int  nrow_max,
bool  flagAddSampleRank 
)

Read a CSV file and load the results into a Db

Returns
Pointer to the Db descriptor
Parameters
[in]file_nameName of the ASCII file
[in]verboseVerbose option if the file cannot be opened
[in]csvfmtCSVformat structure
[in]ncol_maxMaximum number of columns (or -1)
[in]nrow_maxMaximum number of rows (or -1)
[in]flagAddSampleRankTrue To add the rank number

◆ st_file_close()

static void st_file_close ( FILE *  file)
static

Close the ASCII file

Parameters
[in]fileFILE structure to be close

◆ st_file_open()

static FILE* st_file_open ( const char *  filename,
const char *  filetype,
int  mode,
int  verbose 
)
static

Open an ASCII file

Returns
FILE returned pointer
Parameters
[in]filenameLocal file name
[in]filetypeType of the file (optional [NULL] when NEW)
[in]modetype of file (OLD or NEW)
[in]verboseVerbose option if the file cannot be opened

◆ st_filename_patch()

static void st_filename_patch ( const char *  ref_name,
int  rank,
int  mode,
char *  file_name 
)
static

Create the File Name by patching the generic name

Parameters
[in]ref_nameReference Name
[in]rankRank of the name
[in]modeChoice of the added extension
  • 0 for reading - extension ".dat"
  • 1 for writing - extension ".out"
  • -1 no extension
[out]file_nameOutput filename
Remarks
When the rank is 0, the generic name is returned
Otherwise the rank is combined in the name

◆ st_record_read()

static int st_record_read ( const char *  title,
const char *  format,
  ... 
)
static

Read the next record

Returns
Error return code
Parameters
[in]titleName of the quantity to be read
[in]formatEncoding format
[in]...Value to be written

◆ st_record_write()

static void st_record_write ( const char *  format,
  ... 
)
static

Write the next record

Parameters
[in]formatEncoding format
[in]...Value to be written

Variable Documentation

◆ EXT_DAT

char EXT_DAT[] = "dat"
static

◆ EXT_OUT

char EXT_OUT[] = "out"
static

◆ Fichier_donnees

char Fichier_donnees[] = "Data"
static

◆ Fichier_environ

char Fichier_environ[] = "Environ"
static

◆ Fichier_frac

char Fichier_frac[] = "Frac"
static

◆ Fichier_grid

char Fichier_grid[] = "Grid"
static

◆ Fichier_model

char Fichier_model[] = "Model"
static

◆ Fichier_neigh

char Fichier_neigh[] = "Neigh"
static

◆ Fichier_option

char Fichier_option[] = "Option"
static

◆ Fichier_polygon

char Fichier_polygon[] = "Polygon"
static

◆ Fichier_rule

char Fichier_rule[] = "Rule"
static

◆ Fichier_simu

char Fichier_simu[] = "Simu"
static

◆ Fichier_vario

char Fichier_vario[] = "Vario"
static

◆ STUDY

char STUDY[BUFFER_LENGTH] = "./"
static