/[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 3641 by gross, Tue Oct 26 07:54:58 2010 UTC revision 3642 by caltinay, Thu Oct 27 03:41:51 2011 UTC
# Line 14  Line 14 
14    
15  /**************************************************************/  /**************************************************************/
16    
17  /* Paso: Matrix Market format is loaded to a SystemMatrix   */  /* Paso: Matrix Market format is loaded to a SystemMatrix     */
18    
19  /**************************************************************/  /**************************************************************/
20    
# Line 82  void q_sort( index_t *row, index_t *col, Line 82  void q_sort( index_t *row, index_t *col,
82    
83          while( l < r )          while( l < r )
84          {          {
85              /* This all section is for checking lval<pivot, where              /* This whole section is for checking lval<pivot, where
86               pivot=N*row[begin]+col[begin] and lval=N*row[l]+col[l]. */               pivot=N*row[begin]+col[begin] and lval=N*row[l]+col[l]. */
87              if (row[l]<row[begin])              if (row[l]<row[begin])
88               {               {
# Line 138  Paso_SystemMatrix* Paso_SystemMatrix_loa Line 138  Paso_SystemMatrix* Paso_SystemMatrix_loa
138          Esys_MPIInfo* mpi_info=Esys_MPIInfo_alloc( MPI_COMM_WORLD);          Esys_MPIInfo* mpi_info=Esys_MPIInfo_alloc( MPI_COMM_WORLD);
139          Esys_resetError();          Esys_resetError();
140          if (mpi_info->size >1) {          if (mpi_info->size >1) {
141          Esys_setError(IO_ERROR, "Paso_SystemMatrix_loadMM_toCSR: support single processor only");          Esys_setError(IO_ERROR, "Paso_SystemMatrix_loadMM_toCSR: supports single processor only");
142          return NULL;          return NULL;
143          }          }
144      /* open the file */      /* open the file */
145      fileHandle_p = fopen( fileName_p, "r" );      fileHandle_p = fopen( fileName_p, "r" );
146      if( fileHandle_p == NULL )      if( fileHandle_p == NULL )
147      {      {
148          Esys_setError(IO_ERROR, "Paso_SystemMatrix_loadMM_toCSR: Cannot read file for reading.");          Esys_setError(IO_ERROR, "Paso_SystemMatrix_loadMM_toCSR: Cannot open file for reading.");
149                  Esys_MPIInfo_free(mpi_info);                  Esys_MPIInfo_free(mpi_info);
150          return NULL;          return NULL;
151      }      }
# Line 185  Paso_SystemMatrix* Paso_SystemMatrix_loa Line 185  Paso_SystemMatrix* Paso_SystemMatrix_loa
185    
186      if( col_ind == NULL || row_ind == NULL || val == NULL || row_ptr == NULL )      if( col_ind == NULL || row_ind == NULL || val == NULL || row_ptr == NULL )
187      {      {
188          Esys_setError(MEMORY_ERROR, "Paso_SystemMatrix_loadMM_toCSR: Could not allocate memory" );          Esys_setError(MEMORY_ERROR, "Paso_SystemMatrix_loadMM_toCSR: Could not allocate memory.");
189    
190                  Esys_MPIInfo_free(mpi_info);                  Esys_MPIInfo_free(mpi_info);
191          fclose( fileHandle_p );          fclose( fileHandle_p );
# Line 275  Paso_SystemMatrix* Paso_SystemMatrix_loa Line 275  Paso_SystemMatrix* Paso_SystemMatrix_loa
275      MM_typecode matrixCode;      MM_typecode matrixCode;
276          Esys_MPIInfo* mpi_info=Esys_MPIInfo_alloc( MPI_COMM_WORLD);          Esys_MPIInfo* mpi_info=Esys_MPIInfo_alloc( MPI_COMM_WORLD);
277          if (mpi_info->size >1) {          if (mpi_info->size >1) {
278          Esys_setError(IO_ERROR, "Paso_SystemMatrix_loadMM_toCSC: support single processor only");          Esys_setError(IO_ERROR, "Paso_SystemMatrix_loadMM_toCSC: supports single processor only");
279          return NULL;          return NULL;
280          }          }
281    
# Line 285  Paso_SystemMatrix* Paso_SystemMatrix_loa Line 285  Paso_SystemMatrix* Paso_SystemMatrix_loa
285      fileHandle_p = fopen( fileName_p, "r" );      fileHandle_p = fopen( fileName_p, "r" );
286      if( fileHandle_p == NULL )      if( fileHandle_p == NULL )
287      {      {
288          Esys_setError(IO_ERROR,"Paso_SystemMatrix_loadMM_toCSC: File could not be opened for reading");          Esys_setError(IO_ERROR,"Paso_SystemMatrix_loadMM_toCSC: File could not be opened for reading.");
289                  Esys_MPIInfo_free(mpi_info);                  Esys_MPIInfo_free(mpi_info);
290          return NULL;          return NULL;
291      }      }
# Line 293  Paso_SystemMatrix* Paso_SystemMatrix_loa Line 293  Paso_SystemMatrix* Paso_SystemMatrix_loa
293      /* process banner */      /* process banner */
294      if( mm_read_banner(fileHandle_p, &matrixCode) != 0 )      if( mm_read_banner(fileHandle_p, &matrixCode) != 0 )
295      {      {
296          Esys_setError(IO_ERROR,"Paso_SystemMatrix_loadMM_toCSC: Error processing MM banner");          Esys_setError(IO_ERROR,"Paso_SystemMatrix_loadMM_toCSC: Error processing MM banner.");
297          fclose( fileHandle_p );          fclose( fileHandle_p );
298                  Esys_MPIInfo_free(mpi_info);                  Esys_MPIInfo_free(mpi_info);
299          return NULL;          return NULL;
# Line 394  void Paso_RHS_loadMM_toCSR( char *fileNa Line 394  void Paso_RHS_loadMM_toCSR( char *fileNa
394      fileHandle_p = fopen( fileName_p, "r" );      fileHandle_p = fopen( fileName_p, "r" );
395      if( fileHandle_p == NULL )      if( fileHandle_p == NULL )
396      {      {
397          Esys_setError(IO_ERROR, "Paso_RHS_loadMM_toCSR: Cannot read file for reading.");          Esys_setError(IO_ERROR, "Paso_RHS_loadMM_toCSR: Cannot open file for reading.");
398      }      }
399    
400      /* process banner */      /* process banner */
# Line 436  void Paso_RHS_loadMM_toCSR( char *fileNa Line 436  void Paso_RHS_loadMM_toCSR( char *fileNa
436      }      }
437    
438  }  }
439    

Legend:
Removed from v.3641  
changed lines
  Added in v.3642

  ViewVC Help
Powered by ViewVC 1.1.26