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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4261 - (hide annotations)
Wed Feb 27 06:09:33 2013 UTC (6 years, 10 months ago) by jfenwick
File size: 3942 byte(s)
Initial all c++ build.
But ... there are now reinterpret_cast<>'s
1 ksteube 1312
2 jfenwick 3981 /*****************************************************************************
3 ksteube 1811 *
4 jfenwick 4154 * Copyright (c) 2003-2013 by University of Queensland
5 jfenwick 3981 * http://www.uq.edu.au
6 ksteube 1811 *
7     * Primary Business: Queensland, Australia
8     * Licensed under the Open Software License version 3.0
9     * http://www.opensource.org/licenses/osl-3.0.php
10     *
11 jfenwick 3981 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12     * Development since 2012 by School of Earth Sciences
13     *
14     *****************************************************************************/
15 dhawcroft 631
16 ksteube 1811
17 jfenwick 3981 /************************************************************************************/
18 jgs 150
19     /* Paso: matrix vector product with sparse matrix */
20    
21 jfenwick 3981 /************************************************************************************/
22 jgs 150
23     /* Copyrights by ACcESS Australia 2003,2004,2005 */
24 jfenwick 2608 /* Author: Lutz Gross, l.gross@uq.edu.au */
25 jgs 150
26 jfenwick 3981 /************************************************************************************/
27 jgs 150
28     #include "Paso.h"
29     #include "SystemMatrix.h"
30    
31 jfenwick 3981 /************************************************************************************************/
32 jgs 150
33     /* raw scaled vector update operation: out = alpha * A * in + beta * out */
34    
35    
36 gross 1639 void Paso_SystemMatrix_MatrixVector(const double alpha,
37 ksteube 1312 Paso_SystemMatrix* A,
38 gross 1639 const double* in,
39     const double beta,
40 ksteube 1312 double* out) {
41 jgs 150
42 jfenwick 1981 /*double *snd_buffer=NULL, *rcv_buffer=NULL;*/
43 jfenwick 3259 Esys_MPIInfo *mpi_info=A->mpi_info;
44 ksteube 1312
45 gross 3369 if (A->is_balanced) {
46     Esys_setError(VALUE_ERROR,"Paso_SystemMatrix_MatrixVector: balanced matrix is not supported.");
47     return;
48     }
49 gross 415 if (A->type & MATRIX_FORMAT_CSC) {
50 ksteube 1312 if ( mpi_info->size>1) {
51 jfenwick 3259 Esys_setError(SYSTEM_ERROR,"Paso_SystemMatrix_MatrixVector: CSC is not supported by MPI.");
52 ksteube 1312 return;
53 gross 415 } else {
54 ksteube 1312 if (A->type & MATRIX_FORMAT_OFFSET1) {
55     Paso_SparseMatrix_MatrixVector_CSC_OFFSET1(alpha,A->mainBlock,in,beta,out);
56     } else {
57     Paso_SparseMatrix_MatrixVector_CSC_OFFSET0(alpha,A->mainBlock,in,beta,out);
58     }
59 gross 415 }
60 ksteube 1312 } else if (A->type & MATRIX_FORMAT_TRILINOS_CRS) {
61 jfenwick 3259 Esys_setError(SYSTEM_ERROR,"Paso_SystemMatrix_MatrixVector: TRILINOS is not supported with MPI.");
62 ksteube 1312 return;
63 gross 415 } else {
64     if (A->type & MATRIX_FORMAT_OFFSET1) {
65 ksteube 1312 if ( mpi_info->size>1) {
66 jfenwick 3259 Esys_setError(SYSTEM_ERROR,"Paso_SystemMatrix_MatrixVector: CSR with index 1 is not supported by MPI.");
67 ksteube 1312 return;
68     } else {
69     Paso_SparseMatrix_MatrixVector_CSR_OFFSET1(alpha,A->mainBlock,in,beta,out);
70     }
71 gross 415 } else {
72 jfenwick 3259 if (Esys_noError()) {
73 ksteube 1312 Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(alpha,A,in,beta,out);
74     }
75 gross 415 }
76     }
77     }
78    
79 phornby 2039 void Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(double alpha,
80 ksteube 1312 Paso_SystemMatrix* A,
81 gross 1639 const double* in,
82     const double beta,
83 ksteube 1312 double* out)
84     {
85     double *remote_values=NULL;
86     /* start exchange */
87     Paso_SystemMatrix_startCollect(A,in);
88     /* process main block */
89 gross 3445 if (A->type & MATRIX_FORMAT_DIAGONAL_BLOCK) {
90     Paso_SparseMatrix_MatrixVector_CSR_OFFSET0_DIAG(alpha,A->mainBlock,in,beta,out);
91     } else {
92     Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(alpha,A->mainBlock,in,beta,out);
93     }
94 ksteube 1312 /* finish exchange */
95     remote_values=Paso_SystemMatrix_finishCollect(A);
96     /* process couple block */
97 artak 2159 if (A->col_coupleBlock->pattern->ptr!=NULL) {
98 gross 3445 if (A->type & MATRIX_FORMAT_DIAGONAL_BLOCK) {
99     Paso_SparseMatrix_MatrixVector_CSR_OFFSET0_DIAG(alpha,A->col_coupleBlock,remote_values,1.,out);
100     } else {
101     Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(alpha,A->col_coupleBlock,remote_values,1.,out);
102     }
103 artak 2159 }
104 gross 415 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26