/[escript]/branches/trilinos_from_5897/paso/src/SystemMatrix_MatrixVector.cpp
ViewVC logotype

Diff of /branches/trilinos_from_5897/paso/src/SystemMatrix_MatrixVector.cpp

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

revision 5932 by caltinay, Fri Feb 5 03:37:49 2016 UTC revision 5933 by caltinay, Wed Feb 17 23:53:30 2016 UTC
# Line 32  Line 32 
32  namespace paso {  namespace paso {
33    
34  /*  raw scaled vector update operation: out = alpha * A * in + beta * out */  /*  raw scaled vector update operation: out = alpha * A * in + beta * out */
35  void SystemMatrix_MatrixVector(double alpha, SystemMatrix_ptr A,  void SystemMatrix::MatrixVector(double alpha, const double* in, double beta,
36                                 const double* in, double beta, double* out)                                  double* out) const
37  {  {
38      if (A->is_balanced) {      if (is_balanced) {
39          Esys_setError(VALUE_ERROR, "SystemMatrix_MatrixVector: balanced matrix is not supported.");          Esys_setError(VALUE_ERROR, "MatrixVector: balanced matrix is not supported.");
40          return;          return;
41      }      }
42      if (A->type & MATRIX_FORMAT_CSC) {      if (type & MATRIX_FORMAT_CSC) {
43          if (A->mpi_info->size > 1) {          if (mpi_info->size > 1) {
44              Esys_setError(SYSTEM_ERROR,"SystemMatrix_MatrixVector: CSC is not supported by MPI.");              Esys_setError(SYSTEM_ERROR,"MatrixVector: CSC is not supported by MPI.");
45              return;              return;
46          } else {          } else {
47              if (A->type & MATRIX_FORMAT_OFFSET1) {              if (type & MATRIX_FORMAT_OFFSET1) {
48                  SparseMatrix_MatrixVector_CSC_OFFSET1(alpha,A->mainBlock,in,beta,out);                  SparseMatrix_MatrixVector_CSC_OFFSET1(alpha, mainBlock, in, beta, out);
49              } else {              } else {
50                  SparseMatrix_MatrixVector_CSC_OFFSET0(alpha,A->mainBlock,in,beta,out);                  SparseMatrix_MatrixVector_CSC_OFFSET0(alpha, mainBlock, in, beta, out);
51              }              }
52          }          }
     } else if (A->type & MATRIX_FORMAT_TRILINOS_CRS) {  
         Esys_setError(SYSTEM_ERROR,"SystemMatrix_MatrixVector: TRILINOS is not supported with MPI.");  
         return;  
53      } else {      } else {
54          if (A->type & MATRIX_FORMAT_OFFSET1) {          if (type & MATRIX_FORMAT_OFFSET1) {
55              if (A->mpi_info->size > 1) {              if (mpi_info->size > 1) {
56                  Esys_setError(SYSTEM_ERROR,"SystemMatrix_MatrixVector: CSR with offset 1 is not supported in MPI.");                  Esys_setError(SYSTEM_ERROR,"MatrixVector: CSR with offset 1 is not supported in MPI.");
57                  return;                  return;
58              } else {              } else {
59                  SparseMatrix_MatrixVector_CSR_OFFSET1(alpha,A->mainBlock,in,beta,out);                  SparseMatrix_MatrixVector_CSR_OFFSET1(alpha, mainBlock, in, beta, out);
60              }              }
61          } else {          } else {
62              if (Esys_noError()) {              if (Esys_noError()) {
63                  SystemMatrix_MatrixVector_CSR_OFFSET0(alpha,A,in,beta,out);                  MatrixVector_CSR_OFFSET0(alpha, in, beta, out);
64              }              }
65          }          }
66      }      }
67  }  }
68    
69  void SystemMatrix_MatrixVector_CSR_OFFSET0(double alpha, SystemMatrix_ptr A,  void SystemMatrix::MatrixVector_CSR_OFFSET0(double alpha, const double* in,
70                                             const double* in, const double beta,                                              double beta, double* out) const
                                            double* out)  
71  {  {
72      // start exchange      // start exchange
73      A->startCollect(in);      startCollect(in);
74      // process main block      // process main block
75      if (A->type & MATRIX_FORMAT_DIAGONAL_BLOCK) {      if (type & MATRIX_FORMAT_DIAGONAL_BLOCK) {
76          SparseMatrix_MatrixVector_CSR_OFFSET0_DIAG(alpha,A->mainBlock,in,beta,out);          SparseMatrix_MatrixVector_CSR_OFFSET0_DIAG(alpha, mainBlock, in, beta, out);
77      } else {      } else {
78          SparseMatrix_MatrixVector_CSR_OFFSET0(alpha,A->mainBlock,in,beta,out);          SparseMatrix_MatrixVector_CSR_OFFSET0(alpha, mainBlock, in, beta, out);
79      }      }
80      // finish exchange      // finish exchange
81      double* remote_values = A->finishCollect();      double* remote_values = finishCollect();
82      // process couple block      // process couple block
83      if (A->col_coupleBlock->pattern->ptr != NULL) {      if (col_coupleBlock->pattern->ptr != NULL) {
84          if (A->type & MATRIX_FORMAT_DIAGONAL_BLOCK) {          if (type & MATRIX_FORMAT_DIAGONAL_BLOCK) {
85              SparseMatrix_MatrixVector_CSR_OFFSET0_DIAG(alpha,A->col_coupleBlock,remote_values,1.,out);              SparseMatrix_MatrixVector_CSR_OFFSET0_DIAG(alpha, col_coupleBlock, remote_values, 1., out);
86          } else {          } else {
87              SparseMatrix_MatrixVector_CSR_OFFSET0(alpha,A->col_coupleBlock,remote_values,1.,out);              SparseMatrix_MatrixVector_CSR_OFFSET0(alpha, col_coupleBlock, remote_values, 1., out);
88          }          }
89      }      }
90  }  }

Legend:
Removed from v.5932  
changed lines
  Added in v.5933

  ViewVC Help
Powered by ViewVC 1.1.26