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

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

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

revision 1312 by ksteube, Mon Sep 24 06:18:44 2007 UTC revision 1369 by gross, Fri Dec 21 05:51:44 2007 UTC
# Line 25  Line 25 
25  /**************************************************************/  /**************************************************************/
26    
27  #include "SystemMatrix.h"  #include "SystemMatrix.h"
28    #include "mmio.h"
29    
30  void Paso_SystemMatrix_saveMM(Paso_SystemMatrix * A_p, char * fileName_p) {  void Paso_SystemMatrix_saveMM(Paso_SystemMatrix * A_p, char * fileName_p) {
31    FILE * fileHandle_p = NULL;    FILE * fileHandle_p = NULL;
32      dim_t N,M,i, iptr_ij;
33      MM_typecode matcode;                        
34    
35    if (A_p->mpi_info->size > 1) {    if (A_p->mpi_info->size > 1) {
36         Paso_setError(TYPE_ERROR,"Paso_SystemMatrix_saveHB: currently single processor runs are supported.\n");         Paso_setError(TYPE_ERROR,"Paso_SystemMatrix_saveMM: currently single processor runs are supported.\n");
37         return;         return;
38    }    }
39      if (A_p->block_size>1) {
40           Paso_setError(TYPE_ERROR,"Paso_SystemMatrix_saveMM: currently only block size 1 is supported.\n");
41           return;
42      }
43    
44    if (A_p->type & MATRIX_FORMAT_SYM) {    if (A_p->type & MATRIX_FORMAT_SYM) {
45      Paso_setError(TYPE_ERROR,"Paso_SystemMatrix_saveMM does not support symmetric storage scheme");      Paso_setError(TYPE_ERROR,"Paso_SystemMatrix_saveMM does not support symmetric storage scheme");
46      return;      return;
# Line 45  void Paso_SystemMatrix_saveMM(Paso_Syste Line 53  void Paso_SystemMatrix_saveMM(Paso_Syste
53    }    }
54    
55    if (A_p->type & MATRIX_FORMAT_CSC) {    if (A_p->type & MATRIX_FORMAT_CSC) {
56      Paso_SparseMatrix_saveHB_CSC( A_p->mainBlock,fileHandle_p);      Paso_setError(TYPE_ERROR,"Paso_SystemMatrix_saveMM does not support CSC yet.");
57    } else {    } else {
58      /* Paso_SparseMatrix_saveHB_CSR( A_p->mainBlock,fileHandle_p); */      mm_initialize_typecode(&matcode);
59      Paso_setError(TYPE_ERROR,"Paso_SystemMatrix_saveMM does not support CSR yet.");      mm_set_matrix(&matcode);
60      return;      mm_set_coordinate(&matcode);
61        mm_set_real(&matcode);
62    
63        N= Paso_SystemMatrix_getGlobalNumRows(A_p);
64        M=Paso_SystemMatrix_getGlobalNumCols(A_p);
65        mm_write_banner(fileHandle_p, matcode);
66        mm_write_mtx_crd_size(fileHandle_p, N, M, A_p->mainBlock->pattern->ptr[N]);
67    
68        for (i=0; i<N; i++) {
69           for (iptr_ij=A_p->mainBlock->pattern->ptr[i];iptr_ij<A_p->mainBlock->pattern->ptr[i+1]; ++iptr_ij) {
70            fprintf(fileHandle_p, "%d %d %25.15e\n", i+1, A_p->mainBlock->pattern->index[iptr_ij]+1, A_p->mainBlock->val[iptr_ij]);
71           }
72         }
73    }    }
74    
75    /* close the file */    /* close the file */

Legend:
Removed from v.1312  
changed lines
  Added in v.1369

  ViewVC Help
Powered by ViewVC 1.1.26