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

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

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

trunk/paso/src/SystemMatrix_nullifyRowsAndCols.c revision 1388 by trankine, Fri Jan 11 07:45:58 2008 UTC trunk/paso/src/SystemMatrix_nullifyRows.c revision 1417 by gross, Mon Feb 25 04:45:48 2008 UTC
# Line 1  Line 1 
1    
2  /* $Id$ */  /* $Id:$ */
3    
4  /*******************************************************  /*******************************************************
5   *   *
6   *           Copyright 2003-2007 by ACceSS MNRF   *       Copyright 2008 by University of Queensland
  *       Copyright 2007 by University of Queensland  
7   *   *
8   *                http://esscc.uq.edu.au   *                http://esscc.uq.edu.au
9   *        Primary Business: Queensland, Australia   *        Primary Business: Queensland, Australia
# Line 17  Line 16 
16    
17  /* Paso: SystemMatrix                                       */  /* Paso: SystemMatrix                                       */
18    
19  /*  nullify rows and columns in the matrix                    */  /*  nullify rows in the matrix                             */
20    
21  /*  the rows and columns are marked by positive values in     */  /*  the rows are marked by positive values in     */
22  /*  mask_row and mask_col. Values on the main diagonal        */  /*  mask_row. Values on the main diagonal        */
23  /*  which are marked to set to zero by both mask_row and      */  /*  which are marked to set to zero by both mask_row       */
24  /*  mask_col are set to main_diagonal_value                   */  /*  are set to main_diagonal_value                   */
25    
26    
27  /**************************************************************/  /**************************************************************/
28    
29  /* Copyrights by ACcESS Australia 2003 */  /* Author: l.gross@uq.edu.au */
 /* Author: gross@access.edu.au */  
30    
31  /**************************************************************/  /**************************************************************/
32    
33  #include "Paso.h"  #include "Paso.h"
34  #include "SystemMatrix.h"  #include "SystemMatrix.h"
35    
36  void Paso_SystemMatrix_nullifyRowsAndCols(Paso_SystemMatrix* A, double* mask_row, double* mask_col, double main_diagonal_value) {  void Paso_SystemMatrix_nullifyRows(Paso_SystemMatrix* A, double* mask_row, double main_diagonal_value) {
37    
   double *remote_values=NULL;  
38    Paso_MPIInfo *mpi_info=A->mpi_info;    Paso_MPIInfo *mpi_info=A->mpi_info;
39    if (mpi_info->size>1) {    if (A ->col_block_size==1 && A ->row_block_size ==1) {
      if (A ->col_block_size==1 && A ->row_block_size ==1) {  
40         if (A->type & MATRIX_FORMAT_CSC) {         if (A->type & MATRIX_FORMAT_CSC) {
41             Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_nullifyRowsAndCols: CSC is not supported by MPI.");             Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_nullifyRows: CSC is not supported by MPI.");
42             return;             return;
43         } else if (A->type & MATRIX_FORMAT_TRILINOS_CRS) {         } else if (A->type & MATRIX_FORMAT_TRILINOS_CRS) {
44             Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_nullifyRowsAndCols: TRILINOS is not supported with MPI.");             Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_nullifyRows: TRILINOS is not supported with MPI.");
45             return;             return;
46         } else {         } else {
          Paso_SystemMatrix_allocBuffer(A);  
47           if (Paso_noError()) {           if (Paso_noError()) {
48              Paso_SystemMatrix_startCollect(A,mask_col) ;              Paso_SparseMatrix_nullifyRows_CSR_BLK1(A->mainBlock,mask_row,main_diagonal_value);
49              Paso_SparseMatrix_nullifyRowsAndCols_CSR_BLK1(A->mainBlock,mask_row,mask_col,main_diagonal_value);              Paso_SparseMatrix_nullifyRows_CSR_BLK1(A->coupleBlock,mask_row,0.);
             remote_values=Paso_SystemMatrix_finishCollect(A);  
             Paso_SparseMatrix_nullifyRowsAndCols_CSR_BLK1(A->coupleBlock,mask_row,remote_values,0.);  
50           }           }
          Paso_SystemMatrix_freeBuffer(A);  
51         }         }
52       } else {    } else {
53         if (A->type & MATRIX_FORMAT_CSC) {         if (A->type & MATRIX_FORMAT_CSC) {
54             Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_nullifyRowsAndCols: CSC is not supported by MPI.");             Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_nullifyRows: CSC is not supported by MPI.");
55             return;             return;
56         } else if (A->type & MATRIX_FORMAT_TRILINOS_CRS) {         } else if (A->type & MATRIX_FORMAT_TRILINOS_CRS) {
57             Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_nullifyRowsAndCols: TRILINOS is not supported with MPI.");             Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_nullifyRows: TRILINOS is not supported with MPI.");
58             return;             return;
59         } else {         } else {
60           Paso_SystemMatrix_allocBuffer(A);           Paso_SystemMatrix_allocBuffer(A);
61           if (Paso_noError()) {           if (Paso_noError()) {
62              Paso_SystemMatrix_startCollect(A,mask_col) ;              Paso_SparseMatrix_nullifyRows_CSR(A->mainBlock,mask_row,main_diagonal_value);
63              Paso_SparseMatrix_nullifyRowsAndCols_CSR(A->mainBlock,mask_row,mask_col,main_diagonal_value);              Paso_SparseMatrix_nullifyRows_CSR(A->coupleBlock,mask_row,0.);
             remote_values=Paso_SystemMatrix_finishCollect(A);  
             Paso_SparseMatrix_nullifyRowsAndCols_CSR(A->coupleBlock,mask_row,remote_values,0.);  
64           }           }
65           Paso_SystemMatrix_freeBuffer(A);           Paso_SystemMatrix_freeBuffer(A);
66         }         }
67       }    }
   } else {  
      if (A ->col_block_size==1 && A ->row_block_size ==1) {  
        if (A->type & MATRIX_FORMAT_CSC) {  
            Paso_SparseMatrix_nullifyRowsAndCols_CSC_BLK1(A->mainBlock,mask_row,mask_col,main_diagonal_value);  
        } else if (A->type & MATRIX_FORMAT_TRILINOS_CRS) {  
            Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_nullifyRowsAndCols: TRILINOS is not supported.");  
        } else {  
            Paso_SparseMatrix_nullifyRowsAndCols_CSR_BLK1(A->mainBlock,mask_row,mask_col,main_diagonal_value);  
        }  
      } else {  
        if (A->type & MATRIX_FORMAT_CSC) {  
            Paso_SparseMatrix_nullifyRowsAndCols_CSC(A->mainBlock,mask_row,mask_col,main_diagonal_value);  
        } else if (A->type & MATRIX_FORMAT_TRILINOS_CRS) {  
            Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_nullifyRowsAndCols: TRILINOS is not supported with MPI.");  
        } else {  
            Paso_SparseMatrix_nullifyRowsAndCols_CSR(A->mainBlock,mask_row,mask_col,main_diagonal_value);  
        }  
      }  
   }  
68    return;    return;
69  }  }

Legend:
Removed from v.1388  
changed lines
  Added in v.1417

  ViewVC Help
Powered by ViewVC 1.1.26