PPL Logo

libs/ck-libs/metis/GKlib/io.c File Reference

Go to the source code of this file.

Functions

FILE * gk_fopen (char *fname, char *mode, const char *msg)
void gk_fclose (FILE *fp)
gk_idx_t gk_getline (char **lineptr, size_t *n, FILE *stream)
char ** gk_readfile (char *fname, gk_idx_t *r_nlines)
int32_tgk_i32readfile (char *fname, gk_idx_t *r_nlines)
int64_tgk_i64readfile (char *fname, gk_idx_t *r_nlines)
int32_tgk_i32readfilebin (char *fname, ssize_t *r_nelmnts)
int64_tgk_i64readfilebin (char *fname, ssize_t *r_nelmnts)
floatgk_freadfilebin (char *fname, ssize_t *r_nelmnts)
size_t gk_fwritefilebin (char *fname, size_t n, float *a)
double * gk_dreadfilebin (char *fname, ssize_t *r_nelmnts)


Function Documentation

FILE* gk_fopen ( char *  fname,
char *  mode,
const char *  msg 
)

void gk_fclose ( FILE *  fp  ) 

gk_idx_t gk_getline ( char **  lineptr,
size_t n,
FILE *  stream 
)

This function is the GKlib implementation of glibc's getline() function.

Returns:
-1 if the EOF has been reached, otherwise it returns the number of bytes read.

Definition at line 57 of file io.c.

References gk_malloc(), and gk_realloc().

Referenced by gk_csr_Read(), gk_graph_Read(), gk_i32readfile(), gk_i64readfile(), gk_readfile(), ReadGraph(), ReadMesh(), and ReadTPwgts().

Here is the call graph for this function:

Here is the caller graph for this function:

char** gk_readfile ( char *  fname,
gk_idx_t r_nlines 
)

This function reads the contents of a text file and returns it in the form of an array of strings.

Parameters:
fname is the name of the file
r_nlines is the number of lines in the file. If it is NULL, this information is not returned.

Definition at line 103 of file io.c.

References gk_fclose(), gk_fopen(), gk_free(), gk_getfilestats(), gk_getline(), gk_malloc(), gk_strdup(), and gk_strtprune().

Here is the call graph for this function:

int32_t* gk_i32readfile ( char *  fname,
gk_idx_t r_nlines 
)

This function reads the contents of a file and returns it in the form of an array of int32_t.

Parameters:
fname is the name of the file
r_nlines is the number of lines in the file. If it is NULL, this information is not returned.

Definition at line 139 of file io.c.

References array, gk_fclose(), gk_fopen(), gk_free(), gk_getfilestats(), gk_getline(), and int32_t.

Here is the call graph for this function:

int64_t* gk_i64readfile ( char *  fname,
gk_idx_t r_nlines 
)

This function reads the contents of a file and returns it in the form of an array of int64_t.

Parameters:
fname is the name of the file
r_nlines is the number of lines in the file. If it is NULL, this information is not returned.

Definition at line 177 of file io.c.

References array, gk_fclose(), gk_fopen(), gk_free(), gk_getfilestats(), and gk_getline().

Here is the call graph for this function:

int32_t* gk_i32readfilebin ( char *  fname,
ssize_t r_nelmnts 
)

This function reads the contents of a binary file and returns it in the form of an array of int32_t.

Parameters:
fname is the name of the file
r_nlines is the number of lines in the file. If it is NULL, this information is not returned.

Definition at line 214 of file io.c.

References array, gk_errexit(), gk_fclose(), gk_fopen(), gk_free(), gk_getfsize(), and int32_t.

Here is the call graph for this function:

int64_t* gk_i64readfilebin ( char *  fname,
ssize_t r_nelmnts 
)

This function reads the contents of a binary file and returns it in the form of an array of int64_t.

Parameters:
fname is the name of the file
r_nlines is the number of lines in the file. If it is NULL, this information is not returned.

Definition at line 253 of file io.c.

References array, gk_errexit(), gk_fclose(), gk_fopen(), gk_free(), and gk_getfsize().

Here is the call graph for this function:

float* gk_freadfilebin ( char *  fname,
ssize_t r_nelmnts 
)

This function reads the contents of a binary file and returns it in the form of an array of float.

Parameters:
fname is the name of the file
r_nlines is the number of lines in the file. If it is NULL, this information is not returned.

Definition at line 292 of file io.c.

References array, float, gk_errexit(), gk_fclose(), gk_fopen(), gk_free(), and gk_getfsize().

Here is the call graph for this function:

size_t gk_fwritefilebin ( char *  fname,
size_t  n,
float a 
)

This function writes the contents of an array into a binary file.

Parameters:
fname is the name of the file
n the number of elements in the array.
a the array to be written out.

Definition at line 331 of file io.c.

References gk_fclose(), and gk_fopen().

Here is the call graph for this function:

double* gk_dreadfilebin ( char *  fname,
ssize_t r_nelmnts 
)

This function reads the contents of a binary file and returns it in the form of an array of double.

Parameters:
fname is the name of the file
r_nlines is the number of lines in the file. If it is NULL, this information is not returned.

Definition at line 354 of file io.c.

References array, gk_errexit(), gk_fclose(), gk_fopen(), gk_free(), and gk_getfsize().

Here is the call graph for this function:


Generated on Mon Sep 21 08:08:59 2020 for Charm++ by  doxygen 1.5.5