/[escript]/trunk/paso/src/SparseMatrix_getSubmatrix.cpp
ViewVC logotype

Diff of /trunk/paso/src/SparseMatrix_getSubmatrix.cpp

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

revision 4803 by caltinay, Wed Mar 26 06:52:28 2014 UTC revision 4819 by caltinay, Tue Apr 1 03:50:23 2014 UTC
# Line 45  SparseMatrix* SparseMatrix_getSubmatrix( Line 45  SparseMatrix* SparseMatrix_getSubmatrix(
45                                          int n_col_sub, const index_t* row_list,                                          int n_col_sub, const index_t* row_list,
46                                          const index_t* new_col_index)                                          const index_t* new_col_index)
47  {  {
     Pattern* sub_pattern=NULL;  
48      SparseMatrix* out=NULL;      SparseMatrix* out=NULL;
49      index_t index_offset=(A->type & MATRIX_FORMAT_OFFSET1 ? 1:0);      index_t index_offset=(A->type & MATRIX_FORMAT_OFFSET1 ? 1:0);
50      int i,k,tmp,m,subpattern_row;      int i,k,tmp,m,subpattern_row;
# Line 54  SparseMatrix* SparseMatrix_getSubmatrix( Line 53  SparseMatrix* SparseMatrix_getSubmatrix(
53      if (A->type & MATRIX_FORMAT_CSC) {      if (A->type & MATRIX_FORMAT_CSC) {
54          Esys_setError(TYPE_ERROR, "SparseMatrix_getSubmatrix: gathering submatrices supports CSR matrix format only.");          Esys_setError(TYPE_ERROR, "SparseMatrix_getSubmatrix: gathering submatrices supports CSR matrix format only.");
55      } else {      } else {
56          sub_pattern=Pattern_getSubpattern(A->pattern, n_row_sub, n_col_sub,          Pattern_ptr sub_pattern(A->pattern->getSubpattern(n_row_sub, n_col_sub,
57                                            row_list, new_col_index);                                            row_list, new_col_index));
58          if (Esys_noError()) {          if (Esys_noError()) {
59              /* create the return object */              /* create the return object */
60              out=SparseMatrix_alloc(type,sub_pattern,A->row_block_size,A->col_block_size,TRUE);              out=SparseMatrix_alloc(type,sub_pattern,A->row_block_size,A->col_block_size,TRUE);
# Line 78  SparseMatrix* SparseMatrix_getSubmatrix( Line 77  SparseMatrix* SparseMatrix_getSubmatrix(
77                  }                  }
78              }              }
79          }          }
         Pattern_free(sub_pattern);  
80      }      }
81      return out;      return out;
82  }  }

Legend:
Removed from v.4803  
changed lines
  Added in v.4819

  ViewVC Help
Powered by ViewVC 1.1.26