/[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 3641 by gross, Mon Sep 12 03:25:25 2011 UTC revision 3642 by caltinay, Thu Oct 27 03:41:51 2011 UTC
# Line 27  Line 27 
27    
28  /**************************************************************/  /**************************************************************/
29    
30  /* allocates a SystemMatrix of type type using the given matrix pattern  /* Allocates a SystemMatrix of given type using the given matrix pattern.
31     Values are initialized by zero.     Values are initialized with zero.
32     if patternIsUnrolled and type & MATRIX_FORMAT_BLK1, it is assumed that the pattern is allready unrolled to match the requested block size     If patternIsUnrolled and type & MATRIX_FORMAT_BLK1, it is assumed
33     and offsets otherwise unrolling and offset adjustment will be performed.     that the pattern is already unrolled to match the requested block size
34  */     and offsets. Otherwise unrolling and offset adjustment will be performed. */
35    
36  Paso_SystemMatrix* Paso_SystemMatrix_alloc(Paso_SystemMatrixType type,Paso_SystemMatrixPattern *pattern, int row_block_size, int col_block_size,  Paso_SystemMatrix* Paso_SystemMatrix_alloc(Paso_SystemMatrixType type,Paso_SystemMatrixPattern *pattern, int row_block_size, int col_block_size,
37    const bool_t patternIsUnrolled) {    const bool_t patternIsUnrolled) {
# Line 45  Paso_SystemMatrix* Paso_SystemMatrix_all Line 45  Paso_SystemMatrix* Paso_SystemMatrix_all
45    Esys_resetError();    Esys_resetError();
46    if (patternIsUnrolled) {    if (patternIsUnrolled) {
47       if ( ! XNOR(type & MATRIX_FORMAT_OFFSET1, pattern->type & MATRIX_FORMAT_OFFSET1) ) {       if ( ! XNOR(type & MATRIX_FORMAT_OFFSET1, pattern->type & MATRIX_FORMAT_OFFSET1) ) {
48           Esys_setError(TYPE_ERROR,"Paso_SystemMatrix_alloc: requested offset and pattern offset does not match.");           Esys_setError(TYPE_ERROR,"Paso_SystemMatrix_alloc: requested offset and pattern offset do not match.");
49           return NULL;           return NULL;
50       }       }
51    }    }
52    /* do we need to apply unrolling ? */    /* do we need to apply unrolling? */
53    unroll      unroll  
54          /* we don't like non-square blocks */          /* we don't like non-square blocks */
55      =   (row_block_size!=col_block_size)      =   (row_block_size!=col_block_size)
# Line 190  void Paso_SystemMatrix_free(Paso_SystemM Line 190  void Paso_SystemMatrix_free(Paso_SystemM
190          #endif          #endif
191          MEMFREE(in);          MEMFREE(in);
192          #ifdef Paso_TRACE          #ifdef Paso_TRACE
193          printf("Paso_SystemMatrix_free: system matrix as been deallocated.\n");          printf("Paso_SystemMatrix_free: system matrix has been deallocated.\n");
194          #endif          #endif
195       }       }
196     }     }
# Line 324  void Paso_SystemMatrix_makeZeroRowSums(P Line 324  void Paso_SystemMatrix_makeZeroRowSums(P
324     const index_t* main_ptr=Paso_SystemMatrix_borrowMainDiagonalPointer(A_p);     const index_t* main_ptr=Paso_SystemMatrix_borrowMainDiagonalPointer(A_p);
325        
326        
327     Paso_SystemMatrix_rowSum(A_p, left_over); /* left_over now hold the row sum */     Paso_SystemMatrix_rowSum(A_p, left_over); /* left_over now holds the row sum */
328    
329     #pragma omp parallel for private(ir,ib, rtmp1, rtmp2) schedule(static)     #pragma omp parallel for private(ir,ib, rtmp1, rtmp2) schedule(static)
330     for (ir=0;ir< n;ir++) {     for (ir=0;ir< n;ir++) {
# Line 364  void Paso_SystemMatrix_setPreconditioner Line 364  void Paso_SystemMatrix_setPreconditioner
364     }     }
365  }  }
366    
367  /* applies the preconditioner */  /* Applies the preconditioner. */
368  /* has to be called within a parallel reqion */  /* Has to be called within a parallel region. */
369  /* barrier synchronization is performed before the evaluation to make sure that the input vector is available */  /* Barrier synchronization is performed before the evaluation to make sure
370       that the input vector is available */
371  void Paso_SystemMatrix_solvePreconditioner(Paso_SystemMatrix* A,double* x,double* b){  void Paso_SystemMatrix_solvePreconditioner(Paso_SystemMatrix* A,double* x,double* b){
372     Paso_Preconditioner* prec=(Paso_Preconditioner*) A->solver_p;     Paso_Preconditioner* prec=(Paso_Preconditioner*) A->solver_p;
373     Paso_Preconditioner_solve(prec, A,x,b);     Paso_Preconditioner_solve(prec, A,x,b);

Legend:
Removed from v.3641  
changed lines
  Added in v.3642

  ViewVC Help
Powered by ViewVC 1.1.26