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

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

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

revision 414 by jgs, Wed Nov 9 02:02:19 2005 UTC revision 415 by gross, Wed Jan 4 05:37:33 2006 UTC
# Line 29  Line 29 
29  Paso_SystemMatrix* Paso_SystemMatrix_getSubmatrix(Paso_SystemMatrix* A,int n_row_sub,index_t* row_list,index_t* new_col_index){  Paso_SystemMatrix* Paso_SystemMatrix_getSubmatrix(Paso_SystemMatrix* A,int n_row_sub,index_t* row_list,index_t* new_col_index){
30        Paso_SystemMatrixPattern* sub_pattern=NULL;        Paso_SystemMatrixPattern* sub_pattern=NULL;
31        Paso_SystemMatrix* out=NULL;        Paso_SystemMatrix* out=NULL;
32          index_t index_offset=(A->type & MATRIX_FORMAT_OFFSET1 ? 1:0);
33        Paso_resetError();        Paso_resetError();
34        int i,k,tmp,m,subpattern_row;        int i,k,tmp,m,subpattern_row;
35        int type=A->type;        int type=A->type;
36        if (type!=CSR) {        if (A->type & MATRIX_FORMAT_CSC) {
37            Paso_setError(TYPE_ERROR,"gathering submatrices supports CSR matrix format only.");            Paso_setError(TYPE_ERROR,"gathering submatrices supports CSR matrix format only.");
38        } else {        } else {
39           sub_pattern=Paso_SystemMatrixPattern_getSubpattern(A->pattern,n_row_sub,row_list,new_col_index);           sub_pattern=Paso_SystemMatrixPattern_getSubpattern(A->pattern,n_row_sub,row_list,new_col_index);
# Line 43  Paso_SystemMatrix* Paso_SystemMatrix_get Line 44  Paso_SystemMatrix* Paso_SystemMatrix_get
44                   #pragma omp parallel for private(i,k,m,subpattern_row,tmp) schedule(static)                   #pragma omp parallel for private(i,k,m,subpattern_row,tmp) schedule(static)
45                   for (i=0;i<n_row_sub;++i) {                   for (i=0;i<n_row_sub;++i) {
46                       subpattern_row=row_list[i];                       subpattern_row=row_list[i];
47                       for (k=A->pattern->ptr[subpattern_row]-PTR_OFFSET;k<A->pattern->ptr[subpattern_row+1]-PTR_OFFSET;++k) {                       for (k=A->pattern->ptr[subpattern_row]-index_offset;k<A->pattern->ptr[subpattern_row+1]-index_offset;++k) {
48                          tmp=new_col_index[A->pattern->index[k]-INDEX_OFFSET];                          tmp=new_col_index[A->pattern->index[k]-index_offset];
49                          if (tmp>-1) {                          if (tmp>-1) {
50                             for (m=out->pattern->ptr[i]-PTR_OFFSET;m<out->pattern->ptr[i+1]-PTR_OFFSET;++m) {                             for (m=out->pattern->ptr[i]-index_offset;m<out->pattern->ptr[i+1]-index_offset;++m) {
51                                 if (out->pattern->index[m]==tmp+INDEX_OFFSET) {                                 if (out->pattern->index[m]==tmp+index_offset) {
52                                     Paso_copyDouble(A->block_size,&(A->val[k*A->block_size]),&(out->val[m*A->block_size]));                                     Paso_copyDouble(A->block_size,&(A->val[k*A->block_size]),&(out->val[m*A->block_size]));
53                                     break;                                     break;
54                                 }                                 }

Legend:
Removed from v.414  
changed lines
  Added in v.415

  ViewVC Help
Powered by ViewVC 1.1.26