## renderingAtomic_ascii

renderingAtomic_ascii — Method to load ascii position file.

## Synopsis

    RenderingFormatLoad* atomicAsciiInit        ();
    struct      dataAscii;
    int         readFile_is_comment             (char *str);
    void        freeDataAscii                   (gpointer data);
    void        putValTypeInAsciiType           (gpointer key,
                                                 gpointer value,
                                                 gpointer data);
    void        putValNbInAsciiType             (gpointer key,
                                                 gpointer value,
                                                 gpointer data);

## Description

Ascii format is a plain text format to store elements and their position. The first line is a commentary and is not read. Then, the next two lines must contains each three numbers, describing the box containing the data. The first number is the length on x direction. The next two numbers are on one hand the component on the same x direction and on the other hand the other component on a direction orthogonal to the x direction, setting thus the y direction. The three other numbers are the component of the z direction on first, the x direction, then the y direction and finally in a direction orthogonal both to x and y directions. After these three first lines, all other lines can be blank, beginning with a '#' character or containing three numbers and a label name for the element.

The `read_ascii_file()` method is used to try to load an ascii file in memory. Other methods are quite private and just put here for other loader which wants to share the code of this loader (see `read_xyz_file()` for instance).

## Details

### atomicAsciiInit ()

    RenderingFormatLoad* atomicAsciiInit        ();

Create the structure that gives access to a load method and some description of it (file formats associated, name...).

Returns : | a loading method.

### struct dataAscii

    struct dataAscii {
      VisuElement *ele;
      int pos;
      int nbNodes;
    };

This structure is used when the file is parsed. Each time a node is successfully read, its VisuElement is compared to those already found. If none is found, a new instance of this structure is created with `ele` pointing to the VisuElement, `pos` is the nth visuElement found and `nbPos` is initialized to one. If the read VisuElement has already been found, the `nbPos` is increased by one.

VisuElement *`ele`; | a VisuElement object ;
int `pos`; | the number of the read element `ele` ;
int `nbNodes`; | number of nodes for this `ele`.

### readFile_is_comment ()

    int         readFile_is_comment             (char *str);

Lines beginning with a '#' are treated as commentaries.

`str` : | a null terminated string.
Returns : |

### freeDataAscii ()

    void        freeDataAscii                   (gpointer data);

This method is used to free an allocated stuct dataAscii, and can be used as a destructor when creating an hashtable with such datas.

`data` : | a pointer to stuct dataAscii instances.

### putValTypeInAsciiType ()

    void        putValTypeInAsciiType           (gpointer key,
                                                 gpointer value,
                                                 gpointer data);

This method is used in a `g_hash_table_foreach()` method that work on `data`. `data` is an array of pointers to VisuElement and this method puts its nth value to point to `key`. The value nth is read from the `pos` attribute of the structure object pointed by `value`.

`key` : | a VisuElement pointer ;
`value` : | a struct dataAscii pointer ;
`data` : | a pointer on array of pointers of VisuElement.

### putValNbInAsciiType ()

    void        putValNbInAsciiType             (gpointer key,
                                                 gpointer value,
                                                 gpointer data);

This method is used in a `g_hash_table_foreach()` method that work on `data`. `data` is an array of int and this method puts its nth value to the value read from the `nbNodes` attribute of the structure object pointed by `value`.

`key` : | a VisuElement pointer ;
`value` : | a struct dataAscii pointer ;
`data` : | a pointer on array of int.