/[escript]/branches/symbolic_from_3470/paso/src/SystemMatrix_debug.c
ViewVC logotype

Diff of /branches/symbolic_from_3470/paso/src/SystemMatrix_debug.c

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

revision 3867 by caltinay, Tue Jan 31 04:55:05 2012 UTC revision 3868 by caltinay, Thu Mar 15 06:07:08 2012 UTC
# Line 91  void Paso_SystemMatrix_fillWithGlobalCoo Line 91  void Paso_SystemMatrix_fillWithGlobalCoo
91    
92  void Paso_SystemMatrix_print(Paso_SystemMatrix *A)  void Paso_SystemMatrix_print(Paso_SystemMatrix *A)
93  {  {
94     dim_t iPtr, q, p;     dim_t iPtr, q, p, ib;
95     const dim_t n=Paso_SystemMatrix_getNumRows(A);     const dim_t n=Paso_SystemMatrix_getNumRows(A);
96     const dim_t block_size=A->block_size;     const dim_t block_size=A->block_size;
97       index_t rank=A->mpi_info->rank;
98       char *str1, *str2;
99       str1 = TMPMEMALLOC(n*n*block_size*30+100, char);
100       str2 = TMPMEMALLOC(30, char);
101        
102     printf("Main Block:\n-----------\n");     sprintf(str1, "rank %d Main Block:\n-----------\n", rank);
103     for (q=0; q< n; ++q){     for (q=0; q< n; ++q){
104        printf("Row %d:\n",q);        sprintf(str2, "Row %d: ",q);
105          strcat(str1, str2);
106        for (iPtr =A->mainBlock->pattern->ptr[q]; iPtr<A->mainBlock->pattern->ptr[q+1]; ++iPtr) {        for (iPtr =A->mainBlock->pattern->ptr[q]; iPtr<A->mainBlock->pattern->ptr[q+1]; ++iPtr) {
107       printf("%d, ",A->mainBlock->pattern->index[iPtr]);       sprintf(str2, "(%d ",A->mainBlock->pattern->index[iPtr]);
108        }       strcat(str1, str2);
109        printf("\n");       for (ib=0; ib<block_size; ib++){
110        for (iPtr =A->mainBlock->pattern->ptr[q]; iPtr<A->mainBlock->pattern->ptr[q+1]; ++iPtr) {         sprintf(str2, "%f ", A->mainBlock->val[iPtr*block_size+ib]);
111       printf("%f, ",A->mainBlock->val[iPtr*block_size]);         strcat(str1, str2);
112         }
113         sprintf(str2, "),");
114         strcat(str1, str2);
115        }        }
116        printf("\n");        sprintf(str1, "%s\n", str1);
117     }     }
118       fprintf(stderr, "%s", str1);
119     if ( ( A->col_coupleBlock != NULL) && (A->mpi_info->size>1) ) {     if ( ( A->col_coupleBlock != NULL) && (A->mpi_info->size>1) ) {
120        printf("Column Couple Block:\n------------------\n");        sprintf(str1, "rank %d Column Couple Block:\n------------------\n", rank);
121        for (q=0; q< A->col_coupleBlock->pattern->numOutput; ++q){        for (q=0; q< A->col_coupleBlock->pattern->numOutput; ++q){
122       printf("Row %d:\n",q);       sprintf(str2, "Row %d: ", q);
123       for (iPtr =A->col_coupleBlock->pattern->ptr[q]; iPtr<A->col_coupleBlock->pattern->ptr[q+1]; ++iPtr) {       strcat(str1, str2);
         printf("%d, ",A->col_coupleBlock->pattern->index[iPtr]);  
      }  
      printf("\n");  
124       for (iPtr =A->col_coupleBlock->pattern->ptr[q]; iPtr<A->col_coupleBlock->pattern->ptr[q+1]; ++iPtr) {       for (iPtr =A->col_coupleBlock->pattern->ptr[q]; iPtr<A->col_coupleBlock->pattern->ptr[q+1]; ++iPtr) {
125          printf("%f, ",A->col_coupleBlock->val[iPtr*block_size]);          if (A->global_id)
126              sprintf(str2, "(%d %f),",A->global_id[A->col_coupleBlock->pattern->index[iPtr]], A->col_coupleBlock->val[iPtr*block_size]);
127            else
128              sprintf(str2, "(%d %f),",A->col_coupleBlock->pattern->index[iPtr], A->col_coupleBlock->val[iPtr*block_size]);
129            strcat(str1, str2);
130       }       }
131       printf("\n");       sprintf(str1, "%s\n", str1);
132        }        }
133          fprintf(stderr, "%s", str1);
134     }     }
135     if ( ( A->row_coupleBlock != NULL ) && (A->mpi_info->size>1) ) {     if ( ( A->row_coupleBlock != NULL ) && (A->mpi_info->size>1) ) {
136        printf("Row Couple Block:\n--------------------\n");        sprintf(str1, "rank %d Row Couple Block:\n--------------------\n", rank);
137        for (p=0; p< A->row_coupleBlock->pattern->numOutput; ++p){        for (p=0; p< A->row_coupleBlock->pattern->numOutput; ++p){
138       printf("Row %d:\n",p);           sprintf(str2, "Row %d:", p);
139       for (iPtr =A->row_coupleBlock->pattern->ptr[p]; iPtr<A->row_coupleBlock->pattern->ptr[p+1]; ++iPtr) {           strcat(str1, str2);
140          printf("%d, ",A->row_coupleBlock->pattern->index[iPtr]);           for (iPtr =A->row_coupleBlock->pattern->ptr[p]; iPtr<A->row_coupleBlock->pattern->ptr[p+1]; ++iPtr) {
141       }              sprintf(str2, "(%d %f),",A->row_coupleBlock->pattern->index[iPtr], A->row_coupleBlock->val[iPtr*block_size]);
142       printf("\n");              strcat(str1, str2);
143       for (iPtr =A->row_coupleBlock->pattern->ptr[p]; iPtr<A->row_coupleBlock->pattern->ptr[p+1]; ++iPtr) {           }
144          printf("%f, ",A->row_coupleBlock->val[iPtr*block_size]);           sprintf(str1, "%s\n", str1);
145       }        }
146       printf("\n");        fprintf(stderr, "%s", str1);
147        }           }
148       if ( ( A->remote_coupleBlock != NULL ) && (A->mpi_info->size>1) ) {
149          sprintf(str1, "rank %d Remote Couple Block:\n--------------------\n", rank);
150          for (p=0; p< A->remote_coupleBlock->pattern->numOutput; ++p){
151             sprintf(str2, "Row %d:", p);
152             strcat(str1, str2);
153             for (iPtr =A->remote_coupleBlock->pattern->ptr[p]; iPtr<A->remote_coupleBlock->pattern->ptr[p+1]; ++iPtr) {
154                sprintf(str2, "(%d %f),",A->remote_coupleBlock->pattern->index[iPtr], A->remote_coupleBlock->val[iPtr*block_size]);
155                strcat(str1, str2);
156             }
157             sprintf(str1, "%s\n", str1);
158          }
159          fprintf(stderr, "%s", str1);
160     }     }
161       TMPMEMFREE(str1);
162       TMPMEMFREE(str2);
163     return;     return;
164  }  }
165    

Legend:
Removed from v.3867  
changed lines
  Added in v.3868

  ViewVC Help
Powered by ViewVC 1.1.26