Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 0d34af1a authored by Mathieu Faverge's avatar Mathieu Faverge
Browse files

Remove csc_load and csc_save

parent d7c24050
No related branches found
No related tags found
No related merge requests found
......@@ -314,109 +314,6 @@ readArrayOfFloat( FILE *stream,
return PASTIX_SUCCESS;
}
/*
Function: spm_load
Load a spm from disk.
Fill *n*, *colptr*, *rowptr*, *values* and *dof* from *infile*.
Parameters:
n - number of columns
colptr - First cscd starting index of each column in *ja* and *a*
rowptr - Row of each element in first CSCD
values - value of each cscd in first CSCD (can be NULL)
dof - Number of degrees of freedom
outfile - Output stream.
Return:
PASTIX_SUCCESS
*/
int
csc_load( pastix_int_t *n,
pastix_int_t **colptr,
pastix_int_t **rowptr,
int *valtype,
void **values,
int *dof,
FILE *infile )
{
int rc, ft;
long tmp1, tmp2;
pastix_int_t nnz;
/* Read the header file */
if (3 != fscanf(infile, "%ld %ld %d\n", &tmp1, &tmp2, &ft)) {
errorPrint("spmLoad:line 1: Wrong input");
return PASTIX_ERR_FILE;
}
*n = (pastix_int_t)tmp1;
*dof = (int)tmp2;
/* Read the colptr array */
*colptr = NULL;
MALLOC_INTERN(*colptr, (*n)+1, pastix_int_t);
assert(*colptr);
rc = readArrayOfInteger( infile, *n+1, *colptr );
if ( rc != PASTIX_SUCCESS )
return rc;
/* Read the rowptr array */
nnz = (*colptr)[*n]-(*colptr)[0];
*rowptr = NULL;
MALLOC_INTERN(*rowptr, nnz, pastix_int_t);
assert(*rowptr);
rc = readArrayOfInteger( infile, nnz, *rowptr );
if ( rc != PASTIX_SUCCESS )
return rc;
/* Read values if values is provided and if file contains */
if (values != NULL) {
pastix_int_t nval = nnz * (*dof) * (*dof);
(*values) = NULL;
switch(ft)
{
case PastixComplex64:
*values = malloc( nval * sizeof(pastix_complex64_t) );
readArrayOfComplex64( infile, nval, *values );
if ( rc != PASTIX_SUCCESS )
return rc;
break;
case PastixComplex32:
*values = malloc( nval * sizeof(pastix_complex32_t) );
readArrayOfComplex32( infile, nval, *values );
if ( rc != PASTIX_SUCCESS )
return rc;
break;
case PastixDouble:
*values = malloc( nval * sizeof(double) );
readArrayOfDouble( infile, nval, *values );
if ( rc != PASTIX_SUCCESS )
return rc;
break;
case PastixFloat:
*values = malloc( nval * sizeof(float) );
readArrayOfFloat( infile, nval, *values );
if ( rc != PASTIX_SUCCESS )
return rc;
break;
}
}
if ( valtype != NULL ) {
*valtype = ft;
}
return PASTIX_SUCCESS;
}
/**
*******************************************************************************
*
......@@ -653,55 +550,6 @@ writeArrayOfFloat( FILE *outfile,
return PASTIX_SUCCESS;
}
int
csc_save( pastix_int_t n,
pastix_int_t *colptr,
pastix_int_t *rowptr,
int ft,
void *values,
int dof,
FILE *outfile )
{
pastix_int_t i;
/* Write header N Dof FloatType */
fprintf( outfile, "%ld %ld %d\n",
(long)n, (long)dof,
(values == NULL) ? 0 : ft );
/* Write colptr */
for (i=0; i<n+1; i++)
{
fprintf(outfile, "%ld ", (long)colptr[i]);
if (i%4 == 3) fprintf(outfile, "\n");
}
if ((i-1)%4 !=3) fprintf(outfile, "\n");
/* Write rowptr */
for (i=0; i<colptr[n]-1; i++)
{
fprintf(outfile, "%ld ", (long)rowptr[i]);
if (i%4 == 3) fprintf(outfile, "\n");
}
if ((i-1)%4 !=3) fprintf(outfile, "\n");
/* Write the values */
if (values != NULL)
{
/* for (i=0; i<(colptr[n]-1)*dof*dof; i++) */
/* { */
/* #ifdef TYPE_COMPLEX */
/* fprintf(outfile, "%lg %lg ", (double)(creal(values[i])), (double)(cimag(values[i]))); */
/* #else */
/* fprintf(outfile, "%lg ", (double)(values[i])); */
/* #endif */
/* if (i%4 == 3) fprintf(outfile, "\n"); */
/* } */
/* if ((i-1)%4 !=3) fprintf(outfile, "\n"); */
}
return PASTIX_SUCCESS;
}
/**
*******************************************************************************
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment