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

Contents of /branches/doubleplusgood/paso/src/SystemMatrix_MatrixVector.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3445 - (show annotations)
Wed Jan 19 06:02:15 2011 UTC (9 years ago) by gross
Original Path: trunk/paso/src/SystemMatrix_MatrixVector.c
File MIME type: text/plain
File size: 3738 byte(s)
more work towards MPI AMG
1
2 /*******************************************************
3 *
4 * Copyright (c) 2003-2010 by University of Queensland
5 * Earth Systems Science Computational Center (ESSCC)
6 * http://www.uq.edu.au/esscc
7 *
8 * Primary Business: Queensland, Australia
9 * Licensed under the Open Software License version 3.0
10 * http://www.opensource.org/licenses/osl-3.0.php
11 *
12 *******************************************************/
13
14
15 /**************************************************************/
16
17 /* Paso: matrix vector product with sparse matrix */
18
19 /**************************************************************/
20
21 /* Copyrights by ACcESS Australia 2003,2004,2005 */
22 /* Author: Lutz Gross, l.gross@uq.edu.au */
23
24 /**************************************************************/
25
26 #include "Paso.h"
27 #include "SystemMatrix.h"
28
29 /**************************************************************************/
30
31 /* raw scaled vector update operation: out = alpha * A * in + beta * out */
32
33
34 void Paso_SystemMatrix_MatrixVector(const double alpha,
35 Paso_SystemMatrix* A,
36 const double* in,
37 const double beta,
38 double* out) {
39
40 /*double *snd_buffer=NULL, *rcv_buffer=NULL;*/
41 Esys_MPIInfo *mpi_info=A->mpi_info;
42
43 if (A->is_balanced) {
44 Esys_setError(VALUE_ERROR,"Paso_SystemMatrix_MatrixVector: balanced matrix is not supported.");
45 return;
46 }
47 if (A->type & MATRIX_FORMAT_CSC) {
48 if ( mpi_info->size>1) {
49 Esys_setError(SYSTEM_ERROR,"Paso_SystemMatrix_MatrixVector: CSC is not supported by MPI.");
50 return;
51 } else {
52 if (A->type & MATRIX_FORMAT_OFFSET1) {
53 Paso_SparseMatrix_MatrixVector_CSC_OFFSET1(alpha,A->mainBlock,in,beta,out);
54 } else {
55 Paso_SparseMatrix_MatrixVector_CSC_OFFSET0(alpha,A->mainBlock,in,beta,out);
56 }
57 }
58 } else if (A->type & MATRIX_FORMAT_TRILINOS_CRS) {
59 Esys_setError(SYSTEM_ERROR,"Paso_SystemMatrix_MatrixVector: TRILINOS is not supported with MPI.");
60 return;
61 } else {
62 if (A->type & MATRIX_FORMAT_OFFSET1) {
63 if ( mpi_info->size>1) {
64 Esys_setError(SYSTEM_ERROR,"Paso_SystemMatrix_MatrixVector: CSR with index 1 is not supported by MPI.");
65 return;
66 } else {
67 Paso_SparseMatrix_MatrixVector_CSR_OFFSET1(alpha,A->mainBlock,in,beta,out);
68 }
69 } else {
70 if (Esys_noError()) {
71 Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(alpha,A,in,beta,out);
72 }
73 }
74 }
75 }
76
77 void Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(double alpha,
78 Paso_SystemMatrix* A,
79 const double* in,
80 const double beta,
81 double* out)
82 {
83 double *remote_values=NULL;
84 /* start exchange */
85 Paso_SystemMatrix_startCollect(A,in);
86 /* process main block */
87 if (A->type & MATRIX_FORMAT_DIAGONAL_BLOCK) {
88 Paso_SparseMatrix_MatrixVector_CSR_OFFSET0_DIAG(alpha,A->mainBlock,in,beta,out);
89 } else {
90 Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(alpha,A->mainBlock,in,beta,out);
91 }
92 /* finish exchange */
93 remote_values=Paso_SystemMatrix_finishCollect(A);
94 /* process couple block */
95 if (A->col_coupleBlock->pattern->ptr!=NULL) {
96 if (A->type & MATRIX_FORMAT_DIAGONAL_BLOCK) {
97 Paso_SparseMatrix_MatrixVector_CSR_OFFSET0_DIAG(alpha,A->col_coupleBlock,remote_values,1.,out);
98 } else {
99 Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(alpha,A->col_coupleBlock,remote_values,1.,out);
100 }
101 }
102
103 }

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26