/* read.h
* Functions that read data from a file and store it in a place
* pointed by argument.
*/
/* Reads input values and stores them in nwd. Allocates space for
* arrays in nwd. This function calls the other functions in this file.
* Arguments: struct nwdata *nwd -- struct where network data is stored
* FILE *inputfile -- file where the network data is read from
*/
void read_values( struct nwdata *nwd, FILE *inputfile );
/* Reads an integer vector from inputfile and stores it in array
* pointed by *vector. Space for this array must be allocated before
* this function is called.
* Arguments: FILE *inputfile -- where the vector is read from
* int *vector -- where the vector is written to
* int n_elements -- number of elements in the vector
* Returns number of elements read.
*/
int read_int_vector( FILE *inputfile, int *vector, int n_elements );
/* Reads a real vector from inputfile and stores it in array pointed
* by *vector. Space for this array must be allocated before this
* function is called.
* Arguments: FILE *inputfile -- where the vector is read from
* double *vector -- where the vector is written to
* int n_elements -- number of elements in the vector
* Returns number of elements read.
*/
int read_real_vector( FILE *inputfile, double *vector, int n_elements );
/* Reads an n times m sized integer matrix from inputfile and stores it
* in the (2-dimensional) array pointed by **matrix. Space for this
* array must be allocated before this function is called.
* Arguments: FILE *inputfile -- where the matrix is read from
* int **matrix -- where the matrix is written to
* int n -- number of rows
* int m -- number of columns
* Returns number of elements read.
*/
int read_int_matrix( FILE *inputfile, int **matrix, int n, int m );
/* Reads an n times m sized real matrix from inputfile and stores it
* in the (2-dimensional) array pointed by **matrix. Space for this
* array must be allocated before this function is called.
* Arguments: FILE *inputfile -- where the matrix is read from
* double **matrix -- where the matrix is written to
* int n -- number of rows
* int m -- number of columns
* Returns number of elements read.
*/
int read_real_matrix( FILE *inputfile, double **matrix, int n, int m );