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

Annotation of /trunk/paso/src/SystemMatrix_MatrixVector.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1552 - (hide annotations)
Thu May 8 08:52:41 2008 UTC (11 years, 6 months ago) by gross
File MIME type: text/plain
File size: 3365 byte(s)
some changes to make the implementatiopn of a upwind MPI version easier
1 ksteube 1312
2 jgs 150 /* $Id$ */
3    
4 ksteube 1312 /*******************************************************
5     *
6     * Copyright 2003-2007 by ACceSS MNRF
7     * Copyright 2007 by University of Queensland
8     *
9     * http://esscc.uq.edu.au
10     * Primary Business: Queensland, Australia
11     * Licensed under the Open Software License version 3.0
12     * http://www.opensource.org/licenses/osl-3.0.php
13     *
14     *******************************************************/
15 dhawcroft 631
16 jgs 150 /**************************************************************/
17    
18     /* Paso: matrix vector product with sparse matrix */
19    
20     /**************************************************************/
21    
22     /* Copyrights by ACcESS Australia 2003,2004,2005 */
23     /* Author: gross@access.edu.au */
24    
25     /**************************************************************/
26    
27     #include "Paso.h"
28     #include "SystemMatrix.h"
29    
30     /**************************************************************************/
31    
32     /* raw scaled vector update operation: out = alpha * A * in + beta * out */
33    
34     /* has to be called within a parallel region */
35     /* barrier synconization is performed to make sure that the input vector available */
36    
37     void Paso_SystemMatrix_MatrixVector(double alpha,
38 ksteube 1312 Paso_SystemMatrix* A,
39     double* in,
40     double beta,
41     double* out) {
42 jgs 150
43 ksteube 1312 double *snd_buffer=NULL, *rcv_buffer=NULL;
44     dim_t N;
45     Paso_MPIInfo *mpi_info=A->mpi_info;
46    
47 gross 415 if (A->type & MATRIX_FORMAT_CSC) {
48 ksteube 1312 if ( mpi_info->size>1) {
49     Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_MatrixVector: CSC is not supported by MPI.");
50     return;
51 gross 415 } else {
52 ksteube 1312 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 gross 415 }
58 ksteube 1312 } else if (A->type & MATRIX_FORMAT_TRILINOS_CRS) {
59     Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_MatrixVector: TRILINOS is not supported with MPI.");
60     return;
61 gross 415 } else {
62     if (A->type & MATRIX_FORMAT_OFFSET1) {
63 ksteube 1312 if ( mpi_info->size>1) {
64     Paso_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 gross 415 } else {
70 ksteube 1312 if (Paso_noError()) {
71     Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(alpha,A,in,beta,out);
72     }
73 gross 415 }
74     }
75     }
76    
77     void Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(double alpha,
78 ksteube 1312 Paso_SystemMatrix* A,
79     double* in,
80     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     Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(alpha,A->mainBlock,in,beta,out);
88     /* finish exchange */
89     remote_values=Paso_SystemMatrix_finishCollect(A);
90     /* process couple block */
91 gross 1552 Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(alpha,A->col_coupleBlock,remote_values,1.,out);
92 gross 415 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26