/[escript]/trunk/paso/src/SystemMatrix_loadMM.c
ViewVC logotype

Diff of /trunk/paso/src/SystemMatrix_loadMM.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1886 by ksteube, Thu Sep 25 23:11:13 2008 UTC revision 1887 by ksteube, Wed Oct 15 03:26:25 2008 UTC
# Line 27  Line 27 
27  #include "mmio.h"  #include "mmio.h"
28  #include "SystemMatrix.h"  #include "SystemMatrix.h"
29    
30    #define FSCANF_CHECK(scan_ret, reason) { if (scan_ret == EOF) perror(reason); return NULL; }
31    
32  static void swap( index_t*, index_t*, double*, int, int );  static void swap( index_t*, index_t*, double*, int, int );
33  static void q_sort( index_t*, index_t*, double*, int, int );  static void q_sort( index_t*, index_t*, double*, int, int );
34  static void print_entries( index_t*, index_t*, double* );  static void print_entries( index_t*, index_t*, double* );
# Line 107  Paso_SystemMatrix* Paso_SystemMatrix_loa Line 109  Paso_SystemMatrix* Paso_SystemMatrix_loa
109      Paso_SystemMatrix *out = NULL;      Paso_SystemMatrix *out = NULL;
110          Paso_SharedComponents *send =NULL;          Paso_SharedComponents *send =NULL;
111          Paso_Connector *connector=NULL;          Paso_Connector *connector=NULL;
112      int i, curr_row;      int i, curr_row, scan_ret;
113      MM_typecode matrixCode;      MM_typecode matrixCode;
114          Paso_MPIInfo* mpi_info=Paso_MPIInfo_alloc( MPI_COMM_WORLD);          Paso_MPIInfo* mpi_info=Paso_MPIInfo_alloc( MPI_COMM_WORLD);
115          Paso_resetError();          Paso_resetError();
# Line 169  Paso_SystemMatrix* Paso_SystemMatrix_loa Line 171  Paso_SystemMatrix* Paso_SystemMatrix_loa
171      /* perform actual read of elements */      /* perform actual read of elements */
172      for( i=0; i<nz; i++ )      for( i=0; i<nz; i++ )
173      {      {
174          fscanf( fileHandle_p, "%d %d %le\n", &row_ind[i], &col_ind[i], &val[i] );          scan_ret = fscanf( fileHandle_p, "%d %d %le\n", &row_ind[i], &col_ind[i], &val[i] );
175            FSCANF_CHECK(scan_ret, "fscanf: read elements 1")
176          row_ind[i]--;          row_ind[i]--;
177          col_ind[i]--;          col_ind[i]--;
178      }      }
# Line 234  Paso_SystemMatrix* Paso_SystemMatrix_loa Line 237  Paso_SystemMatrix* Paso_SystemMatrix_loa
237      index_t *row_ind = NULL;      index_t *row_ind = NULL;
238      index_t *col_ptr = NULL;      index_t *col_ptr = NULL;
239      double *val = NULL;      double *val = NULL;
240      int i, curr_col=0;      int i, curr_col=0, scan_ret;
241      MM_typecode matrixCode;      MM_typecode matrixCode;
242          Paso_MPIInfo* mpi_info=Paso_MPIInfo_alloc( MPI_COMM_WORLD);          Paso_MPIInfo* mpi_info=Paso_MPIInfo_alloc( MPI_COMM_WORLD);
243          if (mpi_info->size >1) {          if (mpi_info->size >1) {
# Line 289  Paso_SystemMatrix* Paso_SystemMatrix_loa Line 292  Paso_SystemMatrix* Paso_SystemMatrix_loa
292      /* perform actual read of elements */      /* perform actual read of elements */
293      for( i=0; i<nz; i++ )      for( i=0; i<nz; i++ )
294      {      {
295          fscanf( fileHandle_p, "%d %d %le\n", &row_ind[i], &col_ind[i], &val[i] );          scan_ret = fscanf( fileHandle_p, "%d %d %le\n", &row_ind[i], &col_ind[i], &val[i] );
296            FSCANF_CHECK(scan_ret, "fscanf: read elements 2")
297          row_ind[i]--;          row_ind[i]--;
298          col_ind[i]--;          col_ind[i]--;
299      }      }

Legend:
Removed from v.1886  
changed lines
  Added in v.1887

  ViewVC Help
Powered by ViewVC 1.1.26