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

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

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

revision 155 by jgs, Wed Nov 9 02:02:19 2005 UTC revision 415 by gross, Wed Jan 4 05:37:33 2006 UTC
# Line 35  Paso_SystemMatrix* Paso_SystemMatrix_all Line 35  Paso_SystemMatrix* Paso_SystemMatrix_all
35       out->iterative=NULL;       out->iterative=NULL;
36       out->val=NULL;         out->val=NULL;  
37       out->reference_counter=1;       out->reference_counter=1;
38       /* check the matrix type */       out->type=type;
39       switch(type) {  
40          case CSC:  
41            out->type=CSC;       if (type & MATRIX_FORMAT_CSC) {
42            if (row_block_size!=col_block_size || col_block_size>3) {          if (type & MATRIX_FORMAT_SYM) {
43               out->row_block_size=1;             Paso_setError(TYPE_ERROR,"Generation of matrix pattern for symmetric CSC is not implemented yet.");
44               out->col_block_size=1;             return NULL;
45               out->pattern=Paso_SystemMatrixPattern_unrollBlocks(pattern,col_block_size,row_block_size);          } else {
46            } else {             if ((type & MATRIX_FORMAT_BLK1) && (row_block_size!=col_block_size || col_block_size>3) ) {
47               out->pattern=Paso_SystemMatrixPattern_reference(pattern);                if (type & MATRIX_FORMAT_OFFSET1) {
48               out->row_block_size=row_block_size;                    out->pattern=Paso_SystemMatrixPattern_unrollBlocks(pattern,PATTERN_FORMAT_OFFSET1,col_block_size,row_block_size);
49               out->col_block_size=col_block_size;                } else {
50            }                    out->pattern=Paso_SystemMatrixPattern_unrollBlocks(pattern,PATTERN_FORMAT_DEFAULT,col_block_size,row_block_size);
51            break;                }
         case CSR:  
            out->type=CSR;  
            if (row_block_size!=col_block_size || col_block_size>3) {  
52                out->row_block_size=1;                out->row_block_size=1;
53                out->col_block_size=1;                out->col_block_size=1;
54                out->pattern=Paso_SystemMatrixPattern_unrollBlocks(pattern,row_block_size,col_block_size);             } else {
55             } else {                if ( (type & MATRIX_FORMAT_OFFSET1) ==(pattern->type & PATTERN_FORMAT_OFFSET1)) {
56                out->pattern=Paso_SystemMatrixPattern_reference(pattern);                    out->pattern=Paso_SystemMatrixPattern_reference(pattern);
57                  } else {
58                      out->pattern=Paso_SystemMatrixPattern_unrollBlocks(pattern,(type & MATRIX_FORMAT_OFFSET1)? PATTERN_FORMAT_OFFSET1:  PATTERN_FORMAT_DEFAULT,1,1);
59                  }
60                out->row_block_size=row_block_size;                out->row_block_size=row_block_size;
61                out->col_block_size=col_block_size;                out->col_block_size=col_block_size;
62            }             }
63            break;          }
64          case CSC_BLK1:          out->num_rows=out->pattern->n_index;
65            out->type=CSC;          out->num_cols=out->pattern->n_ptr;
66            out->row_block_size=1;          n_norm = out->num_cols * out->col_block_size;
           out->col_block_size=1;  
           if (row_block_size==1 && col_block_size==1) {  
               out->pattern=Paso_SystemMatrixPattern_reference(pattern);  
           } else {  
              out->pattern=Paso_SystemMatrixPattern_unrollBlocks(pattern,col_block_size,row_block_size);  
           }  
           break;  
         case CSR_BLK1:  
           out->type=CSR;  
           out->row_block_size=1;  
           out->col_block_size=1;  
           if (row_block_size==1 && col_block_size==1) {  
               out->pattern=Paso_SystemMatrixPattern_reference(pattern);  
           } else {  
              out->pattern=Paso_SystemMatrixPattern_unrollBlocks(pattern,row_block_size,col_block_size);  
           }  
           break;  
         case CSC_SYM:  
         case CSC_BLK1_SYM:  
           out->type=CSC_SYM;  
           Paso_setError(TYPE_ERROR,"convertion of matrix pattern for symmetric CSC is not implemented yet.");  
           return NULL;  
         default:  
           Paso_setError(TYPE_ERROR,"unknown matrix type identifier.");  
           return NULL;  
      }  
      if (out->type==CSC || out->type==CSC_SYM ) {  
          out->num_rows=out->pattern->n_index;  
          out->num_cols=out->pattern->n_ptr;  
          n_norm = out->num_cols * out->col_block_size;  
   
67       } else {       } else {
68           out->num_rows=out->pattern->n_ptr;          if (type & MATRIX_FORMAT_SYM) {
69           out->num_cols=out->pattern->n_index;             Paso_setError(TYPE_ERROR,"Generation of matrix pattern for symmetric CSR is not implemented yet.");
70           n_norm = out->num_rows * out->row_block_size;             return NULL;
71       }          } else {
72               if ((type & MATRIX_FORMAT_BLK1) && (row_block_size!=col_block_size || col_block_size>3) ) {
73                  if (type & MATRIX_FORMAT_OFFSET1) {
74                      out->pattern=Paso_SystemMatrixPattern_unrollBlocks(pattern,PATTERN_FORMAT_OFFSET1,row_block_size,col_block_size);
75                  } else {
76                      out->pattern=Paso_SystemMatrixPattern_unrollBlocks(pattern,PATTERN_FORMAT_DEFAULT,row_block_size,col_block_size);
77                  }
78                  out->row_block_size=1;
79                  out->col_block_size=1;
80               } else {
81                  if ((type & MATRIX_FORMAT_OFFSET1)==(pattern->type & PATTERN_FORMAT_OFFSET1)) {
82                      out->pattern=Paso_SystemMatrixPattern_reference(pattern);
83                  } else {
84                      out->pattern=Paso_SystemMatrixPattern_unrollBlocks(pattern,(type & MATRIX_FORMAT_OFFSET1)? PATTERN_FORMAT_OFFSET1:  PATTERN_FORMAT_DEFAULT,1,1);
85                  }
86                  out->row_block_size=row_block_size;
87                  out->col_block_size=col_block_size;
88               }
89            }
90            out->num_rows=out->pattern->n_index;
91            out->num_cols=out->pattern->n_ptr;
92            n_norm = out->num_cols * out->col_block_size;
93            out->num_rows=out->pattern->n_ptr;
94            out->num_cols=out->pattern->n_index;
95            n_norm = out->num_rows * out->row_block_size;
96         }
97       out->logical_row_block_size=row_block_size;       out->logical_row_block_size=row_block_size;
98       out->logical_col_block_size=col_block_size;       out->logical_col_block_size=col_block_size;
99       out->logical_block_size=out->logical_row_block_size*out->logical_block_size;       out->logical_block_size=out->logical_row_block_size*out->logical_block_size;

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

  ViewVC Help
Powered by ViewVC 1.1.26