/[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 1551 by gross, Mon Feb 4 06:45:48 2008 UTC revision 1552 by gross, Thu May 8 08:52:41 2008 UTC
# Line 49  Paso_SystemMatrix* Paso_SystemMatrix_all Line 49  Paso_SystemMatrix* Paso_SystemMatrix_all
49       out->row_distribution=NULL;       out->row_distribution=NULL;
50       out->col_distribution=NULL;       out->col_distribution=NULL;
51       out->mpi_info=Paso_MPIInfo_getReference(pattern->mpi_info);       out->mpi_info=Paso_MPIInfo_getReference(pattern->mpi_info);
52         out->row_coupler=NULL;
53         out->col_coupler=NULL;
54       out->mainBlock=NULL;       out->mainBlock=NULL;
55       out->coupleBlock=NULL;       out->row_coupleBlock=NULL;
56         out->col_coupleBlock=NULL;
57       out->normalizer_is_valid=FALSE;       out->normalizer_is_valid=FALSE;
58       out->normalizer=NULL;       out->normalizer=NULL;
59       out->solver_package=PASO_PASO;         out->solver_package=PASO_PASO;  
# Line 58  Paso_SystemMatrix* Paso_SystemMatrix_all Line 61  Paso_SystemMatrix* Paso_SystemMatrix_all
61       out->trilinos_data=NULL;       out->trilinos_data=NULL;
62       out->reference_counter=1;       out->reference_counter=1;
63    
64    
65       pattern_format_out= (type & MATRIX_FORMAT_OFFSET1)? PATTERN_FORMAT_OFFSET1:  PATTERN_FORMAT_DEFAULT;       pattern_format_out= (type & MATRIX_FORMAT_OFFSET1)? PATTERN_FORMAT_OFFSET1:  PATTERN_FORMAT_DEFAULT;
66       /* ====== compressed sparse columns === */       /* ====== compressed sparse columns === */
67       if (type & MATRIX_FORMAT_CSC) {       if (type & MATRIX_FORMAT_CSC) {
# Line 98  Paso_SystemMatrix* Paso_SystemMatrix_all Line 102  Paso_SystemMatrix* Paso_SystemMatrix_all
102       out->logical_col_block_size=col_block_size;       out->logical_col_block_size=col_block_size;
103       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;
104       out->block_size=out->row_block_size*out->col_block_size;       out->block_size=out->row_block_size*out->col_block_size;
105         out->col_coupler=Paso_Coupler_alloc(pattern->col_connector,out->col_block_size);
106         out->row_coupler=Paso_Coupler_alloc(pattern->row_connector,out->row_block_size);
107       /* this should be bypassed if trilinos is used */       /* this should be bypassed if trilinos is used */
108       if (type & MATRIX_FORMAT_TRILINOS_CRS) {       if (type & MATRIX_FORMAT_TRILINOS_CRS) {
109          #ifdef TRILINOS          #ifdef TRILINOS
# Line 106  Paso_SystemMatrix* Paso_SystemMatrix_all Line 112  Paso_SystemMatrix* Paso_SystemMatrix_all
112       } else {       } else {
113          out->solver_package=PASO_PASO;            out->solver_package=PASO_PASO;  
114          out->mainBlock=Paso_SparseMatrix_alloc(type,out->pattern->mainPattern,row_block_size,col_block_size);          out->mainBlock=Paso_SparseMatrix_alloc(type,out->pattern->mainPattern,row_block_size,col_block_size);
115          out->coupleBlock=Paso_SparseMatrix_alloc(type,out->pattern->couplePattern,row_block_size,col_block_size);          out->col_coupleBlock=Paso_SparseMatrix_alloc(type,out->pattern->col_couplePattern,row_block_size,col_block_size);
116            out->row_coupleBlock=Paso_SparseMatrix_alloc(type,out->pattern->row_couplePattern,row_block_size,col_block_size);
117          /* allocate memory for matrix entries */          /* allocate memory for matrix entries */
118          if (type & MATRIX_FORMAT_CSC) {          if (type & MATRIX_FORMAT_CSC) {
119             n_norm = out->mainBlock->numCols * out->col_block_size;             n_norm = out->mainBlock->numCols * out->col_block_size;
# Line 151  void Paso_SystemMatrix_free(Paso_SystemM Line 158  void Paso_SystemMatrix_free(Paso_SystemM
158          Paso_Distribution_free(in->row_distribution);          Paso_Distribution_free(in->row_distribution);
159          Paso_Distribution_free(in->col_distribution);          Paso_Distribution_free(in->col_distribution);
160          Paso_MPIInfo_free(in->mpi_info);          Paso_MPIInfo_free(in->mpi_info);
161            Paso_Coupler_free(in->row_coupler);
162            Paso_Coupler_free(in->col_coupler);
163          Paso_SparseMatrix_free(in->mainBlock);          Paso_SparseMatrix_free(in->mainBlock);
164          Paso_SparseMatrix_free(in->coupleBlock);          Paso_SparseMatrix_free(in->col_coupleBlock);
165            Paso_SparseMatrix_free(in->row_coupleBlock);
166          MEMFREE(in->normalizer);          MEMFREE(in->normalizer);
167          Paso_solve_free(in);          Paso_solve_free(in);
168          #ifdef TRILINOS          #ifdef TRILINOS
# Line 165  void Paso_SystemMatrix_free(Paso_SystemM Line 175  void Paso_SystemMatrix_free(Paso_SystemM
175       }       }
176     }     }
177  }  }
 void Paso_SystemMatrix_allocBuffer(Paso_SystemMatrix* A) {  
    if (! Paso_Coupler_bufferIsAllocated(A->pattern->coupler) ) {  
        Paso_Coupler_allocBuffer(A->pattern->coupler,A->col_block_size);  
    }  
 }  
 void Paso_SystemMatrix_freeBuffer(Paso_SystemMatrix* A) {  
     Paso_Coupler_freeBuffer(A->pattern->coupler);  
 }  
178  void  Paso_SystemMatrix_startCollect(Paso_SystemMatrix* A,const double* in)  void  Paso_SystemMatrix_startCollect(Paso_SystemMatrix* A,const double* in)
179  {  {
180    Paso_Coupler_startCollect(A->pattern->coupler, in);    Paso_SystemMatrix_startColCollect(A,in);
181  }  }
182  double* Paso_SystemMatrix_finishCollect(Paso_SystemMatrix* A)  double* Paso_SystemMatrix_finishCollect(Paso_SystemMatrix* A)
183  {  {
184   Paso_Coupler_finishCollect(A->pattern->coupler);   return Paso_SystemMatrix_finishColCollect(A);
185   return A->pattern->coupler->recv_buffer;  }
186    
187    void  Paso_SystemMatrix_startColCollect(Paso_SystemMatrix* A,const double* in)
188    {
189      Paso_Coupler_startCollect(A->col_coupler, in);
190    }
191    double* Paso_SystemMatrix_finishColCollect(Paso_SystemMatrix* A)
192    {
193     Paso_Coupler_finishCollect(A->col_coupler);
194     return A->col_coupler->recv_buffer;
195    }
196    void  Paso_SystemMatrix_startRowCollect(Paso_SystemMatrix* A,const double* in)
197    {
198      Paso_Coupler_startCollect(A->row_coupler, in);
199    }
200    double* Paso_SystemMatrix_finishRowCollect(Paso_SystemMatrix* A)
201    {
202     Paso_Coupler_finishCollect(A->row_coupler);
203     return A->row_coupler->recv_buffer;
204  }  }
205    
206  dim_t Paso_SystemMatrix_getTotalNumRows(const Paso_SystemMatrix* A){  dim_t Paso_SystemMatrix_getTotalNumRows(const Paso_SystemMatrix* A){

Legend:
Removed from v.1551  
changed lines
  Added in v.1552

  ViewVC Help
Powered by ViewVC 1.1.26