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

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

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

revision 3282 by jfenwick, Mon Oct 11 01:48:14 2010 UTC revision 3283 by gross, Mon Oct 18 22:39:28 2010 UTC
# Line 24  Line 24 
24    
25  #include "Paso.h"  #include "Paso.h"
26  #include "SparseMatrix.h"  #include "SparseMatrix.h"
27    #include "MKL.h"
28    #include "Preconditioner.h"
29    #include "UMFPACK.h"
30  #include "TRILINOS.h"  #include "TRILINOS.h"
31  #include "mmio.h"  #include "mmio.h"
32    
# Line 108  Paso_SparseMatrix* Paso_SparseMatrix_all Line 111  Paso_SparseMatrix* Paso_SparseMatrix_all
111    Paso_SparseMatrixType pattern_format_out;    Paso_SparseMatrixType pattern_format_out;
112    bool_t unroll=FALSE;    bool_t unroll=FALSE;
113    
   if (type & MATRIX_FORMAT_SYM) {  
      Esys_setError(TYPE_ERROR,"Paso_SparseMatrix_alloc: symmetric matrix pattern are not supported.");  
      return NULL;  
   }  
   
114    if (patternIsUnrolled) {    if (patternIsUnrolled) {
115       if (! XNOR(type & MATRIX_FORMAT_OFFSET1, pattern->type & PATTERN_FORMAT_OFFSET1) ) {       if (! XNOR(type & MATRIX_FORMAT_OFFSET1, pattern->type & PATTERN_FORMAT_OFFSET1) ) {
116           Esys_setError(TYPE_ERROR,"Paso_SparseMatrix_alloc: requested offset and pattern offset does not match.");           Esys_setError(TYPE_ERROR,"Paso_SparseMatrix_alloc: requested offset and pattern offset does not match.");
# Line 139  Paso_SparseMatrix* Paso_SparseMatrix_all Line 137  Paso_SparseMatrix* Paso_SparseMatrix_all
137       out->val=NULL;         out->val=NULL;  
138       out->reference_counter=1;       out->reference_counter=1;
139       out->type=type;       out->type=type;
140       out->solver=NULL;       out->solver_package=PASO_PASO;  
141         out->solver_p=NULL;  
142        
143       /* ====== compressed sparse columns === */       /* ====== compressed sparse columns === */
144       if (type & MATRIX_FORMAT_CSC) {       if (type & MATRIX_FORMAT_CSC) {
145             if (unroll) {             if (unroll) {
# Line 210  void Paso_SparseMatrix_free(Paso_SparseM Line 209  void Paso_SparseMatrix_free(Paso_SparseM
209    if (in!=NULL) {    if (in!=NULL) {
210       in->reference_counter--;       in->reference_counter--;
211       if (in->reference_counter<=0) {       if (in->reference_counter<=0) {
212          Paso_Pattern_free(in->pattern);      switch(in->solver_package) {
213          MEMFREE(in->val);        
214      if(in->solver!=NULL) {          case PASO_SMOOTHER:
215          MEMFREE(in->solver);             Paso_Preconditioner_LocalSmoother_free((Paso_Preconditioner_LocalSmoother*) in->solver_p);
216               break;
217          
218            case PASO_MKL:
219               Paso_MKL_free(in); /* releases solver_p */
220               break;
221          
222            case PASO_UMFPACK:
223               Paso_UMFPACK_free(in); /* releases solver_p */
224               break;
225      }      }
226        MEMFREE(in->val);
227        Paso_Pattern_free(in->pattern);
228          MEMFREE(in);          MEMFREE(in);
229       }       }
230     }     }
# Line 335  void Paso_SparseMatrix_saveMM(Paso_Spars Line 345  void Paso_SparseMatrix_saveMM(Paso_Spars
345         return;         return;
346    }    }
347    
   if (A_p->type & MATRIX_FORMAT_SYM) {  
     Esys_setError(TYPE_ERROR,"Paso_SparseMatrix_saveMM does not support symmetric storage scheme");  
     return;  
   }  
     
348    /* open the file */    /* open the file */
349    fileHandle_p = fopen(fileName_p, "w");    fileHandle_p = fopen(fileName_p, "w");
350    if (fileHandle_p==NULL) {    if (fileHandle_p==NULL) {
# Line 411  index_t* Paso_SparseMatrix_borrowColorin Line 416  index_t* Paso_SparseMatrix_borrowColorin
416  {  {
417     return Paso_Pattern_borrowColoringPointer(A_p->pattern);     return Paso_Pattern_borrowColoringPointer(A_p->pattern);
418  }  }
419    dim_t Paso_SparseMatrix_maxDeg(Paso_SparseMatrix * A_p)
420    {
421       return Paso_Pattern_maxDeg(A_p->pattern);
422    }
423    
424  Paso_SparseMatrix* Paso_SparseMatrix_unroll(Paso_SparseMatrix* A) {  Paso_SparseMatrix* Paso_SparseMatrix_unroll(Paso_SparseMatrix* A) {
425      Paso_SparseMatrix *out = NULL;      Paso_SparseMatrix *out = NULL;
# Line 478  Paso_SparseMatrix* Paso_SparseMatrix_unr Line 487  Paso_SparseMatrix* Paso_SparseMatrix_unr
487      }      }
488    
489   return out;   return out;
 }  
490    }

Legend:
Removed from v.3282  
changed lines
  Added in v.3283

  ViewVC Help
Powered by ViewVC 1.1.26